A Discrete-Event Network Simulator
API
ns3::AttributeContainerValue< A, C > Class Template Reference

A container for one type of attribute. More...

#include "attribute-container.h"

+ Inheritance diagram for ns3::AttributeContainerValue< A, C >:
+ Collaboration diagram for ns3::AttributeContainerValue< A, C >:

Public Types

typedef A attribute_type
 AttributeValue (element) type. More...
 
typedef container_type::const_iterator const_iterator
 stl-style Const iterator type. More...
 
typedef std::list< value_typecontainer_type
 Internal container type. More...
 
typedef std::result_of< decltype(&A::Get)(A)>::type item_type
 Item type of container returned by Get. More...
 
typedef container_type::iterator iterator
 stl-style Non-const iterator type. More...
 
typedef AttributeContainerValue::const_iterator Iterator
 NS3 style iterator type. More...
 
typedef C< item_typeresult_type
 Type of container returned. More...
 
typedef container_type::size_type size_type
 Size type for container. More...
 
typedef Ptr< A > value_type
 Type actually stored within the container. More...
 

Public Member Functions

 AttributeContainerValue (char sep=',')
 Default constructor. More...
 
template<class CONTAINER >
 AttributeContainerValue (const CONTAINER &c)
 Construct from another container. More...
 
template<class ITER >
 AttributeContainerValue (const ITER begin, const ITER end)
 Construct from iterators. More...
 
 ~AttributeContainerValue ()
 Destructor. More...
 
Iterator Begin (void)
 NS3-style beginning of container. More...
 
iterator begin (void)
 STL-style beginning of container. More...
 
const_iterator begin (void) const
 STL-style const beginning of container. More...
 
Ptr< AttributeValueCopy (void) const
 
bool DeserializeFromString (std::string value, Ptr< const AttributeChecker > checker)
 
Iterator End (void)
 NS3-style ending of container. More...
 
iterator end (void)
 STL-style end of container. More...
 
const_iterator end (void) const
 STL-style const end of container. More...
 
result_type Get (void) const
 Return a container of items. More...
 
size_type GetN (void) const
 NS3-style Number of items. More...
 
std::string SerializeToString (Ptr< const AttributeChecker > checker) const
 
template<class T >
void Set (const T &c)
 Copy items from container c. More...
 
size_type size (void) const
 STL-style number of items in container. 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 Member Functions

template<class ITER >
Ptr< AttributeContainerValue< A, C > > CopyFrom (const ITER begin, const ITER end)
 Copy items from begin to end. More...
 

Private Attributes

container_type m_container
 Internal container. More...
 
char m_sep
 Item separator. More...
 

Detailed Description

template<class A, template< class... > class C = std::list>
class ns3::AttributeContainerValue< A, C >

A container for one type of attribute.


AttributeValue implementation for AttributeContainer.

The container uses A to parse items into elements. Internally the container is always a list but an instance can return the items in a container specified by C.

Template Parameters
AAttributeValue type to be contained.
CPossibly templated container class returned by Get.
See also
AttributeValue

Definition at line 51 of file attribute-container.h.

Member Typedef Documentation

◆ attribute_type

template<class A, template< class... > class C = std::list>
typedef A ns3::AttributeContainerValue< A, C >::attribute_type

AttributeValue (element) type.

Definition at line 55 of file attribute-container.h.

◆ const_iterator

template<class A, template< class... > class C = std::list>
typedef container_type::const_iterator ns3::AttributeContainerValue< A, C >::const_iterator

stl-style Const iterator type.

Definition at line 61 of file attribute-container.h.

◆ container_type

template<class A, template< class... > class C = std::list>
typedef std::list<value_type> ns3::AttributeContainerValue< A, C >::container_type

Internal container type.

Definition at line 59 of file attribute-container.h.

◆ item_type

template<class A, template< class... > class C = std::list>
typedef std::result_of<decltype(&A::Get)(A)>::type ns3::AttributeContainerValue< A, C >::item_type

Item type of container returned by Get.

Definition at line 71 of file attribute-container.h.

◆ iterator

template<class A, template< class... > class C = std::list>
typedef container_type::iterator ns3::AttributeContainerValue< A, C >::iterator

stl-style Non-const iterator type.

Definition at line 63 of file attribute-container.h.

◆ Iterator

template<class A, template< class... > class C = std::list>
typedef AttributeContainerValue::const_iterator ns3::AttributeContainerValue< A, C >::Iterator

NS3 style iterator type.

Definition at line 67 of file attribute-container.h.

◆ result_type

template<class A, template< class... > class C = std::list>
typedef C<item_type> ns3::AttributeContainerValue< A, C >::result_type

Type of container returned.

Definition at line 73 of file attribute-container.h.

◆ size_type

template<class A, template< class... > class C = std::list>
typedef container_type::size_type ns3::AttributeContainerValue< A, C >::size_type

Size type for container.

Definition at line 65 of file attribute-container.h.

◆ value_type

template<class A, template< class... > class C = std::list>
typedef Ptr<A> ns3::AttributeContainerValue< A, C >::value_type

Type actually stored within the container.

Definition at line 57 of file attribute-container.h.

Constructor & Destructor Documentation

◆ AttributeContainerValue() [1/3]

template<class A , template< class... > class C>
ns3::AttributeContainerValue< A, C >::AttributeContainerValue ( char  sep = ',')

Default constructor.

Parameters
[in]sepCharacter separator between elements for parsing.

Definition at line 320 of file attribute-container.h.

◆ AttributeContainerValue() [2/3]

template<class A , template< class... > class C>
template<class CONTAINER >
ns3::AttributeContainerValue< A, C >::AttributeContainerValue ( const CONTAINER &  c)

Construct from another container.

Template Parameters
CONTAINER[deduced]type of container passed for initialization.
Parameters
cInstance of CONTAINER with which to initialize AttributeContainerValue.

Definition at line 328 of file attribute-container.h.

◆ AttributeContainerValue() [3/3]

template<class A , template< class... > class C>
template<class ITER >
ns3::AttributeContainerValue< A, C >::AttributeContainerValue ( const ITER  begin,
const ITER  end 
)

Construct from iterators.

Template Parameters
ITER[deduced]type of iterator.
Parameters
[in]beginIterator that points to first initialization item.
[in]endIterator that points ones past last initialization item.

Definition at line 336 of file attribute-container.h.

References ns3::AttributeContainerValue< A, C >::begin(), ns3::AttributeContainerValue< A, C >::CopyFrom(), and ns3::AttributeContainerValue< A, C >::end().

+ Here is the call graph for this function:

◆ ~AttributeContainerValue()

template<class A , template< class... > class C>
ns3::AttributeContainerValue< A, C >::~AttributeContainerValue ( )

Destructor.

Definition at line 343 of file attribute-container.h.

Member Function Documentation

◆ Begin()

template<class A , template< class... > class C>
AttributeContainerValue< A, C >::Iterator ns3::AttributeContainerValue< A, C >::Begin ( void  )

NS3-style beginning of container.

Returns
Iterator pointing to first time in container.

Definition at line 423 of file attribute-container.h.

Referenced by AttributeContainerTestCase::DoRun().

+ Here is the caller graph for this function:

◆ begin() [1/2]

template<class A , template< class... > class C>
AttributeContainerValue< A, C >::iterator ns3::AttributeContainerValue< A, C >::begin ( void  )

STL-style beginning of container.

Returns
Iterator pointing to first item in container.

Definition at line 444 of file attribute-container.h.

Referenced by ns3::AttributeContainerValue< A, C >::AttributeContainerValue().

+ Here is the caller graph for this function:

◆ begin() [2/2]

template<class A , template< class... > class C>
AttributeContainerValue< A, C >::const_iterator ns3::AttributeContainerValue< A, C >::begin ( void  ) const

STL-style const beginning of container.

Returns
Const iterator pointing to first item in container.

Definition at line 458 of file attribute-container.h.

◆ Copy()

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

Implements ns3::AttributeValue.

Definition at line 350 of file attribute-container.h.

◆ CopyFrom()

template<class A , template< class... > class C>
template<class ITER >
Ptr< AttributeContainerValue< A, C > > ns3::AttributeContainerValue< A, C >::CopyFrom ( const ITER  begin,
const ITER  end 
)
private

Copy items from begin to end.

The internal container is cleared before values are copied using the push_back method.

Template Parameters
ITER[deduced]iterator type
Parameters
[in]beginPoints to first item to copy
[in]endPoints to one after last item to copy
Returns
This object with items copied.

Definition at line 473 of file attribute-container.h.

Referenced by ns3::AttributeContainerValue< A, C >::AttributeContainerValue().

+ Here is the caller graph for this function:

◆ DeserializeFromString()

template<class A , template< class... > class C>
bool ns3::AttributeContainerValue< A, C >::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 360 of file attribute-container.h.

Referenced by AttributeContainerSerializationTestCase::DoRun().

+ Here is the caller graph for this function:

◆ End()

template<class A , template< class... > class C>
AttributeContainerValue< A, C >::Iterator ns3::AttributeContainerValue< A, C >::End ( void  )

NS3-style ending of container.

Returns
Iterator pointing one past last item of container.

Definition at line 430 of file attribute-container.h.

Referenced by AttributeContainerTestCase::DoRun().

+ Here is the caller graph for this function:

◆ end() [1/2]

template<class A , template< class... > class C>
AttributeContainerValue< A, C >::iterator ns3::AttributeContainerValue< A, C >::end ( void  )

STL-style end of container.

Returns
Iterator pointing to one past last item in container.

Definition at line 451 of file attribute-container.h.

Referenced by ns3::AttributeContainerValue< A, C >::AttributeContainerValue().

+ Here is the caller graph for this function:

◆ end() [2/2]

template<class A , template< class... > class C>
AttributeContainerValue< A, C >::const_iterator ns3::AttributeContainerValue< A, C >::end ( void  ) const

STL-style const end of container.

Returns
Const iterator pointing to one past last item in container.

Definition at line 465 of file attribute-container.h.

◆ Get()

template<class A , template< class... > class C>
AttributeContainer ns3::AttributeContainerValue< A, C >::Get ( void  ) const

Return a container of items.


Returns
Container of items.
The AttributeContainer value.

Definition at line 397 of file attribute-container.h.

Referenced by AttributeContainerSetGetTestCase::DoRun().

+ Here is the caller graph for this function:

◆ GetN()

template<class A , template< class... > class C>
AttributeContainerValue< A, C >::size_type ns3::AttributeContainerValue< A, C >::GetN ( void  ) const

NS3-style Number of items.

Returns
Number of items in container.

Definition at line 416 of file attribute-container.h.

Referenced by AttributeContainerTestCase::DoRun(), AttributeContainerSerializationTestCase::DoRun(), and AttributeContainerSetGetTestCase::DoRun().

+ Here is the caller graph for this function:

◆ SerializeToString()

template<class A , template< class... > class C>
std::string ns3::AttributeContainerValue< A, C >::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 382 of file attribute-container.h.

Referenced by AttributeContainerSerializationTestCase::DoRun().

+ Here is the caller graph for this function:

◆ Set()

template<class A , template< class... > class C>
template<class T >
void ns3::AttributeContainerValue< A, C >::Set ( const T &  c)

Copy items from container c.


Set the value.

This method assumes c has stl-style begin and end methods. The AttributeContainerValue value is cleared before copying from c.

Template Parameters
Ttype of container.
Parameters
cContainer from which to copy items.
[in]valueThe value to adopt.

Definition at line 408 of file attribute-container.h.

◆ size()

template<class A , template< class... > class C>
AttributeContainerValue< A, C >::size_type ns3::AttributeContainerValue< A, C >::size ( void  ) const

STL-style number of items in container.

Returns
number of items in container.

Definition at line 437 of file attribute-container.h.

Member Data Documentation

◆ m_container

template<class A, template< class... > class C = std::list>
container_type ns3::AttributeContainerValue< A, C >::m_container
private

Internal container.

Definition at line 182 of file attribute-container.h.

◆ m_sep

template<class A, template< class... > class C = std::list>
char ns3::AttributeContainerValue< A, C >::m_sep
private

Item separator.

Definition at line 181 of file attribute-container.h.


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