src/common/fv-trace-source.h
changeset 1421 df273f351a4c
parent 1323 08174b13d76f
parent 1420 3feedd3e4f5f
child 1422 d40dfd686fc3
equal deleted inserted replaced
1323:08174b13d76f 1421:df273f351a4c
     1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
       
     2 /*
       
     3  * Copyright (c) 2006 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 
       
    22 #ifndef F_VARIABLE_TRACER_H
       
    23 #define F_VARIABLE_TRACER_H
       
    24 
       
    25 #include "callback-trace-source.h"
       
    26 #include <stdint.h>
       
    27 
       
    28 namespace ns3 {
       
    29 
       
    30 class FVTraceSourceBase {
       
    31 public:
       
    32   typedef CallbackTraceSource<double, double> ChangeNotifyCallback;
       
    33 
       
    34   FVTraceSourceBase () {}
       
    35   FVTraceSourceBase (FVTraceSourceBase const &o) {}
       
    36   FVTraceSourceBase &operator = (FVTraceSourceBase const &o) {
       
    37       return *this;
       
    38   }
       
    39 
       
    40   ~FVTraceSourceBase () {}
       
    41 
       
    42   void AddCallback (CallbackBase const & callback, TraceContext const & context) {
       
    43     m_callback.AddCallback (callback, context);
       
    44   }
       
    45   void RemoveCallback (CallbackBase const & callback) {
       
    46     m_callback.RemoveCallback (callback);
       
    47   }
       
    48 protected:
       
    49   void notify (double oldVal, double newVal) {
       
    50       if (oldVal != newVal) 
       
    51         {
       
    52           m_callback (oldVal, newVal);
       
    53         }
       
    54   }
       
    55 private:
       
    56   ChangeNotifyCallback m_callback;
       
    57 };
       
    58 
       
    59 template <typename T>
       
    60 class FVTraceSource : public FVTraceSourceBase 
       
    61 {
       
    62 public:
       
    63 };
       
    64 
       
    65 }; // namespace ns3
       
    66 
       
    67 #endif /* F_VARIABLE_TRACER_H */