31template <
class A,
class B>
33operator<<(std::ostream& os,
const std::pair<A, B>& p)
35 os <<
"(" << p.first <<
"," << p.second <<
")";
52template <
class A,
class B>
59 typedef typename std::invoke_result_t<
decltype(&A::Get), A>
first_type;
61 typedef typename std::invoke_result_t<
decltype(&B::Get), B>
second_type;
63 typedef typename std::pair<first_type, second_type>
result_type;
92 result_type
Get()
const;
97 void Set(
const result_type& value);
105 template <
typename T>
150template <
class A,
class B>
165template <
class A,
class B>
176template <
class A,
class B>
189template <
typename A,
typename B,
typename T1>
213template <
class A,
class B>
237template <
class A,
class B>
239 : m_firstchecker(nullptr),
240 m_secondchecker(nullptr)
244template <
class A,
class B>
247 : m_firstchecker(firstchecker),
248 m_secondchecker(secondchecker)
252template <
class A,
class B>
257 m_firstchecker = firstchecker;
258 m_secondchecker = secondchecker;
261template <
class A,
class B>
265 return std::make_pair(m_firstchecker, m_secondchecker);
270template <
class A,
class B>
277template <
class A,
class B>
278Ptr<const AttributeChecker>
283 acchecker->SetCheckers(firstchecker, secondchecker);
287template <
class A,
class B>
291 std::string pairName;
292 std::string underlyingType;
294 std::string first_type_name =
typeid(
typename T::value_type::first_type).name();
295 std::string second_type_name =
typeid(
typename T::value_type::second_type).name();
297 std::ostringstream oss;
298 oss <<
"ns3::PairValue<" << first_type_name <<
", " << second_type_name <<
">";
299 pairName = oss.str();
303 std::ostringstream oss;
304 oss <<
typeid(
typename T::value_type).name();
305 underlyingType = oss.str();
311template <
class A,
class B>
319 p->m_value = std::make_pair(
DynamicCast<A>(m_value.first->Copy()),
325template <
class A,
class B>
335 std::istringstream iss(value);
337 auto first = pchecker->GetCheckers().first->CreateValidValue(
StringValue(value));
350 auto second = pchecker->GetCheckers().second->CreateValidValue(
StringValue(value));
362 m_value = std::make_pair(firstattr, secondattr);
366template <
class A,
class B>
370 std::ostringstream oss;
371 oss << m_value.first->SerializeToString(checker);
373 oss << m_value.second->SerializeToString(checker);
378template <
class A,
class B>
382 return std::make_pair(m_value.first->Get(), m_value.second->Get());
385template <
class A,
class B>
392template <
class A,
class B>
401template <
typename A,
typename B,
typename T1>
Attribute helper (ATTRIBUTE_ )macros definition.
Represent the type of an attribute.
Hold a value for an Attribute.
AttributeChecker implementation for PairValue.
virtual void SetCheckers(Ptr< const AttributeChecker > firstchecker, Ptr< const AttributeChecker > secondchecker)=0
Set the individual AttributeChecker for each pair entry.
std::pair< Ptr< const AttributeChecker >, Ptr< const AttributeChecker > > checker_pair_type
Type holding an AttributeChecker for each member of a pair.
virtual checker_pair_type GetCheckers() const =0
Get the pair of checkers for each pair entry.
AttributeValue implementation for Pair.
PairValue(const result_type &value)
Construct this PairValue from a std::pair.
std::pair< first_type, second_type > result_type
Type returned by Get or passed in Set.
result_type Get() const
Get the stored value as a std::pair.
bool GetAccessor(T &value) const
Access the Pair value as type T.
std::invoke_result_t< decltype(&A::Get), A > first_type
Type of abscissa (first entry of pair).
std::pair< Ptr< A >, Ptr< B > > value_type
Type of value stored in the PairValue.
value_type m_value
The stored Pair instance.
std::string SerializeToString(Ptr< const AttributeChecker > checker) const override
void Set(const result_type &value)
Set the value.
std::invoke_result_t< decltype(&B::Get), B > second_type
Type of ordinal (second entry of pair).
bool DeserializeFromString(std::string value, Ptr< const AttributeChecker > checker) override
Ptr< AttributeValue > Copy() const override
Smart pointer class similar to boost::intrusive_ptr.
Hold variables of type string.
Internal checker class templated to each AttributeChecker for each entry in the pair.
Ptr< const AttributeChecker > m_secondchecker
The second checker.
Ptr< const AttributeChecker > m_firstchecker
The first checker.
void SetCheckers(Ptr< const AttributeChecker > firstchecker, Ptr< const AttributeChecker > secondchecker) override
Set the individual AttributeChecker for each pair entry.
ns3::PairChecker::checker_pair_type GetCheckers() const override
Get the pair of checkers for each pair entry.
PairChecker()
Default c'tor.
Ptr< const AttributeAccessor > MakePairAccessor(T1 a1)
Create an AttributeAccessor for std::pair<>.
Ptr< AttributeChecker > MakePairChecker()
Make a PairChecker without abscissa and ordinate AttributeCheckers.
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
ns3::StringValue attribute value declarations.