add application tracing support
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Tue, 11 Dec 2007 13:51:03 +0100
changeset 2260 712afe5037e5
parent 2259 fdb8cddfcecb
child 2261 15da56d6a494
add application tracing support
src/node/node.cc
src/node/node.h
--- a/src/node/node.cc	Tue Dec 11 13:42:09 2007 +0100
+++ b/src/node/node.cc	Tue Dec 11 13:51:03 2007 +0100
@@ -60,6 +60,34 @@
 }
 
 
+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), 
@@ -92,6 +120,7 @@
 {
   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;
 }
--- a/src/node/node.h	Tue Dec 11 13:42:09 2007 +0100
+++ b/src/node/node.h	Tue Dec 11 13:51:03 2007 +0100
@@ -58,6 +58,25 @@
 };
 
 /**
+ * \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.
  *
  * This class holds together: