GetName -> GetTypeName

This commit is contained in:
Mathieu Lacage
2007-08-30 14:35:44 +02:00
parent 62df1e933b
commit 3330ba77b1
19 changed files with 246 additions and 41 deletions

View File

@@ -0,0 +1,204 @@
///
/// \ingroup TraceSourceList
/// \brief send ipv4 packet to outgoing interface
/// \param arg1 the trace context associated to the connected trace source.
/// \param arg2 packet sent.
/// \param arg3 index of output ipv4 interface.
///
///
/// The path to this trace source is: /nodes/[0-n]/ipv4/tx.
///
/// The following classes can be extracted from \p arg1 with
/// ns3::TraceContext::GetElement:
/// - ns3::NodeListIndex
/// - ns3::Ipv4L3ProtocolTraceContextElement
void TraceSinkCallback0 (const TraceContext & arg1, const Packet & arg2, uint32_t arg3);
///
/// \ingroup TraceSourceList
/// \brief receive ipv4 packet from incoming interface
/// \param arg1 the trace context associated to the connected trace source.
/// \param arg2 packet received.
/// \param arg3 index of input ipv4 interface.
///
///
/// The path to this trace source is: /nodes/[0-n]/ipv4/rx.
///
/// The following classes can be extracted from \p arg1 with
/// ns3::TraceContext::GetElement:
/// - ns3::NodeListIndex
/// - ns3::Ipv4L3ProtocolTraceContextElement
void TraceSinkCallback1 (const TraceContext & arg1, const Packet & arg2, uint32_t arg3);
///
/// \ingroup TraceSourceList
/// \brief drop ipv4 packet
/// \param arg1 the trace context associated to the connected trace source.
/// \param arg2 packet dropped.
///
///
/// The path to this trace source is: /nodes/[0-n]/ipv4/drop.
///
/// The following classes can be extracted from \p arg1 with
/// ns3::TraceContext::GetElement:
/// - ns3::NodeListIndex
/// - ns3::Ipv4L3ProtocolTraceContextElement
void TraceSinkCallback2 (const TraceContext & arg1, const Packet & arg2);
///
/// \ingroup TraceSourceList
/// \brief store packet in queue
/// \param arg1 the trace context associated to the connected trace source.
/// \param arg2 packet queued.
///
///
/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/queue/enqueue.
///
/// The following classes can be extracted from \p arg1 with
/// ns3::TraceContext::GetElement:
/// - ns3::NodeListIndex
/// - ns3::NodeNetDeviceIndex
/// - ns3::QueueTraceType
void TraceSinkCallback3 (const TraceContext & arg1, const Packet & arg2);
///
/// \ingroup TraceSourceList
/// \brief remove packet from queue
/// \param arg1 the trace context associated to the connected trace source.
/// \param arg2 packet dequeued.
///
///
/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/queue/dequeue.
///
/// The following classes can be extracted from \p arg1 with
/// ns3::TraceContext::GetElement:
/// - ns3::NodeListIndex
/// - ns3::NodeNetDeviceIndex
/// - ns3::QueueTraceType
void TraceSinkCallback4 (const TraceContext & arg1, const Packet & arg2);
///
/// \ingroup TraceSourceList
/// \brief drop packet from queue
/// \param arg1 the trace context associated to the connected trace source.
/// \param arg2 packet dropped.
///
///
/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/queue/drop.
///
/// The following classes can be extracted from \p arg1 with
/// ns3::TraceContext::GetElement:
/// - ns3::NodeListIndex
/// - ns3::NodeNetDeviceIndex
/// - ns3::QueueTraceType
void TraceSinkCallback5 (const TraceContext & arg1, const Packet & arg2);
///
/// \ingroup TraceSourceList
/// \brief receive MAC packet
/// \param arg1 the trace context associated to the connected trace source.
/// \param arg2 packet received.
///
///
/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/rx.
///
/// The following classes can be extracted from \p arg1 with
/// ns3::TraceContext::GetElement:
/// - ns3::NodeListIndex
/// - ns3::NodeNetDeviceIndex
/// - ns3::PointToPointTraceType
void TraceSinkCallback6 (const TraceContext & arg1, const Packet & arg2);
///
/// \ingroup TraceSourceList
/// \brief receive MAC packet
/// \param arg1 the trace context associated to the connected trace source.
/// \param arg2 packet received.
///
///
/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/rx.
///
/// The following classes can be extracted from \p arg1 with
/// ns3::TraceContext::GetElement:
/// - ns3::NodeListIndex
/// - ns3::NodeNetDeviceIndex
/// - ns3::CsmaTraceType
void TraceSinkCallback7 (const TraceContext & arg1, const Packet & arg2);
///
/// \ingroup TraceSourceList
/// \brief drop MAC packet
/// \param arg1 the trace context associated to the connected trace source.
/// \param arg2 packet dropped.
///
///
/// The path to this trace source is: /nodes/[0-n]/devices/[0-n]/drop.
///
/// The following classes can be extracted from \p arg1 with
/// ns3::TraceContext::GetElement:
/// - ns3::NodeListIndex
/// - ns3::NodeNetDeviceIndex
/// - ns3::CsmaTraceType
void TraceSinkCallback8 (const TraceContext & arg1, const Packet & arg2);
///
/// \ingroup TraceSourceList
/// \brief The value of the speed vector changed
/// \param arg1 the trace context associated to the connected trace source.
/// \param arg2 the mobility model whose course changed.
///
///
/// The path to this trace source is: /nodes/[0-n]/$MobilityModelNotifier/course-change.
///
/// The following classes can be extracted from \p arg1 with
/// ns3::TraceContext::GetElement:
/// - ns3::NodeListIndex
void TraceSinkCallback9 (const TraceContext & arg1, Ptr<const MobilityModel> arg2);
///
/// \ingroup TraceSourceList
/// \brief send ipv4 packet to outgoing interface
/// \param arg1 the trace context associated to the connected trace source.
/// \param arg2 packet sent.
/// \param arg3 index of output ipv4 interface.
///
///
/// The path to this trace source is: /nodes/[0-n]/$Ipv4L3Protocol/tx.
///
/// The following classes can be extracted from \p arg1 with
/// ns3::TraceContext::GetElement:
/// - ns3::NodeListIndex
/// - ns3::Ipv4L3ProtocolTraceContextElement
void TraceSinkCallback10 (const TraceContext & arg1, const Packet & arg2, uint32_t arg3);
///
/// \ingroup TraceSourceList
/// \brief receive ipv4 packet from incoming interface
/// \param arg1 the trace context associated to the connected trace source.
/// \param arg2 packet received.
/// \param arg3 index of input ipv4 interface.
///
///
/// The path to this trace source is: /nodes/[0-n]/$Ipv4L3Protocol/rx.
///
/// The following classes can be extracted from \p arg1 with
/// ns3::TraceContext::GetElement:
/// - ns3::NodeListIndex
/// - ns3::Ipv4L3ProtocolTraceContextElement
void TraceSinkCallback11 (const TraceContext & arg1, const Packet & arg2, uint32_t arg3);
///
/// \ingroup TraceSourceList
/// \brief drop ipv4 packet
/// \param arg1 the trace context associated to the connected trace source.
/// \param arg2 packet dropped.
///
///
/// The path to this trace source is: /nodes/[0-n]/$Ipv4L3Protocol/drop.
///
/// The following classes can be extracted from \p arg1 with
/// ns3::TraceContext::GetElement:
/// - ns3::NodeListIndex
/// - ns3::Ipv4L3ProtocolTraceContextElement
void TraceSinkCallback12 (const TraceContext & arg1, const Packet & arg2);

View File

@@ -320,7 +320,7 @@ public:
else if (m_sources == DOUBLEB) {os << "doubleB";}
else if (m_sources == UINT16_T) {os << "uint16_t";}
}
std::string GetName (void) {return "TraceSourceTest";}
std::string GetTypeName (void) {return "ns3::TraceSourceTest";}
TraceSourceTest () : m_sources (TraceSourceTest::DOUBLEA) {}
TraceSourceTest (enum Sources sources) :m_sources (sources) {}
bool IsDoubleA (void) const {return m_sources == TraceSourceTest::DOUBLEA;}
@@ -340,7 +340,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";}
std::string GetTypeName (void) const {return "ns3::SubTraceSourceTest";}
SubTraceSourceTest () : m_sources (SubTraceSourceTest::INT) {}
SubTraceSourceTest (enum Sources sources) : m_sources (sources) {}
private:

View File

@@ -3,11 +3,11 @@
namespace ns3 {
std::string
ElementRegistry::GetName (uint16_t uid)
ElementRegistry::GetTypeName (uint16_t uid)
{
InfoVector *vec = GetInfoVector ();
struct Info info = (*vec)[uid - 1];
return info.getName ();
return info.getTypeName ();
}
uint32_t
ElementRegistry::GetSize (uint16_t uid)

View File

@@ -48,7 +48,7 @@ namespace ns3 {
* MyContext ();
* ~MyContext ();
* void Print (std::ostream &os) const;
* std::string GetName (void) const;
* std::string GetTypeName (void) const;
*
* // the user-specific API to manipulate the context.
* void SetData (uint8_t data);
@@ -73,8 +73,9 @@ namespace ns3 {
* os << "mycontext=" << (uint32_t) m_myContextData;
* }
* std::string
* MyContext::GetName (void) const
* MyContext::GetTypeName (void) const
* {
* // return a fully-qualified c++ type name
* return "MyContext";
* }
* void
@@ -121,23 +122,23 @@ 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 std::string GetTypeName (uint16_t uid);
static void Destroy (uint16_t uid, uint8_t *instance);
private:
typedef std::string (*GetNameCb) (void);
typedef std::string (*GetTypeNameCb) (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;
GetTypeNameCb getTypeName;
PrintCb print;
DestroyCb destroy;
};
typedef std::vector<struct Info> InfoVector;
static InfoVector *GetInfoVector (void);
template <typename T>
static std::string DoGetName (void);
static std::string DoGetTypeName (void);
template <typename T>
static void DoPrint (uint8_t *instance, std::ostream &os);
template <typename T>
@@ -155,10 +156,10 @@ ElementRegistry::DoPrint (uint8_t *instance, std::ostream &os)
}
template <typename T>
std::string
ElementRegistry::DoGetName (void)
ElementRegistry::DoGetTypeName (void)
{
static T obj;
return obj.GetName ();
return obj.GetTypeName ();
}
template <typename T>
void
@@ -187,7 +188,7 @@ ElementRegistry::AllocateUid (std::string name)
struct Info info;
info.size = sizeof (T);
info.uidString = name;
info.getName = &ElementRegistry::DoGetName<T>;
info.getTypeName = &ElementRegistry::DoGetTypeName<T>;
info.print = &ElementRegistry::DoPrint<T>;
info.destroy = &ElementRegistry::DoDestroy<T>;
vec->push_back (info);

View File

@@ -66,7 +66,7 @@ TraceContext::Iterator::Next (void)
std::string
TraceContext::Iterator::Get (void) const
{
std::string name = ElementRegistry::GetName (m_uid);
std::string name = ElementRegistry::GetTypeName (m_uid);
return name;
}
@@ -298,7 +298,7 @@ TraceContext::PrintAvailable (std::ostream &os, std::string separator) const
do {
currentUid = m_data->data[i];
uint8_t size = ElementRegistry::GetSize (currentUid);
os << ElementRegistry::GetName (currentUid);
os << ElementRegistry::GetTypeName (currentUid);
i += 1 + size;
if (i < m_data->size && currentUid != 0)
{
@@ -371,8 +371,8 @@ template <int N>
class Ctx : public TraceContextElement
{
public:
static uint16_t GetUid (void) {static uint16_t uid = AllocateUid<Ctx<N> > (GetName ()); return uid;}
static std::string GetName (void) {std::ostringstream oss; oss << "Ctx" << N; return oss.str ();}
static uint16_t GetUid (void) {static uint16_t uid = AllocateUid<Ctx<N> > (GetTypeName ()); return uid;}
static std::string GetTypeName (void) {std::ostringstream oss; oss << "Ctx" << N; return oss.str ();}
Ctx () : m_v (0) {}
Ctx (int v) : m_v (v) {}
void Print (std::ostream &os) {os << N;}

View File

@@ -60,9 +60,9 @@ CsmaTraceType::GetUid (void)
return uid;
}
std::string
CsmaTraceType::GetName (void) const
CsmaTraceType::GetTypeName (void) const
{
return "CsmaTraceType";
return "ns3::CsmaTraceType";
}

View File

@@ -52,7 +52,7 @@ public:
CsmaTraceType ();
void Print (std::ostream &os) const;
static uint16_t GetUid (void);
std::string GetName (void) const;
std::string GetTypeName (void) const;
private:
enum Type m_type;
};

View File

@@ -54,9 +54,9 @@ PointToPointTraceType::GetUid (void)
return uid;
}
std::string
PointToPointTraceType::GetName (void) const
PointToPointTraceType::GetTypeName (void) const
{
return "PointToPointTraceType";
return "ns3::PointToPointTraceType";
}

View File

@@ -44,7 +44,7 @@ public:
PointToPointTraceType ();
void Print (std::ostream &os) const;
static uint16_t GetUid (void);
std::string GetName (void) const;
std::string GetTypeName (void) const;
};
/**

View File

@@ -88,9 +88,9 @@ Ipv4L3ProtocolTraceContextElement::GetUid (void)
return uid;
}
std::string
Ipv4L3ProtocolTraceContextElement::GetName (void) const
Ipv4L3ProtocolTraceContextElement::GetTypeName (void) const
{
return "Ipv4L3ProtocolTraceContextElement";
return "ns3::Ipv4L3ProtocolTraceContextElement";
}
@@ -117,9 +117,9 @@ Ipv4L3ProtocolInterfaceIndex::GetUid (void)
return uid;
}
std::string
Ipv4L3ProtocolInterfaceIndex::GetName (void) const
Ipv4L3ProtocolInterfaceIndex::GetTypeName (void) const
{
return "Ipv4L3ProtocolInterfaceIndex";
return "ns3::Ipv4L3ProtocolInterfaceIndex";
}

View File

@@ -59,7 +59,7 @@ public:
bool IsDrop (void) const;
void Print (std::ostream &os) const;
static uint16_t GetUid (void);
std::string GetName (void) const;
std::string GetTypeName (void) const;
private:
enum Type m_type;
};
@@ -72,7 +72,7 @@ public:
uint32_t Get (void) const;
void Print (std::ostream &os) const;
static uint16_t GetUid (void);
std::string GetName (void) const;
std::string GetTypeName (void) const;
private:
uint32_t m_index;
};

View File

@@ -55,9 +55,9 @@ Ipv4L4ProtocolTraceContextElement::GetUid (void)
return uid;
}
std::string
Ipv4L4ProtocolTraceContextElement::GetName (void) const
Ipv4L4ProtocolTraceContextElement::GetTypeName (void) const
{
return "Ipv4L4ProtocolTraceContextElement";
return "ns3::Ipv4L4ProtocolTraceContextElement";
}

View File

@@ -45,7 +45,7 @@ public:
int Get (void) const;
void Print (std::ostream &os) const;
static uint16_t GetUid (void);
std::string GetName (void) const;
std::string GetTypeName (void) const;
private:
int m_protocolNumber;
};

View File

@@ -51,9 +51,9 @@ NodeListIndex::Get (void) const
return m_index;
}
std::string
NodeListIndex::GetName (void) const
NodeListIndex::GetTypeName (void) const
{
return "NodeListIndex";
return "ns3::NodeListIndex";
}

View File

@@ -40,7 +40,7 @@ public:
void Print (std::ostream &os);
static uint16_t GetUid (void);
uint32_t Get (void) const;
std::string GetName (void) const;
std::string GetTypeName (void) const;
private:
uint32_t m_index;
};

View File

@@ -53,9 +53,9 @@ NodeNetDeviceIndex::GetUid (void)
return uid;
}
std::string
NodeNetDeviceIndex::GetName (void) const
NodeNetDeviceIndex::GetTypeName (void) const
{
return "NodeNetDeviceIndex";
return "ns3::NodeNetDeviceIndex";
}

View File

@@ -44,7 +44,7 @@ public:
NodeNetDeviceIndex (uint32_t index);
uint32_t Get (void) const;
void Print (std::ostream &os) const;
std::string GetName (void) const;
std::string GetTypeName (void) const;
static uint16_t GetUid (void);
private:
uint32_t m_index;

View File

@@ -33,9 +33,9 @@ static ClassIdDefaultValue g_classIdDefaultValue ("Queue", "Packet Queue",
std::string
QueueTraceType::GetName (void) const
QueueTraceType::GetTypeName (void) const
{
return "QueueTraceType";
return "ns3::QueueTraceType";
}
uint16_t
QueueTraceType::GetUid (void)

View File

@@ -52,7 +52,7 @@ public:
bool IsDequeue (void) const;
bool IsDrop (void) const;
void Print (std::ostream &os) const;
std::string GetName (void) const;
std::string GetTypeName (void) const;
private:
enum Type m_type;
};