|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
20 #ifndef OBJECT_PTR_CONTAINER_H
21 #define OBJECT_PTR_CONTAINER_H
49 typedef std::map<std::size_t, Ptr<Object> >::const_iterator
Iterator;
71 std::size_t
GetN (
void)
const;
126 template <
typename T,
typename U,
typename INDEX>
129 INDEX (T::*getN)(
void)
const);
146 template <
typename T,
typename U,
typename INDEX>
149 Ptr<U> (T::*get)(INDEX)
const);
161 template <
typename T>
176 template <
typename T>
182 return T::GetTypeId ();
190 return "ns3::ObjectPtrContainerValue";
198 return "ns3::Ptr< " + T::GetTypeId ().GetName () +
" >";
202 return ns3::Create<ObjectPtrContainerValue> ();
208 if (src == 0 || dst == 0)
252 template <
typename T,
typename U,
typename INDEX>
255 INDEX (T::*getN)(
void)
const)
259 virtual bool DoGetN (
const ObjectBase *
object, std::size_t *
n)
const
261 const T *obj =
dynamic_cast<const T *
> (object);
266 *
n = (obj->*m_getN)();
271 const T *obj =
static_cast<const T *
> (object);
273 return (obj->*m_get)(i);
275 Ptr<U> (T::*m_get)(INDEX)
const;
276 INDEX (T::*m_getN)(void)
const;
277 } *spec =
new MemberGetters ();
283 template <
typename T,
typename U,
typename INDEX>
284 Ptr<const AttributeAccessor>
286 Ptr<U> (T::*get)(INDEX)
const)
291 template <
typename T>
294 return Create<internal::ObjectPtrContainerChecker<T> > ();
a unique identifier for an interface.
virtual TypeId GetItemTypeId(void) const =0
Get the TypeId of the container class type.
Iterator End(void) const
Get an iterator to the past-the-end Object.
virtual bool Get(const ObjectBase *object, AttributeValue &value) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual std::string GetValueTypeName(void) const
virtual Ptr< AttributeValue > Create(void) const
std::size_t GetN(void) const
Get the number of Objects.
Hold a value for an Attribute.
Ptr< const AttributeAccessor > MakeObjectPtrContainerAccessor(Ptr< U >(T::*get)(INDEX) const, INDEX(T::*getN)(void) const)
Create an AttributeAccessor using a container class indexed get method.
virtual bool Check(const AttributeValue &value) const
Container for a set of ns3::Object pointers.
virtual std::string GetUnderlyingTypeInformation(void) const
virtual bool Copy(const AttributeValue &source, AttributeValue &destination) const
Copy the source to the destination.
Ptr< Object > Get(std::size_t i) const
Get a specific Object.
virtual Ptr< AttributeValue > Copy(void) const
Get a copy of this container.
virtual TypeId GetItemTypeId(void) const
Get the TypeId of the container class type.
Represent the type of an attribute.
ObjectPtrContainerChecker implementation class.
Ptr< const AttributeChecker > MakeObjectPtrContainerChecker(void)
virtual bool Set(ObjectBase *object, const AttributeValue &value) const
virtual bool DeserializeFromString(std::string value, Ptr< const AttributeChecker > checker)
Deserialize from a string.
ns3::AttributeValue, ns3::AttributeAccessor and ns3::AttributeChecker declarations.
ObjectPtrContainerValue()
Default constructor.
allow setting and getting the value of an attribute.
std::map< std::size_t, Ptr< Object > > m_objects
The container implementation.
virtual bool HasSetter(void) const
Iterator Begin(void) const
Get an iterator to the first Object.
virtual bool HasGetter(void) const
virtual bool HasUnderlyingTypeInformation(void) const
AttributeChecker implementation for ObjectPtrContainerValue.
std::map< std::size_t, Ptr< Object > >::const_iterator Iterator
Iterator type for traversing this container.
ns3::Ptr smart pointer declaration and implementation.
AttributeAccessor implementation for ObjectPtrContainerValue.
virtual bool DoGetN(const ObjectBase *object, std::size_t *n) const =0
Get the number of instances in the container.
virtual std::string SerializeToString(Ptr< const AttributeChecker > checker) const
Serialize each of the Object pointers to a string.
Anchor the ns-3 type and attribute system.
ns3::Object class declaration, which is the root of the Object hierarchy and Aggregation.
virtual Ptr< Object > DoGet(const ObjectBase *object, std::size_t i, std::size_t *index) const =0
Get an instance from the container, identified by index.