A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
attribute-construction-list.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011 Mathieu Lacage
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Authors: Mathieu Lacage <mathieu.lacage@gmail.com>
7
*/
8
#include "
attribute-construction-list.h
"
9
10
#include "
log.h
"
11
12
/**
13
* \file
14
* \ingroup object
15
* ns3::AttributeConstructionList implementation.
16
*/
17
18
namespace
ns3
19
{
20
21
NS_LOG_COMPONENT_DEFINE
(
"AttributeConstructionList"
);
22
23
AttributeConstructionList::AttributeConstructionList
()
24
{
25
NS_LOG_FUNCTION
(
this
);
26
}
27
28
void
29
AttributeConstructionList::Add
(std::string name,
30
Ptr<const AttributeChecker>
checker,
31
Ptr<AttributeValue>
value)
32
{
33
// get rid of any previous value stored in this
34
// vector of values.
35
NS_LOG_FUNCTION
(
this
<< name << checker << value);
36
37
for
(
auto
k =
m_list
.begin(); k !=
m_list
.end(); k++)
38
{
39
if
(k->checker == checker)
40
{
41
m_list
.erase(k);
42
break
;
43
}
44
}
45
// store the new value.
46
Item
attr;
47
attr.
checker
= checker;
48
attr.
value
= value;
49
attr.
name
= name;
50
m_list
.push_back(attr);
51
}
52
53
Ptr<AttributeValue>
54
AttributeConstructionList::Find
(
Ptr<const AttributeChecker>
checker)
const
55
{
56
NS_LOG_FUNCTION
(
this
<< checker);
57
for
(
auto
k =
m_list
.begin(); k !=
m_list
.end(); k++)
58
{
59
NS_LOG_DEBUG
(
"Found "
<< k->name <<
" "
<< k->checker <<
" "
<< k->value);
60
if
(k->checker == checker)
61
{
62
return
k->value;
63
}
64
}
65
return
nullptr
;
66
}
67
68
AttributeConstructionList::CIterator
69
AttributeConstructionList::Begin
()
const
70
{
71
NS_LOG_FUNCTION
(
this
);
72
return
m_list
.begin();
73
}
74
75
AttributeConstructionList::CIterator
76
AttributeConstructionList::End
()
const
77
{
78
NS_LOG_FUNCTION
(
this
);
79
return
m_list
.end();
80
}
81
82
}
// 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:54
ns3::AttributeConstructionList::Begin
CIterator Begin() const
Definition
attribute-construction-list.cc:69
ns3::AttributeConstructionList::End
CIterator End() const
Definition
attribute-construction-list.cc:76
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:29
ns3::AttributeConstructionList::m_list
std::list< Item > m_list
The list of Items.
Definition
attribute-construction-list.h:74
ns3::AttributeConstructionList::AttributeConstructionList
AttributeConstructionList()
Constructor.
Definition
attribute-construction-list.cc:23
ns3::AttributeConstructionList::CIterator
std::list< Item >::const_iterator CIterator
Iterator type.
Definition
attribute-construction-list.h:44
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition
log.h:257
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:229
log.h
Debug message logging.
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:34
ns3::AttributeConstructionList::Item::name
std::string name
The name of the Attribute.
Definition
attribute-construction-list.h:40
ns3::AttributeConstructionList::Item::checker
Ptr< const AttributeChecker > checker
Checker used to validate serialized values.
Definition
attribute-construction-list.h:36
ns3::AttributeConstructionList::Item::value
Ptr< AttributeValue > value
The value of the Attribute.
Definition
attribute-construction-list.h:38
src
core
model
attribute-construction-list.cc
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0