A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
node-container.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008 INRIA
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
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18
*/
19
#ifndef NODE_CONTAINER_H
20
#define NODE_CONTAINER_H
21
22
#include "ns3/node.h"
23
24
#include <type_traits>
25
#include <vector>
26
27
namespace
ns3
28
{
29
39
class
NodeContainer
40
{
41
public
:
43
typedef
std::vector<Ptr<Node>>::const_iterator
Iterator
;
44
57
static
NodeContainer
GetGlobal
();
58
62
NodeContainer
();
63
70
NodeContainer
(
Ptr<Node>
node);
71
79
NodeContainer
(std::string nodeName);
80
95
explicit
NodeContainer
(uint32_t n, uint32_t systemId = 0);
96
113
template
<
typename
... Ts>
114
NodeContainer
(
const
NodeContainer
& nc, Ts&&...
args
);
115
135
Iterator
Begin
()
const
;
136
156
Iterator
End
()
const
;
157
178
uint32_t
GetN
()
const
;
179
201
Ptr<Node>
Get
(uint32_t i)
const
;
202
213
void
Create
(uint32_t n);
214
227
void
Create
(uint32_t n, uint32_t systemId);
228
235
void
Add
(
const
NodeContainer
& nc);
236
246
template
<
typename
... Ts>
247
void
Add
(
const
NodeContainer
& nc, Ts&&...
args
);
248
254
void
Add
(
Ptr<Node>
node);
255
262
void
Add
(std::string nodeName);
263
270
bool
Contains
(uint32_t
id
)
const
;
271
272
private
:
273
std::vector<Ptr<Node>>
m_nodes
;
274
};
275
276
}
// namespace ns3
277
279
// Implementation of the templates declared above
281
282
namespace
ns3
283
{
284
285
template
<
typename
... Ts>
286
NodeContainer::NodeContainer
(
const
NodeContainer
& nc, Ts&&...
args
)
287
{
288
static_assert(std::conjunction_v<std::is_convertible<Ts, NodeContainer>...>,
289
"Variable types are not convertible to NodeContainer"
);
290
291
Add
(nc, std::forward<Ts>(
args
)...);
292
}
293
294
template
<
typename
... Ts>
295
void
296
NodeContainer::Add
(
const
NodeContainer
& nc, Ts&&...
args
)
297
{
298
static_assert(std::conjunction_v<std::is_convertible<Ts, NodeContainer>...>,
299
"Variable types are not convertible to NodeContainer"
);
300
301
Add
(nc);
302
Add
(std::forward<Ts>(
args
)...);
303
}
304
305
}
// namespace ns3
306
307
#endif
/* NODE_CONTAINER_H */
ns3::NodeContainer
keep track of a set of node pointers.
Definition:
node-container.h:40
ns3::NodeContainer::End
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
Definition:
node-container.cc:66
ns3::NodeContainer::m_nodes
std::vector< Ptr< Node > > m_nodes
Nodes smart pointers.
Definition:
node-container.h:273
ns3::NodeContainer::GetN
uint32_t GetN() const
Get the number of Ptr<Node> stored in this container.
Definition:
node-container.cc:72
ns3::NodeContainer::GetGlobal
static NodeContainer GetGlobal()
Create a NodeContainer that contains a list of all nodes created through NodeContainer::Create() and ...
Definition:
node-container.cc:28
ns3::NodeContainer::Create
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Definition:
node-container.cc:84
ns3::NodeContainer::Contains
bool Contains(uint32_t id) const
Return true if container contains a Node with index id.
Definition:
node-container.cc:124
ns3::NodeContainer::Iterator
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Definition:
node-container.h:43
ns3::NodeContainer::Add
void Add(const NodeContainer &nc)
Append the contents of another NodeContainer to the end of this container.
Definition:
node-container.cc:102
ns3::NodeContainer::Begin
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
Definition:
node-container.cc:60
ns3::NodeContainer::NodeContainer
NodeContainer()
Create an empty NodeContainer.
Definition:
node-container.cc:38
ns3::NodeContainer::Get
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Definition:
node-container.cc:78
ns3::Ptr< Node >
check-style-clang-format.args
args
Definition:
check-style-clang-format.py:754
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
network
helper
node-container.h
Generated on Sun Mar 3 2024 17:11:05 for ns-3 by
1.9.1