A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
node-list.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors:
7 * Mathieu Lacage <mathieu.lacage@sophia.inria.fr>,
8 */
9#ifndef NODE_LIST_H
10#define NODE_LIST_H
11
12#include "ns3/ptr.h"
13
14#include <vector>
15
16namespace ns3
17{
18
19class Node;
20class CallbackBase;
21
22/**
23 * @ingroup network
24 *
25 * @brief the list of simulation nodes.
26 *
27 * Every Node created is automatically added to this list.
28 */
30{
31 public:
32 /// Node container iterator
33 typedef std::vector<Ptr<Node>>::const_iterator Iterator;
34
35 /**
36 * @param node node to add
37 * @returns index of node in list.
38 *
39 * This method is called automatically from Node::Node so
40 * the user has little reason to call it himself.
41 */
42 static uint32_t Add(Ptr<Node> node);
43 /**
44 * @returns a C++ iterator located at the beginning of this
45 * list.
46 */
47 static Iterator Begin();
48 /**
49 * @returns a C++ iterator located at the end of this
50 * list.
51 */
52 static Iterator End();
53 /**
54 * @param n index of requested node.
55 * @returns the Node associated to index n.
56 */
57 static Ptr<Node> GetNode(uint32_t n);
58 /**
59 * @returns the number of nodes currently in the list.
60 */
61 static uint32_t GetNNodes();
62};
63
64} // namespace ns3
65
66#endif /* NODE_LIST_H */
the list of simulation nodes.
Definition node-list.h:30
static Iterator Begin()
Definition node-list.cc:226
static uint32_t GetNNodes()
Definition node-list.cc:247
static Ptr< Node > GetNode(uint32_t n)
Definition node-list.cc:240
static uint32_t Add(Ptr< Node > node)
Definition node-list.cc:219
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Definition node-list.h:33
static Iterator End()
Definition node-list.cc:233
Smart pointer class similar to boost::intrusive_ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.