src/core/traced-callback.h
changeset 2531 b451b5fc8b57
parent 2482 adbc284a5849
child 2569 d5cff2968984
     1.1 --- a/src/core/traced-callback.h	Tue Feb 26 19:51:33 2008 +0100
     1.2 +++ b/src/core/traced-callback.h	Sun Mar 02 21:00:37 2008 +0100
     1.3 @@ -41,6 +41,7 @@
     1.4  public:
     1.5    TracedCallback ();
     1.6    void Connect (const CallbackBase & callback);
     1.7 +  void ConnectWithContext (const CallbackBase & callback, std::string path);
     1.8    void Disconnect (const CallbackBase & callback);
     1.9    void operator() (void) const;
    1.10    void operator() (T1 a1) const;
    1.11 @@ -48,7 +49,7 @@
    1.12    void operator() (T1 a1, T2 a2, T3 a3) const;
    1.13    void operator() (T1 a1, T2 a2, T3 a3, T4 a4) const;
    1.14  
    1.15 -private:
    1.16 +private:  
    1.17    typedef std::list<Callback<void,T1,T2,T3,T4> > CallbackList;
    1.18    CallbackList m_callbackList;
    1.19  };
    1.20 @@ -59,7 +60,6 @@
    1.21  
    1.22  namespace ns3 {
    1.23  
    1.24 -
    1.25  template<typename T1, typename T2, 
    1.26           typename T3, typename T4>
    1.27  TracedCallback<T1,T2,T3,T4>::TracedCallback ()
    1.28 @@ -77,6 +77,16 @@
    1.29  template<typename T1, typename T2, 
    1.30           typename T3, typename T4>
    1.31  void 
    1.32 +TracedCallback<T1,T2,T3,T4>::ConnectWithContext (const CallbackBase & callback, std::string path)
    1.33 +{
    1.34 +  Callback<void,std::string,T1,T2,T3,T4> cb;
    1.35 +  cb.Assign (callback);
    1.36 +  Callback<void,T1,T2,T3,T4> realCb = cb.Bind (path);
    1.37 +  m_callbackList.push_back (realCb);
    1.38 +}
    1.39 +template<typename T1, typename T2, 
    1.40 +         typename T3, typename T4>
    1.41 +void 
    1.42  TracedCallback<T1,T2,T3,T4>::Disconnect (const CallbackBase & callback)
    1.43  {
    1.44    for (typename CallbackList::iterator i = m_callbackList.begin ();