add NetDevice list into Node base class

This commit is contained in:
Mathieu Lacage committed 2007-04-30 10:16:04 +02:00
1 parent deb602517b
commit f856c72ac2
4 files changed
+35

No files matched your search

+6
View File
@@ -153,5 +153,11 @@ InternetNode::GetArp (void) const
return static_cast<Arp*> (m_l3Demux->Lookup (Arp::PROT_NUMBER));
}
void
InternetNode::DoAddDevice (NetDevice *device) const
{
//XXX
}
}//namespace ns3
+1
View File
@@ -57,6 +57,7 @@ public:
void SetName(std::string name);
private:
virtual void DoAddDevice (NetDevice *device) const;
// Capabilities
NetDeviceList* m_netDevices;
ApplicationList* m_applicationList;
+19
View File
@@ -68,6 +68,25 @@ Node::SetSystemId(uint32_t s )
m_sid = s;
}
uint32_t
Node::AddDevice (NetDevice *device)
{
uint32_t index = m_devices.size ();
m_devices.push_back (device);
DoAddDevice (device);
return index;
}
NetDevice *
Node::GetDevice (uint32_t index) const
{
return m_devices[index];
}
uint32_t
Node::GetNDevices (void) const
{
return m_devices.size ();
}
// Node stack creation and management routines.
Node* Node::Create()
{
+9
View File
@@ -100,6 +100,7 @@ class Arp;
class TraceContext;
class TraceResolver;
class NetDevice;
class Node {
friend class NodeList;
@@ -119,6 +120,13 @@ public:
uint32_t GetSystemId (void) const;
void SetSystemId(uint32_t s);
uint32_t AddDevice (NetDevice *device);
NetDevice *GetDevice (uint32_t index) const;
uint32_t GetNDevices (void) const;
private:
virtual void DoAddDevice (NetDevice *device) const = 0;
#ifdef REMOVE_FOR_NOW
// Define a protected delete operator. This will prevent users
// from attempting to delete Node objects. The deletion of
@@ -181,6 +189,7 @@ public:
private:
uint32_t m_id; // Node id for this node
uint32_t m_sid; // System id for this node
std::vector<NetDevice *> m_devices;
};
} //namespace ns3