NetDevice and Channel now derive from Interface rather than Object

This commit is contained in:
Mathieu Lacage
2007-05-11 19:26:01 +02:00
parent 5cb92847c4
commit b3aee2deb2
4 changed files with 18 additions and 8 deletions

View File

@@ -27,14 +27,18 @@ NS_DEBUG_COMPONENT_DEFINE ("Channel");
namespace ns3 {
const InterfaceId Channel::iid ("Channel");
Channel::Channel ()
: m_name("Channel")
: Interface (Channel::iid),
m_name("Channel")
{
NS_DEBUG("Channel::Channel ()");
}
Channel::Channel (std::string name)
: m_name(name)
: Interface (Channel::iid),
m_name(name)
{
NS_DEBUG("Channel::Channel (" << name << ")");
}

View File

@@ -24,7 +24,7 @@
#include <string>
#include <stdint.h>
#include "ns3/object.h"
#include "ns3/interface.h"
#include "ns3/ptr.h"
namespace ns3 {
@@ -37,9 +37,10 @@ class NetDevice;
* A channel is a logical path over which information flows. The path can
* be as simple as a short piece of wire, or as complicated as space-time.
*/
class Channel : public Object
class Channel : public Interface
{
public:
static const InterfaceId iid;
Channel ();
Channel (std::string name);

View File

@@ -21,15 +21,19 @@
#include <iostream>
#include "ns3/assert.h"
#include "ns3/interface.h"
#include "channel.h"
#include "net-device.h"
#include "llc-snap-header.h"
#include "node.h"
#include "ns3/channel.h"
namespace ns3 {
const InterfaceId NetDevice::iid ("NetDevice");
NetDevice::NetDevice(Ptr<Node> node, const MacAddress& addr) :
Interface (NetDevice::iid),
m_node (node),
m_name(""),
m_ifIndex (0),

View File

@@ -25,9 +25,9 @@
#include <stdint.h>
#include "ns3/callback.h"
#include "ns3/packet.h"
#include "ns3/object.h"
#include "mac-address.h"
#include "ns3/interface.h"
#include "ns3/ptr.h"
#include "mac-address.h"
namespace ns3 {
@@ -55,9 +55,10 @@ class Channel;
* this base class and implement your own version of the
* NetDevice::SendTo method.
*/
class NetDevice : public Object
class NetDevice : public Interface
{
public:
static const InterfaceId iid;
/**
* \param node base class node pointer of device's node
* \param addr MAC address of this device.