A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::CallbackImpl< R, UArgs > Class Template Reference

CallbackImpl class with varying numbers of argument types. More...

#include "callback.h"

+ Inheritance diagram for ns3::CallbackImpl< R, UArgs >:
+ Collaboration diagram for ns3::CallbackImpl< R, UArgs >:

Public Member Functions

 CallbackImpl (std::function< R(UArgs...)> func, const CallbackComponentVector &components)
 Constructor.
 
const CallbackComponentVectorGetComponents () const
 Get the vector of callback components.
 
const std::function< R(UArgs...)> & GetFunction () const
 Get the stored function.
 
std::string GetTypeid () const override
 Get the name of this object type.
 
bool IsEqual (Ptr< const CallbackImplBase > other) const override
 Equality test.
 
operator() (UArgs... uargs) const
 Function call operator.
 
- Public Member Functions inherited from ns3::CallbackImplBase
virtual ~CallbackImplBase ()
 Virtual destructor.
 
- Public Member Functions inherited from ns3::SimpleRefCount< CallbackImplBase >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 

Static Public Member Functions

static std::string DoGetTypeid ()
 Get the name of this object type.
 

Private Attributes

std::vector< std::shared_ptr< CallbackComponentBase > > m_components
 Stores the original callable object and the bound arguments, if any.
 
std::function< R(UArgs...)> m_func
 Stores the callable object associated with this callback (as a lambda)
 

Additional Inherited Members

- Static Protected Member Functions inherited from ns3::CallbackImplBase
template<typename T >
static std::string GetCppTypeid ()
 Helper to get the C++ typeid as a string.
 

Detailed Description

template<typename R, typename... UArgs>
class ns3::CallbackImpl< R, UArgs >

CallbackImpl class with varying numbers of argument types.

Template Parameters
R[explicit] The return type of the Callback.
UArgs[explicit] The types of any arguments to the Callback.

Definition at line 225 of file callback.h.

Constructor & Destructor Documentation

◆ CallbackImpl()

template<typename R , typename... UArgs>
ns3::CallbackImpl< R, UArgs >::CallbackImpl ( std::function< R(UArgs...)> func,
const CallbackComponentVector & components )
inline

Constructor.

Parameters
functhe callable object
componentsthe callback components (callable object and bound arguments)

Definition at line 234 of file callback.h.

Member Function Documentation

◆ DoGetTypeid()

template<typename R , typename... UArgs>
static std::string ns3::CallbackImpl< R, UArgs >::DoGetTypeid ( )
inlinestatic

Get the name of this object type.

Returns
The object type as a string.

Definition at line 312 of file callback.h.

References ns3::CallbackImplBase::GetCppTypeid().

Referenced by ns3::Callback< R, UArgs >::Assign(), and ns3::CallbackImpl< R, UArgs >::GetTypeid().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetComponents()

template<typename R , typename... UArgs>
const CallbackComponentVector & ns3::CallbackImpl< R, UArgs >::GetComponents ( ) const
inline

Get the vector of callback components.

Returns
A const reference to the vector of callback components.

Definition at line 253 of file callback.h.

References ns3::CallbackImpl< R, UArgs >::m_components.

◆ GetFunction()

template<typename R , typename... UArgs>
const std::function< R(UArgs...)> & ns3::CallbackImpl< R, UArgs >::GetFunction ( ) const
inline

Get the stored function.

Returns
A const reference to the stored function.

Definition at line 244 of file callback.h.

References ns3::CallbackImpl< R, UArgs >::m_func.

◆ GetTypeid()

template<typename R , typename... UArgs>
std::string ns3::CallbackImpl< R, UArgs >::GetTypeid ( ) const
inlineoverridevirtual

Get the name of this object type.

Returns
The object type as a string.

Implements ns3::CallbackImplBase.

Definition at line 306 of file callback.h.

References ns3::CallbackImpl< R, UArgs >::DoGetTypeid().

+ Here is the call graph for this function:

◆ IsEqual()

template<typename R , typename... UArgs>
bool ns3::CallbackImpl< R, UArgs >::IsEqual ( Ptr< const CallbackImplBase > other) const
inlineoverridevirtual

Equality test.

Parameters
[in]otherCallback Ptr
Returns
true if we are equal

Implements ns3::CallbackImplBase.

Definition at line 269 of file callback.h.

References ns3::CallbackImpl< R, UArgs >::m_components, and ns3::PeekPointer().

+ Here is the call graph for this function:

◆ operator()()

template<typename R , typename... UArgs>
R ns3::CallbackImpl< R, UArgs >::operator() ( UArgs... uargs) const
inline

Function call operator.

Parameters
uargsThe arguments to the Callback.
Returns
Callback value

Definition at line 264 of file callback.h.

References ns3::CallbackImpl< R, UArgs >::m_func.

Member Data Documentation

◆ m_components

template<typename R , typename... UArgs>
std::vector<std::shared_ptr<CallbackComponentBase> > ns3::CallbackImpl< R, UArgs >::m_components
private

Stores the original callable object and the bound arguments, if any.

Definition at line 335 of file callback.h.

Referenced by ns3::CallbackImpl< R, UArgs >::GetComponents(), and ns3::CallbackImpl< R, UArgs >::IsEqual().

◆ m_func

template<typename R , typename... UArgs>
std::function<R(UArgs...)> ns3::CallbackImpl< R, UArgs >::m_func
private

Stores the callable object associated with this callback (as a lambda)

Definition at line 332 of file callback.h.

Referenced by ns3::CallbackImpl< R, UArgs >::GetFunction(), and ns3::CallbackImpl< R, UArgs >::operator()().


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