src/core/trace-context.cc
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 27 Aug 2007 20:45:49 +0200
changeset 1369 ca4667a61c57
parent 1367 45e351c58b30
child 1371 bebf690257c9
permissions -rw-r--r--
add TraceContext::IsSimilar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     2
/*
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     3
 * Copyright (c) 2007 INRIA
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     4
 * All rights reserved.
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     5
 *
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     6
 * This program is free software; you can redistribute it and/or modify
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     7
 * it under the terms of the GNU General Public License version 2 as
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     8
 * published by the Free Software Foundation;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     9
 *
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    13
 * GNU General Public License for more details.
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    14
 *
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    16
 * along with this program; if not, write to the Free Software
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    18
 *
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    19
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    20
 */
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    21
#include "trace-context.h"
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    22
#include "trace-context-element.h"
1335
d0e45d84f9c6 fix includes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1334
diff changeset
    23
#include "assert.h"
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    24
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    25
namespace ns3 {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    26
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    27
TraceContext::TraceContext ()
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    28
  : m_data (0)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    29
{}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    30
TraceContext::TraceContext (TraceContext const &o)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    31
  : m_data (o.m_data)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    32
{
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    33
  if (m_data != 0)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    34
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    35
      m_data->count++;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    36
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    37
}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    38
TraceContext const & 
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    39
TraceContext::operator = (TraceContext const &o)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    40
{
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    41
  if (m_data != 0)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    42
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    43
      m_data->count--;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    44
      if (m_data->count == 0)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    45
        {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    46
          uint8_t *buffer = (uint8_t *)m_data;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    47
          delete [] buffer;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    48
        }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    49
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    50
  m_data = o.m_data;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    51
  if (m_data != 0)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    52
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    53
      m_data->count++;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    54
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    55
  return *this;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    56
}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    57
TraceContext::~TraceContext ()
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    58
{
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    59
  if (m_data != 0)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    60
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    61
      m_data->count--;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    62
      if (m_data->count == 0)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    63
        {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    64
          uint8_t *buffer = (uint8_t *)m_data;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    65
          delete [] buffer;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    66
        }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    67
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    68
}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    69
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    70
void 
1361
85344cd127f5 rename TraceContext::Add to AddElement and Union
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1360
diff changeset
    71
TraceContext::Union (TraceContext const &o)
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    72
{
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    73
  if (o.m_data == 0)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    74
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    75
      return;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    76
    }
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    77
  uint16_t currentUid;
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    78
  uint16_t i = 0;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    79
  while (i < o.m_data->size) 
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    80
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    81
      currentUid = o.m_data->data[i];
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    82
      uint8_t size = ElementRegistry::GetSize (currentUid);
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    83
      uint8_t *selfBuffer = CheckPresent (currentUid);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    84
      uint8_t *otherBuffer = &(o.m_data->data[i+1]);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    85
      if (selfBuffer != 0)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    86
        {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    87
          if (memcmp (selfBuffer, otherBuffer, size) != 0)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    88
            {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    89
              NS_FATAL_ERROR ("You cannot add TraceContexts which "<<
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    90
                              "have different values stored in them.");
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    91
            }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    92
        }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    93
      else
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    94
        {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    95
          DoAdd (currentUid, otherBuffer);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    96
        }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    97
      i += 1 + size;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    98
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    99
}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   100
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   101
uint8_t *
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   102
TraceContext::CheckPresent (uint8_t uid) const
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   103
{
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   104
  if (m_data == 0)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   105
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   106
      return false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   107
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   108
  uint8_t currentUid;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   109
  uint16_t i = 0;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   110
  do {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   111
    currentUid = m_data->data[i];
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   112
    uint8_t size = ElementRegistry::GetSize (currentUid);
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   113
    if (currentUid == uid)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   114
      {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   115
        return &m_data->data[i+1];
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   116
      }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   117
    i += 1 + size;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   118
  } while (i < m_data->size && currentUid != 0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   119
  return 0;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   120
}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   121
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   122
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   123
bool
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   124
TraceContext::DoAdd (uint8_t uid, uint8_t const *buffer)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   125
{
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   126
  NS_ASSERT (uid != 0);
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   127
  uint8_t size = ElementRegistry::GetSize (uid);
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   128
  uint8_t *present = CheckPresent (uid);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   129
  if (present != 0) {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   130
    if (memcmp (present, buffer, size) == 0)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   131
      {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   132
        return true;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   133
      }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   134
    else
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   135
      {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   136
        return false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   137
      }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   138
  }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   139
  if (m_data == 0)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   140
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   141
      uint16_t newSize = 1 + size;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   142
      uint16_t allocatedSize;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   143
      if (newSize > 4)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   144
        {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   145
          allocatedSize = sizeof (struct Data) + newSize - 4;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   146
        }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   147
      else
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   148
        {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   149
          allocatedSize = sizeof (struct Data);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   150
        }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   151
      struct Data *data = (struct Data *) (new uint8_t [allocatedSize] ());
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   152
      data->size = newSize;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   153
      data->count = 1;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   154
      data->data[0] = uid;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   155
      memcpy (data->data + 1, buffer, size);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   156
      m_data = data;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   157
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   158
  else
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   159
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   160
      uint16_t newSize = m_data->size + 1 + size;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   161
      uint16_t allocatedSize;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   162
      if (newSize > 4)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   163
        {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   164
          allocatedSize = sizeof (struct Data) + newSize - 4;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   165
        }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   166
      else
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   167
        {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   168
          allocatedSize = sizeof (struct Data);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   169
        }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   170
      struct Data *data = (struct Data *) (new uint8_t [allocatedSize] ());
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   171
      data->size = newSize;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   172
      data->count = 1;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   173
      memcpy (data->data, m_data->data, m_data->size);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   174
      data->data[m_data->size] = uid;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   175
      memcpy (data->data + m_data->size + 1, buffer, size);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   176
      m_data->count--;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   177
      if (m_data->count == 0)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   178
        {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   179
          uint8_t *buffer = (uint8_t *)m_data;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   180
          delete [] buffer;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   181
        }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   182
      m_data = data;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   183
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   184
  return true;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   185
}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   186
bool
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   187
TraceContext::DoGet (uint8_t uid, uint8_t *buffer) const
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   188
{
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   189
  if (m_data == 0)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   190
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   191
      return false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   192
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   193
  uint8_t currentUid;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   194
  uint16_t i = 0;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   195
  do {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   196
    currentUid = m_data->data[i];
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   197
    uint8_t size = ElementRegistry::GetSize (currentUid);
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   198
    if (currentUid == uid)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   199
      {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   200
        memcpy (buffer, &m_data->data[i+1], size);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   201
        return true;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   202
      }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   203
    i += 1 + size;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   204
  } while (i < m_data->size && currentUid != 0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   205
  return false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   206
}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   207
1229
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   208
void 
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   209
TraceContext::Print (std::ostream &os) const
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   210
{
1229
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   211
  if (m_data == 0)
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   212
    {
1229
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   213
      return;
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   214
    }
1229
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   215
  uint8_t currentUid;
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   216
  uint16_t i = 0;
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   217
  do {
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   218
    currentUid = m_data->data[i];
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   219
    uint8_t size = ElementRegistry::GetSize (currentUid);
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   220
    uint8_t *instance = &m_data->data[i+1];
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   221
    ElementRegistry::Print (currentUid, instance, os);
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   222
    i += 1 + size;
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   223
    if (i < m_data->size && currentUid != 0)
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   224
      {
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   225
        os << " ";
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   226
      }
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   227
    else
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   228
      {
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   229
        break;
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   230
      }
e4cfe4094c10 build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   231
  } while (true);
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   232
}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   233
1367
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   234
void 
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   235
TraceContext::PrintAvailable (std::ostream &os, std::string separator) const
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   236
{
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   237
  if (m_data == 0)
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   238
    {
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   239
      return;
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   240
    }
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   241
  uint8_t currentUid;
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   242
  uint16_t i = 0;
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   243
  do {
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   244
    currentUid = m_data->data[i];
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   245
    uint8_t size = ElementRegistry::GetSize (currentUid);
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   246
    os << ElementRegistry::GetName (currentUid);
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   247
    i += 1 + size;
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   248
    if (i < m_data->size && currentUid != 0)
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   249
      {
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   250
        os << separator;
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   251
      }
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   252
    else
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   253
      {
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   254
        break;
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   255
      }
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   256
  } while (true);
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   257
}
45e351c58b30 add TraceContext::PrintAvailable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1361
diff changeset
   258
1369
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   259
bool 
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   260
TraceContext::IsSimilar (const TraceContext &o) const
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   261
{
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   262
  if (m_data == 0 && o.m_data == 0)
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   263
    {
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   264
      return true;
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   265
    }
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   266
  if ((m_data != 0 && o.m_data == 0) || 
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   267
      (m_data == 0 && o.m_data != 0))
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   268
    {
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   269
      return false;
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   270
    }
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   271
  uint8_t myCurrentUid;
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   272
  uint16_t myI = 0;
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   273
  uint8_t otherCurrentUid;
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   274
  uint16_t otherI = 0;
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   275
  do {
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   276
    myCurrentUid = m_data->data[myI];
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   277
    otherCurrentUid = o.m_data->data[otherI];
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   278
    uint8_t mySize = ElementRegistry::GetSize (myCurrentUid);
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   279
    uint8_t otherSize = ElementRegistry::GetSize (otherCurrentUid);
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   280
    myI += 1 + mySize;
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   281
    otherI += 1 + otherSize;
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   282
  } while (myCurrentUid == otherCurrentUid && 
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   283
           myCurrentUid != 0 && 
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   284
           otherCurrentUid != 0);
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   285
  if (myCurrentUid == 0 && otherCurrentUid == 0)
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   286
    {
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   287
      return true;
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   288
    }
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   289
  else
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   290
    {
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   291
      return false;
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   292
    }
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   293
}
ca4667a61c57 add TraceContext::IsSimilar
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1367
diff changeset
   294
1360
7686e996bd1d add operator << for Packet and TraceContext
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   295
std::ostream& operator<< (std::ostream& os, const TraceContext &context)
7686e996bd1d add operator << for Packet and TraceContext
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   296
{
7686e996bd1d add operator << for Packet and TraceContext
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   297
  context.Print (os);
7686e996bd1d add operator << for Packet and TraceContext
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   298
  return os;
7686e996bd1d add operator << for Packet and TraceContext
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   299
}
7686e996bd1d add operator << for Packet and TraceContext
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   300
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   301
}//namespace ns3
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   302
1335
d0e45d84f9c6 fix includes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1334
diff changeset
   303
#include "test.h"
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   304
#include <sstream>
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   305
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   306
namespace ns3 {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   307
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   308
template <int N>
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   309
class Ctx : public TraceContextElement
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   310
{
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   311
public:
1235
dc52ea3507ff TraceContextElement::Register -> TraceContextElement::AllocateUid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1229
diff changeset
   312
  static uint16_t GetUid (void) {static uint16_t uid = AllocateUid<Ctx<N> > (GetName ()); return uid;}
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   313
  static std::string GetName (void) {std::ostringstream oss; oss << "Ctx" << N; return oss.str ();}
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   314
  Ctx () : m_v (0) {}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   315
  Ctx (int v) : m_v (v) {}
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   316
  void Print (std::ostream &os) {os << N;}
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   317
  int Get (void) const { return N;}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   318
private:
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   319
  int m_v;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   320
};
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   321
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   322
class TraceContextTest : public Test
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   323
{
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   324
public:
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   325
  TraceContextTest ();
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   326
  virtual bool RunTests (void);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   327
};
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   328
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   329
TraceContextTest::TraceContextTest ()
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   330
  : Test ("TraceContext")
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   331
{}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   332
bool 
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   333
TraceContextTest::RunTests (void)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   334
{
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   335
  bool ok = true;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   336
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   337
  TraceContext ctx;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   338
  Ctx<0> v0;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   339
  Ctx<0> v01 = Ctx<0> (1);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   340
  Ctx<1> v1;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   341
  Ctx<2> v2;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   342
  Ctx<3> v3;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   343
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   344
  if (ctx.SafeGet (v0))
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   345
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   346
      ok = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   347
    }
1361
85344cd127f5 rename TraceContext::Add to AddElement and Union
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1360
diff changeset
   348
  ctx.AddElement (v0);
85344cd127f5 rename TraceContext::Add to AddElement and Union
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1360
diff changeset
   349
  ctx.AddElement (v0);
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   350
  if (ctx.SafeAdd (v01))
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   351
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   352
      ok = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   353
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   354
  ctx.Get (v0);
1361
85344cd127f5 rename TraceContext::Add to AddElement and Union
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1360
diff changeset
   355
  ctx.AddElement (v1);
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   356
  ctx.Get (v1);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   357
  ctx.Get (v0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   358
  ctx.Get (v1);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   359
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   360
  TraceContext copy = ctx;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   361
  ctx.Get (v0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   362
  ctx.Get (v1);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   363
  copy.Get (v0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   364
  copy.Get (v1);
1361
85344cd127f5 rename TraceContext::Add to AddElement and Union
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1360
diff changeset
   365
  copy.AddElement (v2);
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   366
  copy.Get (v0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   367
  copy.Get (v1);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   368
  copy.Get (v2);
1361
85344cd127f5 rename TraceContext::Add to AddElement and Union
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1360
diff changeset
   369
  ctx.AddElement (v3);
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   370
  ctx.Get (v0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   371
  ctx.Get (v1);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   372
  ctx.Get (v3);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   373
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   374
  if (ctx.SafeGet (v2))
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   375
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   376
      ok = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   377
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   378
  if (copy.SafeGet (v3))
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   379
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   380
      ok = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   381
    }
1361
85344cd127f5 rename TraceContext::Add to AddElement and Union
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1360
diff changeset
   382
  ctx.Union (copy);
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   383
  ctx.Get (v2);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   384
  if (copy.SafeGet (v3))
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   385
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   386
      ok = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   387
    }
1361
85344cd127f5 rename TraceContext::Add to AddElement and Union
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1360
diff changeset
   388
  copy.Union (ctx);
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   389
  copy.Get (v3);  
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   390
  
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   391
  return ok;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   392
}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   393
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   394
static TraceContextTest g_traceContextTest;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   395
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   396
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   397
}//namespace ns3