A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
attribute-default-iterator.cc
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-2.0-only
3 *
4 * Authors: Faker Moatamri <faker.moatamri@sophia.inria.fr>
5 * Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
6 */
7
9
10#include "ns3/attribute.h"
11#include "ns3/callback.h"
12#include "ns3/global-value.h"
13#include "ns3/object-ptr-container.h"
14#include "ns3/pointer.h"
15#include "ns3/string.h"
16
17namespace ns3
18{
19
23
24void
26{
27 for (uint32_t i = 0; i < TypeId::GetRegisteredN(); i++)
28 {
31 {
32 continue;
33 }
34 bool calledStart = false;
35 for (uint32_t j = 0; j < tid.GetAttributeN(); j++)
36 {
38 if (!(info.flags & TypeId::ATTR_CONSTRUCT))
39 {
40 // we can't construct the attribute, so, there is no
41 // initial value for the attribute
42 continue;
43 }
44 // No accessor, go to next attribute
45 if (!info.accessor)
46 {
47 continue;
48 }
49 if (!info.accessor->HasSetter())
50 {
51 // skip this attribute it doesn't have an setter
52 continue;
53 }
54 if (!info.checker)
55 {
56 // skip, it doesn't have a checker
57 continue;
58 }
59 if (!info.initialValue)
60 {
61 // No value, check next attribute
62 continue;
63 }
66 if (vector)
67 {
68 // a vector value, won't take it
69 continue;
70 }
72 if (pointer)
73 {
74 // pointer value, won't take it
75 continue;
76 }
78 if (callback)
79 {
80 // callback value, won't take it
81 continue;
82 }
83 // We take only values, no pointers or vectors or callbacks
84 if (!calledStart)
85 {
87 }
88 VisitAttribute(tid, info.name, info.initialValue->SerializeToString(info.checker), j);
89 calledStart = true;
90 }
91 if (calledStart)
92 {
94 }
95 }
96}
97
98void
102
103void
107
108void
109AttributeDefaultIterator::DoVisitAttribute(std::string name, std::string defaultValue)
110{
111}
112
113void
115 std::string name,
116 std::string defaultValue,
117 uint32_t index)
118{
119 DoVisitAttribute(name, defaultValue);
120}
121
122} // 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.
a unique identifier for an interface.
Definition type-id.h:48
bool MustHideFromDocumentation() const
Check if this TypeId should not be listed in documentation.
Definition type-id.cc:1162
@ ATTR_CONSTRUCT
The attribute can be written at construction-time.
Definition type-id.h:55
static uint16_t GetRegisteredN()
Get the number of registered TypeIds.
Definition type-id.cc:926
std::size_t GetAttributeN() const
Get the number of attributes.
Definition type-id.cc:1170
static TypeId GetRegistered(uint16_t i)
Get a TypeId by index.
Definition type-id.cc:933
TypeId::AttributeInformation GetAttribute(std::size_t i) const
Get Attribute information by index.
Definition type-id.cc:1178
std::string GetName() const
Get the name.
Definition type-id.cc:1061
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Definition ptr.h:580
Attribute implementation.
Definition type-id.h:70
std::string name
Attribute name.
Definition type-id.h:72
Ptr< const AttributeAccessor > accessor
Accessor object.
Definition type-id.h:82
uint32_t flags
AttributeFlags value.
Definition type-id.h:76
Ptr< const AttributeChecker > checker
Checker object.
Definition type-id.h:84
Ptr< const AttributeValue > initialValue
Configured initial value.
Definition type-id.h:80