convert CsmaNetDevice to Attributes.

This commit is contained in:
Mathieu Lacage committed 2008-02-27 20:23:57 +01:00
1 parent efa249ad0d
commit cd376675cf
8 files changed
+93 -258

No files matched your search

-68
View File
@@ -55,64 +55,6 @@ Node::GetTypeId (void)
return tid;
}
NodeNetDeviceIndex::NodeNetDeviceIndex ()
: m_index (0)
{}
NodeNetDeviceIndex::NodeNetDeviceIndex (uint32_t index)
: m_index (index)
{}
uint32_t
NodeNetDeviceIndex::Get (void) const
{
return m_index;
}
void
NodeNetDeviceIndex::Print (std::ostream &os) const
{
os << "device=" << m_index;
}
uint16_t
NodeNetDeviceIndex::GetUid (void)
{
static uint16_t uid = AllocateUid<NodeNetDeviceIndex> ("NodeNetDeviceIndex");
return uid;
}
std::string
NodeNetDeviceIndex::GetTypeName (void) const
{
return "ns3::NodeNetDeviceIndex";
}
NodeApplicationIndex::NodeApplicationIndex ()
: m_index (0)
{}
NodeApplicationIndex::NodeApplicationIndex (uint32_t index)
: m_index (index)
{}
uint32_t
NodeApplicationIndex::Get (void) const
{
return m_index;
}
void
NodeApplicationIndex::Print (std::ostream &os) const
{
os << "device=" << m_index;
}
uint16_t
NodeApplicationIndex::GetUid (void)
{
static uint16_t uid = AllocateUid<NodeApplicationIndex> ("NodeApplicationIndex");
return uid;
}
std::string
NodeApplicationIndex::GetTypeName (void) const
{
return "ns3::NodeApplicationIndex";
}
Node::Node()
: m_id(0),
m_sid(0)
@@ -138,16 +80,6 @@ Node::Construct (void)
Node::~Node ()
{}
Ptr<TraceResolver>
Node::GetTraceResolver (void) const
{
Ptr<CompositeTraceResolver> resolver = Create<CompositeTraceResolver> ();
resolver->AddArray ("devices", m_devices.begin (), m_devices.end (), NodeNetDeviceIndex ());
resolver->AddArray ("applications", m_applications.begin (), m_applications.end (), NodeApplicationIndex ());
resolver->SetParentResolver (Object::GetTraceResolver ());
return resolver;
}
uint32_t
Node::GetId (void) const
{
-41
View File
@@ -25,56 +25,16 @@
#include "ns3/object.h"
#include "ns3/callback.h"
#include "ns3/trace-context-element.h"
#include "ns3/ptr.h"
namespace ns3 {
class TraceContext;
class TraceResolver;
class NetDevice;
class Application;
class Packet;
class Address;
class CompositeTraceResolver;
/**
* \brief hold in a TraceContext the index of a NetDevice within a Node
*/
class NodeNetDeviceIndex : public TraceContextElement
{
public:
NodeNetDeviceIndex ();
NodeNetDeviceIndex (uint32_t index);
/**
* \returns the index of the NetDevice within its container Node.
*/
uint32_t Get (void) const;
void Print (std::ostream &os) const;
std::string GetTypeName (void) const;
static uint16_t GetUid (void);
private:
uint32_t m_index;
};
/**
* \brief hold in a TraceContext the index of an Application within a Node
*/
class NodeApplicationIndex : public TraceContextElement
{
public:
NodeApplicationIndex ();
NodeApplicationIndex (uint32_t index);
/**
* \returns the index of the Application within its container Node.
*/
uint32_t Get (void) const;
void Print (std::ostream &os) const;
std::string GetTypeName (void) const;
static uint16_t GetUid (void);
private:
uint32_t m_index;
};
/**
* \brief A network Node.
@@ -199,7 +159,6 @@ public:
void UnregisterProtocolHandler (ProtocolHandler handler);
protected:
virtual Ptr<TraceResolver> GetTraceResolver (void) const;
/**
* The dispose method. Subclasses must override this method
* and must chain up to it by calling Node::DoDispose at the