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-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
23
namespace
ns3 {
24
25
NS_LOG_COMPONENT_DEFINE
(
"AttributeConstructionList"
);
26
27
AttributeConstructionList::AttributeConstructionList
()
28
{}
29
30
void
31
AttributeConstructionList::Add
(std::string name,
Ptr<const AttributeChecker>
checker,
Ptr<AttributeValue>
value)
32
{
33
// get rid of any previous value stored in this
34
// vector of values.
35
for
(std::list<struct Item>::iterator k =
m_list
.begin (); k !=
m_list
.end (); k++)
36
{
37
if
(k->checker == checker)
38
{
39
m_list
.erase (k);
40
break
;
41
}
42
}
43
// store the new value.
44
struct
Item
attr;
45
attr.
checker
= checker;
46
attr.
value
= value;
47
attr.
name
= name;
48
m_list
.push_back (attr);
49
50
}
51
Ptr<AttributeValue>
52
AttributeConstructionList::Find
(
Ptr<const AttributeChecker>
checker)
const
53
{
54
NS_LOG_FUNCTION
(checker);
55
for
(
CIterator
k =
m_list
.begin (); k !=
m_list
.end (); k++)
56
{
57
NS_LOG_DEBUG
(
"Found "
<< k->name <<
" "
<< k->checker <<
" "
<< k->value);
58
if
(k->checker == checker)
59
{
60
return
k->value;
61
}
62
}
63
return
0;
64
}
65
66
AttributeConstructionList::CIterator
67
AttributeConstructionList::Begin
(
void
)
const
68
{
69
return
m_list
.begin();
70
}
71
AttributeConstructionList::CIterator
72
AttributeConstructionList::End
(
void
)
const
73
{
74
return
m_list
.end();
75
}
76
77
}
// namespace ns3
src
core
model
attribute-construction-list.cc
Generated on Tue Oct 9 2012 16:45:34 for ns-3 by
1.8.1.2