A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
Attribute Implementation

These are the internal implementation functions for the Attribute system. More...

+ Collaboration diagram for Attribute Implementation:

Files

file  attribute-accessor-helper.h
 ns3::MakeAccessorHelper declarations and template implementations.
 
file  type-name.h
 ns3::TypeNameGet() function declarations.
 

Classes

class  ns3::AccessorHelper< T, U >
 Basic functionality for accessing class attributes via class data members, or get functor/set methods. More...
 
struct  ns3::AccessorTrait< T >
 The non-const and non-reference type equivalent to T. More...
 

Macros

#define TYPENAMEGET_DEFINE(T)
 Macro that defines a template specialization for TypeNameGet<T>() .
 

Functions

template<typename V , typename T , typename U >
Ptr< const AttributeAccessorns3::DoMakeAccessorHelperOne (U T::*memberVariable)
 MakeAccessorHelper implementation for a class data member.
 
template<typename V , typename T , typename U >
Ptr< const AttributeAccessorns3::DoMakeAccessorHelperOne (U(T::*getter)() const)
 MakeAccessorHelper implementation for a class get functor method.
 
template<typename V , typename T , typename U >
Ptr< const AttributeAccessorns3::DoMakeAccessorHelperOne (void(T::*setter)(U))
 MakeAccessorHelper implementation for a class set method returning void.
 
template<typename W , typename T , typename U , typename V >
Ptr< const AttributeAccessorns3::DoMakeAccessorHelperTwo (bool(T::*setter)(U), V(T::*getter)() const)
 MakeAccessorHelper implementation with a class get functor method and a class set method returning bool.
 
template<typename W , typename T , typename U , typename V >
Ptr< const AttributeAccessorns3::DoMakeAccessorHelperTwo (V(T::*getter)() const, bool(T::*setter)(U))
 
template<typename W , typename T , typename U , typename V >
Ptr< const AttributeAccessorns3::DoMakeAccessorHelperTwo (V(T::*getter)() const, void(T::*setter)(U))
 
template<typename W , typename T , typename U , typename V >
Ptr< const AttributeAccessorns3::DoMakeAccessorHelperTwo (void(T::*setter)(U), V(T::*getter)() const)
 MakeAccessorHelper implementation with a class get functor method and a class set method returning void.
 
template<typename V , typename T1 >
Ptr< const AttributeAccessorns3::MakeAccessorHelper (T1 a1)
 Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
 
template<typename V , typename T1 , typename T2 >
Ptr< const AttributeAccessorns3::MakeAccessorHelper (T1 a1, T2 a2)
 Create an AttributeAccessor using a pair of get functor and set methods from a class.
 
template<typename T , typename BASE >
Ptr< AttributeCheckerns3::MakeSimpleAttributeChecker (std::string name, std::string underlying)
 A simple string-based attribute checker.
 
template<typename T >
std::string ns3::TypeNameGet ()
 Type name strings for AttributeValue types.
 
 ns3::TYPENAMEGET_DEFINE (bool)
 ns3::TypeNameGet() specialization for numeric types.
 
 ns3::TYPENAMEGET_DEFINE (int8_t)
 ns3::TypeNameGet() specialization for numeric types.
 
 ns3::TYPENAMEGET_DEFINE (int16_t)
 ns3::TypeNameGet() specialization for numeric types.
 
 ns3::TYPENAMEGET_DEFINE (int32_t)
 ns3::TypeNameGet() specialization for numeric types.
 
 ns3::TYPENAMEGET_DEFINE (int64_t)
 ns3::TypeNameGet() specialization for numeric types.
 
 ns3::TYPENAMEGET_DEFINE (uint8_t)
 ns3::TypeNameGet() specialization for numeric types.
 
 ns3::TYPENAMEGET_DEFINE (uint16_t)
 ns3::TypeNameGet() specialization for numeric types.
 
 ns3::TYPENAMEGET_DEFINE (uint32_t)
 ns3::TypeNameGet() specialization for numeric types.
 
 ns3::TYPENAMEGET_DEFINE (uint64_t)
 ns3::TypeNameGet() specialization for numeric types.
 
 ns3::TYPENAMEGET_DEFINE (float)
 ns3::TypeNameGet() specialization for numeric types.
 
 ns3::TYPENAMEGET_DEFINE (double)
 ns3::TypeNameGet() specialization for numeric types.
 
 ns3::TYPENAMEGET_DEFINE (long double)
 ns3::TypeNameGet() specialization for numeric types.
 

Detailed Description

These are the internal implementation functions for the Attribute system.

Module code shouldn't need to call these directly. Instead, see Attribute Helper.

There are three versions of DoMakeAccessorHelperOne:

There are two pairs of DoMakeAccessorHelperTwo (four total):

Macro Definition Documentation

◆ TYPENAMEGET_DEFINE

#define TYPENAMEGET_DEFINE (   T)
Value:
template <> \
inline std::string TypeNameGet<T>() \
{ \
return #T; \
}

Macro that defines a template specialization for TypeNameGet<T>() .

Parameters
TThe type.

Definition at line 60 of file type-name.h.

Function Documentation

◆ DoMakeAccessorHelperOne() [1/3]

template<typename V , typename T , typename U >
Ptr< const AttributeAccessor > ns3::DoMakeAccessorHelperOne ( U T::*  memberVariable)
inline

MakeAccessorHelper implementation for a class data member.

Template Parameters
V[explicit] The specific AttributeValue type to use to represent the Attribute.
T[deduced] The class holding the data member.
U[deduced] The type of the data member.
Parameters
[in]memberVariableThe address of the data member.
Returns
The AttributeAccessor.

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

◆ DoMakeAccessorHelperOne() [2/3]

template<typename V , typename T , typename U >
Ptr< const AttributeAccessor > ns3::DoMakeAccessorHelperOne ( U(T::*)() const  getter)
inline

MakeAccessorHelper implementation for a class get functor method.

Template Parameters
V[explicit] The specific AttributeValue type to use to represent the Attribute.
T[deduced] The class holding the get functor method.
U[deduced] The return type of the get functor method.
Parameters
[in]getterThe address of the class get functor method.
Returns
The AttributeAccessor.

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

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

+ Here is the call graph for this function:

◆ DoMakeAccessorHelperOne() [3/3]

template<typename V , typename T , typename U >
Ptr< const AttributeAccessor > ns3::DoMakeAccessorHelperOne ( void(T::*)(U)  setter)
inline

MakeAccessorHelper implementation for a class set method returning void.

Template Parameters
V[explicit] The specific AttributeValue type to use to represent the Attribute.
T[deduced] The class holding the set method.
U[deduced] The argument type of the set method.
Parameters
[in]setterThe address of the class set method, returning void.
Returns
The AttributeAccessor.

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

◆ DoMakeAccessorHelperTwo() [1/4]

template<typename W , typename T , typename U , typename V >
Ptr< const AttributeAccessor > ns3::DoMakeAccessorHelperTwo ( bool(T::*)(U)  setter,
V(T::*)() const  getter 
)
inline

MakeAccessorHelper implementation with a class get functor method and a class set method returning bool.

The two versions of this function differ only in argument order.

Template Parameters
W[explicit] The specific AttributeValue type to use to represent the Attribute.
T[deduced] The class holding the functor methods.
U[deduced] The argument type of the set method.
V[deduced] The return type of the get functor method.
Parameters
[in]setterThe address of the class set method, returning bool.
[in]getterThe address of the class get functor method.
Returns
The AttributeAccessor.

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

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

+ Here is the call graph for this function:

◆ DoMakeAccessorHelperTwo() [2/4]

template<typename W , typename T , typename U , typename V >
Ptr< const AttributeAccessor > ns3::DoMakeAccessorHelperTwo ( V(T::*)() const  getter,
bool(T::*)(U)  setter 
)
inline

MakeAccessorHelper implementation with a class get functor method and a class set method returning bool.

The two versions of this function differ only in argument order.

Template Parameters
W[explicit] The specific AttributeValue type to use to represent the Attribute.
T[deduced] The class holding the functor methods.
U[deduced] The argument type of the set method.
V[deduced] The return type of the get functor method.
Parameters
[in]setterThe address of the class set method, returning bool.
[in]getterThe address of the class get functor method.
Returns
The AttributeAccessor.

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

◆ DoMakeAccessorHelperTwo() [3/4]

template<typename W , typename T , typename U , typename V >
Ptr< const AttributeAccessor > ns3::DoMakeAccessorHelperTwo ( V(T::*)() const  getter,
void(T::*)(U)  setter 
)
inline

MakeAccessorHelper implementation with a class get functor method and a class set method returning void.

The two versions of this function differ only in argument order.

Template Parameters
W[explicit] The specific AttributeValue type to use to represent the Attribute.
T[deduced] The class holding the functor methods.
U[deduced] The argument type of the set method.
V[deduced] The return type of the get functor method.
Parameters
[in]setterThe address of the class set method, returning void.
[in]getterThe address of the class get functor method.
Returns
The AttributeAccessor.

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

◆ DoMakeAccessorHelperTwo() [4/4]

template<typename W , typename T , typename U , typename V >
Ptr< const AttributeAccessor > ns3::DoMakeAccessorHelperTwo ( void(T::*)(U)  setter,
V(T::*)() const  getter 
)
inline

MakeAccessorHelper implementation with a class get functor method and a class set method returning void.

The two versions of this function differ only in argument order.

Template Parameters
W[explicit] The specific AttributeValue type to use to represent the Attribute.
T[deduced] The class holding the functor methods.
U[deduced] The argument type of the set method.
V[deduced] The return type of the get functor method.
Parameters
[in]setterThe address of the class set method, returning void.
[in]getterThe address of the class get functor method.
Returns
The AttributeAccessor.

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

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

+ Here is the call graph for this function:

◆ MakeAccessorHelper() [1/2]

template<typename V , typename T1 >
Ptr< const AttributeAccessor > ns3::MakeAccessorHelper ( T1  a1)
inline

Create an AttributeAccessor for a class data member, or a lone class get functor or set method.

The get functor method should have a signature like

typedef U (T::*getter)() const

where T is the class and U is the type of the return value.

The set method should have one of these signatures:

typedef void (T::*setter)(U)
typedef bool (T::*setter)(U)

where T is the class and U is the type of the value to set the attribute to, which should be compatible with the specific AttributeValue type V which holds the value (or the type implied by the name Make<V>Accessor of this function.) In the case of a setter returning bool, the return value should be true if the value could be set successfully.

Template Parameters
V[explicit] (If present) The specific AttributeValue type to use to represent the Attribute. (If not present, the type V is implicit in the name of this function, as "Make<V>Accessor"
T1[deduced] The type of the class data member, or the type of the class get functor or set method.
Parameters
[in]a1The address of the data member, or the get or set method.
Returns
The AttributeAccessor

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

Referenced by ns3::internal::TupleHelper< Args >::MakeTupleAccessor(), and ns3::internal::TupleHelper< std::tuple< Args... > >::MakeTupleAccessor().

+ Here is the caller graph for this function:

◆ MakeAccessorHelper() [2/2]

template<typename V , typename T1 , typename T2 >
Ptr< const AttributeAccessor > ns3::MakeAccessorHelper ( T1  a1,
T2  a2 
)
inline

Create an AttributeAccessor using a pair of get functor and set methods from a class.

The get functor method should have a signature like

typedef U (T::*getter)() const

where T is the class and U is the type of the return value.

The set method should have one of these signatures:

typedef void (T::*setter)(U)
typedef bool (T::*setter)(U)

where T is the class and U is the type of the value to set the attribute to, which should be compatible with the specific AttributeValue type V which holds the value (or the type implied by the name Make<V>Accessor of this function.) In the case of a setter returning bool, the return value should be true if the value could be set successfully.

In practice the setter and getter arguments can appear in either order, but setter first is preferred.

Template Parameters
V[explicit] (If present) The specific AttributeValue type to use to represent the Attribute. (If not present, the type V is implicit in the name of this function as "Make<V>Accessor"
T1[deduced] The type of the class data member, or the type of the class get functor or set method.
T2[deduced] The type of the getter class functor method.
Parameters
[in]a2The address of the class method to set the attribute.
[in]a1The address of the data member, or the get or set method.
Returns
The AttributeAccessor

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

◆ MakeSimpleAttributeChecker()

template<typename T , typename BASE >
Ptr< AttributeChecker > ns3::MakeSimpleAttributeChecker ( std::string  name,
std::string  underlying 
)

A simple string-based attribute checker.

Template Parameters
T[explicit] The specific AttributeValue type used to represent the Attribute.
BASE[explicit] The AttributeChecker type corresponding to T.
Parameters
[in]nameThe name of the AttributeValue type, essentially the string form of T.
[in]underlyingUnderlying type name.
Returns
Ptr to AttributeChecker.

String-based AttributeChecker implementation.

Definition at line 99 of file attribute-helper.h.

References ns3::Copy(), and ns3::Create().

+ Here is the call graph for this function:

◆ TypeNameGet()

template<typename T >
std::string ns3::TypeNameGet ( )

Type name strings for AttributeValue types.

Custom classes should add a template specialization of this function using the macro TYPE_NAME_GET_DEFINE(T).

Template Parameters
T[explicit] The type.
Returns
The type name as a string.

Definition at line 47 of file type-name.h.

References NS_FATAL_ERROR.

◆ TYPENAMEGET_DEFINE() [1/12]

ns3::TYPENAMEGET_DEFINE ( bool  )

ns3::TypeNameGet() specialization for numeric types.

Returns
The numeric type name as a string.

◆ TYPENAMEGET_DEFINE() [2/12]

ns3::TYPENAMEGET_DEFINE ( double  )

ns3::TypeNameGet() specialization for numeric types.

Returns
The numeric type name as a string.

◆ TYPENAMEGET_DEFINE() [3/12]

ns3::TYPENAMEGET_DEFINE ( float  )

ns3::TypeNameGet() specialization for numeric types.

Returns
The numeric type name as a string.

◆ TYPENAMEGET_DEFINE() [4/12]

ns3::TYPENAMEGET_DEFINE ( int16_t  )

ns3::TypeNameGet() specialization for numeric types.

Returns
The numeric type name as a string.

◆ TYPENAMEGET_DEFINE() [5/12]

ns3::TYPENAMEGET_DEFINE ( int32_t  )

ns3::TypeNameGet() specialization for numeric types.

Returns
The numeric type name as a string.

◆ TYPENAMEGET_DEFINE() [6/12]

ns3::TYPENAMEGET_DEFINE ( int64_t  )

ns3::TypeNameGet() specialization for numeric types.

Returns
The numeric type name as a string.

◆ TYPENAMEGET_DEFINE() [7/12]

ns3::TYPENAMEGET_DEFINE ( int8_t  )

ns3::TypeNameGet() specialization for numeric types.

Returns
The numeric type name as a string.

◆ TYPENAMEGET_DEFINE() [8/12]

ns3::TYPENAMEGET_DEFINE ( long double  )

ns3::TypeNameGet() specialization for numeric types.

Returns
The numeric type name as a string.

◆ TYPENAMEGET_DEFINE() [9/12]

ns3::TYPENAMEGET_DEFINE ( uint16_t  )

ns3::TypeNameGet() specialization for numeric types.

Returns
The numeric type name as a string.

◆ TYPENAMEGET_DEFINE() [10/12]

ns3::TYPENAMEGET_DEFINE ( uint32_t  )

ns3::TypeNameGet() specialization for numeric types.

Returns
The numeric type name as a string.

◆ TYPENAMEGET_DEFINE() [11/12]

ns3::TYPENAMEGET_DEFINE ( uint64_t  )

ns3::TypeNameGet() specialization for numeric types.

Returns
The numeric type name as a string.

◆ TYPENAMEGET_DEFINE() [12/12]

ns3::TYPENAMEGET_DEFINE ( uint8_t  )

ns3::TypeNameGet() specialization for numeric types.

Returns
The numeric type name as a string.