src/core/trace-context-element.cc
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Fri, 10 Aug 2007 15:53:43 +0200
changeset 1334 e8e07f44359f
parent 1227 src/common/trace-context-element.cc@268a9fc6f4a2
child 1364 7866d4dd9e64
permissions -rw-r--r--
move trace code to core module
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
#include "trace-context-element.h"
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
namespace ns3 {
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
uint32_t 
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
ElementRegistry::GetSize (uint16_t uid)
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
{
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
  InfoVector *vec = GetInfoVector ();
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
  struct Info info = (*vec)[uid - 1];
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
  return info.size;
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
}
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
void 
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
ElementRegistry::Print (uint16_t uid, uint8_t *instance, std::ostream &os)
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
{
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
  InfoVector *vec = GetInfoVector ();
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
  struct Info info = (*vec)[uid - 1];
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
  info.print (instance, os);
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
}
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
void 
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
ElementRegistry::Destroy (uint16_t uid, uint8_t *instance)
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
{
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
  InfoVector *vec = GetInfoVector ();
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
  struct Info info = (*vec)[uid - 1];
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
  info.destroy (instance);
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
}
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
ElementRegistry::InfoVector *
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
ElementRegistry::GetInfoVector (void)
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
{
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
  static InfoVector vector;
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
  return &vector;
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
}
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
} // namespace ns3