author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Mon, 24 Mar 2008 10:41:44 -0700 | |
changeset 2699 | cbc8b1ae341d |
parent 2697 | cab2a59cba8f |
child 2756 | 672f1203a4d1 |
permissions | -rw-r--r-- |
2417
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1 |
#ifndef NODE_CONTAINER_H |
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
2 |
#define NODE_CONTAINER_H |
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
3 |
|
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
4 |
#include <stdint.h> |
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
5 |
#include <vector> |
2603
1308da4cb3bf
move helpers to their own dir.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2516
diff
changeset
|
6 |
#include "ns3/node.h" |
2417
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
|
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
8 |
namespace ns3 { |
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
|
2697 | 10 |
/** |
11 |
* \brief keep track of a set of node pointers. |
|
12 |
* |
|
13 |
*/ |
|
2417
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
14 |
class NodeContainer |
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
{ |
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
public: |
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
typedef std::vector<Ptr<Node> >::const_iterator Iterator; |
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
18 |
|
2697 | 19 |
/** |
20 |
* Create an empty NodeContainer. |
|
21 |
*/ |
|
2516
d189f25169ee
add extra NodeContainer constructors
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2417
diff
changeset
|
22 |
NodeContainer (); |
2697 | 23 |
/** |
24 |
* \param node a node to add to the container |
|
25 |
* |
|
26 |
* Create a NodeContainer with exactly one node. |
|
27 |
*/ |
|
2516
d189f25169ee
add extra NodeContainer constructors
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2417
diff
changeset
|
28 |
NodeContainer (Ptr<Node> node); |
2697 | 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 |
*/ |
|
2516
d189f25169ee
add extra NodeContainer constructors
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2417
diff
changeset
|
36 |
NodeContainer (const NodeContainer &a, const NodeContainer &b); |
d189f25169ee
add extra NodeContainer constructors
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2417
diff
changeset
|
37 |
|
2697 | 38 |
/** |
39 |
* \returns an iterator to the start of the vector of node pointers. |
|
40 |
*/ |
|
2417
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
41 |
Iterator Begin (void) const; |
2697 | 42 |
/** |
43 |
* \returns an iterator to the end of the vector of node pointers. |
|
44 |
*/ |
|
2417
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
45 |
Iterator End (void) const; |
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
46 |
|
2697 | 47 |
/** |
48 |
* \returns the number of node pointers stored in this NodeContainer. |
|
49 |
*/ |
|
2417
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
50 |
uint32_t GetN (void) const; |
2697 | 51 |
/** |
52 |
* \param i the index of the requested node pointer. |
|
53 |
* \returns the requested node pointer. |
|
54 |
*/ |
|
2417
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
55 |
Ptr<Node> Get (uint32_t i) const; |
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
56 |
|
2697 | 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 |
*/ |
|
2417
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
62 |
void Create (uint32_t n); |
2697 | 63 |
/** |
64 |
* \param other another NodeContainer |
|
65 |
* |
|
66 |
* Append the node pointers from the input NodeContainer at the end |
|
67 |
* of this NodeContainer. |
|
68 |
*/ |
|
2417
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
69 |
void Add (NodeContainer other); |
2697 | 70 |
/** |
71 |
* \param node a node pointer |
|
72 |
* |
|
73 |
* Append the input node pointer at the end of this NodeContainer. |
|
74 |
*/ |
|
2417
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
75 |
void Add (Ptr<Node> node); |
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
76 |
|
2699
cbc8b1ae341d
add NodeContainer::GetGlobal
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2697
diff
changeset
|
77 |
/** |
cbc8b1ae341d
add NodeContainer::GetGlobal
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2697
diff
changeset
|
78 |
* \returns a container which contains a list of _all_ nodes |
cbc8b1ae341d
add NodeContainer::GetGlobal
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2697
diff
changeset
|
79 |
* created through NodeContainer::Create and stored |
cbc8b1ae341d
add NodeContainer::GetGlobal
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2697
diff
changeset
|
80 |
* in ns3::NodeList. |
cbc8b1ae341d
add NodeContainer::GetGlobal
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2697
diff
changeset
|
81 |
*/ |
cbc8b1ae341d
add NodeContainer::GetGlobal
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2697
diff
changeset
|
82 |
static NodeContainer GetGlobal (void); |
cbc8b1ae341d
add NodeContainer::GetGlobal
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2697
diff
changeset
|
83 |
|
2417
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
84 |
private: |
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
85 |
std::vector<Ptr<Node> > m_nodes; |
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
86 |
}; |
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
87 |
|
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
88 |
} // namespace ns3 |
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
89 |
|
004ac83aca83
add device/node containers for helper API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
90 |
#endif /* NODE_CONTAINER_H */ |