A Discrete-Event Network Simulator
API
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.cc
 ns3::TypeNameGet() function 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...
 

Functions

template<typename V , typename T , template< typename... > class U, typename ... I, typename = typename std::enable_if< ( is_container< U<I...> >::value ), void>::type>
Ptr< const AttributeAccessorns3::DoMakeAccessorHelperOne (U< I... > T::*memberContainer)
 DoMakeAccessorHelperOne specialization for member containers. More...
 
template<typename V , typename T , typename U >
Ptr< const AttributeAccessorns3::DoMakeAccessorHelperOne (U T::*memberVariable)
 MakeAccessorHelper implementation for a class data member. More...
 
template<typename V , typename T , typename U >
Ptr< const AttributeAccessorns3::DoMakeAccessorHelperOne (U(T::*getter)(void) const)
 MakeAccessorHelper implementation for a class get functor method. More...
 
template<typename V , typename T , typename U >
Ptr< const AttributeAccessorns3::DoMakeAccessorHelperOne (void(T::*setter)(U))
 MakeAccessorHelper implementation for a class set method returning void. More...
 
template<typename W , typename T , typename U , typename V >
Ptr< const AttributeAccessorns3::DoMakeAccessorHelperTwo (void(T::*setter)(U), V(T::*getter)(void) const)
 MakeAccessorHelper implementation with a class get functor method and a class set method returning void. More...
 
template<typename W , typename T , typename U , typename V >
Ptr< const AttributeAccessorns3::DoMakeAccessorHelperTwo (V(T::*getter)(void) const, void(T::*setter)(U))
 MakeAccessorHelper implementation with a class get functor method and a class set method returning void. More...
 
template<typename W , typename T , typename U , typename V >
Ptr< const AttributeAccessorns3::DoMakeAccessorHelperTwo (bool(T::*setter)(U), V(T::*getter)(void) const)
 MakeAccessorHelper implementation with a class get functor method and a class set method returning bool. More...
 
template<typename W , typename T , typename U , typename V >
Ptr< const AttributeAccessorns3::DoMakeAccessorHelperTwo (V(T::*getter)(void) const, bool(T::*setter)(U))
 MakeAccessorHelper implementation with a class get functor method and a class set method returning bool. More...
 
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. More...
 
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. More...
 
template<typename T , typename BASE >
Ptr< AttributeCheckerns3::MakeSimpleAttributeChecker (std::string name, std::string underlying)
 A simple string-based attribute checker. More...
 
template<typename T >
std::string ns3::TypeNameGet (void)
 Type name strings for numeric AttributeValue types. More...
 
template<>
std::string ns3::TypeNameGet< int8_t > (void)
 ns3::TypeNameGet(void) specializaton. More...
 
template<>
std::string ns3::TypeNameGet< int16_t > (void)
 ns3::TypeNameGet(void) specializaton. More...
 
template<>
std::string ns3::TypeNameGet< int32_t > (void)
 ns3::TypeNameGet(void) specializaton. More...
 
template<>
std::string ns3::TypeNameGet< int64_t > (void)
 ns3::TypeNameGet(void) specializaton. More...
 
template<>
std::string ns3::TypeNameGet< uint8_t > (void)
 ns3::TypeNameGet(void) specializaton. More...
 
template<>
std::string ns3::TypeNameGet< uint16_t > (void)
 ns3::TypeNameGet(void) specializaton. More...
 
template<>
std::string ns3::TypeNameGet< uint32_t > (void)
 ns3::TypeNameGet(void) specializaton. More...
 
template<>
std::string ns3::TypeNameGet< uint64_t > (void)
 ns3::TypeNameGet(void) specializaton. More...
 
template<>
std::string ns3::TypeNameGet< float > (void)
 ns3::TypeNameGet(void) specializaton. More...
 
template<>
std::string ns3::TypeNameGet< double > (void)
 ns3::TypeNameGet(void) specializaton. More...
 

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):

Function Documentation

◆ DoMakeAccessorHelperOne() [1/4]

template<typename V , typename T , template< typename... > class U, typename ... I, typename = typename std::enable_if< ( is_container< U<I...> >::value ), void>::type>
Ptr<const AttributeAccessor> ns3::DoMakeAccessorHelperOne ( U< I... > T::*  memberContainer)
inline

DoMakeAccessorHelperOne specialization for member containers.

The template parameter list contains an extra parameter that is intended to disambiguate an attribute container from any other templated attribute, e.g Ptr or Callback. Disambiguation is based on begin/end and iterator.

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 container.
I[deduced] The type of item (s) within the container.
Parameters
[in]memberContainerThe address of the data member.
Returns
The AttributeAccessor.

Definition at line 108 of file attribute-container-accessor-helper.h.

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

+ Here is the call graph for this function:

◆ DoMakeAccessorHelperOne() [2/4]

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 259 of file attribute-accessor-helper.h.

◆ DoMakeAccessorHelperOne() [3/4]

template<typename V , typename T , typename U >
Ptr<const AttributeAccessor> ns3::DoMakeAccessorHelperOne ( U(T::*)(void) 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 321 of file attribute-accessor-helper.h.

References NS_UNUSED.

◆ DoMakeAccessorHelperOne() [4/4]

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 378 of file attribute-accessor-helper.h.

References NS_UNUSED.

◆ DoMakeAccessorHelperTwo() [1/4]

template<typename W , typename T , typename U , typename V >
Ptr<const AttributeAccessor> ns3::DoMakeAccessorHelperTwo ( void(T::*)(U)  setter,
V(T::*)(void) 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 445 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::*)(void) 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 506 of file attribute-accessor-helper.h.

◆ DoMakeAccessorHelperTwo() [3/4]

template<typename W , typename T , typename U , typename V >
Ptr<const AttributeAccessor> ns3::DoMakeAccessorHelperTwo ( bool(T::*)(U)  setter,
V(T::*)(void) 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 533 of file attribute-accessor-helper.h.

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

+ Here is the call graph for this function:

◆ DoMakeAccessorHelperTwo() [4/4]

template<typename W , typename T , typename U , typename V >
Ptr<const AttributeAccessor> ns3::DoMakeAccessorHelperTwo ( V(T::*)(void) 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 594 of file attribute-accessor-helper.h.

◆ 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)(void) 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 604 of file attribute-accessor-helper.h.

◆ 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)(void) 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 612 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 98 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 ( void  )

Type name strings for numeric AttributeValue types.

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

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

◆ TypeNameGet< double >()

template<>
std::string ns3::TypeNameGet< double > ( void  )

ns3::TypeNameGet(void) specializaton.

Returns
The numeric type name as a string.

Definition at line 40 of file type-name.cc.

◆ TypeNameGet< float >()

template<>
std::string ns3::TypeNameGet< float > ( void  )

ns3::TypeNameGet(void) specializaton.

Returns
The numeric type name as a string.

Definition at line 39 of file type-name.cc.

◆ TypeNameGet< int16_t >()

template<>
std::string ns3::TypeNameGet< int16_t > ( void  )

ns3::TypeNameGet(void) specializaton.

Returns
The numeric type name as a string.

Definition at line 32 of file type-name.cc.

◆ TypeNameGet< int32_t >()

template<>
std::string ns3::TypeNameGet< int32_t > ( void  )

ns3::TypeNameGet(void) specializaton.

Returns
The numeric type name as a string.

Definition at line 33 of file type-name.cc.

◆ TypeNameGet< int64_t >()

template<>
std::string ns3::TypeNameGet< int64_t > ( void  )

ns3::TypeNameGet(void) specializaton.

Returns
The numeric type name as a string.

Definition at line 34 of file type-name.cc.

◆ TypeNameGet< int8_t >()

template<>
std::string ns3::TypeNameGet< int8_t > ( void  )

ns3::TypeNameGet(void) specializaton.

Returns
The numeric type name as a string.

Definition at line 31 of file type-name.cc.

◆ TypeNameGet< uint16_t >()

template<>
std::string ns3::TypeNameGet< uint16_t > ( void  )

ns3::TypeNameGet(void) specializaton.

Returns
The numeric type name as a string.

Definition at line 36 of file type-name.cc.

◆ TypeNameGet< uint32_t >()

template<>
std::string ns3::TypeNameGet< uint32_t > ( void  )

ns3::TypeNameGet(void) specializaton.

Returns
The numeric type name as a string.

Definition at line 37 of file type-name.cc.

◆ TypeNameGet< uint64_t >()

template<>
std::string ns3::TypeNameGet< uint64_t > ( void  )

ns3::TypeNameGet(void) specializaton.

Returns
The numeric type name as a string.

Definition at line 38 of file type-name.cc.

◆ TypeNameGet< uint8_t >()

template<>
std::string ns3::TypeNameGet< uint8_t > ( void  )

ns3::TypeNameGet(void) specializaton.

Returns
The numeric type name as a string.

Definition at line 35 of file type-name.cc.