rename Node to INode
This commit is contained in:
@@ -34,7 +34,7 @@ namespace ns3 {
|
||||
// Application Methods
|
||||
|
||||
// \brief Application Constructor
|
||||
Application::Application(Ptr<Node> n)
|
||||
Application::Application(Ptr<INode> n)
|
||||
: m_node (n)
|
||||
{
|
||||
m_node->AddApplication (this);
|
||||
@@ -77,7 +77,7 @@ void Application::Stop(const RandomVariable& stopVar)
|
||||
delete v;
|
||||
}
|
||||
|
||||
Ptr<Node> Application::GetNode() const
|
||||
Ptr<INode> Application::GetINode() const
|
||||
{
|
||||
return m_node;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class Node;
|
||||
class INode;
|
||||
class RandomVariable;
|
||||
|
||||
/**
|
||||
@@ -52,7 +52,7 @@ class RandomVariable;
|
||||
class Application : public Object
|
||||
{
|
||||
public:
|
||||
Application(Ptr<Node>);
|
||||
Application(Ptr<INode>);
|
||||
virtual ~Application();
|
||||
|
||||
/**
|
||||
@@ -98,9 +98,9 @@ public:
|
||||
void Stop(const RandomVariable& stopVariable);
|
||||
|
||||
/**
|
||||
* \returns the Node to which this Application object is attached.
|
||||
* \returns the INode to which this Application object is attached.
|
||||
*/
|
||||
Ptr<Node> GetNode() const;
|
||||
Ptr<INode> GetINode() const;
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -128,7 +128,7 @@ private:
|
||||
|
||||
EventId m_startEvent;
|
||||
EventId m_stopEvent;
|
||||
Ptr<Node> m_node;
|
||||
Ptr<INode> m_node;
|
||||
};
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
// Author: George F. Riley<riley@ece.gatech.edu>
|
||||
//
|
||||
|
||||
// Implement the basic Node object for ns3.
|
||||
// Implement the basic INode object for ns3.
|
||||
// George F. Riley, Georgia Tech, Fall 2006
|
||||
|
||||
#include "i-node.h"
|
||||
@@ -30,47 +30,47 @@
|
||||
|
||||
namespace ns3{
|
||||
|
||||
const InterfaceId Node::iid ("Node");
|
||||
const InterfaceId INode::iid ("INode");
|
||||
|
||||
Node::Node()
|
||||
: Interface (Node::iid),
|
||||
INode::INode()
|
||||
: Interface (INode::iid),
|
||||
m_id(0),
|
||||
m_sid(0)
|
||||
{
|
||||
m_id = NodeList::Add (this);
|
||||
}
|
||||
|
||||
Node::Node(uint32_t sid)
|
||||
: Interface (Node::iid),
|
||||
INode::INode(uint32_t sid)
|
||||
: Interface (INode::iid),
|
||||
m_id(0),
|
||||
m_sid(sid)
|
||||
{
|
||||
m_id = NodeList::Add (this);
|
||||
}
|
||||
|
||||
Node::~Node ()
|
||||
INode::~INode ()
|
||||
{}
|
||||
|
||||
TraceResolver *
|
||||
Node::CreateTraceResolver (TraceContext const &context)
|
||||
INode::CreateTraceResolver (TraceContext const &context)
|
||||
{
|
||||
return DoCreateTraceResolver (context);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Node::GetId (void) const
|
||||
INode::GetId (void) const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Node::GetSystemId (void) const
|
||||
INode::GetSystemId (void) const
|
||||
{
|
||||
return m_sid;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Node::AddDevice (Ptr<NetDevice> device)
|
||||
INode::AddDevice (Ptr<NetDevice> device)
|
||||
{
|
||||
uint32_t index = m_devices.size ();
|
||||
m_devices.push_back (device);
|
||||
@@ -79,36 +79,36 @@ Node::AddDevice (Ptr<NetDevice> device)
|
||||
return index;
|
||||
}
|
||||
Ptr<NetDevice>
|
||||
Node::GetDevice (uint32_t index) const
|
||||
INode::GetDevice (uint32_t index) const
|
||||
{
|
||||
return m_devices[index];
|
||||
}
|
||||
uint32_t
|
||||
Node::GetNDevices (void) const
|
||||
INode::GetNDevices (void) const
|
||||
{
|
||||
return m_devices.size ();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Node::AddApplication (Ptr<Application> application)
|
||||
INode::AddApplication (Ptr<Application> application)
|
||||
{
|
||||
uint32_t index = m_applications.size ();
|
||||
m_applications.push_back (application);
|
||||
return index;
|
||||
}
|
||||
Ptr<Application>
|
||||
Node::GetApplication (uint32_t index) const
|
||||
INode::GetApplication (uint32_t index) const
|
||||
{
|
||||
return m_applications[index];
|
||||
}
|
||||
uint32_t
|
||||
Node::GetNApplications (void) const
|
||||
INode::GetNApplications (void) const
|
||||
{
|
||||
return m_applications.size ();
|
||||
}
|
||||
|
||||
|
||||
void Node::DoDispose()
|
||||
void INode::DoDispose()
|
||||
{
|
||||
for (std::vector<Ptr<NetDevice> >::iterator i = m_devices.begin ();
|
||||
i != m_devices.end (); i++)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
// Author: George F. Riley<riley@ece.gatech.edu>
|
||||
//
|
||||
|
||||
// Define the basic Node object for ns3.
|
||||
// Define the basic INode object for ns3.
|
||||
// George F. Riley, Georgia Tech, Fall 2006
|
||||
|
||||
#ifndef I_NODE_H
|
||||
@@ -37,35 +37,35 @@ class NetDevice;
|
||||
class Application;
|
||||
|
||||
/**
|
||||
* \brief A network Node.
|
||||
* \brief A network INode.
|
||||
*
|
||||
* This class holds together:
|
||||
* - a list of NetDevice objects which represent the network interfaces
|
||||
* of this node which are connected to other Node instances through
|
||||
* of this node which are connected to other INode instances through
|
||||
* Channel instances.
|
||||
* - a list of Application objects which represent the userspace
|
||||
* traffic generation applications which interact with the Node
|
||||
* traffic generation applications which interact with the INode
|
||||
* through the Socket API.
|
||||
* - a node Id: a unique per-node identifier.
|
||||
* - a system Id: a unique Id used for parallel simulations.
|
||||
* - a trace resolver which can be used to connect user trace sinks
|
||||
* to the node's trace sources.
|
||||
*
|
||||
* Every Node created is added to the NodeList automatically.
|
||||
* Every INode created is added to the NodeList automatically.
|
||||
*/
|
||||
class Node : public Interface
|
||||
class INode : public Interface
|
||||
{
|
||||
public:
|
||||
static const InterfaceId iid;
|
||||
|
||||
virtual ~Node();
|
||||
virtual ~INode();
|
||||
|
||||
/**
|
||||
* \param context the trace context for the TraceResolver to create
|
||||
* \returns a newly-created TraceResolver. The caller takes
|
||||
* ownership of the returned pointer.
|
||||
*
|
||||
* Request the Node to create a trace resolver. This method
|
||||
* Request the INode to create a trace resolver. This method
|
||||
* could be used directly by a user who needs access to very low-level
|
||||
* trace configuration.
|
||||
*/
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
/**
|
||||
* \returns the unique id of this node.
|
||||
*
|
||||
* This unique id happens to be also the index of the Node into
|
||||
* This unique id happens to be also the index of the INode into
|
||||
* the NodeList.
|
||||
*/
|
||||
uint32_t GetId (void) const;
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
|
||||
/**
|
||||
* \param device NetDevice to associate to this node.
|
||||
* \returns the index of the NetDevice into the Node's list of
|
||||
* \returns the index of the NetDevice into the INode's list of
|
||||
* NetDevice.
|
||||
*
|
||||
* Associate this device to this node.
|
||||
@@ -97,21 +97,21 @@ public:
|
||||
uint32_t AddDevice (Ptr<NetDevice> device);
|
||||
/**
|
||||
* \param index the index of the requested NetDevice
|
||||
* \returns the requested NetDevice associated to this Node.
|
||||
* \returns the requested NetDevice associated to this INode.
|
||||
*/
|
||||
Ptr<NetDevice> GetDevice (uint32_t index) const;
|
||||
/**
|
||||
* \returns the number of NetDevice instances associated
|
||||
* to this Node.
|
||||
* to this INode.
|
||||
*/
|
||||
uint32_t GetNDevices (void) const;
|
||||
|
||||
/**
|
||||
* \param application Application to associate to this node.
|
||||
* \returns the index of the Application within the Node's list
|
||||
* \returns the index of the Application within the INode's list
|
||||
* of Application.
|
||||
*
|
||||
* Associated this Application to this Node. This method is called
|
||||
* Associated this Application to this INode. This method is called
|
||||
* automatically from Application::Application so the user
|
||||
* has little reasons to call this method directly.
|
||||
*/
|
||||
@@ -119,11 +119,11 @@ public:
|
||||
/**
|
||||
* \param index
|
||||
* \returns the application associated to this requested index
|
||||
* within this Node.
|
||||
* within this INode.
|
||||
*/
|
||||
Ptr<Application> GetApplication (uint32_t index) const;
|
||||
/**
|
||||
* \returns the number of applications associated to this Node.
|
||||
* \returns the number of applications associated to this INode.
|
||||
*/
|
||||
uint32_t GetNApplications (void) const;
|
||||
|
||||
@@ -131,16 +131,16 @@ protected:
|
||||
/**
|
||||
* Must be invoked by subclasses only.
|
||||
*/
|
||||
Node();
|
||||
INode();
|
||||
/**
|
||||
* \param systemId a unique integer used for parallel simulations.
|
||||
*
|
||||
* Must be invoked by subclasses only.
|
||||
*/
|
||||
Node(uint32_t systemId);
|
||||
INode(uint32_t systemId);
|
||||
/**
|
||||
* The dispose method. Subclasses must override this method
|
||||
* and must chain up to it by calling Node::DoDispose at the
|
||||
* and must chain up to it by calling INode::DoDispose at the
|
||||
* end of their own DoDispose method.
|
||||
*/
|
||||
virtual void DoDispose (void);
|
||||
@@ -153,16 +153,16 @@ private:
|
||||
*/
|
||||
virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context) = 0;
|
||||
/**
|
||||
* \param device the device added to this Node.
|
||||
* \param device the device added to this INode.
|
||||
*
|
||||
* This method is invoked whenever a user calls Node::AddDevice.
|
||||
* This method is invoked whenever a user calls INode::AddDevice.
|
||||
* Subclasses are expected to call NetDevice::SetReceiveCallback
|
||||
* at this point to setup the node's receive function for
|
||||
* the NetDevice packets.
|
||||
*/
|
||||
virtual void DoAddDevice (Ptr<NetDevice> device) const = 0;
|
||||
|
||||
uint32_t m_id; // Node id for this node
|
||||
uint32_t m_id; // INode id for this node
|
||||
uint32_t m_sid; // System id for this node
|
||||
std::vector<Ptr<NetDevice> > m_devices;
|
||||
std::vector<Ptr<Application> > m_applications;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace ns3 {
|
||||
|
||||
const InterfaceId NetDevice::iid ("NetDevice");
|
||||
|
||||
NetDevice::NetDevice(Ptr<Node> node, const MacAddress& addr) :
|
||||
NetDevice::NetDevice(Ptr<INode> node, const MacAddress& addr) :
|
||||
Interface (NetDevice::iid),
|
||||
m_node (node),
|
||||
m_name(""),
|
||||
@@ -229,8 +229,8 @@ NetDevice::NotifyLinkDown (void)
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<Node>
|
||||
NetDevice::GetNode (void) const
|
||||
Ptr<INode>
|
||||
NetDevice::GetINode (void) const
|
||||
{
|
||||
return m_node;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class Node;
|
||||
class INode;
|
||||
class TraceResolver;
|
||||
class TraceContext;
|
||||
class Channel;
|
||||
@@ -166,7 +166,7 @@ public:
|
||||
* base class to print the nodeid for example, it can invoke
|
||||
* this method.
|
||||
*/
|
||||
Ptr<Node> GetNode (void) const;
|
||||
Ptr<INode> GetINode (void) const;
|
||||
|
||||
/**
|
||||
* \returns true if ARP is needed, false otherwise.
|
||||
@@ -187,7 +187,7 @@ public:
|
||||
* \param node base class node pointer of device's node
|
||||
* \param addr MAC address of this device.
|
||||
*/
|
||||
NetDevice(Ptr<Node> node, const MacAddress& addr);
|
||||
NetDevice(Ptr<INode> node, const MacAddress& addr);
|
||||
/**
|
||||
* Enable broadcast support. This method should be
|
||||
* called by subclasses from their constructor
|
||||
@@ -279,7 +279,7 @@ public:
|
||||
*/
|
||||
virtual Ptr<Channel> DoGetChannel (void) const = 0;
|
||||
|
||||
Ptr<Node> m_node;
|
||||
Ptr<INode> m_node;
|
||||
std::string m_name;
|
||||
uint16_t m_ifIndex;
|
||||
MacAddress m_address;
|
||||
|
||||
@@ -49,26 +49,26 @@ public:
|
||||
NodeListPriv ();
|
||||
~NodeListPriv ();
|
||||
|
||||
uint32_t Add (Ptr<Node> node);
|
||||
uint32_t Add (Ptr<INode> node);
|
||||
NodeList::Iterator Begin (void);
|
||||
NodeList::Iterator End (void);
|
||||
TraceResolver *CreateTraceResolver (TraceContext const &context);
|
||||
Node *PeekNode (uint32_t n);
|
||||
Ptr<Node> GetNode (uint32_t n);
|
||||
uint32_t GetNNodes (void);
|
||||
INode *PeekINode (uint32_t n);
|
||||
Ptr<INode> GetINode (uint32_t n);
|
||||
uint32_t GetNINodes (void);
|
||||
|
||||
private:
|
||||
std::vector<Ptr<Node> > m_nodes;
|
||||
std::vector<Ptr<INode> > m_nodes;
|
||||
};
|
||||
|
||||
NodeListPriv::NodeListPriv ()
|
||||
{}
|
||||
NodeListPriv::~NodeListPriv ()
|
||||
{
|
||||
for (std::vector<Ptr<Node> >::iterator i = m_nodes.begin ();
|
||||
for (std::vector<Ptr<INode> >::iterator i = m_nodes.begin ();
|
||||
i != m_nodes.end (); i++)
|
||||
{
|
||||
Ptr<Node> node = *i;
|
||||
Ptr<INode> node = *i;
|
||||
node->Dispose ();
|
||||
*i = 0;
|
||||
}
|
||||
@@ -77,7 +77,7 @@ NodeListPriv::~NodeListPriv ()
|
||||
|
||||
|
||||
uint32_t
|
||||
NodeListPriv::Add (Ptr<Node> node)
|
||||
NodeListPriv::Add (Ptr<INode> node)
|
||||
{
|
||||
uint32_t index = m_nodes.size ();
|
||||
m_nodes.push_back (node);
|
||||
@@ -95,18 +95,18 @@ NodeListPriv::End (void)
|
||||
return m_nodes.end ();
|
||||
}
|
||||
uint32_t
|
||||
NodeListPriv::GetNNodes (void)
|
||||
NodeListPriv::GetNINodes (void)
|
||||
{
|
||||
return m_nodes.size ();
|
||||
}
|
||||
Node *
|
||||
NodeListPriv::PeekNode (uint32_t n)
|
||||
INode *
|
||||
NodeListPriv::PeekINode (uint32_t n)
|
||||
{
|
||||
return PeekPointer (m_nodes[n]);
|
||||
}
|
||||
|
||||
Ptr<Node>
|
||||
NodeListPriv::GetNode (uint32_t n)
|
||||
Ptr<INode>
|
||||
NodeListPriv::GetINode (uint32_t n)
|
||||
{
|
||||
return m_nodes[n];
|
||||
}
|
||||
@@ -115,11 +115,11 @@ NodeListPriv::GetNode (uint32_t n)
|
||||
TraceResolver *
|
||||
NodeListPriv::CreateTraceResolver (TraceContext const &context)
|
||||
{
|
||||
ArrayTraceResolver<Node> *resolver =
|
||||
new ArrayTraceResolver<Node>
|
||||
ArrayTraceResolver<INode> *resolver =
|
||||
new ArrayTraceResolver<INode>
|
||||
(context,
|
||||
MakeCallback (&NodeListPriv::GetNNodes, this),
|
||||
MakeCallback (&NodeListPriv::PeekNode, this));
|
||||
MakeCallback (&NodeListPriv::GetNINodes, this),
|
||||
MakeCallback (&NodeListPriv::PeekINode, this));
|
||||
return resolver;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ NodeListPriv::CreateTraceResolver (TraceContext const &context)
|
||||
namespace ns3 {
|
||||
|
||||
uint32_t
|
||||
NodeList::Add (Ptr<Node> node)
|
||||
NodeList::Add (Ptr<INode> node)
|
||||
{
|
||||
return SimulationSingleton<NodeListPriv>::Get ()->Add (node);
|
||||
}
|
||||
@@ -152,10 +152,10 @@ NodeList::CreateTraceResolver (TraceContext const &context)
|
||||
{
|
||||
return SimulationSingleton<NodeListPriv>::Get ()->CreateTraceResolver (context);
|
||||
}
|
||||
Ptr<Node>
|
||||
NodeList::GetNode (uint32_t n)
|
||||
Ptr<INode>
|
||||
NodeList::GetINode (uint32_t n)
|
||||
{
|
||||
return SimulationSingleton<NodeListPriv>::Get ()->GetNode (n);
|
||||
return SimulationSingleton<NodeListPriv>::Get ()->GetINode (n);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,29 +28,29 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class Node;
|
||||
class INode;
|
||||
class TraceResolver;
|
||||
class TraceContext;
|
||||
|
||||
/**
|
||||
* \brief the list of simulation nodes.
|
||||
*
|
||||
* Every Node created is automatically added to this list.
|
||||
* Every INode created is automatically added to this list.
|
||||
*/
|
||||
class NodeList
|
||||
{
|
||||
public:
|
||||
typedef ArrayTraceResolver<Node>::Index NodeIndex;
|
||||
typedef std::vector< Ptr<Node> >::iterator Iterator;
|
||||
typedef ArrayTraceResolver<INode>::Index NodeIndex;
|
||||
typedef std::vector< Ptr<INode> >::iterator Iterator;
|
||||
|
||||
/**
|
||||
* \param node node to add
|
||||
* \returns index of node in list.
|
||||
*
|
||||
* This method is called automatically from Node::Node so
|
||||
* This method is called automatically from INode::INode so
|
||||
* the user has little reason to call it himself.
|
||||
*/
|
||||
static uint32_t Add (Ptr<Node> node);
|
||||
static uint32_t Add (Ptr<INode> node);
|
||||
/**
|
||||
* \returns a C++ iterator located at the beginning of this
|
||||
* list.
|
||||
@@ -71,9 +71,9 @@ public:
|
||||
|
||||
/**
|
||||
* \param n index of requested node.
|
||||
* \returns the Node associated to index n.
|
||||
* \returns the INode associated to index n.
|
||||
*/
|
||||
static Ptr<Node> GetNode (uint32_t n);
|
||||
static Ptr<INode> GetINode (uint32_t n);
|
||||
};
|
||||
|
||||
}//namespace ns3
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class Node;
|
||||
class INode;
|
||||
|
||||
/**
|
||||
* \brief Define a Socket API based on the BSD Socket API.
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
/**
|
||||
* \returns the node this socket is associated with.
|
||||
*/
|
||||
virtual Ptr<Node> GetNode (void) const = 0;
|
||||
virtual Ptr<INode> GetINode (void) const = 0;
|
||||
|
||||
/**
|
||||
* Allocate a free port number and
|
||||
|
||||
Reference in New Issue
Block a user