A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
attribute-construction-list.cc
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
#include "
attribute-construction-list.h
"
20
21
#include "
log.h
"
22
29
namespace
ns3
30
{
31
32
NS_LOG_COMPONENT_DEFINE
(
"AttributeConstructionList"
);
33
34
AttributeConstructionList::AttributeConstructionList
()
35
{
36
NS_LOG_FUNCTION
(
this
);
37
}
38
39
void
40
AttributeConstructionList::Add
(std::string name,
41
Ptr<const AttributeChecker>
checker,
42
Ptr<AttributeValue>
value)
43
{
44
// get rid of any previous value stored in this
45
// vector of values.
46
NS_LOG_FUNCTION
(
this
<< name << checker << value);
47
48
for
(
auto
k
=
m_list
.begin();
k
!=
m_list
.end();
k
++)
49
{
50
if
(
k
->checker == checker)
51
{
52
m_list
.erase(
k
);
53
break
;
54
}
55
}
56
// store the new value.
57
Item
attr;
58
attr.
checker
= checker;
59
attr.
value
= value;
60
attr.
name
= name;
61
m_list
.push_back(attr);
62
}
63
64
Ptr<AttributeValue>
65
AttributeConstructionList::Find
(
Ptr<const AttributeChecker>
checker)
const
66
{
67
NS_LOG_FUNCTION
(
this
<< checker);
68
for
(
auto
k
=
m_list
.begin();
k
!=
m_list
.end();
k
++)
69
{
70
NS_LOG_DEBUG
(
"Found "
<<
k
->name <<
" "
<<
k
->checker <<
" "
<<
k
->value);
71
if
(
k
->checker == checker)
72
{
73
return
k
->value;
74
}
75
}
76
return
nullptr
;
77
}
78
79
AttributeConstructionList::CIterator
80
AttributeConstructionList::Begin
()
const
81
{
82
NS_LOG_FUNCTION
(
this
);
83
return
m_list
.begin();
84
}
85
86
AttributeConstructionList::CIterator
87
AttributeConstructionList::End
()
const
88
{
89
NS_LOG_FUNCTION
(
this
);
90
return
m_list
.end();
91
}
92
93
}
// namespace ns3
attribute-construction-list.h
ns3::AttributeConstructionList declaration.
ns3::AttributeConstructionList::Find
Ptr< AttributeValue > Find(Ptr< const AttributeChecker > checker) const
Find an Attribute in the list from its AttributeChecker.
Definition:
attribute-construction-list.cc:65
ns3::AttributeConstructionList::Begin
CIterator Begin() const
Definition:
attribute-construction-list.cc:80
ns3::AttributeConstructionList::End
CIterator End() const
Definition:
attribute-construction-list.cc:87
ns3::AttributeConstructionList::Add
void Add(std::string name, Ptr< const AttributeChecker > checker, Ptr< AttributeValue > value)
Add an Attribute to the list.
Definition:
attribute-construction-list.cc:40
ns3::AttributeConstructionList::m_list
std::list< Item > m_list
The list of Items.
Definition:
attribute-construction-list.h:85
ns3::AttributeConstructionList::AttributeConstructionList
AttributeConstructionList()
Constructor.
Definition:
attribute-construction-list.cc:34
ns3::AttributeConstructionList::CIterator
std::list< Item >::const_iterator CIterator
Iterator type.
Definition:
attribute-construction-list.h:55
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:202
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition:
log.h:268
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition:
log-macros-enabled.h:240
log.h
Debug message logging.
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
two-ray-to-three-gpp-ch-calibration.k
k
Definition:
two-ray-to-three-gpp-ch-calibration.py:534
ns3::AttributeConstructionList::Item
A single Attribute triple.
Definition:
attribute-construction-list.h:45
ns3::AttributeConstructionList::Item::name
std::string name
The name of the Attribute.
Definition:
attribute-construction-list.h:51
ns3::AttributeConstructionList::Item::checker
Ptr< const AttributeChecker > checker
Checker used to validate serialized values.
Definition:
attribute-construction-list.h:47
ns3::AttributeConstructionList::Item::value
Ptr< AttributeValue > value
The value of the Attribute.
Definition:
attribute-construction-list.h:49
src
core
model
attribute-construction-list.cc
Generated on Sun Mar 3 2024 17:10:55 for ns-3 by
1.9.1