A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
attribute-default-iterator.cc
Go to the documentation of this file.
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation;
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14 *
15 * Authors: Faker Moatamri <faker.moatamri@sophia.inria.fr>
16 * Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
17 */
18
20
21#include "ns3/attribute.h"
22#include "ns3/callback.h"
23#include "ns3/global-value.h"
24#include "ns3/object-ptr-container.h"
25#include "ns3/pointer.h"
26#include "ns3/string.h"
27
28namespace ns3
29{
30
32{
33}
34
35void
37{
38 for (uint32_t i = 0; i < TypeId::GetRegisteredN(); i++)
39 {
42 {
43 continue;
44 }
45 bool calledStart = false;
46 for (uint32_t j = 0; j < tid.GetAttributeN(); j++)
47 {
49 if (!(info.flags & TypeId::ATTR_CONSTRUCT))
50 {
51 // we can't construct the attribute, so, there is no
52 // initial value for the attribute
53 continue;
54 }
55 // No accessor, go to next attribute
56 if (!info.accessor)
57 {
58 continue;
59 }
60 if (!info.accessor->HasSetter())
61 {
62 // skip this attribute it doesn't have an setter
63 continue;
64 }
65 if (!info.checker)
66 {
67 // skip, it doesn't have a checker
68 continue;
69 }
70 if (!info.initialValue)
71 {
72 // No value, check next attribute
73 continue;
74 }
76 DynamicCast<const ObjectPtrContainerValue>(info.initialValue);
77 if (vector)
78 {
79 // a vector value, won't take it
80 continue;
81 }
82 Ptr<const PointerValue> pointer = DynamicCast<const PointerValue>(info.initialValue);
83 if (pointer)
84 {
85 // pointer value, won't take it
86 continue;
87 }
88 Ptr<const CallbackValue> callback = DynamicCast<const CallbackValue>(info.initialValue);
89 if (callback)
90 {
91 // callback value, won't take it
92 continue;
93 }
94 // We take only values, no pointers or vectors or callbacks
95 if (!calledStart)
96 {
98 }
99 VisitAttribute(tid, info.name, info.initialValue->SerializeToString(info.checker), j);
100 calledStart = true;
101 }
102 if (calledStart)
103 {
105 }
106 }
107}
108
109void
111{
112}
113
114void
116{
117}
118
119void
120AttributeDefaultIterator::DoVisitAttribute(std::string name, std::string defaultValue)
121{
122}
123
124void
126 std::string name,
127 std::string defaultValue,
128 uint32_t index)
129{
130 DoVisitAttribute(name, defaultValue);
131}
132
133} // namespace ns3
virtual void VisitAttribute(TypeId tid, std::string name, std::string defaultValue, uint32_t index)
Visit an Attribute.
virtual void EndVisitTypeId()
End the analysis of a TypeId.
void Iterate()
This function will go through all the TypeIds and get only the attributes which are explicit values (...
virtual void DoVisitAttribute(std::string name, std::string defaultValue)
Visit an Attribute.
virtual void StartVisitTypeId(std::string name)
Begin the analysis of a TypeId.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
a unique identifier for an interface.
Definition: type-id.h:59
bool MustHideFromDocumentation() const
Check if this TypeId should not be listed in documentation.
Definition: type-id.cc:1093
@ ATTR_CONSTRUCT
The attribute can be written at construction-time.
Definition: type-id.h:66
static uint16_t GetRegisteredN()
Get the number of registered TypeIds.
Definition: type-id.cc:880
std::size_t GetAttributeN() const
Get the number of attributes.
Definition: type-id.cc:1101
static TypeId GetRegistered(uint16_t i)
Get a TypeId by index.
Definition: type-id.cc:887
TypeId::AttributeInformation GetAttribute(std::size_t i) const
Get Attribute information by index.
Definition: type-id.cc:1109
std::string GetName() const
Get the name.
Definition: type-id.cc:992
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Attribute implementation.
Definition: type-id.h:81
std::string name
Attribute name.
Definition: type-id.h:83
Ptr< const AttributeAccessor > accessor
Accessor object.
Definition: type-id.h:93
uint32_t flags
AttributeFlags value.
Definition: type-id.h:87
Ptr< const AttributeChecker > checker
Checker object.
Definition: type-id.h:95
Ptr< const AttributeValue > initialValue
Configured initial value.
Definition: type-id.h:91