5 #include <vector> |
5 #include <vector> |
6 #include "ns3/node.h" |
6 #include "ns3/node.h" |
7 |
7 |
8 namespace ns3 { |
8 namespace ns3 { |
9 |
9 |
|
10 /** |
|
11 * \brief keep track of a set of node pointers. |
|
12 * |
|
13 */ |
10 class NodeContainer |
14 class NodeContainer |
11 { |
15 { |
12 public: |
16 public: |
13 typedef std::vector<Ptr<Node> >::const_iterator Iterator; |
17 typedef std::vector<Ptr<Node> >::const_iterator Iterator; |
14 |
18 |
|
19 /** |
|
20 * Create an empty NodeContainer. |
|
21 */ |
15 NodeContainer (); |
22 NodeContainer (); |
|
23 /** |
|
24 * \param node a node to add to the container |
|
25 * |
|
26 * Create a NodeContainer with exactly one node. |
|
27 */ |
16 NodeContainer (Ptr<Node> node); |
28 NodeContainer (Ptr<Node> node); |
|
29 /** |
|
30 * \param a a node container |
|
31 * \param b another node container |
|
32 * |
|
33 * Create a node container which is a concatenation of the two input |
|
34 * NodeContainers. |
|
35 */ |
17 NodeContainer (const NodeContainer &a, const NodeContainer &b); |
36 NodeContainer (const NodeContainer &a, const NodeContainer &b); |
18 |
37 |
|
38 /** |
|
39 * \returns an iterator to the start of the vector of node pointers. |
|
40 */ |
19 Iterator Begin (void) const; |
41 Iterator Begin (void) const; |
|
42 /** |
|
43 * \returns an iterator to the end of the vector of node pointers. |
|
44 */ |
20 Iterator End (void) const; |
45 Iterator End (void) const; |
21 |
46 |
|
47 /** |
|
48 * \returns the number of node pointers stored in this NodeContainer. |
|
49 */ |
22 uint32_t GetN (void) const; |
50 uint32_t GetN (void) const; |
|
51 /** |
|
52 * \param i the index of the requested node pointer. |
|
53 * \returns the requested node pointer. |
|
54 */ |
23 Ptr<Node> Get (uint32_t i) const; |
55 Ptr<Node> Get (uint32_t i) const; |
24 |
56 |
|
57 /** |
|
58 * \param n the number of nodes to create |
|
59 * |
|
60 * Create n nodes and append pointers to them to the end of this NodeContainer. |
|
61 */ |
25 void Create (uint32_t n); |
62 void Create (uint32_t n); |
|
63 /** |
|
64 * \param other another NodeContainer |
|
65 * |
|
66 * Append the node pointers from the input NodeContainer at the end |
|
67 * of this NodeContainer. |
|
68 */ |
26 void Add (NodeContainer other); |
69 void Add (NodeContainer other); |
|
70 /** |
|
71 * \param node a node pointer |
|
72 * |
|
73 * Append the input node pointer at the end of this NodeContainer. |
|
74 */ |
27 void Add (Ptr<Node> node); |
75 void Add (Ptr<Node> node); |
28 |
76 |
29 private: |
77 private: |
30 std::vector<Ptr<Node> > m_nodes; |
78 std::vector<Ptr<Node> > m_nodes; |
31 }; |
79 }; |