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
28
AttributeConstructionList::AttributeConstructionList
()
29
{
30
NS_LOG_FUNCTION
(
this
);
31
}
32
33
void
34
AttributeConstructionList::Add
(std::string name,
Ptr<const AttributeChecker>
checker,
Ptr<AttributeValue>
value)
35
{
36
// get rid of any previous value stored in this
37
// vector of values.
38
NS_LOG_FUNCTION
(
this
<< name << checker << value);
39
40
for
(std::list<struct Item>::iterator k =
m_list
.begin (); k !=
m_list
.end (); k++)
41
{
42
if
(k->checker == checker)
43
{
44
m_list
.erase (k);
45
break
;
46
}
47
}
48
// store the new value.
49
struct
Item
attr;
50
attr.
checker
= checker;
51
attr.
value
= value;
52
attr.
name
= name;
53
m_list
.push_back (attr);
54
55
}
56
Ptr<AttributeValue>
57
AttributeConstructionList::Find
(
Ptr<const AttributeChecker>
checker)
const
58
{
59
NS_LOG_FUNCTION
(
this
<< checker);
60
for
(
CIterator
k =
m_list
.begin (); k !=
m_list
.end (); k++)
61
{
62
NS_LOG_DEBUG
(
"Found "
<< k->name <<
" "
<< k->checker <<
" "
<< k->value);
63
if
(k->checker == checker)
64
{
65
return
k->value;
66
}
67
}
68
return
0;
69
}
70
71
AttributeConstructionList::CIterator
72
AttributeConstructionList::Begin
(
void
)
const
73
{
74
NS_LOG_FUNCTION
(
this
);
75
return
m_list
.begin();
76
}
77
AttributeConstructionList::CIterator
78
AttributeConstructionList::End
(
void
)
const
79
{
80
NS_LOG_FUNCTION
(
this
);
81
return
m_list
.end();
82
}
83
84
}
// namespace ns3
ns3::AttributeConstructionList::AttributeConstructionList
AttributeConstructionList()
Definition:
attribute-construction-list.cc:28
ns3::Ptr
smart pointer class similar to boost::intrusive_ptr
Definition:
ptr.h:59
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
Definition:
log.h:345
ns3::NS_LOG_COMPONENT_DEFINE
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
ns3::AttributeConstructionList::End
CIterator End(void) const
Definition:
attribute-construction-list.cc:78
ns3::AttributeConstructionList::Item::checker
Ptr< const AttributeChecker > checker
Definition:
attribute-construction-list.h:33
ns3::AttributeConstructionList::Item::value
Ptr< AttributeValue > value
Definition:
attribute-construction-list.h:34
ns3::AttributeConstructionList::Find
Ptr< AttributeValue > Find(Ptr< const AttributeChecker > checker) const
Definition:
attribute-construction-list.cc:57
attribute-construction-list.h
ns3::AttributeConstructionList::Begin
CIterator Begin(void) const
Definition:
attribute-construction-list.cc:72
ns3::AttributeConstructionList::m_list
std::list< struct Item > m_list
Definition:
attribute-construction-list.h:45
ns3::AttributeConstructionList::Item
Definition:
attribute-construction-list.h:31
ns3::AttributeConstructionList::CIterator
std::list< struct Item >::const_iterator CIterator
Definition:
attribute-construction-list.h:37
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Definition:
log.h:289
log.h
ns3::AttributeConstructionList::Add
void Add(std::string name, Ptr< const AttributeChecker > checker, Ptr< AttributeValue > value)
Definition:
attribute-construction-list.cc:34
ns3::AttributeConstructionList::Item::name
std::string name
Definition:
attribute-construction-list.h:35
src
core
model
attribute-construction-list.cc
Generated on Sat Apr 19 2014 14:06:51 for ns-3 by
1.8.6