add device/node containers for helper API.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/net-device-container.cc Thu Feb 14 23:56:21 2008 +0100
@@ -0,0 +1,40 @@
+#include "net-device-container.h"
+
+namespace ns3 {
+
+NetDeviceContainer::Iterator
+NetDeviceContainer::Begin (void) const
+{
+ return m_nodes.begin ();
+}
+NetDeviceContainer::Iterator
+NetDeviceContainer::End (void) const
+{
+ return m_nodes.end ();
+}
+
+uint32_t
+NetDeviceContainer::GetN (void) const
+{
+ return m_nodes.size ();
+}
+Ptr<NetDevice>
+NetDeviceContainer::Get (uint32_t i) const
+{
+ return m_nodes[i];
+}
+void
+NetDeviceContainer::Add (NetDeviceContainer other)
+{
+ for (Iterator i = other.Begin (); i != other.End (); i++)
+ {
+ m_nodes.push_back (*i);
+ }
+}
+void
+NetDeviceContainer::Add (Ptr<NetDevice> node)
+{
+ m_nodes.push_back (node);
+}
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/net-device-container.h Thu Feb 14 23:56:21 2008 +0100
@@ -0,0 +1,31 @@
+#ifndef NET_DEVICE_CONTAINER_H
+#define NET_DEVICE_CONTAINER_H
+
+#include <stdint.h>
+#include <vector>
+#include "net-device.h"
+
+namespace ns3 {
+
+class NetDeviceContainer
+{
+public:
+ typedef std::vector<Ptr<NetDevice> >::const_iterator Iterator;
+
+ Iterator Begin (void) const;
+ Iterator End (void) const;
+
+ uint32_t GetN (void) const;
+ Ptr<NetDevice> Get (uint32_t i) const;
+
+ void Create (uint32_t n);
+ void Add (NetDeviceContainer other);
+ void Add (Ptr<NetDevice> node);
+
+private:
+ std::vector<Ptr<NetDevice> > m_nodes;
+};
+
+} // namespace ns3
+
+#endif /* NET_DEVICE_CONTAINER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/node-container.cc Thu Feb 14 23:56:21 2008 +0100
@@ -0,0 +1,48 @@
+#include "node-container.h"
+
+namespace ns3 {
+
+NodeContainer::Iterator
+NodeContainer::Begin (void) const
+{
+ return m_nodes.begin ();
+}
+NodeContainer::Iterator
+NodeContainer::End (void) const
+{
+ return m_nodes.end ();
+}
+
+uint32_t
+NodeContainer::GetN (void) const
+{
+ return m_nodes.size ();
+}
+Ptr<Node>
+NodeContainer::Get (uint32_t i) const
+{
+ return m_nodes[i];
+}
+void
+NodeContainer::Create (uint32_t n)
+{
+ for (uint32_t i = 0; i < n; i++)
+ {
+ m_nodes.push_back (CreateObject<Node> ());
+ }
+}
+void
+NodeContainer::Add (NodeContainer other)
+{
+ for (Iterator i = other.Begin (); i != other.End (); i++)
+ {
+ m_nodes.push_back (*i);
+ }
+}
+void
+NodeContainer::Add (Ptr<Node> node)
+{
+ m_nodes.push_back (node);
+}
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/node-container.h Thu Feb 14 23:56:21 2008 +0100
@@ -0,0 +1,31 @@
+#ifndef NODE_CONTAINER_H
+#define NODE_CONTAINER_H
+
+#include <stdint.h>
+#include <vector>
+#include "node.h"
+
+namespace ns3 {
+
+class NodeContainer
+{
+public:
+ typedef std::vector<Ptr<Node> >::const_iterator Iterator;
+
+ Iterator Begin (void) const;
+ Iterator End (void) const;
+
+ uint32_t GetN (void) const;
+ Ptr<Node> Get (uint32_t i) const;
+
+ void Create (uint32_t n);
+ void Add (NodeContainer other);
+ void Add (Ptr<Node> node);
+
+ private:
+ std::vector<Ptr<Node> > m_nodes;
+};
+
+} // namespace ns3
+
+#endif /* NODE_CONTAINER_H */