iceoryx_hoofs 2.0.5
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
iox::cxx::ConstMethodCallback< ReturnValue, Args > Class Template Reference

Public Types

template<typename T >
using ConstMethodPointer = ReturnValue(T::*)(Args...) const
 

Public Member Functions

 ConstMethodCallback (const ConstMethodCallback &rhs) noexcept=default
 
ConstMethodCallbackoperator= (const ConstMethodCallback &rhs) noexcept=default
 
template<typename ClassType >
 ConstMethodCallback (const ClassType &objectRef, ConstMethodPointer< ClassType > const methodPtr) noexcept
 Constructs a ConstMethodCallback from a pointer to a specific object and a pointer to a method of that class.
 
 ConstMethodCallback (ConstMethodCallback &&rhs) noexcept
 Move constructor.
 
ConstMethodCallbackoperator= (ConstMethodCallback &&rhs) noexcept
 Move assignment operator.
 
template<typename... MethodArguments>
expected< ReturnValue, MethodCallbackError > operator() (MethodArguments &&... args) const noexcept
 Calls the method if the ConstMethodCallback is valid, otherwise it will return MethodCallbackError::UNINITIALIZED_CALLBACK.
 
bool operator== (const ConstMethodCallback &rhs) const noexcept
 Comparison operator. Two ConstMethodCallbacks are equal if they have the same object pointer and method pointer.
 
bool operator!= (const ConstMethodCallback &rhs) const noexcept
 Inequality operator. Two ConstMethodCallback are not equal if they have different object or method pointer.
 
 operator bool () const noexcept
 Verifies if the ConstMethodCallback is valid.
 
bool isValid () const noexcept
 Verifies if the ConstMethodCallback is valid.
 
template<typename ClassType >
void setCallback (const ClassType &objectRef, ConstMethodPointer< ClassType > methodPtr) noexcept
 Sets a new callback.
 
template<typename ClassType >
const ClassType * getObjectPointer () const noexcept
 Returns object pointer.
 
template<typename ClassType >
auto getMethodPointer () const noexcept -> ConstMethodPointer< ClassType >
 Returns cond method pointer.
 

Constructor & Destructor Documentation

◆ ConstMethodCallback() [1/2]

template<typename ReturnValue , typename... Args>
template<typename ClassType >
iox::cxx::ConstMethodCallback< ReturnValue, Args >::ConstMethodCallback ( const ClassType &  objectRef,
ConstMethodPointer< ClassType > const  methodPtr 
)
noexcept

Constructs a ConstMethodCallback from a pointer to a specific object and a pointer to a method of that class.

Parameters
[in]objectRefconst object reference
[in]methodPtrpointer to a const method

◆ ConstMethodCallback() [2/2]

template<typename ReturnValue , typename... Args>
iox::cxx::ConstMethodCallback< ReturnValue, Args >::ConstMethodCallback ( ConstMethodCallback< ReturnValue, Args > &&  rhs)
noexcept

Move constructor.

Parameters
[in]rhsmove origin

Member Function Documentation

◆ isValid()

template<typename ReturnValue , typename... Args>
bool iox::cxx::ConstMethodCallback< ReturnValue, Args >::isValid ( ) const
noexcept

Verifies if the ConstMethodCallback is valid.

Returns
true if objectRef != nullptr otherwise false

◆ operator bool()

template<typename ReturnValue , typename... Args>
iox::cxx::ConstMethodCallback< ReturnValue, Args >::operator bool ( ) const
explicitnoexcept

Verifies if the ConstMethodCallback is valid.

Returns
true if objectRef != nullptr otherwise false

◆ operator()()

template<typename ReturnValue , typename... Args>
template<typename... MethodArguments>
expected< ReturnValue, MethodCallbackError > iox::cxx::ConstMethodCallback< ReturnValue, Args >::operator() ( MethodArguments &&...  args) const
noexcept

Calls the method if the ConstMethodCallback is valid, otherwise it will return MethodCallbackError::UNINITIALIZED_CALLBACK.

Parameters
[in]args...arguments which will be perfectly forwarded to the method
Returns
If ConstMethodCallback is valid the return value of the method, otherwise an error.

◆ operator=()

template<typename ReturnValue , typename... Args>
ConstMethodCallback & iox::cxx::ConstMethodCallback< ReturnValue, Args >::operator= ( ConstMethodCallback< ReturnValue, Args > &&  rhs)
noexcept

Move assignment operator.

Parameters
[in]rhsmove origin
Returns
reference to this

◆ setCallback()

template<typename ReturnValue , typename... Args>
template<typename ClassType >
void iox::cxx::ConstMethodCallback< ReturnValue, Args >::setCallback ( const ClassType &  objectRef,
ConstMethodPointer< ClassType >  methodPtr 
)
noexcept

Sets a new callback.

Parameters
[in]objectRefconst reference to the object
[in]methodPtrpointer to the method

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