src/common/trace-resolver.cc
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Fri, 10 Aug 2007 14:28:52 +0200
changeset 1329 fc842b2faece
parent 1328 03f1081c21a7
child 1330 d67fce6d56f8
permissions -rw-r--r--
remove dead code
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     2
/*
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     3
 * Copyright (c) 2007 INRIA
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     4
 * All rights reserved.
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     5
 *
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     6
 * This program is free software; you can redistribute it and/or modify
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     7
 * it under the terms of the GNU General Public License version 2 as
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     8
 * published by the Free Software Foundation;
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     9
 *
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    13
 * GNU General Public License for more details.
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    14
 *
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    16
 * along with this program; if not, write to the Free Software
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    18
 *
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    19
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    20
 */
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    21
#include "trace-resolver.h"
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    22
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    23
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
    24
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    25
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    26
TraceResolver::~TraceResolver ()
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    27
{}
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    28
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    29
void 
1325
f3be9eed2d90 remove TraceContext argument from TraceResolver constructor and move it to Connect
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 345
diff changeset
    30
TraceResolver::Connect (std::string path, CallbackBase const &cb, const TraceContext &context)
1329
fc842b2faece remove dead code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1328
diff changeset
    31
{}
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    32
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    33
void 
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    34
TraceResolver::Disconnect (std::string path, CallbackBase const &cb)
1329
fc842b2faece remove dead code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1328
diff changeset
    35
{}
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    36
1328
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    37
std::string 
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    38
TraceResolver::GetElement (std::string path)
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    39
{
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    40
  std::string::size_type cur = 1;
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    41
  // check that first char is "/"
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    42
  std::string::size_type next = path.find ("/", cur);
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    43
  std::string id = std::string (path, cur, next-1);
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    44
  return id;
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    45
}
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    46
std::string 
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    47
TraceResolver::GetSubpath (std::string path)
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    48
{
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    49
  std::string::size_type cur = 1;
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    50
  // check that first char is "/"
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    51
  std::string::size_type next = path.find ("/", cur);
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    52
  std::string subpath;
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    53
  if (next != std::string::npos)
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    54
    {
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    55
      subpath = std::string (path, next, std::string::npos);
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    56
    }
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    57
  else
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    58
    {
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    59
      subpath = "";
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    60
    }
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    61
  return subpath;
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    62
}
03f1081c21a7 override Connect from ArrayTraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1325
diff changeset
    63
345
47b41507a45a move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    64
}//namespace ns3