A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::PairValue< A, B > Class Template Reference

AttributeValue implementation for Pair. 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).
 
typedef std::pair< first_type, second_typeresult_type
 Type returned by Get or passed in Set.
 
typedef std::invoke_result_t< decltype(&B::Get), B > second_type
 Type of ordinal (second entry of pair).
 
typedef std::pair< Ptr< A >, Ptr< B > > value_type
 Type of value stored in the PairValue.
 

Public Member Functions

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

Private Attributes

value_type m_value
 The stored Pair instance.
 

Detailed Description

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

AttributeValue implementation for Pair.

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

See also
AttributeValue

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

Constructor & Destructor Documentation

◆ PairValue() [1/2]

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

Definition at line 65 of file pair.h.

◆ PairValue() [2/2]

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

Construct this PairValue from a std::pair.

Parameters
[in]valueValue with which to construct.

Definition at line 73 of file pair.h.

References ns3::PairValue< A, B >::Set().

+ Here is the call graph for this function:

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 311 of file pair.h.

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

+ Here is the call graph for this function:

◆ 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 325 of file pair.h.

References ns3::DynamicCast().

+ Here is the call graph for this function:

◆ Get()

template<class A , class B >
PairValue< A, B >::result_type ns3::PairValue< A, B >::Get ( ) 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>.

Definition at line 378 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 393 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 366 of file pair.h.

◆ Set()

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

Set the value.

Parameters
[in]valueThe value to adopt.

Definition at line 385 of file pair.h.

References ns3::Create().

Referenced by ns3::PairValue< A, B >::PairValue(), and PairValueTestCase::DoRun().

+ Here is the call graph for this function:
+ 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

The stored Pair instance.

Definition at line 107 of file pair.h.


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