iceoryx2
C++ Bindings
Loading...
Searching...
No Matches
iox2::internal::CallbackContext< T > Class Template Reference

#include <callback_context.hpp>

Public Member Functions

 CallbackContext (const T &ptr)
auto value () const -> const T &

Detailed Description

template<typename T>
class iox2::internal::CallbackContext< T >

Building block to provide a type-safe context pointer to a C callback that has a void* context argument. The context could be hereby a user provided clojure with capture or any other C++ object.

Example

void some_c_callback(void* context) {
ctx->value(); // access underlying my_context_object
}
SomeType my_context_object;
auto ctx = internal::ctx(my_context_object);
some_c_callback(static_cast<void*>(&ctx));
auto ctx(const T &ptr) -> CallbackContext< T >
auto ctx_cast(void *ptr) -> CallbackContext< T > *

Definition at line 47 of file callback_context.hpp.

Constructor & Destructor Documentation

◆ CallbackContext()

template<typename T>
iox2::internal::CallbackContext< T >::CallbackContext ( const T & ptr)
inlineexplicit

Definition at line 49 of file callback_context.hpp.

Member Function Documentation

◆ value()

template<typename T>
auto iox2::internal::CallbackContext< T >::value ( ) const->constT &
inline

Definition at line 53 of file callback_context.hpp.


The documentation for this class was generated from the following file: