From 4e5eab77e2eb3d62fcef17b699990f9d5bd7993e Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 24 Mar 2008 10:41:44 -0700 Subject: [PATCH] add NodeContainer::GetGlobal --- src/helper/node-container.cc | 12 ++++++++++++ src/helper/node-container.h | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/src/helper/node-container.cc b/src/helper/node-container.cc index a4b8237bc..2d9722016 100644 --- a/src/helper/node-container.cc +++ b/src/helper/node-container.cc @@ -1,4 +1,5 @@ #include "node-container.h" +#include "ns3/node-list.h" namespace ns3 { @@ -58,4 +59,15 @@ NodeContainer::Add (Ptr node) 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 diff --git a/src/helper/node-container.h b/src/helper/node-container.h index 677c2095e..1c99fe55d 100644 --- a/src/helper/node-container.h +++ b/src/helper/node-container.h @@ -74,6 +74,13 @@ public: */ void Add (Ptr 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 > m_nodes; };