A Discrete-Event Network Simulator
API
ns3::ObjectPtrContainerValue Class Reference

Container for a set of ns3::Object pointers. More...

#include "object-ptr-container.h"

+ Inheritance diagram for ns3::ObjectPtrContainerValue:
+ Collaboration diagram for ns3::ObjectPtrContainerValue:

Public Types

typedef std::map< std::size_t, Ptr< Object > >::const_iterator Iterator
 Iterator type for traversing this container. More...
 

Public Member Functions

 ObjectPtrContainerValue ()
 Default constructor. More...
 
Iterator Begin () const
 Get an iterator to the first Object. More...
 
Ptr< AttributeValueCopy () const override
 Get a copy of this container. More...
 
bool DeserializeFromString (std::string value, Ptr< const AttributeChecker > checker) override
 Deserialize from a string. More...
 
Iterator End () const
 Get an iterator to the past-the-end Object. More...
 
Ptr< ObjectGet (std::size_t i) const
 Get a specific Object. More...
 
std::size_t GetN () const
 Get the number of Objects. More...
 
std::string SerializeToString (Ptr< const AttributeChecker > checker) const override
 Serialize each of the Object pointers to a string. More...
 
- Public Member Functions inherited from ns3::AttributeValue
 AttributeValue ()
 
virtual ~AttributeValue ()
 
virtual Ptr< AttributeValueCopy () const =0
 
virtual bool DeserializeFromString (std::string value, Ptr< const AttributeChecker > checker)=0
 
virtual std::string SerializeToString (Ptr< const AttributeChecker > checker) const =0
 
- Public Member Functions inherited from ns3::SimpleRefCount< AttributeValue >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount () const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator. More...
 
void Ref () const
 Increment the reference count. More...
 
void Unref () const
 Decrement the reference count. More...
 

Private Attributes

std::map< std::size_t, Ptr< Object > > m_objects
 The container implementation. More...
 

Friends

class ObjectPtrContainerAccessor
 ObjectPtrContainerAccessor::Get() needs access. More...
 

Detailed Description

Container for a set of ns3::Object pointers.

AttributeValue implementation for ObjectPtrContainer.

This class it used to get attribute access to an array of ns3::Object pointers.

See also
AttributeValue

Definition at line 45 of file object-ptr-container.h.

Member Typedef Documentation

◆ Iterator

typedef std::map<std::size_t,Ptr<Object>>::const_iterator ns3::ObjectPtrContainerValue::Iterator

Iterator type for traversing this container.

Definition at line 49 of file object-ptr-container.h.

Constructor & Destructor Documentation

◆ ObjectPtrContainerValue()

ObjectPtrContainer ns3::ObjectPtrContainerValue::ObjectPtrContainerValue ( )

Default constructor.

Definition at line 34 of file object-ptr-container.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ Begin()

◆ Copy()

Ptr< AttributeValue > ns3::ObjectPtrContainerValue::Copy ( ) const
overridevirtual

Get a copy of this container.

Returns
A copy of this container.

Implements ns3::AttributeValue.

Definition at line 74 of file object-ptr-container.cc.

References NS_LOG_FUNCTION.

◆ DeserializeFromString()

bool ns3::ObjectPtrContainerValue::DeserializeFromString ( std::string  value,
Ptr< const AttributeChecker checker 
)
overridevirtual

Deserialize from a string.

(Not implemented; raises a fatal error.)

Parameters
[in]valueThe serialized string form.
[in]checkerThe checker to use.
Returns
true.

Implements ns3::AttributeValue.

Definition at line 98 of file object-ptr-container.cc.

References NS_FATAL_ERROR, NS_LOG_FUNCTION, and second::value.

◆ End()

ObjectPtrContainerValue::Iterator ns3::ObjectPtrContainerValue::End ( ) const

◆ Get()

ObjectPtrContainer ns3::ObjectPtrContainerValue::Get ( std::size_t  i) const

Get a specific Object.

Parameters
[in]iThe index of the requested object.
Returns
The requested object
The ObjectPtrContainer value.

Definition at line 61 of file object-ptr-container.cc.

References m_objects, NS_LOG_FUNCTION, and second::value.

Referenced by ObjectVectorAttributeTestCase::DoRun(), and ObjectMapAttributeTestCase::DoRun().

+ Here is the caller graph for this function:

◆ GetN()

std::size_t ns3::ObjectPtrContainerValue::GetN ( ) const

◆ SerializeToString()

std::string ns3::ObjectPtrContainerValue::SerializeToString ( Ptr< const AttributeChecker checker) const
overridevirtual

Serialize each of the Object pointers to a string.

Note this serializes the Ptr values, not the Objects themselves.

Parameters
[in]checkerThe checker to use (currently not used.)
Returns
The string form of the Objects.

Implements ns3::AttributeValue.

Definition at line 81 of file object-ptr-container.cc.

References Begin(), End(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

Friends And Related Function Documentation

◆ ObjectPtrContainerAccessor

friend class ObjectPtrContainerAccessor
friend

ObjectPtrContainerAccessor::Get() needs access.

Definition at line 106 of file object-ptr-container.h.

Member Data Documentation

◆ m_objects

std::map<std::size_t, Ptr<Object> > ns3::ObjectPtrContainerValue::m_objects
private

The container implementation.

Definition at line 108 of file object-ptr-container.h.

Referenced by Begin(), End(), ns3::ObjectPtrContainerAccessor::Get(), Get(), and GetN().


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