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>
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>
291 template <
typename T>
294 return Create<internal::ObjectPtrContainerChecker<T> > ();
ns3::AttributeValue, ns3::AttributeAccessor and ns3::AttributeChecker declarations.
allow setting and getting the value of an attribute.
Represent the type of an attribute.
Hold a value for an Attribute.
Anchor the ns-3 type and attribute system.
AttributeAccessor implementation for ObjectPtrContainerValue.
virtual bool Set(ObjectBase *object, const AttributeValue &value) const
virtual bool HasSetter(void) const
virtual bool DoGetN(const ObjectBase *object, std::size_t *n) const =0
Get the number of instances in the container.
virtual bool HasGetter(void) const
virtual bool Get(const ObjectBase *object, AttributeValue &value) const
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.
AttributeChecker implementation for ObjectPtrContainerValue.
virtual TypeId GetItemTypeId(void) const =0
Get the TypeId of the container class type.
Container for a set of ns3::Object pointers.
virtual std::string SerializeToString(Ptr< const AttributeChecker > checker) const
Serialize each of the Object pointers to a string.
virtual Ptr< AttributeValue > Copy(void) const
Get a copy of this container.
std::map< std::size_t, Ptr< Object > > m_objects
The container implementation.
std::size_t GetN(void) const
Get the number of Objects.
Iterator Begin(void) const
Get an iterator to the first Object.
ObjectPtrContainerValue()
Default constructor.
virtual bool DeserializeFromString(std::string value, Ptr< const AttributeChecker > checker)
Deserialize from a string.
std::map< std::size_t, Ptr< Object > >::const_iterator Iterator
Iterator type for traversing this container.
Ptr< Object > Get(std::size_t i) const
Get a specific Object.
Iterator End(void) const
Get an iterator to the past-the-end Object.
a unique identifier for an interface.
ObjectPtrContainerChecker implementation class.
virtual TypeId GetItemTypeId(void) const
Get the TypeId of the container class type.
virtual bool Check(const AttributeValue &value) const
virtual std::string GetUnderlyingTypeInformation(void) const
virtual std::string GetValueTypeName(void) const
virtual bool Copy(const AttributeValue &source, AttributeValue &destination) const
Copy the source to the destination.
virtual Ptr< AttributeValue > Create(void) const
virtual bool HasUnderlyingTypeInformation(void) 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.
Ptr< const AttributeChecker > MakeObjectPtrContainerChecker(void)
auto get(const nlohmann::detail::iteration_proxy_value< IteratorType > &i) -> decltype(i.key())
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Object class declaration, which is the root of the Object hierarchy and Aggregation.
ns3::Ptr smart pointer declaration and implementation.