A Discrete-Event Network Simulator
API
ns3::AttributeChecker Class Referenceabstract

Represent the type of an attribute. More...

#include "attribute.h"

+ Inheritance diagram for ns3::AttributeChecker:
+ Collaboration diagram for ns3::AttributeChecker:

Public Member Functions

 AttributeChecker ()
 
virtual ~AttributeChecker ()
 
virtual bool Check (const AttributeValue &value) const =0
 
virtual bool Copy (const AttributeValue &source, AttributeValue &destination) const =0
 Copy the source to the destination. More...
 
virtual Ptr< AttributeValueCreate (void) const =0
 
Ptr< AttributeValueCreateValidValue (const AttributeValue &value) const
 Create a valid value from the argument value, or reinterpret the argument as a string. More...
 
virtual std::string GetUnderlyingTypeInformation (void) const =0
 
virtual std::string GetValueTypeName (void) const =0
 
virtual bool HasUnderlyingTypeInformation (void) const =0
 
- Public Member Functions inherited from ns3::SimpleRefCount< AttributeChecker >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o[[maybe_unused]])
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= ([[maybe_unused]] const SimpleRefCount &o)
 Assignment operator. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 

Detailed Description

Represent the type of an attribute.

Each type of attribute has an associated unique AttributeChecker subclass. The type of the subclass can be safely used by users to infer the type of the associated attribute. i.e., we expect binding authors to use the checker associated to an attribute to detect the type of the associated attribute.

Most subclasses of this base class are implemented by the ATTRIBUTE_HELPER_HEADER and ATTRIBUTE_HELPER_CPP macros.

Definition at line 166 of file attribute.h.

Constructor & Destructor Documentation

◆ AttributeChecker()

ns3::AttributeChecker::AttributeChecker ( )

Definition at line 48 of file attribute.cc.

◆ ~AttributeChecker()

ns3::AttributeChecker::~AttributeChecker ( )
virtual

Definition at line 50 of file attribute.cc.

Member Function Documentation

◆ Check()

virtual bool ns3::AttributeChecker::Check ( const AttributeValue value) const
pure virtual
Parameters
[in]valueA pointer to the value to check
Returns
true if the input value is both of the right type and if its value is within the requested range. Returns false otherwise.

Implemented in ns3::internal::TupleChecker< Args >, ns3::internal::ObjectPtrContainerChecker< T >, ns3::EnumChecker, ns3::EmptyAttributeChecker, and ns3::internal::PointerChecker< T >.

Referenced by CreateValidValue().

+ Here is the caller graph for this function:

◆ Copy()

virtual bool ns3::AttributeChecker::Copy ( const AttributeValue source,
AttributeValue destination 
) const
pure virtual

Copy the source to the destination.

Parameters
[in]sourceSource AttributeValue
[out]destinationDestination AttributeValue
Returns
true if copy was successful

Implemented in ns3::EnumChecker, ns3::internal::TupleChecker< Args >, ns3::internal::PointerChecker< T >, ns3::internal::ObjectPtrContainerChecker< T >, and ns3::EmptyAttributeChecker.

◆ Create()

virtual Ptr<AttributeValue> ns3::AttributeChecker::Create ( void  ) const
pure virtual
Returns
a new instance of an AttributeValue (wrapper in an Attribute instance) which matches the type of the underlying attribute.

This method is typically used to create a temporary variable prior to calling Attribute::DeserializeFromString.

Implemented in ns3::internal::TupleChecker< Args >, ns3::internal::PointerChecker< T >, ns3::internal::ObjectPtrContainerChecker< T >, ns3::EnumChecker, and ns3::EmptyAttributeChecker.

Referenced by CreateValidValue().

+ Here is the caller graph for this function:

◆ CreateValidValue()

Ptr< AttributeValue > ns3::AttributeChecker::CreateValidValue ( const AttributeValue value) const

Create a valid value from the argument value, or reinterpret the argument as a string.

Parameters
[in]valueThe AttributeValue to check
Returns
Ptr to a valid value

Definition at line 54 of file attribute.cc.

References Check(), Create(), ns3::StringValue::Get(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ GetUnderlyingTypeInformation()

virtual std::string ns3::AttributeChecker::GetUnderlyingTypeInformation ( void  ) const
pure virtual
Returns
a human-readable representation of information about the underlying C++ type.

Implemented in ns3::internal::TupleChecker< Args >, ns3::internal::PointerChecker< T >, ns3::internal::ObjectPtrContainerChecker< T >, ns3::EnumChecker, and ns3::EmptyAttributeChecker.

◆ GetValueTypeName()

virtual std::string ns3::AttributeChecker::GetValueTypeName ( void  ) const
pure virtual
Returns
the c++ fully-qualified typename of the subclass of the ns3::AttributeValue base class which is associated to this checker.

A typical return value here is FooValue where Foo is the name of the type being wrapped.

Implemented in ns3::internal::TupleChecker< Args >, ns3::internal::PointerChecker< T >, ns3::internal::ObjectPtrContainerChecker< T >, ns3::EnumChecker, and ns3::EmptyAttributeChecker.

◆ HasUnderlyingTypeInformation()

virtual bool ns3::AttributeChecker::HasUnderlyingTypeInformation ( void  ) const
pure virtual
Returns
true if this checker has information about the underlying C++ type, false otherwise.

If this method returns false, the return value of the GetUnderlyingTypeInformation method cannot be relied upon.

Implemented in ns3::internal::TupleChecker< Args >, ns3::internal::PointerChecker< T >, ns3::internal::ObjectPtrContainerChecker< T >, ns3::EnumChecker, and ns3::EmptyAttributeChecker.


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