src/core/composite-trace-resolver.cc
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Sun, 12 Aug 2007 18:27:52 +0200
changeset 1345 eb06ae6eb180
parent 1338 253557415994
child 1352 34176d861b6e
permissions -rw-r--r--
use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
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 "composite-trace-resolver.h"
1335
d0e45d84f9c6 fix includes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1334
diff changeset
    22
#include "debug.h"
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    23
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    24
NS_DEBUG_COMPONENT_DEFINE ("CompositeTraceResolver");
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    25
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    26
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
    27
1325
f3be9eed2d90 remove TraceContext argument from TraceResolver constructor and move it to Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1235
diff changeset
    28
CompositeTraceResolver::CompositeTraceResolver ()
345
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
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    31
CompositeTraceResolver::~CompositeTraceResolver ()
1338
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    32
{
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    33
  for (TraceItems::iterator i = m_items.begin (); i != m_items.end (); i++)
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    34
    {
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    35
      delete *i;
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    36
    }
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    37
  m_items.clear ();
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    38
}
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    39
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    40
void 
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    41
CompositeTraceResolver::AddItem (CompositeItem *item)
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    42
{
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    43
  m_items.push_back (item);
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    44
}
345
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
void 
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    47
CompositeTraceResolver::Add (std::string name, 
1333
c0d66de933e9 convert TraceResolver * to Ptr<TraceResolver>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1329
diff changeset
    48
                             Callback<Ptr<TraceResolver> > createResolver)
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    49
{
1338
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    50
  class MakerCompositeItem : public CompositeItem
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    51
  {
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    52
  public:
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    53
    virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context)
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    54
    {maker ()->Connect (subpath, cb, context);}
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    55
    virtual void Disconnect (std::string subpath, const CallbackBase &cb)
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    56
    {maker ()->Disconnect (subpath, cb);}
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    57
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    58
    Callback<Ptr<TraceResolver> > maker;
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    59
  } *item = new MakerCompositeItem ();
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    60
  item->name = name;
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    61
  item->context = TraceContext ();
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    62
  item->maker = createResolver;
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
    63
  AddItem (item);
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    64
}
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    65
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    66
void 
1345
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    67
CompositeTraceResolver::Add (std::string name,
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    68
                             FVTraceSourceBase &trace)
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    69
{
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    70
  DoAddFV (name, trace, TraceContext ());
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    71
}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    72
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    73
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    74
void 
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    75
CompositeTraceResolver::DoAddFV (std::string name,
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    76
                               FVTraceSourceBase &trace, 
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    77
                               const TraceContext &context)
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    78
{
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    79
  class FVCompositeItem : public CompositeItem
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    80
  {
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    81
  public:
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    82
    virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context)
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    83
    {if (subpath == "") {trace->AddCallback (cb, context);}}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    84
    virtual void Disconnect (std::string subpath, const CallbackBase &cb)
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    85
    {if (subpath == "") {trace->RemoveCallback (cb);}}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    86
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    87
    FVTraceSourceBase *trace;
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    88
  } *item = new FVCompositeItem ();
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    89
  item->name = name;
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    90
  item->context = context;
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    91
  item->trace = &trace;
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    92
  AddItem (item);
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    93
}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    94
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    95
void 
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    96
CompositeTraceResolver::Add (std::string name,
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    97
                             UVTraceSourceBase &trace)
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    98
{
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
    99
  DoAddUV (name, trace, TraceContext ());
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   100
}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   101
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   102
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   103
void 
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   104
CompositeTraceResolver::DoAddUV (std::string name,
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   105
                                 UVTraceSourceBase &trace,
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   106
                                 const TraceContext &context)
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   107
{
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   108
  class UVCompositeItem : public CompositeItem
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   109
  {
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   110
  public:
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   111
    virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context)
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   112
    {if (subpath == "") {trace->AddCallback (cb, context);}}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   113
    virtual void Disconnect (std::string subpath, const CallbackBase &cb)
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   114
    {if (subpath == "") {trace->RemoveCallback (cb);}}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   115
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   116
    UVTraceSourceBase *trace;
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   117
  } *item = new UVCompositeItem ();
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   118
  item->name = name;
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   119
  item->context = context;
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   120
  item->trace = &trace;
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   121
  AddItem (item);
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   122
}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   123
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   124
void
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   125
CompositeTraceResolver::Add (std::string name,
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   126
                             SVTraceSourceBase &trace)
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   127
{
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   128
  DoAddSV (name, trace, TraceContext ());
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   129
}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   130
void
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   131
CompositeTraceResolver::DoAddSV (std::string name,
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   132
                                 SVTraceSourceBase &trace, 
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   133
                                 const TraceContext &context)
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   134
{
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   135
  class SVCompositeItem : public CompositeItem
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   136
  {
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   137
  public:
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   138
    virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context)
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   139
    {if (subpath == "") {trace->AddCallback (cb, context);}}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   140
    virtual void Disconnect (std::string subpath, const CallbackBase &cb)
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   141
    {if (subpath == "") {trace->RemoveCallback (cb);}}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   142
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   143
    SVTraceSourceBase *trace;
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   144
  } *item = new SVCompositeItem ();
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   145
  item->name = name;
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   146
  item->context = context;
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   147
  item->trace = &trace;
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   148
  AddItem (item);
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   149
}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   150
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   151
void 
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   152
CompositeTraceResolver::DoAddCallback (std::string name,
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   153
                                       CallbackTraceSourceBase &trace, 
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   154
                                       const TraceContext &context)
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   155
{
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   156
  class CallbackCompositeItem : public CompositeItem
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   157
  {
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   158
  public:
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   159
    virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context)
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   160
    {if (subpath == "") {trace->AddCallback (cb, context);}}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   161
    virtual void Disconnect (std::string subpath, const CallbackBase &cb)
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   162
    {if (subpath == "") {trace->RemoveCallback (cb);}}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   163
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   164
    CallbackTraceSourceBase *trace;
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   165
  } *item = new CallbackCompositeItem ();
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   166
  item->name = name;
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   167
  item->context = context;
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   168
  item->trace = &trace;
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   169
  AddItem (item);
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   170
}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   171
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   172
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   173
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   174
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   175
void 
1338
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   176
CompositeTraceResolver::AddChild (std::string name, Ptr<Object> child)
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   177
{
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   178
  DoAddChild (name, child, TraceContext ());
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   179
}
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   180
void 
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   181
CompositeTraceResolver::DoAddChild (std::string name, Ptr<Object> child, const TraceContext &context)
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   182
{
1338
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   183
  class ChildCompositeItem : public CompositeItem
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   184
  {
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   185
  public:
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   186
    virtual void Connect (std::string subpath, const CallbackBase &cb, const TraceContext &context)
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   187
    {child->TraceConnect (subpath, cb, context);}
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   188
    virtual void Disconnect (std::string subpath, const CallbackBase &cb)
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   189
    {child->TraceDisconnect (subpath, cb);}
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   190
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   191
    Ptr<Object> child;
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   192
  } *item = new ChildCompositeItem ();
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   193
  item->name = name;
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   194
  item->context = context;
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   195
  item->child = child;
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   196
  AddItem (item);
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   197
}
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   198
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   199
void
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   200
CompositeTraceResolver::SetParent (Ptr<TraceResolver> resolver)
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   201
{
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   202
  m_parent = resolver;
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   203
}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   204
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   205
void 
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   206
CompositeTraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context)
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   207
{
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   208
  NS_DEBUG ("connect path="<<path);
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   209
  DoRecursiveOperation (path, cb, context, CONNECT);
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   210
}
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   211
void 
1338
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   212
CompositeTraceResolver::DoRecursiveOperation (std::string path, 
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   213
                                              const CallbackBase  &cb, 
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   214
                                              const TraceContext &context,
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   215
                                              enum Operation op)
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   216
{
1338
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   217
  if (path == "")
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   218
    {
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   219
      return;
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   220
    }
1328
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1327
diff changeset
   221
  std::string id = GetElement (path);
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1327
diff changeset
   222
  std::string subpath = GetSubpath (path);
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   223
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   224
  if (id == "*")
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   225
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   226
      for (TraceItems::const_iterator i = m_items.begin (); i != m_items.end (); i++)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   227
	{
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   228
          OperationOne (subpath, i, cb, context, op);
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   229
        }
1338
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   230
      DoRecursiveOperationForParent (path, cb, context, op);
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   231
      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
   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
  std::string::size_type start, end;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   234
  start = id.find_first_of ("(", 0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   235
  end = id.find_first_of (")", 0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   236
  if (start != 0 || end != (id.size ()-1))
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   237
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   238
      for (TraceItems::const_iterator i = m_items.begin (); i != m_items.end (); i++)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   239
	{
1338
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   240
	  if ((*i)->name == id)
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   241
	    {
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   242
              OperationOne (subpath, i, cb, context, op);
1338
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   243
              DoRecursiveOperationForParent (path, cb, context, op);
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   244
              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
   245
	    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   246
	}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   247
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   248
  std::list<std::string> names;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   249
  std::string alternatives = std::string (id, start+1, end-1);
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   250
  std::string::size_type next_pos, cur_pos;
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   251
  next_pos = 0;
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   252
  cur_pos = 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
   253
  while (true)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   254
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   255
      std::string element;
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   256
      next_pos = alternatives.find ("|", cur_pos);
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   257
      if (next_pos == std::string::npos)
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   258
	{
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   259
	  element = std::string (alternatives, cur_pos, alternatives.size ());
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   260
	  names.push_back (element);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   261
	  break;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   262
	}
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   263
      element = std::string (alternatives, cur_pos, next_pos);
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   264
      names.push_back (element);
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   265
      cur_pos = next_pos + 1;
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   266
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   267
  for (std::list<std::string>::const_iterator i = names.begin (); i != names.end (); i++)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   268
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   269
      for (TraceItems::const_iterator j = m_items.begin (); j != m_items.end (); j++)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   270
	{
1338
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   271
	  if ((*j)->name == *i)
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   272
	    {
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   273
              OperationOne (subpath, j, cb, context, op);
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   274
	      break;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   275
	    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   276
	}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   277
    }
1338
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   278
  DoRecursiveOperationForParent (path, cb, context, op);
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   279
}
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   280
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   281
void
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   282
CompositeTraceResolver::DoRecursiveOperationForParent (std::string path, 
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   283
                                                       const CallbackBase &cb, 
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   284
                                                       const TraceContext &context, 
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   285
                                                       enum Operation op)
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   286
{
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   287
  if (m_parent == 0)
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   288
    {
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   289
      return;
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   290
    }
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   291
  switch (op) {
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   292
  case CONNECT:
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   293
    m_parent->Connect (path, cb, context);
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   294
    break;
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   295
  case DISCONNECT:
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   296
    m_parent->Disconnect (path, cb);
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   297
    break;
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   298
  }
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   299
}
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   300
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   301
void 
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   302
CompositeTraceResolver::OperationOne (std::string subpath, 
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   303
                                      TraceItems::const_iterator i,
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   304
                                      const CallbackBase &cb,
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   305
                                      const TraceContext &context,
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   306
                                      enum Operation op)
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   307
{
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   308
  switch (op) {
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   309
  case CONNECT: {
1338
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   310
    NS_DEBUG ("connect to path="<<subpath<<" name="<<(*i)->name);
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   311
    TraceContext ctx = context;
1338
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   312
    ctx.Add ((*i)->context);
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   313
    (*i)->Connect (subpath, cb, ctx);
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   314
    } break;
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   315
  case DISCONNECT:
1338
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   316
    (*i)->Disconnect (subpath, cb);
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   317
    break;
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   318
  }
1328
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1327
diff changeset
   319
}
1327
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   320
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   321
void 
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   322
CompositeTraceResolver::Disconnect (std::string path, CallbackBase const &cb)
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   323
{
798c425d3b1f override Connect and Disconnect in Composite and Terminal Trace resolvers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
   324
  DoRecursiveOperation (path, cb, TraceContext (), DISCONNECT);
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   325
}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   326
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   327
}//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
   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
#ifdef RUN_SELF_TESTS
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   330
1335
d0e45d84f9c6 fix includes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1334
diff changeset
   331
#include "test.h"
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   332
#include "trace-context-element.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
   333
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   334
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
   335
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   336
class TraceSourceTest : public TraceContextElement
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   337
{
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   338
public:
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   339
  enum Sources {
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   340
    DOUBLEA,
1345
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   341
    DOUBLEB,
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   342
    UINT16_T
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   343
  };
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   344
  static uint16_t GetUid (void) 
1235
dc52ea3507ff TraceContextElement::Register -> TraceContextElement::AllocateUid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   345
  {static uint16_t uid = AllocateUid<TraceSourceTest> ("TraceSourceTest"); return uid;}
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   346
  void Print (std::ostream &os)
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   347
  {os << "tracesource=";
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   348
    if (m_sources == DOUBLEA) {os << "doubleA";}
1345
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   349
    else if (m_sources == DOUBLEB) {os << "doubleB";}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   350
    else if (m_sources == UINT16_T) {os << "uint16_t";}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   351
  }
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   352
  TraceSourceTest () : m_sources (TraceSourceTest::DOUBLEA) {}
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   353
  TraceSourceTest (enum Sources sources) :m_sources (sources) {}
1345
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   354
  bool IsDoubleA (void) const {return m_sources == TraceSourceTest::DOUBLEA;}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   355
  bool IsDoubleB (void) const {return m_sources == TraceSourceTest::DOUBLEB;}
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   356
  bool IsUint16 (void) const {return m_sources == TraceSourceTest::UINT16_T;}
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   357
private:
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   358
  enum TraceSourceTest::Sources m_sources;
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   359
};
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   360
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   361
class SubTraceSourceTest : public TraceContextElement
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   362
{
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   363
public:
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   364
  enum Sources {
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   365
    INT,
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   366
  };
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   367
  static uint16_t GetUid (void) 
1235
dc52ea3507ff TraceContextElement::Register -> TraceContextElement::AllocateUid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1227
diff changeset
   368
  {static uint16_t uid = AllocateUid<SubTraceSourceTest> ("SubTraceSourceTest"); return uid;}
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   369
  void Print (std::ostream &os)
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   370
  {os << "subtracesource=int";}
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   371
  SubTraceSourceTest () : m_sources (SubTraceSourceTest::INT) {}
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   372
  SubTraceSourceTest (enum Sources sources) : m_sources (sources) {}
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   373
private:
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   374
  enum Sources m_sources;
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   375
};
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   376
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   377
class CompositeTraceResolverTest : 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
   378
{
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   379
public:
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   380
  CompositeTraceResolverTest ();
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   381
  virtual ~CompositeTraceResolverTest ();
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   382
  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
   383
private:
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   384
  void TraceDouble (TraceContext const &context, double v);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   385
  void TraceInt (TraceContext const &context, int v);
1333
c0d66de933e9 convert TraceResolver * to Ptr<TraceResolver>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1329
diff changeset
   386
  Ptr<TraceResolver> CreateSubResolver ();
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   387
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   388
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   389
  bool m_gotDoubleA;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   390
  bool m_gotDoubleB;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   391
  CallbackTraceSource<int> m_traceInt;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   392
  bool m_gotInt;
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
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   395
CompositeTraceResolverTest::CompositeTraceResolverTest ()
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   396
  : Test ("CompositeTraceResolver")
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   397
{}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   398
CompositeTraceResolverTest::~CompositeTraceResolverTest ()
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   399
{}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   400
void 
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   401
CompositeTraceResolverTest::TraceDouble (TraceContext const &context, double v)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   402
{
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   403
  TraceSourceTest source;
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   404
  context.Get (source);
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   405
  if (source.IsDoubleA ())
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   406
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   407
      m_gotDoubleA = true;
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   408
    }
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   409
  else if (source.IsDoubleB ())
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   410
    {
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   411
      m_gotDoubleB = true;
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   412
    }
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   413
  else
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   414
    {
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   415
      NS_FATAL_ERROR ("should not get any other trace source in this sink");
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   416
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   417
  
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   418
}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   419
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   420
void 
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   421
CompositeTraceResolverTest::TraceInt (TraceContext const &context, int v)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   422
{
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   423
  m_gotInt = true;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   424
}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   425
1333
c0d66de933e9 convert TraceResolver * to Ptr<TraceResolver>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1329
diff changeset
   426
Ptr<TraceResolver>
1325
f3be9eed2d90 remove TraceContext argument from TraceResolver constructor and move it to Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1235
diff changeset
   427
CompositeTraceResolverTest::CreateSubResolver (void)
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   428
{
1333
c0d66de933e9 convert TraceResolver * to Ptr<TraceResolver>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1329
diff changeset
   429
  Ptr<CompositeTraceResolver> subresolver = Create<CompositeTraceResolver> ();
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   430
  subresolver->Add ("trace-int", m_traceInt, 
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   431
                    SubTraceSourceTest (SubTraceSourceTest::INT));
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   432
  return subresolver;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   433
}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   434
bool 
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   435
CompositeTraceResolverTest::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
   436
{
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   437
  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
   438
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   439
  CallbackTraceSource<double> traceDoubleA;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   440
  CallbackTraceSource<double> traceDoubleB;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   441
  TraceContext context;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   442
1325
f3be9eed2d90 remove TraceContext argument from TraceResolver constructor and move it to Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1235
diff changeset
   443
  CompositeTraceResolver resolver;
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   444
1227
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   445
  resolver.Add ("trace-double-a", traceDoubleA, 
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   446
                TraceSourceTest (TraceSourceTest::DOUBLEA));
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   447
  resolver.Add ("trace-double-b", traceDoubleB, 
268a9fc6f4a2 work in progress towards a working trace context
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
   448
                TraceSourceTest (TraceSourceTest::DOUBLEB));
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   449
1325
f3be9eed2d90 remove TraceContext argument from TraceResolver constructor and move it to Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1235
diff changeset
   450
  resolver.Connect ("/*", MakeCallback (&CompositeTraceResolverTest::TraceDouble, this), TraceContext ());
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   451
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   452
  m_gotDoubleA = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   453
  m_gotDoubleB = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   454
  traceDoubleA (0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   455
  if (!m_gotDoubleA || m_gotDoubleB)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   456
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   457
      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
   458
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   459
  m_gotDoubleA = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   460
  traceDoubleA (0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   461
  traceDoubleB (0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   462
  if (!m_gotDoubleA || !m_gotDoubleB)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   463
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   464
      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
   465
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   466
  m_gotDoubleA = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   467
  m_gotDoubleB = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   468
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   469
  resolver.Disconnect ("/*", MakeCallback (&CompositeTraceResolverTest::TraceDouble, this));
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   470
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   471
  m_gotDoubleA = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   472
  m_gotDoubleB = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   473
  traceDoubleA (0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   474
  traceDoubleB (0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   475
  if (m_gotDoubleA || m_gotDoubleB)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   476
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   477
      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
   478
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   479
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   480
  resolver.Connect ("/trace-double-a", 
1325
f3be9eed2d90 remove TraceContext argument from TraceResolver constructor and move it to Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1235
diff changeset
   481
		    MakeCallback (&CompositeTraceResolverTest::TraceDouble, this), TraceContext ());
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   482
  m_gotDoubleA = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   483
  m_gotDoubleB = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   484
  traceDoubleA (0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   485
  traceDoubleB (0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   486
  if (!m_gotDoubleA || m_gotDoubleB)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   487
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   488
      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
   489
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   490
  resolver.Disconnect ("/trace-double-a", 
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   491
		       MakeCallback (&CompositeTraceResolverTest::TraceDouble, this));
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   492
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   493
  resolver.Connect ("/(trace-double-a)", 
1325
f3be9eed2d90 remove TraceContext argument from TraceResolver constructor and move it to Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1235
diff changeset
   494
		    MakeCallback (&CompositeTraceResolverTest::TraceDouble, this), TraceContext ());
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   495
  m_gotDoubleA = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   496
  m_gotDoubleB = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   497
  traceDoubleA (0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   498
  traceDoubleB (0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   499
  if (!m_gotDoubleA || m_gotDoubleB)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   500
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   501
      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
   502
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   503
  resolver.Disconnect ("/trace-double-a", 
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   504
		       MakeCallback (&CompositeTraceResolverTest::TraceDouble, this));
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   505
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   506
  resolver.Connect ("/(trace-double-a|trace-double-b)", 
1325
f3be9eed2d90 remove TraceContext argument from TraceResolver constructor and move it to Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1235
diff changeset
   507
		    MakeCallback (&CompositeTraceResolverTest::TraceDouble, this), TraceContext ());
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   508
  m_gotDoubleA = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   509
  m_gotDoubleB = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   510
  traceDoubleA (0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   511
  traceDoubleB (0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   512
  if (!m_gotDoubleA || !m_gotDoubleB)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   513
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   514
      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
   515
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   516
  resolver.Disconnect ("/trace-double-a", 
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   517
		       MakeCallback (&CompositeTraceResolverTest::TraceDouble, this));
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   518
  m_gotDoubleA = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   519
  m_gotDoubleB = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   520
  traceDoubleA (0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   521
  traceDoubleB (0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   522
  if (m_gotDoubleA || !m_gotDoubleB)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   523
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   524
      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
   525
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   526
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   527
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   528
  resolver.Disconnect ("/(trace-double-a|trace-double-b)", 
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   529
		       MakeCallback (&CompositeTraceResolverTest::TraceDouble, this));
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   530
  m_gotDoubleA = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   531
  m_gotDoubleB = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   532
  traceDoubleA (0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   533
  traceDoubleB (0);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   534
  if (m_gotDoubleA || m_gotDoubleB)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   535
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   536
      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
   537
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   538
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   539
  resolver.Add ("subresolver", 
1338
253557415994 rewrite the CompositeTraceResolver to use a simpler implementation, not based on callbacks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1335
diff changeset
   540
		MakeCallback (&CompositeTraceResolverTest::CreateSubResolver, this));
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   541
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   542
  resolver.Connect ("/subresolver/trace-int", 
1325
f3be9eed2d90 remove TraceContext argument from TraceResolver constructor and move it to Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1235
diff changeset
   543
		    MakeCallback (&CompositeTraceResolverTest::TraceInt, this), TraceContext ());
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   544
  m_gotInt = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   545
  m_traceInt (1);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   546
  if (!m_gotInt)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   547
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   548
      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
   549
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   550
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   551
  resolver.Disconnect ("/subresolver/trace-int", 
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   552
		       MakeCallback (&CompositeTraceResolverTest::TraceInt, this));
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   553
  m_gotInt = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   554
  m_traceInt (1);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   555
  if (m_gotInt)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   556
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   557
      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
   558
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   559
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   560
  resolver.Connect ("/*/trace-int", 
1325
f3be9eed2d90 remove TraceContext argument from TraceResolver constructor and move it to Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1235
diff changeset
   561
		    MakeCallback (&CompositeTraceResolverTest::TraceInt, this), TraceContext ());
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   562
  m_gotInt = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   563
  m_traceInt (1);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   564
  if (!m_gotInt)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   565
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   566
      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
   567
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   568
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   569
  resolver.Disconnect ("/subresolver/trace-int", 
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   570
		       MakeCallback (&CompositeTraceResolverTest::TraceInt, this));
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   571
  m_gotInt = false;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   572
  m_traceInt (1);
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   573
  if (m_gotInt)
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   574
    {
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   575
      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
   576
    }
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   577
1345
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   578
  SVTraceSource<uint16_t> source;
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   579
1345
eb06ae6eb180 use the abstract base of CallbackTraceSource to avoid pushing too much code in the header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1338
diff changeset
   580
  resolver.Add ("uint16_t", source, TraceSourceTest (TraceSourceTest::UINT16_T));
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   581
  
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   582
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   583
  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
   584
}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   585
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   586
static CompositeTraceResolverTest g_compositeTraceResolverTest;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   587
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   588
}//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
   589
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   590
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   591
#endif /* RUN_SELF_TESTS */