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 * 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 * Authors:
18 * Mathieu Lacage <mathieu.lacage@sophia.inria.fr>,
19 */
20#ifndef NODE_LIST_H
21#define NODE_LIST_H
22
23#include "ns3/ptr.h"
24
25#include <vector>
26
27namespace ns3
28{
29
30class Node;
31class CallbackBase;
32
33/**
34 * \ingroup network
35 *
36 * \brief the list of simulation nodes.
37 *
38 * Every Node created is automatically added to this list.
39 */
41{
42 public:
43 /// Node container iterator
44 typedef std::vector<Ptr<Node>>::const_iterator Iterator;
45
46 /**
47 * \param node node to add
48 * \returns index of node in list.
49 *
50 * This method is called automatically from Node::Node so
51 * the user has little reason to call it himself.
52 */
53 static uint32_t Add(Ptr<Node> node);
54 /**
55 * \returns a C++ iterator located at the beginning of this
56 * list.
57 */
58 static Iterator Begin();
59 /**
60 * \returns a C++ iterator located at the end of this
61 * list.
62 */
63 static Iterator End();
64 /**
65 * \param n index of requested node.
66 * \returns the Node associated to index n.
67 */
68 static Ptr<Node> GetNode(uint32_t n);
69 /**
70 * \returns the number of nodes currently in the list.
71 */
72 static uint32_t GetNNodes();
73};
74
75} // namespace ns3
76
77#endif /* NODE_LIST_H */
the list of simulation nodes.
Definition: node-list.h:41
static Iterator Begin()
Definition: node-list.cc:237
static uint32_t GetNNodes()
Definition: node-list.cc:258
static Ptr< Node > GetNode(uint32_t n)
Definition: node-list.cc:251
static uint32_t Add(Ptr< Node > node)
Definition: node-list.cc:230
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Definition: node-list.h:44
static Iterator End()
Definition: node-list.cc:244
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Every class exported by the ns3 library is enclosed in the ns3 namespace.