remove Node::Copy, Node::Create and Node::*Prototype* methods.

This commit is contained in:
Mathieu Lacage
2007-05-02 12:34:53 +02:00
parent 3b476dbd6c
commit c82b51d8da
6 changed files with 12 additions and 258 deletions

View File

@@ -99,90 +99,6 @@ void Node::Dispose()
m_devices.erase (m_devices.begin (), m_devices.end ());
}
Node::SmartNodeVec_t **
Node::GetNodeVector (void)
{
static SmartNodeVec_t *vector = 0;
if (vector == 0)
{
vector = new SmartNodeVec_t ();
Simulator::ScheduleDestroy (&Node::DestroyNodes);
}
return &vector;
}
Node::SmartNodeVec_t **
Node::GetPrototypeVector (void)
{
static SmartNodeVec_t *vector = 0;
if (vector == 0)
{
vector = new SmartNodeVec_t ();
Simulator::ScheduleDestroy (&Node::DestroyPrototypes);
}
return &vector;
}
void
Node::DestroyNodes (void)
{
SmartNodeVec_t **vector = GetNodeVector ();
delete *vector;
*vector = 0;
}
void
Node::DestroyPrototypes (void)
{
SmartNodeVec_t **vector = GetPrototypeVector ();
delete *vector;
*vector = 0;
}
// Node stack creation and management routines.
Node* Node::Create()
{
Node* n = (*GetPrototypeVector ())->Back()->Copy(); // Copy the top of the stack
(*GetNodeVector ())->Add (n);
NodeList::Add (n); // Add to global list of nodes
return n;
}
Node* Node::Create(uint32_t sid)
{ // Create with distributed simulation systemid
// ! Need to check if sid matches DistributedSimulator system id,
// and create an empty (ghost) node if so. Code this later
Node* n = Create(sid);
return n;
}
Node* Node::GetNodePrototype()
{ // Get node* to top of prototypes stack
return (*GetPrototypeVector ())->Back();
}
Node* Node::PushNodePrototype(const Node& n)
{ // Add a new node to the top of the prototypes stack
(*GetPrototypeVector ())->Add(n.Copy());
return (*GetPrototypeVector ())->Back();
}
Node* Node::PushNodePrototype()
{ // Replicate the top of the prototype stack
(*GetPrototypeVector ())->Add(GetNodePrototype()->Copy());
return (*GetPrototypeVector ())->Back();
}
void Node::PopNodePrototype()
{
if (!(*GetPrototypeVector ())->Empty()) (*GetPrototypeVector ())->Remove();
}
void Node::ClearAll()
{ // Delete all nodes for memory leak checking, including prototypes
(*GetNodeVector ())->Clear ();
(*GetPrototypeVector ())->Clear();
}
L3Demux*
Node::GetL3Demux() const
{