20 #ifndef OBJECT_PTR_CONTAINER_H
21 #define OBJECT_PTR_CONTAINER_H
26 #include "attribute.h"
41 typedef std::map<uint32_t, Ptr<Object> >::const_iterator Iterator;
48 Iterator
Begin (
void)
const;
52 Iterator
End (
void)
const;
56 uint32_t
GetN (
void)
const;
69 std::map<uint32_t, Ptr<Object> > m_objects;
73 template <
typename T,
typename U,
typename INDEX>
75 MakeObjectPtrContainerAccessor (
Ptr<U> (T::*
get)(INDEX)
const,
76 INDEX (T::*getN)(
void)
const);
78 template <
typename T,
typename U,
typename INDEX>
80 MakeObjectPtrContainerAccessor (INDEX (T::*getN)(
void)
const,
81 Ptr<U> (T::*
get)(INDEX)
const);
86 virtual TypeId GetItemTypeId (
void)
const = 0;
102 virtual TypeId GetItemTypeId (
void)
const {
103 return T::GetTypeId ();
109 return "ns3::ObjectPtrContainerValue";
115 return "ns3::Ptr< " + T::GetTypeId ().GetName () +
" >";
118 return ns3::Create<ObjectPtrContainerValue> ();
123 if (src == 0 || dst == 0)
143 virtual bool DoGetN (
const ObjectBase *
object, uint32_t *n)
const = 0;
147 template <
typename T,
typename U,
typename INDEX>
149 MakeObjectPtrContainerAccessor (
Ptr<U> (T::*
get)(INDEX)
const,
150 INDEX (T::*getN)(
void)
const)
154 virtual bool DoGetN (
const ObjectBase *
object, uint32_t *n)
const {
155 const T *obj =
dynamic_cast<const T *
> (object);
160 *n = (obj->*m_getN)();
163 virtual Ptr<Object> DoGet (
const ObjectBase *
object, uint32_t i, uint32_t *index)
const {
164 const T *obj =
static_cast<const T *
> (object);
166 return (obj->*m_get)(i);
168 Ptr<U> (T::*m_get)(INDEX)
const;
169 INDEX (T::*m_getN)(void)
const;
170 } *spec =
new MemberGetters ();
173 return Ptr<const AttributeAccessor> (spec,
false);
176 template <
typename T,
typename U,
typename INDEX>
177 Ptr<const AttributeAccessor>
178 MakeObjectPtrContainerAccessor (INDEX (T::*getN)(
void)
const,
179 Ptr<U> (T::*
get)(INDEX)
const)
181 return MakeObjectPtrContainerAccessor (
get, getN);
184 template <
typename T>
185 Ptr<const AttributeChecker> MakeObjectPtrContainerChecker (
void)
187 return Create<internal::AnObjectPtrContainerChecker<T> > ();
virtual Ptr< AttributeValue > Copy(void) const
Represent the type of an attribute.
virtual std::string GetUnderlyingTypeInformation(void) const
virtual std::string GetValueTypeName(void) const
virtual bool HasSetter(void) const
Hold a value for an Attribute.
implement the ns-3 type and attribute system
virtual Ptr< AttributeValue > Create(void) const
Ptr< Object > Get(uint32_t i) const
virtual bool Set(ObjectBase *object, const AttributeValue &value) const
virtual bool HasUnderlyingTypeInformation(void) const
virtual bool HasGetter(void) const
allow setting and getting the value of an attribute.
virtual bool Check(const AttributeValue &value) const
Iterator Begin(void) const
virtual bool DeserializeFromString(std::string value, Ptr< const AttributeChecker > checker)
uint32_t GetN(void) const
contain a set of ns3::Object pointers.
virtual bool Get(const ObjectBase *object, AttributeValue &value) const
virtual std::string SerializeToString(Ptr< const AttributeChecker > checker) const
a unique identifier for an interface.