A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
attribute-default-iterator.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* This program is free software; you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License version 2 as
5
* published by the Free Software Foundation;
6
*
7
* This program is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
* GNU General Public License for more details.
11
*
12
* You should have received a copy of the GNU General Public License
13
* along with this program; if not, write to the Free Software
14
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
*
16
* Authors: Faker Moatamri <faker.moatamri@sophia.inria.fr>
17
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18
*/
19
20
#include "
attribute-default-iterator.h
"
21
#include "ns3/attribute.h"
22
#include "ns3/pointer.h"
23
#include "ns3/callback.h"
24
#include "ns3/global-value.h"
25
#include "ns3/string.h"
26
#include "ns3/object-ptr-container.h"
27
28
namespace
ns3
29
{
30
31
AttributeDefaultIterator::~AttributeDefaultIterator
()
32
{
33
}
34
void
35
AttributeDefaultIterator::Iterate
(
void
)
36
{
37
for
(uint32_t i = 0; i <
TypeId::GetRegisteredN
(); i++)
38
{
39
TypeId
tid =
TypeId::GetRegistered
(i);
40
if
(tid.
MustHideFromDocumentation
())
41
{
42
continue
;
43
}
44
bool
calledStart =
false
;
45
for
(uint32_t j = 0; j < tid.
GetAttributeN
(); j++)
46
{
47
struct
TypeId::AttributeInformation
info = tid.
GetAttribute
(j);
48
if
(!(info.
flags
&
TypeId::ATTR_CONSTRUCT
))
49
{
50
// we can't construct the attribute, so, there is no
51
// initial value for the attribute
52
continue
;
53
}
54
//No accessor, go to next attribute
55
if
(info.
accessor
== 0)
56
{
57
continue
;
58
}
59
if
(!info.
accessor
->
HasSetter
())
60
{
61
//skip this attribute it doesn't have an setter
62
continue
;
63
}
64
if
(info.
checker
== 0)
65
{
66
//skip, it doesn't have a checker
67
continue
;
68
}
69
if
(info.
initialValue
== 0)
70
{
71
//No value, check next attribute
72
continue
;
73
}
74
Ptr<const ObjectPtrContainerValue>
vector = DynamicCast<const ObjectPtrContainerValue> (info.
initialValue
);
75
if
(vector != 0)
76
{
77
//a vector value, won't take it
78
continue
;
79
}
80
Ptr<const PointerValue>
pointer = DynamicCast<const PointerValue> (info.
initialValue
);
81
if
(pointer != 0)
82
{
83
//pointer value, won't take it
84
continue
;
85
}
86
Ptr<const CallbackValue>
callback = DynamicCast<const CallbackValue> (info.
initialValue
);
87
if
(callback != 0)
88
{
89
//callback value, won't take it
90
continue
;
91
}
92
//We take only values, no pointers or vectors or callbacks
93
if
(!calledStart)
94
{
95
StartVisitTypeId
(tid.
GetName
());
96
}
97
VisitAttribute
(tid, info.
name
, info.
initialValue
->
SerializeToString
(info.
checker
), j);
98
calledStart =
true
;
99
}
100
if
(calledStart)
101
{
102
EndVisitTypeId
();
103
}
104
}
105
}
106
107
void
108
AttributeDefaultIterator::StartVisitTypeId
(std::string name)
109
{
110
}
111
void
112
AttributeDefaultIterator::EndVisitTypeId
(
void
)
113
{
114
}
115
116
void
117
AttributeDefaultIterator::DoVisitAttribute
(std::string name, std::string defaultValue)
118
{
119
}
120
121
void
122
AttributeDefaultIterator::VisitAttribute
(
TypeId
tid, std::string name, std::string defaultValue, uint32_t index)
123
{
124
DoVisitAttribute
(name, defaultValue);
125
}
126
127
}
// namespace ns3
src
config-store
model
attribute-default-iterator.cc
Generated on Tue Oct 9 2012 16:45:33 for ns-3 by
1.8.1.2