iox::cxx::MethodCallback🔗
Public Types🔗
Name | |
---|---|
template <typename T > using ReturnValue(T::*)(Args...) |
MethodPointer |
Public Functions🔗
Name | |
---|---|
MethodCallback() =default | |
MethodCallback(const MethodCallback & rhs) =default | |
MethodCallback & | operator=(const MethodCallback & rhs) =default |
~MethodCallback() =default | |
template <typename ClassType > |
MethodCallback(ClassType & objectRef, MethodPointer< ClassType > methodPtr) Constructs a MethodCallback from a pointer to a specific object and a pointer to a method of that object. |
MethodCallback(MethodCallback && rhs) Move constructor. |
|
MethodCallback & | operator=(MethodCallback && rhs) Move assignment operator. |
template <typename... MethodArguments> expected< ReturnValue, MethodCallbackError > |
operator()(MethodArguments &&... args) Calls the method if the MethodCallback is valid, otherwise it will return MethodCallbackError::UNINITIALIZED_CALLBACK. |
bool | operator==(const MethodCallback & rhs) const Comparison operator. Two MethodCallbacks are equal if they have the same object pointer and method pointer. |
bool | operator!=(const MethodCallback & rhs) const Inequality operator. Two MethodCallbacks are not equal if they have different object or method pointer. |
operator bool() const Verifies if the MethodCallback is valid. |
|
bool | isValid() const Verifies if the MethodCallback is valid. |
template <typename ClassType > void |
setCallback(ClassType & objectRef, MethodPointer< ClassType > methodPtr) Sets a new callback. |
template <typename ClassType > ClassType * |
getObjectPointer() const Returns objectRef. |
template <typename ClassType > auto |
getMethodPointer() const Returns cond method pointer. |
Detailed Description🔗
template <typename ReturnValue ,
typename... Args>
class iox::cxx::MethodCallback;
Public Types Documentation🔗
using MethodPointer🔗
template <typename T >
using iox::cxx::MethodCallback< ReturnValue, Args >::MethodPointer = ReturnValue (T::*)(Args...);
Public Functions Documentation🔗
function MethodCallback🔗
MethodCallback() =default
function MethodCallback🔗
MethodCallback(
const MethodCallback & rhs
) =default
function operator=🔗
MethodCallback & operator=(
const MethodCallback & rhs
) =default
function ~MethodCallback🔗
~MethodCallback() =default
function MethodCallback🔗
template <typename ClassType >
MethodCallback(
ClassType & objectRef,
MethodPointer< ClassType > methodPtr
)
Constructs a MethodCallback from a pointer to a specific object and a pointer to a method of that object.
Parameters:
- objectRef object reference
- methodPtr pointer to a method
function MethodCallback🔗
MethodCallback(
MethodCallback && rhs
)
Move constructor.
Parameters:
- rhs move origin
function operator=🔗
MethodCallback & operator=(
MethodCallback && rhs
)
Move assignment operator.
Parameters:
- rhs move origin
Return: reference to this
function operator()🔗
template <typename... MethodArguments>
expected< ReturnValue, MethodCallbackError > operator()(
MethodArguments &&... args
)
Calls the method if the MethodCallback is valid, otherwise it will return MethodCallbackError::UNINITIALIZED_CALLBACK.
Parameters:
- args... arguments which will be perfectly forwarded to the method
Return: If MethodCallback is valid the return value of the method, otherwise an error.
function operator==🔗
bool operator==(
const MethodCallback & rhs
) const
Comparison operator. Two MethodCallbacks are equal if they have the same object pointer and method pointer.
function operator!=🔗
bool operator!=(
const MethodCallback & rhs
) const
Inequality operator. Two MethodCallbacks are not equal if they have different object or method pointer.
function operator bool🔗
explicit operator bool() const
Verifies if the MethodCallback is valid.
Return: true if objectRef != nullptr otherwise false
function isValid🔗
bool isValid() const
Verifies if the MethodCallback is valid.
Return: true if objectRef != nullptr otherwise false
function setCallback🔗
template <typename ClassType >
void setCallback(
ClassType & objectRef,
MethodPointer< ClassType > methodPtr
)
Sets a new callback.
Parameters:
- objectRef const reference to the object
- methodPtr pointer to the method
function getObjectPointer🔗
template <typename ClassType >
ClassType * getObjectPointer() const
Returns objectRef.
function getMethodPointer🔗
template <typename ClassType >
auto getMethodPointer() const
Returns cond method pointer.
Updated on 31 May 2022 at 11:34:55 CEST