A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
attribute-construction-list.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Mathieu Lacage
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Mathieu Lacage <mathieu.lacage@gmail.com>
7 */
8#ifndef ATTRIBUTE_CONSTRUCTION_LIST_H
9#define ATTRIBUTE_CONSTRUCTION_LIST_H
10
11#include "attribute.h"
12
13#include <list>
14
15/**
16 * \file
17 * \ingroup object
18 * ns3::AttributeConstructionList declaration.
19 */
20
21namespace ns3
22{
23
24/**
25 * \ingroup object
26 * List of Attribute name, value and checker triples used
27 * to construct Objects.
28 */
30{
31 public:
32 /** A single Attribute triple */
33 struct Item
34 {
35 /** Checker used to validate serialized values. */
37 /** The value of the Attribute. */
39 /** The name of the Attribute. */
40 std::string name;
41 };
42
43 /** Iterator type. */
44 typedef std::list<Item>::const_iterator CIterator;
45
46 /** Constructor */
48
49 /**
50 * Add an Attribute to the list.
51 *
52 * \param [in] name The Attribute name.
53 * \param [in] checker The checker to use for this Attribute.
54 * \param [in] value The AttributeValue to add.
55 */
56 void Add(std::string name, Ptr<const AttributeChecker> checker, Ptr<AttributeValue> value);
57
58 /**
59 * Find an Attribute in the list from its AttributeChecker.
60 *
61 * \param [in] checker The AttributeChecker to find. Typically this is the
62 * AttributeChecker from TypeId::AttributeInformation.
63 * \returns The AttributeValue.
64 */
66
67 /** \returns The first item in the list */
68 CIterator Begin() const;
69 /** \returns The end of the list (iterator to one past the last). */
70 CIterator End() const;
71
72 private:
73 /** The list of Items */
74 std::list<Item> m_list;
75};
76
77} // namespace ns3
78
79#endif /* ATTRIBUTE_CONSTRUCTION_LIST_H */
ns3::AttributeValue, ns3::AttributeAccessor and ns3::AttributeChecker declarations.
List of Attribute name, value and checker triples used to construct Objects.
Ptr< AttributeValue > Find(Ptr< const AttributeChecker > checker) const
Find an Attribute in the list from its AttributeChecker.
void Add(std::string name, Ptr< const AttributeChecker > checker, Ptr< AttributeValue > value)
Add an Attribute to the list.
std::list< Item > m_list
The list of Items.
std::list< Item >::const_iterator CIterator
Iterator type.
Smart pointer class similar to boost::intrusive_ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::string name
The name of the Attribute.
Ptr< const AttributeChecker > checker
Checker used to validate serialized values.
Ptr< AttributeValue > value
The value of the Attribute.