iceoryx2
C++ Language 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) {
auto ctx = internal::ctx_cast<SomeType>(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 >

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 -> const T&
inline

Definition at line 53 of file callback_context.hpp.


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