A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::AccessorHelper< T, U > Class Template Referenceabstract

Basic functionality for accessing class attributes via class data members, or get functor/set methods. More...

#include "attribute-accessor-helper.h"

+ Inheritance diagram for ns3::AccessorHelper< T, U >:
+ Collaboration diagram for ns3::AccessorHelper< T, U >:

Public Member Functions

 AccessorHelper ()
 Constructor.
 
bool Get (const ObjectBase *object, AttributeValue &val) const override
 Get the value of the underlying member into the AttributeValue.
 
bool Set (ObjectBase *object, const AttributeValue &val) const override
 Set the underlying member to the argument AttributeValue.
 
- Public Member Functions inherited from ns3::AttributeAccessor
 AttributeAccessor ()
 
virtual ~AttributeAccessor ()
 
virtual bool HasGetter () const =0
 
virtual bool HasSetter () const =0
 
- Public Member Functions inherited from ns3::SimpleRefCount< AttributeAccessor >
 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.
 

Private Member Functions

virtual bool DoGet (const T *object, U *v) const =0
 Getter implementation.
 
virtual bool DoSet (T *object, const U *v) const =0
 Setter implementation.
 

Detailed Description

template<typename T, typename U>
class ns3::AccessorHelper< T, U >

Basic functionality for accessing class attributes via class data members, or get functor/set methods.

Template Parameters
T[explicit] Class of object holding the attribute.
U[explicit] AttributeValue type for the underlying class member which is an attribute.

Definition at line 139 of file attribute-accessor-helper.h.

Constructor & Destructor Documentation

◆ AccessorHelper()

template<typename T , typename U >
ns3::AccessorHelper< T, U >::AccessorHelper ( )
inline

Constructor.

Definition at line 143 of file attribute-accessor-helper.h.

Member Function Documentation

◆ DoGet()

template<typename T , typename U >
virtual bool ns3::AccessorHelper< T, U >::DoGet ( const T * object,
U * v ) const
privatepure virtual

Getter implementation.

See also
Get()
Parameters
[out]objectThe parent object holding the attribute.
[out]vThe specific AttributeValue to set.
Returns
true if the member value could be retrieved successfully

Referenced by ns3::AccessorHelper< T, U >::Get().

+ Here is the caller graph for this function:

◆ DoSet()

template<typename T , typename U >
virtual bool ns3::AccessorHelper< T, U >::DoSet ( T * object,
const U * v ) const
privatepure virtual

Setter implementation.

See also
Set()
Parameters
[in]objectThe parent object holding the attribute.
[in]vThe specific AttributeValue to set.
Returns
true if the member was set successfully.

Referenced by ns3::AccessorHelper< T, U >::Set().

+ Here is the caller graph for this function:

◆ Get()

template<typename T , typename U >
bool ns3::AccessorHelper< T, U >::Get ( const ObjectBase * object,
AttributeValue & val ) const
inlineoverridevirtual

Get the value of the underlying member into the AttributeValue.

Handle dynamic casting from generic ObjectBase and AttributeValue up to desired object class and specific AttributeValue.

Forwards to DoGet method.

Parameters
[out]objectGeneric object pointer, to upcast to T .
[out]valGeneric AttributeValue, to upcast to U .
Returns
true if the member value could be retrieved successfully

Implements ns3::AttributeAccessor.

Definition at line 186 of file attribute-accessor-helper.h.

References ns3::AccessorHelper< T, U >::DoGet().

+ Here is the call graph for this function:

◆ Set()

template<typename T , typename U >
bool ns3::AccessorHelper< T, U >::Set ( ObjectBase * object,
const AttributeValue & val ) const
inlineoverridevirtual

Set the underlying member to the argument AttributeValue.

Handle dynamic casting from generic ObjectBase and AttributeValue up to desired object class and specific AttributeValue.

Forwards to DoSet method.

Parameters
[in]objectGeneric object pointer, to upcast to T .
[in]valGeneric AttributeValue, to upcast to U .
Returns
true if the member was set successfully.

Implements ns3::AttributeAccessor.

Definition at line 159 of file attribute-accessor-helper.h.

References ns3::AccessorHelper< T, U >::DoSet().

Referenced by ns3::DoMakeAccessorHelperOne(), and ns3::DoMakeAccessorHelperTwo().

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

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