22 #include "ns3/simulator.h"
23 #include "ns3/object-vector.h"
24 #include "ns3/config.h"
26 #include "ns3/assert.h"
27 #include "node-list.h"
40 static TypeId GetTypeId (
void);
45 NodeList::Iterator Begin (
void)
const;
46 NodeList::Iterator End (
void)
const;
48 uint32_t GetNNodes (
void);
55 static void Delete (
void);
56 std::vector<Ptr<Node> > m_nodes;
62 NodeListPriv::GetTypeId (
void)
66 .AddAttribute (
"NodeList",
"The list of all nodes created during the simulation.",
68 MakeObjectVectorAccessor (&NodeListPriv::m_nodes),
69 MakeObjectVectorChecker<Node> ())
75 NodeListPriv::Get (
void)
81 NodeListPriv::DoGet (
void)
84 static Ptr<NodeListPriv> ptr = 0;
87 ptr = CreateObject<NodeListPriv> ();
94 NodeListPriv::Delete (
void)
102 NodeListPriv::NodeListPriv ()
106 NodeListPriv::~NodeListPriv ()
114 for (std::vector<
Ptr<Node> >::iterator i = m_nodes.begin ();
115 i != m_nodes.end (); i++)
121 m_nodes.erase (m_nodes.begin (), m_nodes.end ());
130 uint32_t index = m_nodes.size ();
131 m_nodes.push_back (node);
137 NodeListPriv::Begin (
void)
const
140 return m_nodes.begin ();
143 NodeListPriv::End (
void)
const
146 return m_nodes.end ();
149 NodeListPriv::GetNNodes (
void)
152 return m_nodes.size ();
156 NodeListPriv::GetNode (uint32_t n)
160 " is out of range (only have " << m_nodes.size () <<
" nodes).");
177 return NodeListPriv::Get ()->Add (node);
183 return NodeListPriv::Get ()->Begin ();
189 return NodeListPriv::Get ()->End ();
195 return NodeListPriv::Get ()->GetNode (n);
201 return NodeListPriv::Get ()->GetNNodes ();
#define NS_LOG_FUNCTION(parameters)
static uint32_t GetNNodes(void)
static Ptr< Node > GetNode(uint32_t n)
#define NS_LOG_COMPONENT_DEFINE(name)
virtual void DoDispose(void)
void UnregisterRootNamespaceObject(Ptr< Object > obj)
#define NS_LOG_FUNCTION_NOARGS()
static Iterator End(void)
static uint32_t Add(Ptr< Node > node)
static void ScheduleWithContext(uint32_t context, Time const &time, MEM mem_ptr, OBJ obj)
private implementation detail of the NodeList API.
void RegisterRootNamespaceObject(Ptr< Object > obj)
#define NS_ASSERT_MSG(condition, message)
static Iterator Begin(void)
virtual void DoDispose(void)
static EventId ScheduleDestroy(MEM mem_ptr, OBJ obj)
a base class which provides memory management and object aggregation
contain a set of ns3::Object pointers.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)