9#ifndef ATTRIBUTE_CONTAINER_H
10#define ATTRIBUTE_CONTAINER_H
32class AttributeChecker;
48template <
class A,
char Sep =
',',
template <
class...>
class C = std::list>
61 typedef typename container_type::iterator
iterator;
63 typedef typename container_type::size_type
size_type;
69 typedef typename std::invoke_result_t<
decltype(&A::Get), A>
item_type;
83 template <
class CONTAINER>
118 void Set(
const T& c);
127 template <
typename T>
185 template <
class ITER>
223template <
class A,
char Sep,
template <
class...>
class C>
237template <
class A,
char Sep =
',',
template <
class...>
class C = std::list>
249template <
class A,
char Sep =
',',
template <
class...>
class C = std::list>
265template <
typename A,
char Sep =
',',
template <
typename...>
class C = std::list,
typename T1>
286 template <
typename...>
class C = std::list,
312template <
class A,
char Sep,
template <
class...>
class C>
329template <
class A,
char Sep,
template <
class...>
class C>
331 : m_itemchecker(nullptr)
335template <
class A,
char Sep,
template <
class...>
class C>
338 : m_itemchecker(itemchecker)
342template <
class A,
char Sep,
template <
class...>
class C>
346 m_itemchecker = itemchecker;
349template <
class A,
char Sep,
template <
class...>
class C>
353 return m_itemchecker;
358template <
class A,
char Sep,
template <
class...>
class C>
365template <
class A,
char Sep,
template <
class...>
class C>
366Ptr<const AttributeChecker>
371 acchecker->SetItemChecker(itemchecker);
375template <
class A,
char Sep,
template <
class...>
class C>
379 std::string containerType;
380 std::string underlyingType;
383 std::ostringstream oss;
384 oss <<
"ns3::AttributeContainerValue<" <<
typeid(
typename T::attribute_type).name() <<
", "
385 <<
typeid(
typename T::container_type).name() <<
">";
386 containerType = oss.str();
390 std::ostringstream oss;
391 oss <<
"ns3::Ptr<" <<
typeid(
typename T::attribute_type).name() <<
">";
392 underlyingType = oss.str();
400template <
class A,
char Sep,
template <
class...>
class C>
405template <
class A,
char Sep,
template <
class...>
class C>
406template <
class CONTAINER>
412template <
class A,
char Sep,
template <
class...>
class C>
420template <
class A,
char Sep,
template <
class...>
class C>
426template <
class A,
char Sep,
template <
class...>
class C>
431 c->m_container = m_container;
435template <
class A,
char Sep,
template <
class...>
class C>
446 std::istringstream iss(value);
447 while (std::getline(iss, value, Sep))
449 auto avalue = acchecker->GetItemChecker()->CreateValidValue(
StringValue(value));
462 m_container.push_back(attr);
467template <
class A,
char Sep,
template <
class...>
class C>
471 std::ostringstream oss;
473 for (
auto attr : *
this)
479 oss << attr->SerializeToString(checker);
485template <
class A,
char Sep,
template <
class...>
class C>
492 c.insert(c.end(), a->Get());
497template <
class A,
char Sep,
template <
class...>
class C>
504 std::copy(src.begin(), src.end(), std::inserter(value, value.end()));
508template <
class A,
char Sep,
template <
class...>
class C>
514 CopyFrom(c.begin(), c.end());
517template <
class A,
char Sep,
template <
class...>
class C>
524template <
class A,
char Sep,
template <
class...>
class C>
531template <
class A,
char Sep,
template <
class...>
class C>
538template <
class A,
char Sep,
template <
class...>
class C>
542 return m_container.size();
545template <
class A,
char Sep,
template <
class...>
class C>
549 return m_container.begin();
552template <
class A,
char Sep,
template <
class...>
class C>
556 return m_container.end();
559template <
class A,
char Sep,
template <
class...>
class C>
563 return m_container.cbegin();
566template <
class A,
char Sep,
template <
class...>
class C>
570 return m_container.cend();
573template <
class A,
char Sep,
template <
class...>
class C>
578 for (ITER iter = begin; iter != end; ++iter)
585template <
typename A,
char Sep,
template <
typename...>
class C,
typename T1>
592template <
typename A,
char Sep,
template <
typename...>
class C,
typename T1,
typename T2>
593Ptr<const AttributeAccessor>
Attribute helper (ATTRIBUTE_ )macros definition.
Represent the type of an attribute.
AttributeChecker implementation for AttributeContainerValue.
virtual Ptr< const AttributeChecker > GetItemChecker() const =0
Get the item checker.
virtual void SetItemChecker(Ptr< const AttributeChecker > itemchecker)=0
Set the item checker.
A container for one type of attribute.
AttributeContainerValue::const_iterator Iterator
NS3 style iterator type.
container_type::size_type size_type
Size type for container.
container_type::iterator iterator
stl-style Non-const iterator type.
std::list< value_type > container_type
Internal container type.
bool GetAccessor(T &value) const
Set the given variable to the values stored by this TupleValue object.
Iterator End()
NS3-style ending of container.
size_type GetN() const
NS3-style Number of items.
Ptr< AttributeContainerValue< A, Sep, C > > CopyFrom(const ITER begin, const ITER end)
Copy items from begin to end.
iterator end()
STL-style end of container.
container_type::const_iterator const_iterator
stl-style Const iterator type.
Ptr< A > value_type
Type actually stored within the container.
std::string SerializeToString(Ptr< const AttributeChecker > checker) const override
C< item_type > result_type
Type of container returned.
container_type m_container
Internal container.
AttributeContainerValue()
Default constructor.
result_type Get() const
Return a container of items.
A attribute_type
AttributeValue (element) type.
void Set(const T &c)
Copy items from container c.
Iterator Begin()
NS3-style beginning of container.
Ptr< AttributeValue > Copy() const override
std::invoke_result_t< decltype(&A::Get), A > item_type
Item type of container returned by Get.
size_type size() const
STL-style number of items in container.
iterator begin()
STL-style beginning of container.
bool DeserializeFromString(std::string value, Ptr< const AttributeChecker > checker) override
~AttributeContainerValue() override
Destructor.
Hold a value for an Attribute.
Smart pointer class similar to boost::intrusive_ptr.
Hold variables of type string.
Ptr< const AttributeChecker > GetItemChecker() const override
Get the item checker.
AttributeContainerChecker()
Ptr< const AttributeChecker > m_itemchecker
The AttributeChecker.
void SetItemChecker(Ptr< const AttributeChecker > itemchecker) override
Set the item checker.
Ptr< AttributeChecker > MakeAttributeContainerChecker()
Make uninitialized AttributeContainerChecker using explicit types.
Ptr< const AttributeAccessor > MakeAttributeContainerAccessor(T1 a1)
Make AttributeContainerAccessor using explicit types.
Ptr< const AttributeAccessor > MakeAccessorHelper(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< AttributeChecker > MakeSimpleAttributeChecker(std::string name, std::string underlying)
A simple string-based attribute checker.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
constexpr double C
speed of light in vacuum, in m/s
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
ns3::StringValue attribute value declarations.