add NodeContainer::GetGlobal
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 24 Mar 2008 10:41:44 -0700
changeset 2699 cbc8b1ae341d
parent 2698 4074ec514771
child 2700 c54fbae72e8f
add NodeContainer::GetGlobal
src/helper/node-container.cc
src/helper/node-container.h
--- a/src/helper/node-container.cc	Mon Mar 24 10:14:35 2008 -0700
+++ b/src/helper/node-container.cc	Mon Mar 24 10:41:44 2008 -0700
@@ -1,4 +1,5 @@
 #include "node-container.h"
+#include "ns3/node-list.h"
 
 namespace ns3 {
 
@@ -58,4 +59,15 @@
   m_nodes.push_back (node);
 }
 
+NodeContainer 
+NodeContainer::GetGlobal (void)
+{
+  NodeContainer c;
+  for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i)
+    {
+      c.Add (*i);
+    }
+  return c;
+}
+
 } // namespace ns3
--- a/src/helper/node-container.h	Mon Mar 24 10:14:35 2008 -0700
+++ b/src/helper/node-container.h	Mon Mar 24 10:41:44 2008 -0700
@@ -74,6 +74,13 @@
    */
   void Add (Ptr<Node> node);
 
+  /**
+   * \returns a container which contains a list of _all_ nodes
+   *          created through NodeContainer::Create and stored
+   *          in ns3::NodeList.
+   */
+  static NodeContainer GetGlobal (void);
+
  private:
   std::vector<Ptr<Node> > m_nodes;
 };