A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::AttributeAccessor Class Referenceabstract

allow setting and getting the value of an attribute. More...

#include "attribute.h"

+ Inheritance diagram for ns3::AttributeAccessor:
+ Collaboration diagram for ns3::AttributeAccessor:

Public Member Functions

 AttributeAccessor ()
 
virtual ~AttributeAccessor ()
 
virtual bool Get (const ObjectBase *object, AttributeValue &attribute) const =0
 
virtual bool HasGetter () const =0
 
virtual bool HasSetter () const =0
 
virtual bool Set (ObjectBase *object, const AttributeValue &value) 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.
 

Detailed Description

allow setting and getting the value of an attribute.

The goal of this class is to hide from the user how an attribute is actually set or get to or from a class instance. Implementations of this base class are usually provided through the MakeAccessorHelper template functions, hidden behind an ATTRIBUTE_HELPER_* macro.

Definition at line 104 of file attribute.h.

Constructor & Destructor Documentation

◆ AttributeAccessor()

ns3::AttributeAccessor::AttributeAccessor ( )

Definition at line 36 of file attribute.cc.

◆ ~AttributeAccessor()

ns3::AttributeAccessor::~AttributeAccessor ( )
virtual

Definition at line 40 of file attribute.cc.

Member Function Documentation

◆ Get()

virtual bool ns3::AttributeAccessor::Get ( const ObjectBase * object,
AttributeValue & attribute ) const
pure virtual
Parameters
[in,out]objectThe object instance to get the value from
[out]attributeA pointer to where the value should be set.
Returns
true if the value could be read successfully, and stored in the input value, false otherwise.

This method expects that the caller has checked that the input value is valid with AttributeChecker::Check.

Implemented in ns3::AccessorHelper< T, U >, ns3::EmptyAttributeAccessor, and ns3::ObjectPtrContainerAccessor.

◆ HasGetter()

virtual bool ns3::AttributeAccessor::HasGetter ( ) const
pure virtual
Returns
true if this accessor supports the Get operation, false otherwise.

Implemented in ns3::EmptyAttributeAccessor, and ns3::ObjectPtrContainerAccessor.

◆ HasSetter()

virtual bool ns3::AttributeAccessor::HasSetter ( ) const
pure virtual
Returns
true if this accessor supports the Set operation, false otherwise.

Implemented in ns3::EmptyAttributeAccessor, and ns3::ObjectPtrContainerAccessor.

◆ Set()

virtual bool ns3::AttributeAccessor::Set ( ObjectBase * object,
const AttributeValue & value ) const
pure virtual
Parameters
[in,out]objectThe object instance to set the value in
[in]valueThe value to set
Returns
true if the value could be set successfully, false otherwise.

This method expects that the caller has checked that the input value is valid with AttributeChecker::Check.

Implemented in ns3::AccessorHelper< T, U >, ns3::EmptyAttributeAccessor, and ns3::ObjectPtrContainerAccessor.


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