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::invoke_result_t< decltype(&A::Get), A > 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::invoke_result_t< decltype(&B::Get), B > 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 () const override
 
bool DeserializeFromString (std::string value, Ptr< const AttributeChecker > checker) override
 
result_type Get () const
 Get the stored value as a std::pair. More...
 
template<typename T >
bool GetAccessor (T &value) const
 
std::string SerializeToString (Ptr< const AttributeChecker > checker) const override
 
void Set (const result_type &value)
 
- 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[[maybe_unused]])
 Copy constructor. More...
 
uint32_t GetReferenceCount () const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o[[maybe_unused]])
 Assignment operator. More...
 
void Ref () const
 Increment the reference count. More...
 
void Unref () const
 Decrement the reference count. More...
 

Private Attributes

value_type m_value
 

Detailed Description

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

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

Definition at line 55 of file pair.h.

Member Typedef Documentation

◆ first_type

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

Type of abscissa (first entry of pair).

Definition at line 61 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 65 of file pair.h.

◆ second_type

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

Type of ordinal (second entry of pair).

Definition at line 63 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 59 of file pair.h.

Constructor & Destructor Documentation

◆ PairValue() [1/2]

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

Definition at line 276 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 ( ) const
overridevirtual
Returns
a deep copy of this class, wrapped into an Attribute object.

Implements ns3::AttributeValue.

Definition at line 289 of file pair.h.

◆ DeserializeFromString()

template<class A , class B >
bool ns3::PairValue< A, B >::DeserializeFromString ( std::string  value,
Ptr< const AttributeChecker checker 
)
overridevirtual
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 303 of file pair.h.

◆ Get()

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

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>.

Definition at line 356 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

Definition at line 371 of file pair.h.

◆ SerializeToString()

template<class A , class B >
std::string ns3::PairValue< A, B >::SerializeToString ( Ptr< const AttributeChecker checker) const
overridevirtual
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 344 of file pair.h.

◆ Set()

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

Definition at line 363 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 >
value_type ns3::PairValue< A, B >::m_value
private

Definition at line 96 of file pair.h.


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