8#ifndef ATTRIBUTE_ACCESSOR_HELPER_H
9#define ATTRIBUTE_ACCESSOR_HELPER_H
57template <
typename V,
typename T1>
100template <
typename V,
typename T1,
typename T2>
109#include <type_traits>
138template <
typename T,
typename U>
161 const U*
value =
dynamic_cast<const U*
>(&
val);
162 if (
value ==
nullptr)
189 if (
value ==
nullptr)
193 const T*
obj =
dynamic_cast<const T*
>(
object);
210 virtual bool DoSet(T*
object,
const U* v)
const = 0;
219 virtual bool DoGet(
const T*
object,
U* v)
const = 0;
235template <
typename V,
typename T,
typename U>
254 bool DoSet(T*
object,
const V* v)
const override
257 bool ok = v->GetAccessor(
tmp);
266 bool DoGet(
const T*
object,
V* v)
const override
272 bool HasGetter()
const override
277 bool HasSetter()
const override
300template <
typename V,
typename T,
typename U>
319 bool DoSet(T* ,
const V* )
const override
324 bool DoGet(
const T*
object,
V* v)
const override
330 bool HasGetter()
const override
335 bool HasSetter()
const override
359template <
typename V,
typename T,
typename U>
378 bool DoSet(T*
object,
const V* v)
const override
381 bool ok = v->GetAccessor(
tmp);
390 bool DoGet(
const T* ,
V* )
const override
395 bool HasGetter()
const override
400 bool HasSetter()
const override
428template <
typename W,
typename T,
typename U,
typename V>
452 bool DoSet(T*
object,
const W* v)
const override
455 bool ok = v->GetAccessor(
tmp);
464 bool DoGet(
const T*
object,
W* v)
const override
470 bool HasGetter()
const override
475 bool HasSetter()
const override
491template <
typename W,
typename T,
typename U,
typename V>
515template <
typename W,
typename T,
typename U,
typename V>
539 bool DoSet(T*
object,
const W* v)
const override
542 bool ok = v->GetAccessor(
tmp);
551 bool DoGet(
const T*
object,
W* v)
const override
557 bool HasGetter()
const override
562 bool HasSetter()
const override
578template <
typename W,
typename T,
typename U,
typename V>
585template <
typename V,
typename T1>
592template <
typename V,
typename T1,
typename T2>
ns3::AttributeValue, ns3::AttributeAccessor and ns3::AttributeChecker declarations.
Basic functionality for accessing class attributes via class data members, or get functor/set methods...
bool Set(ObjectBase *object, const AttributeValue &val) const override
Set the underlying member to the argument AttributeValue.
AccessorHelper()
Constructor.
virtual bool DoGet(const T *object, U *v) const =0
Getter implementation.
bool Get(const ObjectBase *object, AttributeValue &val) const override
Get the value of the underlying member into the AttributeValue.
virtual bool DoSet(T *object, const U *v) const =0
Setter implementation.
allow setting and getting the value of an attribute.
Hold a value for an Attribute.
Anchor the ns-3 type and attribute system.
Smart pointer class similar to boost::intrusive_ptr.
Ptr< const AttributeAccessor > DoMakeAccessorHelperOne(U T::*memberVariable)
MakeAccessorHelper implementation for a class data member.
Ptr< const AttributeAccessor > MakeAccessorHelper(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > DoMakeAccessorHelperTwo(void(T::*setter)(U), V(T::*getter)() const)
MakeAccessorHelper implementation with a class get functor method and a class set method returning vo...
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static unsigned int value(char c)
The non-const and non-reference type equivalent to T.
std::remove_cvref_t< T > Result
The non-const, non reference type.