EventTraceSource -> TracedCallback, ValueTraceSource -> TracedValue.
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Tue, 26 Feb 2008 19:51:33 +0100
changeset 2482adbc284a5849
parent 2481 8db62d9a69fd
child 2483 a6097b0414b3
EventTraceSource -> TracedCallback, ValueTraceSource -> TracedValue.
src/core/attribute-test.cc
src/core/event-trace-source.cc
src/core/event-trace-source.h
src/core/traced-callback.cc
src/core/traced-callback.h
src/core/traced-value.h
src/core/value-trace-source.h
src/core/wscript
     1.1 --- a/src/core/attribute-test.cc	Tue Feb 26 18:33:10 2008 +0100
     1.2 +++ b/src/core/attribute-test.cc	Tue Feb 26 19:51:33 2008 +0100
     1.3 @@ -8,7 +8,7 @@
     1.4  #include "random-variable.h"
     1.5  #include "double.h"
     1.6  #include "object-vector.h"
     1.7 -#include "value-trace-source.h"
     1.8 +#include "traced-value.h"
     1.9  #include "trace-source-accessor.h"
    1.10  
    1.11  namespace ns3 {
    1.12 @@ -203,10 +203,10 @@
    1.13    RandomVariable m_random;
    1.14    std::vector<Ptr<Derived> > m_vector1;
    1.15    std::vector<Ptr<Derived> > m_vector2;
    1.16 -  ValueTraceSource<int8_t> m_intSrc1;
    1.17 -  ValueTraceSource<int8_t> m_intSrc2;
    1.18 -  EventTraceSource<double, int, float> m_cb;
    1.19 -  ValueTraceSource<ValueClassTest> m_valueSrc;
    1.20 +  TracedValue<int8_t> m_intSrc1;
    1.21 +  TracedValue<int8_t> m_intSrc2;
    1.22 +  TracedCallback<double, int, float> m_cb;
    1.23 +  TracedValue<ValueClassTest> m_valueSrc;
    1.24  };
    1.25  
    1.26  
     2.1 --- a/src/core/event-trace-source.cc	Tue Feb 26 18:33:10 2008 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,100 +0,0 @@
     2.4 -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
     2.5 -/*
     2.6 - * Copyright (c) 2007 INRIA
     2.7 - * All rights reserved.
     2.8 - *
     2.9 - * This program is free software; you can redistribute it and/or modify
    2.10 - * it under the terms of the GNU General Public License version 2 as
    2.11 - * published by the Free Software Foundation;
    2.12 - *
    2.13 - * This program is distributed in the hope that it will be useful,
    2.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2.16 - * GNU General Public License for more details.
    2.17 - *
    2.18 - * You should have received a copy of the GNU General Public License
    2.19 - * along with this program; if not, write to the Free Software
    2.20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2.21 - *
    2.22 - * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
    2.23 - */
    2.24 -#include "event-trace-source.h"
    2.25 -
    2.26 -#ifdef RUN_SELF_TESTS
    2.27 -
    2.28 -#include "test.h"
    2.29 -
    2.30 -namespace ns3 {
    2.31 -
    2.32 -class EventTraceSourceTest : public Test 
    2.33 -{
    2.34 -public:
    2.35 -  EventTraceSourceTest ();
    2.36 -  virtual ~EventTraceSourceTest ();
    2.37 -  virtual bool RunTests (void);
    2.38 -private:
    2.39 -  void CbOne (uint8_t a, double b);
    2.40 -  void CbTwo (uint8_t a, double b);
    2.41 -
    2.42 -  bool m_one;
    2.43 -  bool m_two;
    2.44 -};
    2.45 -
    2.46 -EventTraceSourceTest::EventTraceSourceTest ()
    2.47 -  : Test ("EventTraceSource")
    2.48 -{}
    2.49 -EventTraceSourceTest::~EventTraceSourceTest ()
    2.50 -{}
    2.51 -void
    2.52 -EventTraceSourceTest::CbOne (uint8_t a, double b)
    2.53 -{
    2.54 -  m_one = true;
    2.55 -}
    2.56 -void
    2.57 -EventTraceSourceTest::CbTwo (uint8_t a, double b)
    2.58 -{
    2.59 -  m_two = true;
    2.60 -}
    2.61 -bool 
    2.62 -EventTraceSourceTest::RunTests (void)
    2.63 -{
    2.64 -  bool result = true;
    2.65 -
    2.66 -  EventTraceSource<uint8_t,double> trace;
    2.67 -  trace.Connect (MakeCallback (&EventTraceSourceTest::CbOne, this));
    2.68 -  trace.Connect (MakeCallback (&EventTraceSourceTest::CbTwo, this));
    2.69 -  m_one = false;
    2.70 -  m_two = false;
    2.71 -  trace (1, 2);
    2.72 -  NS_TEST_ASSERT (m_one);
    2.73 -  NS_TEST_ASSERT (m_two);
    2.74 -
    2.75 -  trace.Disconnect (MakeCallback (&EventTraceSourceTest::CbOne, this));
    2.76 -  m_one = false;
    2.77 -  m_two = false;
    2.78 -  trace (1, 2);
    2.79 -  NS_TEST_ASSERT (!m_one);
    2.80 -  NS_TEST_ASSERT (m_two);
    2.81 -  trace.Disconnect (MakeCallback (&EventTraceSourceTest::CbTwo, this));
    2.82 -  m_one = false;
    2.83 -  m_two = false;
    2.84 -  trace (1, 2);
    2.85 -  NS_TEST_ASSERT (!m_one);
    2.86 -  NS_TEST_ASSERT (!m_two);
    2.87 -
    2.88 -  trace.Connect (MakeCallback (&EventTraceSourceTest::CbOne, this));
    2.89 -  trace.Connect (MakeCallback (&EventTraceSourceTest::CbTwo, this));
    2.90 -  m_one = false;
    2.91 -  m_two = false;
    2.92 -  trace (1, 2);
    2.93 -  NS_TEST_ASSERT (m_one);
    2.94 -  NS_TEST_ASSERT (m_two);
    2.95 -
    2.96 -  return result;
    2.97 -}
    2.98 -
    2.99 -static EventTraceSourceTest g_eventTraceTest;
   2.100 -
   2.101 -}//namespace ns3
   2.102 -
   2.103 -#endif /* RUN_SELF_TESTS */
     3.1 --- a/src/core/event-trace-source.h	Tue Feb 26 18:33:10 2008 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,153 +0,0 @@
     3.4 -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
     3.5 -/*
     3.6 - * Copyright (c) 2005,2006,2007 INRIA
     3.7 - * All rights reserved.
     3.8 - *
     3.9 - * This program is free software; you can redistribute it and/or modify
    3.10 - * it under the terms of the GNU General Public License version 2 as
    3.11 - * published by the Free Software Foundation;
    3.12 - *
    3.13 - * This program is distributed in the hope that it will be useful,
    3.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3.16 - * GNU General Public License for more details.
    3.17 - *
    3.18 - * You should have received a copy of the GNU General Public License
    3.19 - * along with this program; if not, write to the Free Software
    3.20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    3.21 - *
    3.22 - * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
    3.23 - */
    3.24 -
    3.25 -#ifndef EVENT_TRACE_SOURCE_H
    3.26 -#define EVENT_TRACE_SOURCE_H
    3.27 -
    3.28 -#include <list>
    3.29 -#include "callback.h"
    3.30 -
    3.31 -namespace ns3 {
    3.32 -
    3.33 -/**
    3.34 - * \brief log arbitrary number of parameters to a matching ns3::Callback
    3.35 - * \ingroup tracing
    3.36 - *
    3.37 - * Whenever operator () is invoked on this class, the call and its arguments
    3.38 - * are forwarded to the internal matching ns3::Callback.
    3.39 - */
    3.40 -template<typename T1 = empty, typename T2 = empty, 
    3.41 -         typename T3 = empty, typename T4 = empty>
    3.42 -class EventTraceSource 
    3.43 -{
    3.44 -public:
    3.45 -  EventTraceSource ();
    3.46 -  void Connect (const CallbackBase & callback);
    3.47 -  void Disconnect (const CallbackBase & callback);
    3.48 -  void operator() (void) const;
    3.49 -  void operator() (T1 a1) const;
    3.50 -  void operator() (T1 a1, T2 a2) const;
    3.51 -  void operator() (T1 a1, T2 a2, T3 a3) const;
    3.52 -  void operator() (T1 a1, T2 a2, T3 a3, T4 a4) const;
    3.53 -
    3.54 -private:
    3.55 -  typedef std::list<Callback<void,T1,T2,T3,T4> > CallbackList;
    3.56 -  CallbackList m_callbackList;
    3.57 -};
    3.58 -
    3.59 -} // namespace ns3
    3.60 -
    3.61 -// implementation below.
    3.62 -
    3.63 -namespace ns3 {
    3.64 -
    3.65 -
    3.66 -template<typename T1, typename T2, 
    3.67 -         typename T3, typename T4>
    3.68 -EventTraceSource<T1,T2,T3,T4>::EventTraceSource ()
    3.69 -  : m_callbackList () 
    3.70 -{}
    3.71 -template<typename T1, typename T2, 
    3.72 -         typename T3, typename T4>
    3.73 -void 
    3.74 -EventTraceSource<T1,T2,T3,T4>::Connect (const CallbackBase & callback)
    3.75 -{
    3.76 -  Callback<void,T1,T2,T3,T4> cb;
    3.77 -  cb.Assign (callback);
    3.78 -  m_callbackList.push_back (cb);
    3.79 -}
    3.80 -template<typename T1, typename T2, 
    3.81 -         typename T3, typename T4>
    3.82 -void 
    3.83 -EventTraceSource<T1,T2,T3,T4>::Disconnect (const CallbackBase & callback)
    3.84 -{
    3.85 -  for (typename CallbackList::iterator i = m_callbackList.begin ();
    3.86 -       i != m_callbackList.end (); /* empty */)
    3.87 -    {
    3.88 -      if ((*i).IsEqual (callback))
    3.89 -	{
    3.90 -	  i = m_callbackList.erase (i);
    3.91 -	}
    3.92 -      else
    3.93 -	{
    3.94 -	  i++;
    3.95 -	}
    3.96 -    }
    3.97 -}
    3.98 -template<typename T1, typename T2, 
    3.99 -         typename T3, typename T4>
   3.100 -void 
   3.101 -EventTraceSource<T1,T2,T3,T4>::operator() (void) const
   3.102 -{
   3.103 -  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
   3.104 -       i != m_callbackList.end (); i++)
   3.105 -    {
   3.106 -      (*i) ();
   3.107 -    }
   3.108 -}
   3.109 -template<typename T1, typename T2, 
   3.110 -         typename T3, typename T4>
   3.111 -void 
   3.112 -EventTraceSource<T1,T2,T3,T4>::operator() (T1 a1) const
   3.113 -{
   3.114 -  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
   3.115 -       i != m_callbackList.end (); i++)
   3.116 -    {
   3.117 -      (*i) (a1);
   3.118 -    }
   3.119 -}
   3.120 -template<typename T1, typename T2, 
   3.121 -         typename T3, typename T4>
   3.122 -void 
   3.123 -EventTraceSource<T1,T2,T3,T4>::operator() (T1 a1, T2 a2) const
   3.124 -{
   3.125 -  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
   3.126 -       i != m_callbackList.end (); i++)
   3.127 -    {
   3.128 -      (*i) (a1, a2);
   3.129 -    }
   3.130 -}
   3.131 -template<typename T1, typename T2, 
   3.132 -         typename T3, typename T4>
   3.133 -void 
   3.134 -EventTraceSource<T1,T2,T3,T4>::operator() (T1 a1, T2 a2, T3 a3) const
   3.135 -{
   3.136 -  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
   3.137 -       i != m_callbackList.end (); i++)
   3.138 -    {
   3.139 -      (*i) (a1, a2, a3);
   3.140 -    }
   3.141 -}
   3.142 -template<typename T1, typename T2, 
   3.143 -         typename T3, typename T4>
   3.144 -void 
   3.145 -EventTraceSource<T1,T2,T3,T4>::operator() (T1 a1, T2 a2, T3 a3, T4 a4) const
   3.146 -{
   3.147 -  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
   3.148 -       i != m_callbackList.end (); i++)
   3.149 -    {
   3.150 -      (*i) (a1, a2, a3, a4);
   3.151 -    }
   3.152 -}
   3.153 -
   3.154 -}//namespace ns3
   3.155 -
   3.156 -#endif /* CALLBACK_TRACE_H */
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/src/core/traced-callback.cc	Tue Feb 26 19:51:33 2008 +0100
     4.3 @@ -0,0 +1,100 @@
     4.4 +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
     4.5 +/*
     4.6 + * Copyright (c) 2007 INRIA
     4.7 + * All rights reserved.
     4.8 + *
     4.9 + * This program is free software; you can redistribute it and/or modify
    4.10 + * it under the terms of the GNU General Public License version 2 as
    4.11 + * published by the Free Software Foundation;
    4.12 + *
    4.13 + * This program is distributed in the hope that it will be useful,
    4.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4.16 + * GNU General Public License for more details.
    4.17 + *
    4.18 + * You should have received a copy of the GNU General Public License
    4.19 + * along with this program; if not, write to the Free Software
    4.20 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    4.21 + *
    4.22 + * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
    4.23 + */
    4.24 +#include "traced-callback.h"
    4.25 +
    4.26 +#ifdef RUN_SELF_TESTS
    4.27 +
    4.28 +#include "test.h"
    4.29 +
    4.30 +namespace ns3 {
    4.31 +
    4.32 +class TracedCallbackTest : public Test 
    4.33 +{
    4.34 +public:
    4.35 +  TracedCallbackTest ();
    4.36 +  virtual ~TracedCallbackTest ();
    4.37 +  virtual bool RunTests (void);
    4.38 +private:
    4.39 +  void CbOne (uint8_t a, double b);
    4.40 +  void CbTwo (uint8_t a, double b);
    4.41 +
    4.42 +  bool m_one;
    4.43 +  bool m_two;
    4.44 +};
    4.45 +
    4.46 +TracedCallbackTest::TracedCallbackTest ()
    4.47 +  : Test ("TracedCallback")
    4.48 +{}
    4.49 +TracedCallbackTest::~TracedCallbackTest ()
    4.50 +{}
    4.51 +void
    4.52 +TracedCallbackTest::CbOne (uint8_t a, double b)
    4.53 +{
    4.54 +  m_one = true;
    4.55 +}
    4.56 +void
    4.57 +TracedCallbackTest::CbTwo (uint8_t a, double b)
    4.58 +{
    4.59 +  m_two = true;
    4.60 +}
    4.61 +bool 
    4.62 +TracedCallbackTest::RunTests (void)
    4.63 +{
    4.64 +  bool result = true;
    4.65 +
    4.66 +  TracedCallback<uint8_t,double> trace;
    4.67 +  trace.Connect (MakeCallback (&TracedCallbackTest::CbOne, this));
    4.68 +  trace.Connect (MakeCallback (&TracedCallbackTest::CbTwo, this));
    4.69 +  m_one = false;
    4.70 +  m_two = false;
    4.71 +  trace (1, 2);
    4.72 +  NS_TEST_ASSERT (m_one);
    4.73 +  NS_TEST_ASSERT (m_two);
    4.74 +
    4.75 +  trace.Disconnect (MakeCallback (&TracedCallbackTest::CbOne, this));
    4.76 +  m_one = false;
    4.77 +  m_two = false;
    4.78 +  trace (1, 2);
    4.79 +  NS_TEST_ASSERT (!m_one);
    4.80 +  NS_TEST_ASSERT (m_two);
    4.81 +  trace.Disconnect (MakeCallback (&TracedCallbackTest::CbTwo, this));
    4.82 +  m_one = false;
    4.83 +  m_two = false;
    4.84 +  trace (1, 2);
    4.85 +  NS_TEST_ASSERT (!m_one);
    4.86 +  NS_TEST_ASSERT (!m_two);
    4.87 +
    4.88 +  trace.Connect (MakeCallback (&TracedCallbackTest::CbOne, this));
    4.89 +  trace.Connect (MakeCallback (&TracedCallbackTest::CbTwo, this));
    4.90 +  m_one = false;
    4.91 +  m_two = false;
    4.92 +  trace (1, 2);
    4.93 +  NS_TEST_ASSERT (m_one);
    4.94 +  NS_TEST_ASSERT (m_two);
    4.95 +
    4.96 +  return result;
    4.97 +}
    4.98 +
    4.99 +static TracedCallbackTest g_eventTraceTest;
   4.100 +
   4.101 +}//namespace ns3
   4.102 +
   4.103 +#endif /* RUN_SELF_TESTS */
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/src/core/traced-callback.h	Tue Feb 26 19:51:33 2008 +0100
     5.3 @@ -0,0 +1,153 @@
     5.4 +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
     5.5 +/*
     5.6 + * Copyright (c) 2005,2006,2007 INRIA
     5.7 + * All rights reserved.
     5.8 + *
     5.9 + * This program is free software; you can redistribute it and/or modify
    5.10 + * it under the terms of the GNU General Public License version 2 as
    5.11 + * published by the Free Software Foundation;
    5.12 + *
    5.13 + * This program is distributed in the hope that it will be useful,
    5.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5.16 + * GNU General Public License for more details.
    5.17 + *
    5.18 + * You should have received a copy of the GNU General Public License
    5.19 + * along with this program; if not, write to the Free Software
    5.20 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    5.21 + *
    5.22 + * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
    5.23 + */
    5.24 +
    5.25 +#ifndef TRACED_CALLBACK_H
    5.26 +#define TRACED_CALLBACK_H
    5.27 +
    5.28 +#include <list>
    5.29 +#include "callback.h"
    5.30 +
    5.31 +namespace ns3 {
    5.32 +
    5.33 +/**
    5.34 + * \brief log arbitrary number of parameters to a matching ns3::Callback
    5.35 + * \ingroup tracing
    5.36 + *
    5.37 + * Whenever operator () is invoked on this class, the call and its arguments
    5.38 + * are forwarded to the internal matching ns3::Callback.
    5.39 + */
    5.40 +template<typename T1 = empty, typename T2 = empty, 
    5.41 +         typename T3 = empty, typename T4 = empty>
    5.42 +class TracedCallback 
    5.43 +{
    5.44 +public:
    5.45 +  TracedCallback ();
    5.46 +  void Connect (const CallbackBase & callback);
    5.47 +  void Disconnect (const CallbackBase & callback);
    5.48 +  void operator() (void) const;
    5.49 +  void operator() (T1 a1) const;
    5.50 +  void operator() (T1 a1, T2 a2) const;
    5.51 +  void operator() (T1 a1, T2 a2, T3 a3) const;
    5.52 +  void operator() (T1 a1, T2 a2, T3 a3, T4 a4) const;
    5.53 +
    5.54 +private:
    5.55 +  typedef std::list<Callback<void,T1,T2,T3,T4> > CallbackList;
    5.56 +  CallbackList m_callbackList;
    5.57 +};
    5.58 +
    5.59 +} // namespace ns3
    5.60 +
    5.61 +// implementation below.
    5.62 +
    5.63 +namespace ns3 {
    5.64 +
    5.65 +
    5.66 +template<typename T1, typename T2, 
    5.67 +         typename T3, typename T4>
    5.68 +TracedCallback<T1,T2,T3,T4>::TracedCallback ()
    5.69 +  : m_callbackList () 
    5.70 +{}
    5.71 +template<typename T1, typename T2, 
    5.72 +         typename T3, typename T4>
    5.73 +void 
    5.74 +TracedCallback<T1,T2,T3,T4>::Connect (const CallbackBase & callback)
    5.75 +{
    5.76 +  Callback<void,T1,T2,T3,T4> cb;
    5.77 +  cb.Assign (callback);
    5.78 +  m_callbackList.push_back (cb);
    5.79 +}
    5.80 +template<typename T1, typename T2, 
    5.81 +         typename T3, typename T4>
    5.82 +void 
    5.83 +TracedCallback<T1,T2,T3,T4>::Disconnect (const CallbackBase & callback)
    5.84 +{
    5.85 +  for (typename CallbackList::iterator i = m_callbackList.begin ();
    5.86 +       i != m_callbackList.end (); /* empty */)
    5.87 +    {
    5.88 +      if ((*i).IsEqual (callback))
    5.89 +	{
    5.90 +	  i = m_callbackList.erase (i);
    5.91 +	}
    5.92 +      else
    5.93 +	{
    5.94 +	  i++;
    5.95 +	}
    5.96 +    }
    5.97 +}
    5.98 +template<typename T1, typename T2, 
    5.99 +         typename T3, typename T4>
   5.100 +void 
   5.101 +TracedCallback<T1,T2,T3,T4>::operator() (void) const
   5.102 +{
   5.103 +  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
   5.104 +       i != m_callbackList.end (); i++)
   5.105 +    {
   5.106 +      (*i) ();
   5.107 +    }
   5.108 +}
   5.109 +template<typename T1, typename T2, 
   5.110 +         typename T3, typename T4>
   5.111 +void 
   5.112 +TracedCallback<T1,T2,T3,T4>::operator() (T1 a1) const
   5.113 +{
   5.114 +  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
   5.115 +       i != m_callbackList.end (); i++)
   5.116 +    {
   5.117 +      (*i) (a1);
   5.118 +    }
   5.119 +}
   5.120 +template<typename T1, typename T2, 
   5.121 +         typename T3, typename T4>
   5.122 +void 
   5.123 +TracedCallback<T1,T2,T3,T4>::operator() (T1 a1, T2 a2) const
   5.124 +{
   5.125 +  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
   5.126 +       i != m_callbackList.end (); i++)
   5.127 +    {
   5.128 +      (*i) (a1, a2);
   5.129 +    }
   5.130 +}
   5.131 +template<typename T1, typename T2, 
   5.132 +         typename T3, typename T4>
   5.133 +void 
   5.134 +TracedCallback<T1,T2,T3,T4>::operator() (T1 a1, T2 a2, T3 a3) const
   5.135 +{
   5.136 +  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
   5.137 +       i != m_callbackList.end (); i++)
   5.138 +    {
   5.139 +      (*i) (a1, a2, a3);
   5.140 +    }
   5.141 +}
   5.142 +template<typename T1, typename T2, 
   5.143 +         typename T3, typename T4>
   5.144 +void 
   5.145 +TracedCallback<T1,T2,T3,T4>::operator() (T1 a1, T2 a2, T3 a3, T4 a4) const
   5.146 +{
   5.147 +  for (typename CallbackList::const_iterator i = m_callbackList.begin ();
   5.148 +       i != m_callbackList.end (); i++)
   5.149 +    {
   5.150 +      (*i) (a1, a2, a3, a4);
   5.151 +    }
   5.152 +}
   5.153 +
   5.154 +}//namespace ns3
   5.155 +
   5.156 +#endif /* TRACED_CALLBACK_H */
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/src/core/traced-value.h	Tue Feb 26 19:51:33 2008 +0100
     6.3 @@ -0,0 +1,480 @@
     6.4 +#ifndef TRACED_VALUE_H
     6.5 +#define TRACED_VALUE_H
     6.6 +
     6.7 +#include "traced-callback.h"
     6.8 +#include "integer.h"
     6.9 +#include "uinteger.h"
    6.10 +#include "boolean.h"
    6.11 +#include "double.h"
    6.12 +#include "enum.h"
    6.13 +
    6.14 +#define TRACE(x)
    6.15 +
    6.16 +namespace ns3 {
    6.17 +
    6.18 +template <typename T>
    6.19 +class TracedValue
    6.20 +{
    6.21 +public:
    6.22 +  TracedValue ()
    6.23 +    : m_v () {}
    6.24 +  TracedValue (const TracedValue &o)
    6.25 +    : m_v (o.m_v) {}
    6.26 +  TracedValue (const T &v)
    6.27 +    : m_v (v) {}
    6.28 +  operator T () const {
    6.29 +    return m_v;
    6.30 +  }
    6.31 +  TracedValue &operator = (const TracedValue &o) {
    6.32 +    TRACE ("x=");
    6.33 +    Set (o.m_v);
    6.34 +    return *this;
    6.35 +  }
    6.36 +  TracedValue (const Integer &value) 
    6.37 +    : m_v (value.Get ()) {}
    6.38 +  operator Integer () const {
    6.39 +    return Integer (m_v);
    6.40 +  }
    6.41 +  TracedValue (const Uinteger &value)
    6.42 +    : m_v (value.Get ()) {}
    6.43 +  operator Uinteger () const {
    6.44 +    return Uinteger (m_v);
    6.45 +  }
    6.46 +  TracedValue (const Boolean &value)
    6.47 +    : m_v (value.Get ()) {}
    6.48 +  operator Boolean () const {
    6.49 +    return Boolean (m_v);
    6.50 +  }
    6.51 +  TracedValue (const Enum &value)
    6.52 +    : m_v (value.Get ()) {}
    6.53 +  operator Enum () const {
    6.54 +    return Enum (m_v);
    6.55 +  }
    6.56 +  void Connect (const CallbackBase &cb) {
    6.57 +    m_cb.Connect (cb);
    6.58 +  }
    6.59 +  void Disconnect (const CallbackBase &cb) {
    6.60 +    m_cb.Disconnect (cb);
    6.61 +  }
    6.62 +  void Set (const T &v) {
    6.63 +    if (m_v != v)
    6.64 +      {
    6.65 +	m_cb (m_v, v);
    6.66 +	m_v = v;
    6.67 +      }
    6.68 +  }
    6.69 +  T Get (void) const {
    6.70 +    return m_v;
    6.71 +  }
    6.72 +  TracedValue &operator++ () {
    6.73 +    TRACE ("++x");
    6.74 +    T tmp = Get ();
    6.75 +    ++tmp;
    6.76 +    Set (tmp);
    6.77 +    return *this;
    6.78 +  }
    6.79 +  TracedValue &operator-- () {
    6.80 +    TRACE ("--x");
    6.81 +    T tmp = Get ();
    6.82 +    --tmp;
    6.83 +    Set (tmp);
    6.84 +    return *this;
    6.85 +  }
    6.86 +  TracedValue operator++ (int) {
    6.87 +    TRACE ("x++");
    6.88 +    TracedValue old (*this);
    6.89 +    T tmp = Get ();
    6.90 +    tmp++;
    6.91 +    Set (tmp);
    6.92 +    return old;
    6.93 +  }
    6.94 +  TracedValue operator-- (int) {
    6.95 +    TRACE ("x--");
    6.96 +    TracedValue old (*this);
    6.97 +    T tmp = Get ();
    6.98 +    tmp--;
    6.99 +    Set (tmp);
   6.100 +    return old;
   6.101 +  }
   6.102 +private:
   6.103 +  T m_v;
   6.104 +  TracedCallback<T,T> m_cb;
   6.105 +};
   6.106 +
   6.107 +template <typename T, typename U>
   6.108 +bool operator == (const TracedValue<T> &lhs, const TracedValue<U> &rhs)
   6.109 +{
   6.110 +  TRACE ("x==x");
   6.111 +  return lhs.Get () == rhs.Get ();
   6.112 +}
   6.113 +template <typename T, typename U>
   6.114 +bool operator == (const TracedValue<T> &lhs, const U &rhs)
   6.115 +{
   6.116 +  TRACE ("x==");
   6.117 +  return lhs.Get () == rhs;
   6.118 +}
   6.119 +template <typename T, typename U>
   6.120 +bool operator == (const U &lhs, const TracedValue<T> &rhs)
   6.121 +{
   6.122 +  TRACE ("==x");
   6.123 +  return lhs == rhs.Get ();
   6.124 +}
   6.125 +
   6.126 +template <typename T, typename U>
   6.127 +bool operator != (const TracedValue<T> &lhs, const TracedValue<U> &rhs)
   6.128 +{
   6.129 +  TRACE ("x!=x");
   6.130 +  return lhs.Get () != rhs.Get ();
   6.131 +}
   6.132 +template <typename T, typename U>
   6.133 +bool operator != (const TracedValue<T> &lhs, const U &rhs)
   6.134 +{
   6.135 +  TRACE ("x!=");
   6.136 +  return lhs.Get () != rhs;
   6.137 +}
   6.138 +template <typename T, typename U>
   6.139 +bool operator != (const U &lhs, const TracedValue<T> &rhs)
   6.140 +{
   6.141 +  TRACE ("!=x");
   6.142 +  return lhs != rhs.Get ();
   6.143 +}
   6.144 +
   6.145 +template <typename T, typename U>
   6.146 +bool operator <= (const TracedValue<T> &lhs, const TracedValue<U> &rhs)
   6.147 +{
   6.148 +  TRACE ("x<=x");
   6.149 +  return lhs.Get () <= rhs.Get ();
   6.150 +}
   6.151 +template <typename T, typename U>
   6.152 +bool operator <= (const TracedValue<T> &lhs, const U &rhs)
   6.153 +{
   6.154 +  TRACE ("x<=");
   6.155 +  return lhs.Get () <= rhs;
   6.156 +}
   6.157 +template <typename T, typename U>
   6.158 +bool operator <= (const U &lhs, const TracedValue<T> &rhs)
   6.159 +{
   6.160 +  TRACE ("<=x");
   6.161 +  return lhs <= rhs.Get ();
   6.162 +}
   6.163 +template <typename T, typename U>
   6.164 +bool operator >= (const TracedValue<T> &lhs, const TracedValue<U> &rhs)
   6.165 +{
   6.166 +  TRACE ("x>=x");
   6.167 +  return lhs.Get () >= rhs.Get ();
   6.168 +}
   6.169 +template <typename T, typename U>
   6.170 +bool operator >= (const TracedValue<T> &lhs, const U &rhs)
   6.171 +{
   6.172 +  TRACE ("x>=");
   6.173 +  return lhs.Get () >= rhs;
   6.174 +}
   6.175 +template <typename T, typename U>
   6.176 +bool operator >= (const U &lhs, const TracedValue<T> &rhs)
   6.177 +{
   6.178 +  TRACE (">=x");
   6.179 +  return lhs >= rhs.Get ();
   6.180 +}
   6.181 +
   6.182 +template <typename T, typename U>
   6.183 +bool operator < (const TracedValue<T> &lhs, const TracedValue<U> &rhs)
   6.184 +{
   6.185 +  TRACE ("x<x");
   6.186 +  return lhs.Get () < rhs.Get ();
   6.187 +}
   6.188 +template <typename T, typename U>
   6.189 +bool operator < (const TracedValue<T> &lhs, const U &rhs)
   6.190 +{
   6.191 +  TRACE ("x<");
   6.192 +  return lhs.Get () < rhs;
   6.193 +}
   6.194 +template <typename T, typename U>
   6.195 +bool operator < (const U &lhs, const TracedValue<T> &rhs)
   6.196 +{
   6.197 +  TRACE ("<x");
   6.198 +  return lhs < rhs.Get ();
   6.199 +}
   6.200 +template <typename T, typename U>
   6.201 +bool operator > (const TracedValue<T> &lhs, const TracedValue<U> &rhs)
   6.202 +{
   6.203 +  TRACE ("x>x");
   6.204 +  return lhs.Get () > rhs.Get ();
   6.205 +}
   6.206 +template <typename T, typename U>
   6.207 +bool operator > (const TracedValue<T> &lhs, const U &rhs)
   6.208 +{
   6.209 +  TRACE ("x>");
   6.210 +  return lhs.Get () > rhs;
   6.211 +}
   6.212 +template <typename T, typename U>
   6.213 +bool operator > (const U &lhs, const TracedValue<T> &rhs)
   6.214 +{
   6.215 +  TRACE (">x");
   6.216 +  return lhs > rhs.Get ();
   6.217 +}
   6.218 +template <typename T, typename U>
   6.219 +TracedValue<T> &operator += (TracedValue<T> &lhs, const U &rhs) {
   6.220 +  TRACE ("x+=");
   6.221 +  T tmp = lhs.Get ();
   6.222 +  tmp += rhs;
   6.223 +  lhs.Set (tmp);
   6.224 +  return lhs;
   6.225 +}
   6.226 +template <typename T, typename U>
   6.227 +TracedValue<T> &operator -= (TracedValue<T> &lhs, const U &rhs) {
   6.228 +  TRACE ("x-=");
   6.229 +  T tmp = lhs.Get ();
   6.230 +  tmp -= rhs;
   6.231 +  lhs.Set (tmp);
   6.232 +  return lhs;
   6.233 +}
   6.234 +template <typename T, typename U>
   6.235 +TracedValue<T> &operator *= (TracedValue<T> &lhs, const U &rhs) {
   6.236 +  TRACE ("x*=");
   6.237 +  T tmp = lhs.Get ();
   6.238 +  tmp *= rhs;
   6.239 +  lhs.Set (tmp);
   6.240 +  return lhs;
   6.241 +}
   6.242 +template <typename T, typename U>
   6.243 +TracedValue<T> &operator /= (TracedValue<T> &lhs, const U &rhs) {
   6.244 +  TRACE ("x/=");
   6.245 +  T tmp = lhs.Get ();
   6.246 +  tmp /= rhs;
   6.247 +  lhs.Set (tmp);
   6.248 +  return lhs;
   6.249 +}
   6.250 +template <typename T, typename U>
   6.251 +TracedValue<T> &operator %= (TracedValue<T> &lhs, const U &rhs) {
   6.252 +  TRACE ("x%=");
   6.253 +  T tmp = lhs.Get ();
   6.254 +  tmp %= rhs;
   6.255 +  lhs.Set (tmp);
   6.256 +  return lhs;
   6.257 +}
   6.258 +template <typename T, typename U>
   6.259 +TracedValue<T> &operator <<= (TracedValue<T> &lhs, const U &rhs) {
   6.260 +  TRACE ("x<<=");
   6.261 +  T tmp = lhs.Get ();
   6.262 +  tmp <<= rhs;
   6.263 +  lhs.Set (tmp);
   6.264 +  return lhs;
   6.265 +}
   6.266 +template <typename T, typename U>
   6.267 +TracedValue<T> &operator >>= (TracedValue<T> &lhs, const U &rhs) {
   6.268 +  TRACE ("x>>=");
   6.269 +  T tmp = lhs.Get ();
   6.270 +  tmp >>= rhs;
   6.271 +  lhs.Set (tmp);
   6.272 +  return lhs;
   6.273 +}
   6.274 +template <typename T, typename U>
   6.275 +TracedValue<T> &operator &= (TracedValue<T> &lhs, const U &rhs) {
   6.276 +  TRACE ("x&=");
   6.277 +  T tmp = lhs.Get ();
   6.278 +  tmp &= rhs;
   6.279 +  lhs.Set (tmp);
   6.280 +  return lhs;
   6.281 +}
   6.282 +template <typename T, typename U>
   6.283 +TracedValue<T> &operator |= (TracedValue<T> &lhs, const U &rhs) {
   6.284 +  TRACE ("x|=");
   6.285 +  T tmp = lhs.Get ();
   6.286 +  tmp |= rhs;
   6.287 +  lhs.Set (tmp);
   6.288 +  return lhs;
   6.289 +}
   6.290 +template <typename T, typename U>
   6.291 +TracedValue<T> &operator ^= (TracedValue<T> &lhs, const U &rhs) {
   6.292 +  TRACE ("x^=");
   6.293 +  T tmp = lhs.Get ();
   6.294 +  tmp ^= rhs;
   6.295 +  lhs.Set (tmp);
   6.296 +  return lhs;
   6.297 +}
   6.298 +template <typename T, typename U>
   6.299 +TracedValue<T> operator + (const TracedValue<T> &lhs, const TracedValue<U> &rhs) {
   6.300 +  TRACE ("x+x");
   6.301 +  return TracedValue<T> (lhs.Get () + rhs.Get ());
   6.302 +}
   6.303 +template <typename T, typename U>
   6.304 +TracedValue<T> operator + (const TracedValue<T> &lhs, const U &rhs) {
   6.305 +  TRACE ("x+");
   6.306 +  return TracedValue<T> (lhs.Get () + rhs);
   6.307 +}
   6.308 +template <typename T, typename U>
   6.309 +TracedValue<T> operator + (const U &lhs, const TracedValue<T> &rhs) {
   6.310 +  TRACE ("+x");
   6.311 +  return TracedValue<T> (lhs + rhs.Get ());
   6.312 +}
   6.313 +
   6.314 +template <typename T, typename U>
   6.315 +TracedValue<T> operator - (const TracedValue<T> &lhs, const TracedValue<U> &rhs) {
   6.316 +  TRACE ("x-x");
   6.317 +  return TracedValue<T> (lhs.Get () - rhs.Get ());
   6.318 +}
   6.319 +template <typename T, typename U>
   6.320 +TracedValue<T> operator - (const TracedValue<T> &lhs, const U &rhs) {
   6.321 +  TRACE ("x-");
   6.322 +  return TracedValue<T> (lhs.Get () - rhs);
   6.323 +}
   6.324 +template <typename T, typename U>
   6.325 +TracedValue<T> operator - (const U &lhs, const TracedValue<T> &rhs) {
   6.326 +  TRACE ("-x");
   6.327 +  return TracedValue<T> (lhs - rhs.Get ());
   6.328 +}
   6.329 +
   6.330 +template <typename T, typename U>
   6.331 +TracedValue<T> operator * (const TracedValue<T> &lhs, const TracedValue<U> &rhs) {
   6.332 +  TRACE ("x*x");
   6.333 +  return TracedValue<T> (lhs.Get () * rhs.Get ());
   6.334 +}
   6.335 +template <typename T, typename U>
   6.336 +TracedValue<T> operator * (const TracedValue<T> &lhs, const U &rhs) {
   6.337 +  TRACE ("x*");
   6.338 +  return TracedValue<T> (lhs.Get () * rhs);
   6.339 +}
   6.340 +template <typename T, typename U>
   6.341 +TracedValue<T> operator * (const U &lhs, const TracedValue<T> &rhs) {
   6.342 +  TRACE ("*x");
   6.343 +  return TracedValue<T> (lhs - rhs.Get ());
   6.344 +}
   6.345 +
   6.346 +template <typename T, typename U>
   6.347 +TracedValue<T> operator / (const TracedValue<T> &lhs, const TracedValue<U> &rhs) {
   6.348 +  TRACE ("x/x");
   6.349 +  return TracedValue<T> (lhs.Get () / rhs.Get ());
   6.350 +}
   6.351 +template <typename T, typename U>
   6.352 +TracedValue<T> operator / (const TracedValue<T> &lhs, const U &rhs) {
   6.353 +  TRACE ("x/");
   6.354 +  return TracedValue<T> (lhs.Get () / rhs);
   6.355 +}
   6.356 +template <typename T, typename U>
   6.357 +TracedValue<T> operator / (const U &lhs, const TracedValue<T> &rhs) {
   6.358 +  TRACE ("/x");
   6.359 +  return TracedValue<T> (lhs / rhs.Get ());
   6.360 +}
   6.361 +
   6.362 +template <typename T, typename U>
   6.363 +TracedValue<T> operator % (const TracedValue<T> &lhs, const TracedValue<U> &rhs) {
   6.364 +  TRACE ("x%x");
   6.365 +  return TracedValue<T> (lhs.Get () % rhs.Get ());
   6.366 +}
   6.367 +template <typename T, typename U>
   6.368 +TracedValue<T> operator % (const TracedValue<T> &lhs, const U &rhs) {
   6.369 +  TRACE ("x%");
   6.370 +  return TracedValue<T> (lhs.Get () % rhs);
   6.371 +}
   6.372 +template <typename T, typename U>
   6.373 +TracedValue<T> operator % (const U &lhs, const TracedValue<T> &rhs) {
   6.374 +  TRACE ("%x");
   6.375 +  return TracedValue<T> (lhs % rhs.Get ());
   6.376 +}
   6.377 +
   6.378 +template <typename T, typename U>
   6.379 +TracedValue<T> operator ^ (const TracedValue<T> &lhs, const TracedValue<U> &rhs) {
   6.380 +  TRACE ("x^x");
   6.381 +  return TracedValue<T> (lhs.Get () ^ rhs.Get ());
   6.382 +}
   6.383 +template <typename T, typename U>
   6.384 +TracedValue<T> operator ^ (const TracedValue<T> &lhs, const U &rhs) {
   6.385 +  TRACE ("x^");
   6.386 +  return TracedValue<T> (lhs.Get () ^ rhs);
   6.387 +}
   6.388 +template <typename T, typename U>
   6.389 +TracedValue<T> operator ^ (const U &lhs, const TracedValue<T> &rhs) {
   6.390 +  TRACE ("^x");
   6.391 +  return TracedValue<T> (lhs ^ rhs.Get ());
   6.392 +}
   6.393 +
   6.394 +template <typename T, typename U>
   6.395 +TracedValue<T> operator | (const TracedValue<T> &lhs, const TracedValue<U> &rhs) {
   6.396 +  TRACE ("x|x");
   6.397 +  return TracedValue<T> (lhs.Get () | rhs.Get ());
   6.398 +}
   6.399 +template <typename T, typename U>
   6.400 +TracedValue<T> operator | (const TracedValue<T> &lhs, const U &rhs) {
   6.401 +  TRACE ("x|");
   6.402 +  return TracedValue<T> (lhs.Get () | rhs);
   6.403 +}
   6.404 +template <typename T, typename U>
   6.405 +TracedValue<T> operator | (const U &lhs, const TracedValue<T> &rhs) {
   6.406 +  TRACE ("|x");
   6.407 +  return TracedValue<T> (lhs | rhs.Get ());
   6.408 +}
   6.409 +
   6.410 +template <typename T, typename U>
   6.411 +TracedValue<T> operator & (const TracedValue<T> &lhs, const TracedValue<U> &rhs) {
   6.412 +  TRACE ("x&x");
   6.413 +  return TracedValue<T> (lhs.Get () & rhs.Get ());
   6.414 +}
   6.415 +template <typename T, typename U>
   6.416 +TracedValue<T> operator & (const TracedValue<T> &lhs, const U &rhs) {
   6.417 +  TRACE ("x&");
   6.418 +  return TracedValue<T> (lhs.Get () & rhs);
   6.419 +}
   6.420 +template <typename T, typename U>
   6.421 +TracedValue<T> operator & (const U &lhs, const TracedValue<T> &rhs) {
   6.422 +  TRACE ("&x");
   6.423 +  return TracedValue<T> (lhs & rhs.Get ());
   6.424 +}
   6.425 +
   6.426 +template <typename T, typename U>
   6.427 +TracedValue<T> operator << (const TracedValue<T> &lhs, const TracedValue<U> &rhs) {
   6.428 +  TRACE ("x<<x");
   6.429 +  return TracedValue<T> (lhs.Get () << rhs.Get ());
   6.430 +}
   6.431 +template <typename T, typename U>
   6.432 +TracedValue<T> operator << (const TracedValue<T> &lhs, const U &rhs) {
   6.433 +  TRACE ("x<<");
   6.434 +  return TracedValue<T> (lhs.Get () << rhs);
   6.435 +}
   6.436 +template <typename T, typename U>
   6.437 +TracedValue<T> operator << (const U &lhs, const TracedValue<T> &rhs) {
   6.438 +  TRACE ("<<x");
   6.439 +  return TracedValue<T> (lhs << rhs.Get ());
   6.440 +}
   6.441 +
   6.442 +template <typename T, typename U>
   6.443 +TracedValue<T> operator >> (const TracedValue<T> &lhs, const TracedValue<U> &rhs) {
   6.444 +  TRACE ("x>>x");
   6.445 +  return TracedValue<T> (lhs.Get () >> rhs.Get ());
   6.446 +}
   6.447 +template <typename T, typename U>
   6.448 +TracedValue<T> operator >> (const TracedValue<T> &lhs, const U &rhs) {
   6.449 +  TRACE ("x>>");
   6.450 +  return TracedValue<T> (lhs.Get () >> rhs);
   6.451 +}
   6.452 +template <typename T, typename U>
   6.453 +TracedValue<T> operator >> (const U &lhs, const TracedValue<T> &rhs) {
   6.454 +  TRACE (">>x");
   6.455 +  return TracedValue<T> (lhs >> rhs.Get ());
   6.456 +}
   6.457 +
   6.458 +
   6.459 +template <typename T>
   6.460 +TracedValue<T> operator + (const TracedValue<T> &lhs) {
   6.461 +  TRACE ("(+x)");
   6.462 +  return TracedValue<T> (+lhs.Get ());
   6.463 +}
   6.464 +template <typename T>
   6.465 +TracedValue<T> operator - (const TracedValue<T> &lhs) {
   6.466 +  TRACE ("(-x)");
   6.467 +  return TracedValue<T> (-lhs.Get ());
   6.468 +}
   6.469 +template <typename T>
   6.470 +TracedValue<T> operator ~ (const TracedValue<T> &lhs) {
   6.471 +  TRACE ("(~x)");
   6.472 +  return TracedValue<T> (~lhs.Get ());
   6.473 +}
   6.474 +template <typename T>
   6.475 +TracedValue<T> operator ! (const TracedValue<T> &lhs) {
   6.476 +  TRACE ("(!x)");
   6.477 +  return TracedValue<T> (!lhs.Get ());
   6.478 +}
   6.479 +
   6.480 +
   6.481 +} // namespace ns3
   6.482 +
   6.483 +#endif /* TRACED_VALUE_H */
     7.1 --- a/src/core/value-trace-source.h	Tue Feb 26 18:33:10 2008 +0100
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,480 +0,0 @@
     7.4 -#ifndef VALUE_TRACE_SOURCE_H
     7.5 -#define VALUE_TRACE_SOURCE_H
     7.6 -
     7.7 -#include "event-trace-source.h"
     7.8 -#include "integer.h"
     7.9 -#include "uinteger.h"
    7.10 -#include "boolean.h"
    7.11 -#include "double.h"
    7.12 -#include "enum.h"
    7.13 -
    7.14 -#define TRACE(x)
    7.15 -
    7.16 -namespace ns3 {
    7.17 -
    7.18 -template <typename T>
    7.19 -class ValueTraceSource
    7.20 -{
    7.21 -public:
    7.22 -  ValueTraceSource ()
    7.23 -    : m_v () {}
    7.24 -  ValueTraceSource (const ValueTraceSource &o)
    7.25 -    : m_v (o.m_v) {}
    7.26 -  ValueTraceSource (const T &v)
    7.27 -    : m_v (v) {}
    7.28 -  operator T () const {
    7.29 -    return m_v;
    7.30 -  }
    7.31 -  ValueTraceSource &operator = (const ValueTraceSource &o) {
    7.32 -    TRACE ("x=");
    7.33 -    Set (o.m_v);
    7.34 -    return *this;
    7.35 -  }
    7.36 -  ValueTraceSource (const Integer &value) 
    7.37 -    : m_v (value.Get ()) {}
    7.38 -  operator Integer () const {
    7.39 -    return Integer (m_v);
    7.40 -  }
    7.41 -  ValueTraceSource (const Uinteger &value)
    7.42 -    : m_v (value.Get ()) {}
    7.43 -  operator Uinteger () const {
    7.44 -    return Uinteger (m_v);
    7.45 -  }
    7.46 -  ValueTraceSource (const Boolean &value)
    7.47 -    : m_v (value.Get ()) {}
    7.48 -  operator Boolean () const {
    7.49 -    return Boolean (m_v);
    7.50 -  }
    7.51 -  ValueTraceSource (const Enum &value)
    7.52 -    : m_v (value.Get ()) {}
    7.53 -  operator Enum () const {
    7.54 -    return Enum (m_v);
    7.55 -  }
    7.56 -  void Connect (const CallbackBase &cb) {
    7.57 -    m_cb.Connect (cb);
    7.58 -  }
    7.59 -  void Disconnect (const CallbackBase &cb) {
    7.60 -    m_cb.Disconnect (cb);
    7.61 -  }
    7.62 -  void Set (const T &v) {
    7.63 -    if (m_v != v)
    7.64 -      {
    7.65 -	m_cb (m_v, v);
    7.66 -	m_v = v;
    7.67 -      }
    7.68 -  }
    7.69 -  T Get (void) const {
    7.70 -    return m_v;
    7.71 -  }
    7.72 -  ValueTraceSource &operator++ () {
    7.73 -    TRACE ("++x");
    7.74 -    T tmp = Get ();
    7.75 -    ++tmp;
    7.76 -    Set (tmp);
    7.77 -    return *this;
    7.78 -  }
    7.79 -  ValueTraceSource &operator-- () {
    7.80 -    TRACE ("--x");
    7.81 -    T tmp = Get ();
    7.82 -    --tmp;
    7.83 -    Set (tmp);
    7.84 -    return *this;
    7.85 -  }
    7.86 -  ValueTraceSource operator++ (int) {
    7.87 -    TRACE ("x++");
    7.88 -    ValueTraceSource old (*this);
    7.89 -    T tmp = Get ();
    7.90 -    tmp++;
    7.91 -    Set (tmp);
    7.92 -    return old;
    7.93 -  }
    7.94 -  ValueTraceSource operator-- (int) {
    7.95 -    TRACE ("x--");
    7.96 -    ValueTraceSource old (*this);
    7.97 -    T tmp = Get ();
    7.98 -    tmp--;
    7.99 -    Set (tmp);
   7.100 -    return old;
   7.101 -  }
   7.102 -private:
   7.103 -  T m_v;
   7.104 -  EventTraceSource<T,T> m_cb;
   7.105 -};
   7.106 -
   7.107 -template <typename T, typename U>
   7.108 -bool operator == (const ValueTraceSource<T> &lhs, const ValueTraceSource<U> &rhs)
   7.109 -{
   7.110 -  TRACE ("x==x");
   7.111 -  return lhs.Get () == rhs.Get ();
   7.112 -}
   7.113 -template <typename T, typename U>
   7.114 -bool operator == (const ValueTraceSource<T> &lhs, const U &rhs)
   7.115 -{
   7.116 -  TRACE ("x==");
   7.117 -  return lhs.Get () == rhs;
   7.118 -}
   7.119 -template <typename T, typename U>
   7.120 -bool operator == (const U &lhs, const ValueTraceSource<T> &rhs)
   7.121 -{
   7.122 -  TRACE ("==x");
   7.123 -  return lhs == rhs.Get ();
   7.124 -}
   7.125 -
   7.126 -template <typename T, typename U>
   7.127 -bool operator != (const ValueTraceSource<T> &lhs, const ValueTraceSource<U> &rhs)
   7.128 -{
   7.129 -  TRACE ("x!=x");
   7.130 -  return lhs.Get () != rhs.Get ();
   7.131 -}
   7.132 -template <typename T, typename U>
   7.133 -bool operator != (const ValueTraceSource<T> &lhs, const U &rhs)
   7.134 -{
   7.135 -  TRACE ("x!=");
   7.136 -  return lhs.Get () != rhs;
   7.137 -}
   7.138 -template <typename T, typename U>
   7.139 -bool operator != (const U &lhs, const ValueTraceSource<T> &rhs)
   7.140 -{
   7.141 -  TRACE ("!=x");
   7.142 -  return lhs != rhs.Get ();
   7.143 -}
   7.144 -
   7.145 -template <typename T, typename U>
   7.146 -bool operator <= (const ValueTraceSource<T> &lhs, const ValueTraceSource<U> &rhs)
   7.147 -{
   7.148 -  TRACE ("x<=x");
   7.149 -  return lhs.Get () <= rhs.Get ();
   7.150 -}
   7.151 -template <typename T, typename U>
   7.152 -bool operator <= (const ValueTraceSource<T> &lhs, const U &rhs)
   7.153 -{
   7.154 -  TRACE ("x<=");
   7.155 -  return lhs.Get () <= rhs;
   7.156 -}
   7.157 -template <typename T, typename U>
   7.158 -bool operator <= (const U &lhs, const ValueTraceSource<T> &rhs)
   7.159 -{
   7.160 -  TRACE ("<=x");
   7.161 -  return lhs <= rhs.Get ();
   7.162 -}
   7.163 -template <typename T, typename U>
   7.164 -bool operator >= (const ValueTraceSource<T> &lhs, const ValueTraceSource<U> &rhs)
   7.165 -{
   7.166 -  TRACE ("x>=x");
   7.167 -  return lhs.Get () >= rhs.Get ();
   7.168 -}
   7.169 -template <typename T, typename U>
   7.170 -bool operator >= (const ValueTraceSource<T> &lhs, const U &rhs)
   7.171 -{
   7.172 -  TRACE ("x>=");
   7.173 -  return lhs.Get () >= rhs;
   7.174 -}
   7.175 -template <typename T, typename U>
   7.176 -bool operator >= (const U &lhs, const ValueTraceSource<T> &rhs)
   7.177 -{
   7.178 -  TRACE (">=x");
   7.179 -  return lhs >= rhs.Get ();
   7.180 -}
   7.181 -
   7.182 -template <typename T, typename U>
   7.183 -bool operator < (const ValueTraceSource<T> &lhs, const ValueTraceSource<U> &rhs)
   7.184 -{
   7.185 -  TRACE ("x<x");
   7.186 -  return lhs.Get () < rhs.Get ();
   7.187 -}
   7.188 -template <typename T, typename U>
   7.189 -bool operator < (const ValueTraceSource<T> &lhs, const U &rhs)
   7.190 -{
   7.191 -  TRACE ("x<");
   7.192 -  return lhs.Get () < rhs;
   7.193 -}
   7.194 -template <typename T, typename U>
   7.195 -bool operator < (const U &lhs, const ValueTraceSource<T> &rhs)
   7.196 -{
   7.197 -  TRACE ("<x");
   7.198 -  return lhs < rhs.Get ();
   7.199 -}
   7.200 -template <typename T, typename U>
   7.201 -bool operator > (const ValueTraceSource<T> &lhs, const ValueTraceSource<U> &rhs)
   7.202 -{
   7.203 -  TRACE ("x>x");
   7.204 -  return lhs.Get () > rhs.Get ();
   7.205 -}
   7.206 -template <typename T, typename U>
   7.207 -bool operator > (const ValueTraceSource<T> &lhs, const U &rhs)
   7.208 -{
   7.209 -  TRACE ("x>");
   7.210 -  return lhs.Get () > rhs;
   7.211 -}
   7.212 -template <typename T, typename U>
   7.213 -bool operator > (const U &lhs, const ValueTraceSource<T> &rhs)
   7.214 -{
   7.215 -  TRACE (">x");
   7.216 -  return lhs > rhs.Get ();
   7.217 -}
   7.218 -template <typename T, typename U>
   7.219 -ValueTraceSource<T> &operator += (ValueTraceSource<T> &lhs, const U &rhs) {
   7.220 -  TRACE ("x+=");
   7.221 -  T tmp = lhs.Get ();
   7.222 -  tmp += rhs;
   7.223 -  lhs.Set (tmp);
   7.224 -  return lhs;
   7.225 -}
   7.226 -template <typename T, typename U>
   7.227 -ValueTraceSource<T> &operator -= (ValueTraceSource<T> &lhs, const U &rhs) {
   7.228 -  TRACE ("x-=");
   7.229 -  T tmp = lhs.Get ();
   7.230 -  tmp -= rhs;
   7.231 -  lhs.Set (tmp);
   7.232 -  return lhs;
   7.233 -}
   7.234 -template <typename T, typename U>
   7.235 -ValueTraceSource<T> &operator *= (ValueTraceSource<T> &lhs, const U &rhs) {
   7.236 -  TRACE ("x*=");
   7.237 -  T tmp = lhs.Get ();
   7.238 -  tmp *= rhs;
   7.239 -  lhs.Set (tmp);
   7.240 -  return lhs;
   7.241 -}
   7.242 -template <typename T, typename U>
   7.243 -ValueTraceSource<T> &operator /= (ValueTraceSource<T> &lhs, const U &rhs) {
   7.244 -  TRACE ("x/=");
   7.245 -  T tmp = lhs.Get ();
   7.246 -  tmp /= rhs;
   7.247 -  lhs.Set (tmp);
   7.248 -  return lhs;
   7.249 -}
   7.250 -template <typename T, typename U>
   7.251 -ValueTraceSource<T> &operator %= (ValueTraceSource<T> &lhs, const U &rhs) {
   7.252 -  TRACE ("x%=");
   7.253 -  T tmp = lhs.Get ();
   7.254 -  tmp %= rhs;
   7.255 -  lhs.Set (tmp);
   7.256 -  return lhs;
   7.257 -}
   7.258 -template <typename T, typename U>
   7.259 -ValueTraceSource<T> &operator <<= (ValueTraceSource<T> &lhs, const U &rhs) {
   7.260 -  TRACE ("x<<=");
   7.261 -  T tmp = lhs.Get ();
   7.262 -  tmp <<= rhs;
   7.263 -  lhs.Set (tmp);
   7.264 -  return lhs;
   7.265 -}
   7.266 -template <typename T, typename U>
   7.267 -ValueTraceSource<T> &operator >>= (ValueTraceSource<T> &lhs, const U &rhs) {
   7.268 -  TRACE ("x>>=");
   7.269 -  T tmp = lhs.Get ();
   7.270 -  tmp >>= rhs;
   7.271 -  lhs.Set (tmp);
   7.272 -  return lhs;
   7.273 -}
   7.274 -template <typename T, typename U>
   7.275 -ValueTraceSource<T> &operator &= (ValueTraceSource<T> &lhs, const U &rhs) {
   7.276 -  TRACE ("x&=");
   7.277 -  T tmp = lhs.Get ();
   7.278 -  tmp &= rhs;
   7.279 -  lhs.Set (tmp);
   7.280 -  return lhs;
   7.281 -}
   7.282 -template <typename T, typename U>
   7.283 -ValueTraceSource<T> &operator |= (ValueTraceSource<T> &lhs, const U &rhs) {
   7.284 -  TRACE ("x|=");
   7.285 -  T tmp = lhs.Get ();
   7.286 -  tmp |= rhs;
   7.287 -  lhs.Set (tmp);
   7.288 -  return lhs;
   7.289 -}
   7.290 -template <typename T, typename U>
   7.291 -ValueTraceSource<T> &operator ^= (ValueTraceSource<T> &lhs, const U &rhs) {
   7.292 -  TRACE ("x^=");
   7.293 -  T tmp = lhs.Get ();
   7.294 -  tmp ^= rhs;
   7.295 -  lhs.Set (tmp);
   7.296 -  return lhs;
   7.297 -}
   7.298 -template <typename T, typename U>
   7.299 -ValueTraceSource<T> operator + (const ValueTraceSource<T> &lhs, const ValueTraceSource<U> &rhs) {
   7.300 -  TRACE ("x+x");
   7.301 -  return ValueTraceSource<T> (lhs.Get () + rhs.Get ());
   7.302 -}
   7.303 -template <typename T, typename U>
   7.304 -ValueTraceSource<T> operator + (const ValueTraceSource<T> &lhs, const U &rhs) {
   7.305 -  TRACE ("x+");
   7.306 -  return ValueTraceSource<T> (lhs.Get () + rhs);
   7.307 -}
   7.308 -template <typename T, typename U>
   7.309 -ValueTraceSource<T> operator + (const U &lhs, const ValueTraceSource<T> &rhs) {
   7.310 -  TRACE ("+x");
   7.311 -  return ValueTraceSource<T> (lhs + rhs.Get ());
   7.312 -}
   7.313 -
   7.314 -template <typename T, typename U>
   7.315 -ValueTraceSource<T> operator - (const ValueTraceSource<T> &lhs, const ValueTraceSource<U> &rhs) {
   7.316 -  TRACE ("x-x");
   7.317 -  return ValueTraceSource<T> (lhs.Get () - rhs.Get ());
   7.318 -}
   7.319 -template <typename T, typename U>
   7.320 -ValueTraceSource<T> operator - (const ValueTraceSource<T> &lhs, const U &rhs) {
   7.321 -  TRACE ("x-");
   7.322 -  return ValueTraceSource<T> (lhs.Get () - rhs);
   7.323 -}
   7.324 -template <typename T, typename U>
   7.325 -ValueTraceSource<T> operator - (const U &lhs, const ValueTraceSource<T> &rhs) {
   7.326 -  TRACE ("-x");
   7.327 -  return ValueTraceSource<T> (lhs - rhs.Get ());
   7.328 -}
   7.329 -
   7.330 -template <typename T, typename U>
   7.331 -ValueTraceSource<T> operator * (const ValueTraceSource<T> &lhs, const ValueTraceSource<U> &rhs) {
   7.332 -  TRACE ("x*x");
   7.333 -  return ValueTraceSource<T> (lhs.Get () * rhs.Get ());
   7.334 -}
   7.335 -template <typename T, typename U>
   7.336 -ValueTraceSource<T> operator * (const ValueTraceSource<T> &lhs, const U &rhs) {
   7.337 -  TRACE ("x*");
   7.338 -  return ValueTraceSource<T> (lhs.Get () * rhs);
   7.339 -}
   7.340 -template <typename T, typename U>
   7.341 -ValueTraceSource<T> operator * (const U &lhs, const ValueTraceSource<T> &rhs) {
   7.342 -  TRACE ("*x");
   7.343 -  return ValueTraceSource<T> (lhs - rhs.Get ());
   7.344 -}
   7.345 -
   7.346 -template <typename T, typename U>
   7.347 -ValueTraceSource<T> operator / (const ValueTraceSource<T> &lhs, const ValueTraceSource<U> &rhs) {
   7.348 -  TRACE ("x/x");
   7.349 -  return ValueTraceSource<T> (lhs.Get () / rhs.Get ());
   7.350 -}
   7.351 -template <typename T, typename U>
   7.352 -ValueTraceSource<T> operator / (const ValueTraceSource<T> &lhs, const U &rhs) {
   7.353 -  TRACE ("x/");
   7.354 -  return ValueTraceSource<T> (lhs.Get () / rhs);
   7.355 -}
   7.356 -template <typename T, typename U>
   7.357 -ValueTraceSource<T> operator / (const U &lhs, const ValueTraceSource<T> &rhs) {
   7.358 -  TRACE ("/x");
   7.359 -  return ValueTraceSource<T> (lhs / rhs.Get ());
   7.360 -}
   7.361 -
   7.362 -template <typename T, typename U>
   7.363 -ValueTraceSource<T> operator % (const ValueTraceSource<T> &lhs, const ValueTraceSource<U> &rhs) {
   7.364 -  TRACE ("x%x");
   7.365 -  return ValueTraceSource<T> (lhs.Get () % rhs.Get ());
   7.366 -}
   7.367 -template <typename T, typename U>
   7.368 -ValueTraceSource<T> operator % (const ValueTraceSource<T> &lhs, const U &rhs) {
   7.369 -  TRACE ("x%");
   7.370 -  return ValueTraceSource<T> (lhs.Get () % rhs);
   7.371 -}
   7.372 -template <typename T, typename U>
   7.373 -ValueTraceSource<T> operator % (const U &lhs, const ValueTraceSource<T> &rhs) {
   7.374 -  TRACE ("%x");
   7.375 -  return ValueTraceSource<T> (lhs % rhs.Get ());
   7.376 -}
   7.377 -
   7.378 -template <typename T, typename U>
   7.379 -ValueTraceSource<T> operator ^ (const ValueTraceSource<T> &lhs, const ValueTraceSource<U> &rhs) {
   7.380 -  TRACE ("x^x");
   7.381 -  return ValueTraceSource<T> (lhs.Get () ^ rhs.Get ());
   7.382 -}
   7.383 -template <typename T, typename U>
   7.384 -ValueTraceSource<T> operator ^ (const ValueTraceSource<T> &lhs, const U &rhs) {
   7.385 -  TRACE ("x^");
   7.386 -  return ValueTraceSource<T> (lhs.Get () ^ rhs);
   7.387 -}
   7.388 -template <typename T, typename U>
   7.389 -ValueTraceSource<T> operator ^ (const U &lhs, const ValueTraceSource<T> &rhs) {
   7.390 -  TRACE ("^x");
   7.391 -  return ValueTraceSource<T> (lhs ^ rhs.Get ());
   7.392 -}
   7.393 -
   7.394 -template <typename T, typename U>
   7.395 -ValueTraceSource<T> operator | (const ValueTraceSource<T> &lhs, const ValueTraceSource<U> &rhs) {
   7.396 -  TRACE ("x|x");
   7.397 -  return ValueTraceSource<T> (lhs.Get () | rhs.Get ());
   7.398 -}
   7.399 -template <typename T, typename U>
   7.400 -ValueTraceSource<T> operator | (const ValueTraceSource<T> &lhs, const U &rhs) {
   7.401 -  TRACE ("x|");
   7.402 -  return ValueTraceSource<T> (lhs.Get () | rhs);
   7.403 -}
   7.404 -template <typename T, typename U>
   7.405 -ValueTraceSource<T> operator | (const U &lhs, const ValueTraceSource<T> &rhs) {
   7.406 -  TRACE ("|x");
   7.407 -  return ValueTraceSource<T> (lhs | rhs.Get ());
   7.408 -}
   7.409 -
   7.410 -template <typename T, typename U>
   7.411 -ValueTraceSource<T> operator & (const ValueTraceSource<T> &lhs, const ValueTraceSource<U> &rhs) {
   7.412 -  TRACE ("x&x");
   7.413 -  return ValueTraceSource<T> (lhs.Get () & rhs.Get ());
   7.414 -}
   7.415 -template <typename T, typename U>
   7.416 -ValueTraceSource<T> operator & (const ValueTraceSource<T> &lhs, const U &rhs) {
   7.417 -  TRACE ("x&");
   7.418 -  return ValueTraceSource<T> (lhs.Get () & rhs);
   7.419 -}
   7.420 -template <typename T, typename U>
   7.421 -ValueTraceSource<T> operator & (const U &lhs, const ValueTraceSource<T> &rhs) {
   7.422 -  TRACE ("&x");
   7.423 -  return ValueTraceSource<T> (lhs & rhs.Get ());
   7.424 -}
   7.425 -
   7.426 -template <typename T, typename U>
   7.427 -ValueTraceSource<T> operator << (const ValueTraceSource<T> &lhs, const ValueTraceSource<U> &rhs) {
   7.428 -  TRACE ("x<<x");
   7.429 -  return ValueTraceSource<T> (lhs.Get () << rhs.Get ());
   7.430 -}
   7.431 -template <typename T, typename U>
   7.432 -ValueTraceSource<T> operator << (const ValueTraceSource<T> &lhs, const U &rhs) {
   7.433 -  TRACE ("x<<");
   7.434 -  return ValueTraceSource<T> (lhs.Get () << rhs);
   7.435 -}
   7.436 -template <typename T, typename U>
   7.437 -ValueTraceSource<T> operator << (const U &lhs, const ValueTraceSource<T> &rhs) {
   7.438 -  TRACE ("<<x");
   7.439 -  return ValueTraceSource<T> (lhs << rhs.Get ());
   7.440 -}
   7.441 -
   7.442 -template <typename T, typename U>
   7.443 -ValueTraceSource<T> operator >> (const ValueTraceSource<T> &lhs, const ValueTraceSource<U> &rhs) {
   7.444 -  TRACE ("x>>x");
   7.445 -  return ValueTraceSource<T> (lhs.Get () >> rhs.Get ());
   7.446 -}
   7.447 -template <typename T, typename U>
   7.448 -ValueTraceSource<T> operator >> (const ValueTraceSource<T> &lhs, const U &rhs) {
   7.449 -  TRACE ("x>>");
   7.450 -  return ValueTraceSource<T> (lhs.Get () >> rhs);
   7.451 -}
   7.452 -template <typename T, typename U>
   7.453 -ValueTraceSource<T> operator >> (const U &lhs, const ValueTraceSource<T> &rhs) {
   7.454 -  TRACE (">>x");
   7.455 -  return ValueTraceSource<T> (lhs >> rhs.Get ());
   7.456 -}
   7.457 -
   7.458 -
   7.459 -template <typename T>
   7.460 -ValueTraceSource<T> operator + (const ValueTraceSource<T> &lhs) {
   7.461 -  TRACE ("(+x)");
   7.462 -  return ValueTraceSource<T> (+lhs.Get ());
   7.463 -}
   7.464 -template <typename T>
   7.465 -ValueTraceSource<T> operator - (const ValueTraceSource<T> &lhs) {
   7.466 -  TRACE ("(-x)");
   7.467 -  return ValueTraceSource<T> (-lhs.Get ());
   7.468 -}
   7.469 -template <typename T>
   7.470 -ValueTraceSource<T> operator ~ (const ValueTraceSource<T> &lhs) {
   7.471 -  TRACE ("(~x)");
   7.472 -  return ValueTraceSource<T> (~lhs.Get ());
   7.473 -}
   7.474 -template <typename T>
   7.475 -ValueTraceSource<T> operator ! (const ValueTraceSource<T> &lhs) {
   7.476 -  TRACE ("(!x)");
   7.477 -  return ValueTraceSource<T> (!lhs.Get ());
   7.478 -}
   7.479 -
   7.480 -
   7.481 -} // namespace ns3
   7.482 -
   7.483 -#endif /* VALUE_TRACE_SOURCE_H */
     8.1 --- a/src/core/wscript	Tue Feb 26 18:33:10 2008 +0100
     8.2 +++ b/src/core/wscript	Tue Feb 26 19:51:33 2008 +0100
     8.3 @@ -63,7 +63,7 @@
     8.4          'object-factory.cc',
     8.5          'object-vector.cc',
     8.6          'global-value.cc',
     8.7 -        'event-trace-source.cc',
     8.8 +        'traced-callback.cc',
     8.9          'trace-source-accessor.cc',
    8.10          'config.cc',
    8.11          ]
    8.12 @@ -120,8 +120,8 @@
    8.13          'object-factory.h',
    8.14          'attribute-helper.h',
    8.15          'global-value.h',
    8.16 -        'event-trace-source.h',
    8.17 -        'value-trace-source.h',
    8.18 +        'traced-callback.h',
    8.19 +        'traced-value.h',
    8.20          'trace-source-accessor.h',
    8.21          'config.h',
    8.22          'object-vector.h',