20 #ifndef OBJECT_PTR_CONTAINER_H
21 #define OBJECT_PTR_CONTAINER_H
49 typedef std::map<uint32_t, Ptr<Object> >::const_iterator
Iterator;
71 uint32_t
GetN (
void)
const;
125 template <
typename T,
typename U,
typename INDEX>
128 INDEX (T::*getN)(
void)
const);
145 template <
typename T,
typename U,
typename INDEX>
148 Ptr<U> (T::*
get)(INDEX)
const);
160 template <
typename T>
175 template <
typename T>
180 return T::GetTypeId ();
186 return "ns3::ObjectPtrContainerValue";
192 return "ns3::Ptr< " + T::GetTypeId ().GetName () +
" >";
195 return ns3::Create<ObjectPtrContainerValue> ();
200 if (src == 0 || dst == 0)
243 template <
typename T,
typename U,
typename INDEX>
246 INDEX (T::*getN)(
void)
const)
250 virtual bool DoGetN (
const ObjectBase *
object, uint32_t *n)
const {
251 const T *obj =
dynamic_cast<const T *
> (object);
256 *n = (obj->*m_getN)();
260 const T *obj =
static_cast<const T *
> (object);
262 return (obj->*m_get)(i);
264 Ptr<U> (T::*m_get)(INDEX)
const;
265 INDEX (T::*m_getN)(void)
const;
266 } *spec =
new MemberGetters ();
272 template <
typename T,
typename U,
typename INDEX>
273 Ptr<const AttributeAccessor>
275 Ptr<U> (T::*
get)(INDEX)
const)
280 template <
typename T>
283 return Create<internal::ObjectPtrContainerChecker<T> > ();
ObjectPtrContainerChecker implementation class.
virtual Ptr< AttributeValue > Copy(void) const
Get a copy of this container.
ObjectPtrContainerValue()
Default constructor.
Represent the type of an attribute.
virtual bool HasSetter(void) const
virtual bool Check(const AttributeValue &value) const
virtual Ptr< Object > DoGet(const ObjectBase *object, uint32_t i, uint32_t *index) const =0
Get an instance from the container, identified by index.
Smart pointer implementation.
Hold a value for an Attribute.
virtual std::string GetUnderlyingTypeInformation(void) const
Anchor the ns-3 type and attribute system.
virtual TypeId GetItemTypeId(void) const =0
Get the TypeId of the container class type.
std::map< uint32_t, Ptr< Object > >::const_iterator Iterator
Iterator type for traversing this container.
virtual bool HasUnderlyingTypeInformation(void) const
Ptr< Object > Get(uint32_t i) const
Get a specific Object.
virtual bool Set(ObjectBase *object, const AttributeValue &value) const
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 HasGetter(void) const
AttributeAccessor implementation for ObjectPtrContainerValue.
ns3::AttributeValue, ns3::AttributeAccessor and ns3::AttributeChecker declarations.
std::map< uint32_t, Ptr< Object > > m_objects
The container implementation.
AttributeChecker implementation for ObjectPtrContainerValue.
allow setting and getting the value of an attribute.
Ptr< const AttributeChecker > MakeObjectPtrContainerChecker(void)
virtual TypeId GetItemTypeId(void) const
Get the TypeId of the container class type.
Iterator Begin(void) const
Get an iterator to the first Object.
ns3::Object class declaration, which is the root of the Object hierarchy and Aggregation.
virtual bool DeserializeFromString(std::string value, Ptr< const AttributeChecker > checker)
Deserialize from a string.
virtual std::string GetValueTypeName(void) const
Iterator End(void) const
Get an iterator to the past-the-end Object.
virtual bool DoGetN(const ObjectBase *object, uint32_t *n) const =0
Get the number of instances in the container.
virtual bool Copy(const AttributeValue &source, AttributeValue &destination) const
Copy the source to the destination.
virtual Ptr< AttributeValue > Create(void) const
uint32_t GetN(void) const
Get the number of Objects.
Container for a set of ns3::Object pointers.
virtual bool Get(const ObjectBase *object, AttributeValue &value) const
virtual std::string SerializeToString(Ptr< const AttributeChecker > checker) const
Serialize each of the Object pointers to a string.
a unique identifier for an interface.