add TraceContextElement::GetName method
This commit is contained in:
@@ -273,6 +273,7 @@ public:
|
||||
else if (m_sources == DOUBLEB) {os << "doubleB";}
|
||||
else if (m_sources == UINT16_T) {os << "uint16_t";}
|
||||
}
|
||||
std::string GetName (void) {return "TraceSourceTest";}
|
||||
TraceSourceTest () : m_sources (TraceSourceTest::DOUBLEA) {}
|
||||
TraceSourceTest (enum Sources sources) :m_sources (sources) {}
|
||||
bool IsDoubleA (void) const {return m_sources == TraceSourceTest::DOUBLEA;}
|
||||
@@ -292,6 +293,7 @@ public:
|
||||
{static uint16_t uid = AllocateUid<SubTraceSourceTest> ("SubTraceSourceTest"); return uid;}
|
||||
void Print (std::ostream &os)
|
||||
{os << "subtracesource=int";}
|
||||
std::string GetName (void) const {return "SubTraceSourceTest";}
|
||||
SubTraceSourceTest () : m_sources (SubTraceSourceTest::INT) {}
|
||||
SubTraceSourceTest (enum Sources sources) : m_sources (sources) {}
|
||||
private:
|
||||
|
||||
@@ -2,6 +2,13 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
std::string
|
||||
ElementRegistry::GetName (uint16_t uid)
|
||||
{
|
||||
InfoVector *vec = GetInfoVector ();
|
||||
struct Info info = (*vec)[uid - 1];
|
||||
return info.getName ();
|
||||
}
|
||||
uint32_t
|
||||
ElementRegistry::GetSize (uint16_t uid)
|
||||
{
|
||||
|
||||
@@ -115,19 +115,24 @@ public:
|
||||
|
||||
static uint32_t GetSize (uint16_t uid);
|
||||
static void Print (uint16_t uid, uint8_t *instance, std::ostream &os);
|
||||
static std::string GetName (uint16_t uid);
|
||||
static void Destroy (uint16_t uid, uint8_t *instance);
|
||||
private:
|
||||
typedef std::string (*GetNameCb) (void);
|
||||
typedef void (*PrintCb) (uint8_t *instance, std::ostream &os);
|
||||
typedef void (*DestroyCb) (uint8_t *instance);
|
||||
struct Info {
|
||||
uint32_t size;
|
||||
std::string uidString;
|
||||
GetNameCb getName;
|
||||
PrintCb print;
|
||||
DestroyCb destroy;
|
||||
};
|
||||
typedef std::vector<struct Info> InfoVector;
|
||||
static InfoVector *GetInfoVector (void);
|
||||
template <typename T>
|
||||
static std::string DoGetName (void);
|
||||
template <typename T>
|
||||
static void DoPrint (uint8_t *instance, std::ostream &os);
|
||||
template <typename T>
|
||||
static void DoDestroy (uint8_t *instance);
|
||||
@@ -143,6 +148,13 @@ ElementRegistry::DoPrint (uint8_t *instance, std::ostream &os)
|
||||
obj.Print (os);
|
||||
}
|
||||
template <typename T>
|
||||
std::string
|
||||
ElementRegistry::DoGetName (void)
|
||||
{
|
||||
static T obj;
|
||||
return obj.GetName ();
|
||||
}
|
||||
template <typename T>
|
||||
void
|
||||
ElementRegistry::DoDestroy (uint8_t *instance)
|
||||
{
|
||||
@@ -169,6 +181,7 @@ ElementRegistry::AllocateUid (std::string name)
|
||||
struct Info info;
|
||||
info.size = sizeof (T);
|
||||
info.uidString = name;
|
||||
info.getName = &ElementRegistry::DoGetName<T>;
|
||||
info.print = &ElementRegistry::DoPrint<T>;
|
||||
info.destroy = &ElementRegistry::DoDestroy<T>;
|
||||
vec->push_back (info);
|
||||
|
||||
@@ -59,6 +59,11 @@ CsmaCdTraceType::GetUid (void)
|
||||
static uint16_t uid = AllocateUid<CsmaCdTraceType> ("CsmaCdTraceType");
|
||||
return uid;
|
||||
}
|
||||
std::string
|
||||
CsmaCdTraceType::GetName (void) const
|
||||
{
|
||||
return "CsmaCdTraceType";
|
||||
}
|
||||
|
||||
|
||||
CsmaCdNetDevice::CsmaCdNetDevice (Ptr<Node> node)
|
||||
|
||||
@@ -52,6 +52,7 @@ public:
|
||||
CsmaCdTraceType ();
|
||||
void Print (std::ostream &os) const;
|
||||
static uint16_t GetUid (void);
|
||||
std::string GetName (void) const;
|
||||
private:
|
||||
enum Type m_type;
|
||||
};
|
||||
|
||||
@@ -53,6 +53,11 @@ PointToPointTraceType::GetUid (void)
|
||||
static uint16_t uid = AllocateUid<PointToPointTraceType> ("PointToPointTraceType");
|
||||
return uid;
|
||||
}
|
||||
std::string
|
||||
PointToPointTraceType::GetName (void) const
|
||||
{
|
||||
return "PointToPointTraceType";
|
||||
}
|
||||
|
||||
|
||||
PointToPointNetDevice::PointToPointNetDevice (Ptr<Node> node,
|
||||
|
||||
@@ -44,6 +44,7 @@ public:
|
||||
PointToPointTraceType ();
|
||||
void Print (std::ostream &os) const;
|
||||
static uint16_t GetUid (void);
|
||||
std::string GetName (void) const;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -87,6 +87,11 @@ Ipv4L3ProtocolTraceContextElement::GetUid (void)
|
||||
static uint16_t uid = AllocateUid<Ipv4L3ProtocolTraceContextElement> ("Ipv4L3ProtocolTraceContextElement");
|
||||
return uid;
|
||||
}
|
||||
std::string
|
||||
Ipv4L3ProtocolTraceContextElement::GetName (void) const
|
||||
{
|
||||
return "Ipv4L3ProtocolTraceContextElement";
|
||||
}
|
||||
|
||||
|
||||
Ipv4L3ProtocolInterfaceIndex::Ipv4L3ProtocolInterfaceIndex ()
|
||||
@@ -111,6 +116,11 @@ Ipv4L3ProtocolInterfaceIndex::GetUid (void)
|
||||
static uint16_t uid = AllocateUid<Ipv4L3ProtocolInterfaceIndex> ("Ipv4L3ProtocolInterfaceIndex");
|
||||
return uid;
|
||||
}
|
||||
std::string
|
||||
Ipv4L3ProtocolInterfaceIndex::GetName (void) const
|
||||
{
|
||||
return "Ipv4L3ProtocolInterfaceIndex";
|
||||
}
|
||||
|
||||
|
||||
Ipv4L3Protocol::Ipv4L3Protocol(Ptr<Node> node)
|
||||
|
||||
@@ -59,6 +59,7 @@ public:
|
||||
bool IsDrop (void) const;
|
||||
void Print (std::ostream &os) const;
|
||||
static uint16_t GetUid (void);
|
||||
std::string GetName (void) const;
|
||||
private:
|
||||
enum Type m_type;
|
||||
};
|
||||
@@ -71,6 +72,7 @@ public:
|
||||
uint32_t Get (void) const;
|
||||
void Print (std::ostream &os) const;
|
||||
static uint16_t GetUid (void);
|
||||
std::string GetName (void) const;
|
||||
private:
|
||||
uint32_t m_index;
|
||||
};
|
||||
|
||||
@@ -54,6 +54,11 @@ Ipv4L4ProtocolTraceContextElement::GetUid (void)
|
||||
static uint16_t uid = AllocateUid<Ipv4L4ProtocolTraceContextElement> ("Ipv4L4ProtocolTraceContextElement");
|
||||
return uid;
|
||||
}
|
||||
std::string
|
||||
Ipv4L4ProtocolTraceContextElement::GetName (void) const
|
||||
{
|
||||
return "Ipv4L4ProtocolTraceContextElement";
|
||||
}
|
||||
|
||||
|
||||
Ipv4L4Demux::Ipv4L4Demux (Ptr<Node> node)
|
||||
|
||||
@@ -45,6 +45,7 @@ public:
|
||||
int Get (void) const;
|
||||
void Print (std::ostream &os) const;
|
||||
static uint16_t GetUid (void);
|
||||
std::string GetName (void) const;
|
||||
private:
|
||||
int m_protocolNumber;
|
||||
};
|
||||
|
||||
@@ -50,6 +50,11 @@ NodeListIndex::Get (void) const
|
||||
{
|
||||
return m_index;
|
||||
}
|
||||
std::string
|
||||
NodeListIndex::GetName (void) const
|
||||
{
|
||||
return "NodeListIndex";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
void Print (std::ostream &os);
|
||||
static uint16_t GetUid (void);
|
||||
uint32_t Get (void) const;
|
||||
std::string GetName (void) const;
|
||||
private:
|
||||
uint32_t m_index;
|
||||
};
|
||||
|
||||
@@ -52,6 +52,11 @@ NodeNetDeviceIndex::GetUid (void)
|
||||
static uint16_t uid = AllocateUid<NodeNetDeviceIndex> ("NodeNetDeviceIndex");
|
||||
return uid;
|
||||
}
|
||||
std::string
|
||||
NodeNetDeviceIndex::GetName (void) const
|
||||
{
|
||||
return "NodeNetDeviceIndex";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ public:
|
||||
NodeNetDeviceIndex (uint32_t index);
|
||||
uint32_t Get (void) const;
|
||||
void Print (std::ostream &os) const;
|
||||
std::string GetName (void) const;
|
||||
static uint16_t GetUid (void);
|
||||
private:
|
||||
uint32_t m_index;
|
||||
|
||||
@@ -32,6 +32,11 @@ static ClassIdDefaultValue g_classIdDefaultValue ("Queue", "Packet Queue",
|
||||
Queue::iid, "DropTailQueue");
|
||||
|
||||
|
||||
std::string
|
||||
QueueTraceType::GetName (void) const
|
||||
{
|
||||
return "QueueTraceType";
|
||||
}
|
||||
uint16_t
|
||||
QueueTraceType::GetUid (void)
|
||||
{
|
||||
|
||||
@@ -52,6 +52,7 @@ public:
|
||||
bool IsDequeue (void) const;
|
||||
bool IsDrop (void) const;
|
||||
void Print (std::ostream &os) const;
|
||||
std::string GetName (void) const;
|
||||
private:
|
||||
enum Type m_type;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user