A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
attribute-construction-list.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2011 Mathieu Lacage
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Authors: Mathieu Lacage <mathieu.lacage@gmail.com>
19
*/
20
#include "
attribute-construction-list.h
"
21
#include "
log.h
"
22
29
namespace
ns3
{
30
31
NS_LOG_COMPONENT_DEFINE
(
"AttributeConstructionList"
);
32
33
AttributeConstructionList::AttributeConstructionList
()
34
{
35
NS_LOG_FUNCTION
(
this
);
36
}
37
38
void
39
AttributeConstructionList::Add
(std::string name,
Ptr<const AttributeChecker>
checker,
Ptr<AttributeValue>
value)
40
{
41
// get rid of any previous value stored in this
42
// vector of values.
43
NS_LOG_FUNCTION
(
this
<< name << checker << value);
44
45
for
(std::list<struct Item>::iterator
k
=
m_list
.begin ();
k
!=
m_list
.end ();
k
++)
46
{
47
if
(
k
->checker == checker)
48
{
49
m_list
.erase (
k
);
50
break
;
51
}
52
}
53
// store the new value.
54
struct
Item
attr;
55
attr.
checker
= checker;
56
attr.
value
= value;
57
attr.
name
= name;
58
m_list
.push_back (attr);
59
60
}
61
Ptr<AttributeValue>
62
AttributeConstructionList::Find
(
Ptr<const AttributeChecker>
checker)
const
63
{
64
NS_LOG_FUNCTION
(
this
<< checker);
65
for
(
CIterator
k
=
m_list
.begin ();
k
!=
m_list
.end ();
k
++)
66
{
67
NS_LOG_DEBUG
(
"Found "
<<
k
->name <<
" "
<<
k
->checker <<
" "
<<
k
->value);
68
if
(
k
->checker == checker)
69
{
70
return
k
->value;
71
}
72
}
73
return
0;
74
}
75
76
AttributeConstructionList::CIterator
77
AttributeConstructionList::Begin
(
void
)
const
78
{
79
NS_LOG_FUNCTION
(
this
);
80
return
m_list
.begin ();
81
}
82
AttributeConstructionList::CIterator
83
AttributeConstructionList::End
(
void
)
const
84
{
85
NS_LOG_FUNCTION
(
this
);
86
return
m_list
.end ();
87
}
88
89
}
// 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:62
ns3::AttributeConstructionList::End
CIterator End(void) const
Definition:
attribute-construction-list.cc:83
ns3::AttributeConstructionList::m_list
std::list< struct Item > m_list
The list of Items.
Definition:
attribute-construction-list.h:85
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:39
ns3::AttributeConstructionList::Begin
CIterator Begin(void) const
Definition:
attribute-construction-list.cc:77
ns3::AttributeConstructionList::CIterator
std::list< struct Item >::const_iterator CIterator
Iterator type.
Definition:
attribute-construction-list.h:53
ns3::AttributeConstructionList::AttributeConstructionList
AttributeConstructionList()
Constructor.
Definition:
attribute-construction-list.cc:33
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:74
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:205
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition:
log.h:273
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:244
log.h
Debug message logging.
bianchi11ax.k
int k
Definition:
bianchi11ax.py:129
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::AttributeConstructionList::Item
A single Attribute triple.
Definition:
attribute-construction-list.h:44
ns3::AttributeConstructionList::Item::name
std::string name
The name of the Attribute.
Definition:
attribute-construction-list.h:50
ns3::AttributeConstructionList::Item::checker
Ptr< const AttributeChecker > checker
Checker used to validate serialized values.
Definition:
attribute-construction-list.h:46
ns3::AttributeConstructionList::Item::value
Ptr< AttributeValue > value
The value of the Attribute.
Definition:
attribute-construction-list.h:48
src
core
model
attribute-construction-list.cc
Generated on Tue Feb 6 2024 19:21:16 for ns-3 by
1.9.1