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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Authors: Mathieu Lacage <mathieu.lacage@gmail.com>
18 */
19#ifndef ATTRIBUTE_CONSTRUCTION_LIST_H
20#define ATTRIBUTE_CONSTRUCTION_LIST_H
21
22#include "attribute.h"
23
24#include <list>
25
26/**
27 * \file
28 * \ingroup object
29 * ns3::AttributeConstructionList declaration.
30 */
31
32namespace ns3
33{
34
35/**
36 * \ingroup object
37 * List of Attribute name, value and checker triples used
38 * to construct Objects.
39 */
41{
42 public:
43 /** A single Attribute triple */
44 struct Item
45 {
46 /** Checker used to validate serialized values. */
48 /** The value of the Attribute. */
50 /** The name of the Attribute. */
51 std::string name;
52 };
53
54 /** Iterator type. */
55 typedef std::list<Item>::const_iterator CIterator;
56
57 /** Constructor */
59
60 /**
61 * Add an Attribute to the list.
62 *
63 * \param [in] name The Attribute name.
64 * \param [in] checker The checker to use for this Attribute.
65 * \param [in] value The AttributeValue to add.
66 */
67 void Add(std::string name, Ptr<const AttributeChecker> checker, Ptr<AttributeValue> value);
68
69 /**
70 * Find an Attribute in the list from its AttributeChecker.
71 *
72 * \param [in] checker The AttributeChecker to find. Typically this is the
73 * AttributeChecker from TypeId::AttributeInformation.
74 * \returns The AttributeValue.
75 */
77
78 /** \returns The first item in the list */
79 CIterator Begin() const;
80 /** \returns The end of the list (iterator to one past the last). */
81 CIterator End() const;
82
83 private:
84 /** The list of Items */
85 std::list<Item> m_list;
86};
87
88} // namespace ns3
89
90#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.
Definition: ptr.h:77
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.