A Discrete-Event Network Simulator
API
ns3::PairValue< A, B > Class Template Reference

Hold objects of type std::pair<A, B>. More...

#include "pair.h"

+ Inheritance diagram for ns3::PairValue< A, B >:
+ Collaboration diagram for ns3::PairValue< A, B >:

Public Types

typedef std::result_of< decltype(&A::Get)(A)>::type first_type
 Type of abscissa (first entry of pair). More...
 
typedef std::pair< first_type, second_typeresult_type
 Type returned by Get or passed in Set. More...
 
typedef std::result_of< decltype(&B::Get)(B)>::type second_type
 Type of ordinal (second entry of pair). More...
 
typedef std::pair< Ptr< A >, Ptr< B > > value_type
 Type of value stored in the PairValue. More...
 

Public Member Functions

 PairValue ()
 
 PairValue (const result_type &value)
 Construct this PairValue from a std::pair. More...
 
Ptr< AttributeValueCopy (void) const
 
bool DeserializeFromString (std::string value, Ptr< const AttributeChecker > checker)
 
result_type Get (void) const
 Get the stored value as a std::pair. More...
 
template<typename T >
bool GetAccessor (T &value) const
 
Access the Pair value as type T. More...
 
std::string SerializeToString (Ptr< const AttributeChecker > checker) const
 
void Set (const result_type &value)
 Set the stored value. More...
 
- Public Member Functions inherited from ns3::AttributeValue
 AttributeValue ()
 
virtual ~AttributeValue ()
 
- Public Member Functions inherited from ns3::SimpleRefCount< AttributeValue >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 

Private Attributes

value_type m_value
 
The stored Pair instance. More...
 

Detailed Description

template<class A, class B>
class ns3::PairValue< A, B >

Hold objects of type std::pair<A, B>.


AttributeValue implementation for Pair.

See also
AttributeValue

Definition at line 47 of file pair.h.

Member Typedef Documentation

◆ first_type

template<class A, class B>
typedef std::result_of<decltype(&A::Get)(A)>::type ns3::PairValue< A, B >::first_type

Type of abscissa (first entry of pair).

Definition at line 53 of file pair.h.

◆ result_type

template<class A, class B>
typedef std::pair<first_type, second_type> ns3::PairValue< A, B >::result_type

Type returned by Get or passed in Set.

Definition at line 57 of file pair.h.

◆ second_type

template<class A, class B>
typedef std::result_of<decltype(&B::Get)(B)>::type ns3::PairValue< A, B >::second_type

Type of ordinal (second entry of pair).

Definition at line 55 of file pair.h.

◆ value_type

template<class A, class B>
typedef std::pair<Ptr<A>, Ptr<B> > ns3::PairValue< A, B >::value_type

Type of value stored in the PairValue.

Definition at line 51 of file pair.h.

Constructor & Destructor Documentation

◆ PairValue() [1/2]

template<class A , class B >
ns3::PairValue< A, B >::PairValue ( )

Definition at line 254 of file pair.h.

◆ PairValue() [2/2]

template<class A, class B>
ns3::PairValue< A, B >::PairValue ( const result_type value)

Construct this PairValue from a std::pair.

Parameters
[in]valueValue with which to construct.

Member Function Documentation

◆ Copy()

template<class A , class B >
Ptr< AttributeValue > ns3::PairValue< A, B >::Copy ( void  ) const
virtual
Returns
a deep copy of this class, wrapped into an Attribute object.

Implements ns3::AttributeValue.

Definition at line 266 of file pair.h.

◆ DeserializeFromString()

template<class A , class B >
bool ns3::PairValue< A, B >::DeserializeFromString ( std::string  value,
Ptr< const AttributeChecker checker 
)
virtual
Parameters
[in]valueA string representation of the value
[in]checkerA pointer to the checker associated to the attribute.
Returns
true if the input string was correctly-formatted and could be successfully deserialized, false otherwise.

Upon return of this function, this AttributeValue instance contains the deserialized value. In most cases, this method will not make any use of the checker argument. However, in a very limited set of cases, the checker argument is needed to perform proper serialization. A nice example of code which needs it is the EnumValue::SerializeToString code.

Implements ns3::AttributeValue.

Definition at line 278 of file pair.h.

◆ Get()

template<class A , class B >
std::pair< A, B > ns3::PairValue< A, B >::Get ( void  ) const

Get the stored value as a std::pair.


This differs from the actual value stored in the object which is a pair of Ptr<AV> where AV is a class derived from AttributeValue.

Returns
stored value as std::pair<A, B>.
The Pair value.

Definition at line 316 of file pair.h.

Referenced by PairValueTestCase::DoRun().

+ Here is the caller graph for this function:

◆ GetAccessor()

template<class A , class B >
template<typename T >
bool ns3::PairValue< A, B >::GetAccessor ( T &  value) const


Access the Pair value as type T.

Template Parameters
T[explicit] The type to cast to.
Parameters
[out]valueThe Pair value, as type T.
Returns
true.

Definition at line 331 of file pair.h.

◆ SerializeToString()

template<class A , class B >
std::string ns3::PairValue< A, B >::SerializeToString ( Ptr< const AttributeChecker checker) const
virtual
Parameters
[in]checkerThe checker associated to the attribute
Returns
A string representation of this value.

In most cases, this method will not make any use of the checker argument. However, in a very limited set of cases, the checker argument is needed to perform proper serialization. A nice example of code which needs it is the EnumValue::SerializeToString code.

Implements ns3::AttributeValue.

Definition at line 304 of file pair.h.

◆ Set()

template<class A, class B>
void ns3::PairValue< A, B >::Set ( const result_type value)

Set the stored value.


Set the value.

Parameters
[in]valuestd::pair<A, B> to be stored.
[in]valueThe value to adopt.

Definition at line 323 of file pair.h.

Referenced by PairValueTestCase::DoRun().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_value

template<class A, class B>
std::pair< A, B > ns3::PairValue< A, B >::m_value
private


The stored Pair instance.

Definition at line 91 of file pair.h.


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