src/common/trace-root.cc
changeset 1742 cf76416ce75b
parent 1741 aa837ce15faf
parent 1426 30b9f2b59a1c
child 1743 0a84462bb582
equal deleted inserted replaced
1741:aa837ce15faf 1742:cf76416ce75b
     1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
       
     2 /*
       
     3  * Copyright (c) 2007 INRIA
       
     4  * All rights reserved.
       
     5  *
       
     6  * This program is free software; you can redistribute it and/or modify
       
     7  * it under the terms of the GNU General Public License version 2 as
       
     8  * published by the Free Software Foundation;
       
     9  *
       
    10  * This program is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    13  * GNU General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License
       
    16  * along with this program; if not, write to the Free Software
       
    17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    18  *
       
    19  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
       
    20  */
       
    21 #include "trace-root.h"
       
    22 #include "ns3/composite-trace-resolver.h"
       
    23 #include "ns3/trace-context.h"
       
    24 
       
    25 namespace ns3 {
       
    26 
       
    27 void 
       
    28 TraceRoot::Connect (std::string path, CallbackBase const &cb)
       
    29 {
       
    30   TraceResolver *resolver = GetComposite ();
       
    31   resolver->Connect (path, cb);
       
    32 }
       
    33 void 
       
    34 TraceRoot::Disconnect (std::string path, CallbackBase const &cb)
       
    35 {
       
    36   TraceResolver *resolver = GetComposite ();
       
    37   resolver->Disconnect (path, cb);
       
    38 }
       
    39 void 
       
    40 TraceRoot::Register (std::string name, 
       
    41                      Callback<TraceResolver *,TraceContext const &> createResolver)
       
    42 {
       
    43   CompositeTraceResolver *resolver = GetComposite ();
       
    44   resolver->Add (name, createResolver);
       
    45 }
       
    46 
       
    47 CompositeTraceResolver *
       
    48 TraceRoot::GetComposite (void)
       
    49 {
       
    50   static CompositeTraceResolver resolver = CompositeTraceResolver (TraceContext ());
       
    51   return &resolver;
       
    52 }
       
    53 
       
    54 } // namespace ns3