add NodeContainer::GetGlobal

This commit is contained in:
Mathieu Lacage
2008-03-24 10:41:44 -07:00
parent 29f19e164e
commit 4e5eab77e2
2 changed files with 19 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
#include "node-container.h"
#include "ns3/node-list.h"
namespace ns3 {
@@ -58,4 +59,15 @@ NodeContainer::Add (Ptr<Node> 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

View File

@@ -74,6 +74,13 @@ public:
*/
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;
};