src/common/trace-container.h
changeset 315 ed16b2078aa4
parent 286 57e6a2006962
equal deleted inserted replaced
314:2a105293177d 315:ed16b2078aa4
    66    * \param callback the callback being connected to the target event source
    66    * \param callback the callback being connected to the target event source
    67    *
    67    *
    68    * This method targets only event sources which are variables of any unsigned
    68    * This method targets only event sources which are variables of any unsigned
    69    * integer type.
    69    * integer type.
    70    */
    70    */
    71   void SetUiVariableCallback (char const *name, 
    71   void SetUiVariableCallback (std::string const &name,
    72                      Callback<void,uint64_t, uint64_t> callback);
    72                      Callback<void,uint64_t, uint64_t> callback);
    73   /**
    73   /**
    74    * \param name the name of the target event source
    74    * \param name the name of the target event source
    75    * \param callback the callback being connected to the target event source
    75    * \param callback the callback being connected to the target event source
    76    *
    76    *
    77    * This method targets only event sources which are variables of any signed
    77    * This method targets only event sources which are variables of any signed
    78    * integer type.
    78    * integer type.
    79    */
    79    */
    80   void SetSiVariableCallback (char const *name, Callback<void,int64_t, int64_t> callback);
    80   void SetSiVariableCallback (std::string const &name, Callback<void,int64_t, int64_t> callback);
    81   /**
    81   /**
    82    * \param name the name of the target event source
    82    * \param name the name of the target event source
    83    * \param callback the callback being connected to the target event source
    83    * \param callback the callback being connected to the target event source
    84    *
    84    *
    85    * This method targets only event sources which are variables of any double type.
    85    * This method targets only event sources which are variables of any double type.
    86    */
    86    */
    87   void SetFVariableCallback (char const *name, Callback<void,double, double> callback);
    87   void SetFVariableCallback (std::string const &name, Callback<void,double, double> callback);
    88   /**
    88   /**
    89    * \param name the name of the target event source
    89    * \param name the name of the target event source
    90    * \param os the output stream being connected to the source trace stream
    90    * \param os the output stream being connected to the source trace stream
    91    *
    91    *
    92    * This method targets only event sources which are of type StreamTracer.
    92    * This method targets only event sources which are of type StreamTracer.
    93    */
    93    */
    94   void SetStream (char const *name, std::ostream *os);
    94   void SetStream (std::string const &name, std::ostream *os);
    95 
    95 
    96   /**
    96   /**
    97    * \param name the name of the target event source
    97    * \param name the name of the target event source
    98    * \param callback the callback being connected to the target event source.
    98    * \param callback the callback being connected to the target event source.
    99    *
    99    *
   100    * This method targets only event sources which are of type CallbackTracer<T1>
   100    * This method targets only event sources which are of type CallbackTracer<T1>
   101    */
   101    */
   102   template <typename T1>
   102   template <typename T1>
   103   void SetCallback (char const *name, Callback<void,T1> callback);
   103   void SetCallback (std::string const &name, Callback<void,T1> callback);
   104   /**
   104   /**
   105    * \param name the name of the target event source
   105    * \param name the name of the target event source
   106    * \param callback the callback being connected to the target event source.
   106    * \param callback the callback being connected to the target event source.
   107    *
   107    *
   108    * This method targets only event sources which are of type CallbackTracer<T1,T2>
   108    * This method targets only event sources which are of type CallbackTracer<T1,T2>
   109    */
   109    */
   110   template <typename T1, typename T2>
   110   template <typename T1, typename T2>
   111   void SetCallback (char const *name, Callback<void,T1,T2> callback);
   111   void SetCallback (std::string const &name, Callback<void,T1,T2> callback);
   112   /**
   112   /**
   113    * \param name the name of the target event source
   113    * \param name the name of the target event source
   114    * \param callback the callback being connected to the target event source.
   114    * \param callback the callback being connected to the target event source.
   115    *
   115    *
   116    * This method targets only event sources which are of type CallbackTracer<T1,T2,T3>
   116    * This method targets only event sources which are of type CallbackTracer<T1,T2,T3>
   117    */
   117    */
   118   template <typename T1, typename T2, typename T3>
   118   template <typename T1, typename T2, typename T3>
   119   void SetCallback (char const *name, Callback<void,T1,T2,T3> callback);
   119   void SetCallback (std::string const &name, Callback<void,T1,T2,T3> callback);
   120   /**
   120   /**
   121    * \param name the name of the target event source
   121    * \param name the name of the target event source
   122    * \param callback the callback being connected to the target event source.
   122    * \param callback the callback being connected to the target event source.
   123    *
   123    *
   124    * This method targets only event sources which are of type CallbackTracer<T1,T2,T3,T4>
   124    * This method targets only event sources which are of type CallbackTracer<T1,T2,T3,T4>
   125    */
   125    */
   126   template <typename T1, typename T2, typename T3, typename T4>
   126   template <typename T1, typename T2, typename T3, typename T4>
   127   void SetCallback (char const *name, Callback<void,T1,T2,T3,T4> callback);
   127   void SetCallback (std::string const&name, Callback<void,T1,T2,T3,T4> callback);
   128   /**
   128   /**
   129    * \param name the name of the target event source
   129    * \param name the name of the target event source
   130    * \param callback the callback being connected to the target event source.
   130    * \param callback the callback being connected to the target event source.
   131    *
   131    *
   132    * This method targets only event sources which are of type CallbackTracer<T1,T2,T3,T4,T5>
   132    * This method targets only event sources which are of type CallbackTracer<T1,T2,T3,T4,T5>
   133    */
   133    */
   134   template <typename T1, typename T2, typename T3, typename T4, typename T5>
   134   template <typename T1, typename T2, typename T3, typename T4, typename T5>
   135   void SetCallback (char const *name, Callback<void,T1,T2,T3,T4,T5> callback);
   135   void SetCallback (std::string const &name, Callback<void,T1,T2,T3,T4,T5> callback);
   136 
   136 
   137   /**
   137   /**
   138    * \param name the name of the registered event source
   138    * \param name the name of the registered event source
   139    * \param var the event source being registered
   139    * \param var the event source being registered
   140    *
   140    *
   141    * This method registers only event sources of type "unsigned integer".
   141    * This method registers only event sources of type "unsigned integer".
   142    */
   142    */
   143   void RegisterUiVariable (char const *name, UiVariableTracerBase *var);
   143   void RegisterUiVariable (std::string const&name, UiVariableTracerBase *var);
   144   /**
   144   /**
   145    * \param name the name of the registered event source
   145    * \param name the name of the registered event source
   146    * \param var the event source being registered
   146    * \param var the event source being registered
   147    *
   147    *
   148    * This method registers only event sources of type "signed integer".
   148    * This method registers only event sources of type "signed integer".
   149    */
   149    */
   150   void RegisterSiVariable (char const *name, SiVariableTracerBase *var);
   150   void RegisterSiVariable (std::string const&name, SiVariableTracerBase *var);
   151   /**
   151   /**
   152    * \param name the name of the registered event source
   152    * \param name the name of the registered event source
   153    * \param var the event source being registered
   153    * \param var the event source being registered
   154    *
   154    *
   155    * This method registers only event sources of type "double".
   155    * This method registers only event sources of type "double".
   156    */
   156    */
   157   void RegisterFVariable (char const *name, FVariableTracerBase *var);
   157   void RegisterFVariable (std::string const&name, FVariableTracerBase *var);
   158   /**
   158   /**
   159    * \param name the name of the registered event source
   159    * \param name the name of the registered event source
   160    * \param stream the event source being registered
   160    * \param stream the event source being registered
   161    *
   161    *
   162    * This method registers only event sources of type StreamTracer.
   162    * This method registers only event sources of type StreamTracer.
   163    */
   163    */
   164   void RegisterStream (char const *name, StreamTracer *stream);
   164   void RegisterStream (std::string const&name, StreamTracer *stream);
   165 
   165 
   166   /**
   166   /**
   167    * \param name the name of the registeref event source
   167    * \param name the name of the registeref event source
   168    * \param tracer the callback tracer being registered.
   168    * \param tracer the callback tracer being registered.
   169    *
   169    *
   170    * This method registers only event sources of type CallbackTracer
   170    * This method registers only event sources of type CallbackTracer
   171    */
   171    */
   172   void RegisterCallback (char const *name, CallbackTracerBase*tracer);
   172   void RegisterCallback (std::string const&name, CallbackTracerBase*tracer);
   173 
   173 
   174   /**
   174   /**
   175    * Print the list of registered event sources in this container only.
   175    * Print the list of registered event sources in this container only.
   176    */
   176    */
   177   void PrintDebug (void);
   177   void PrintDebug (void);
   200 
   200 
   201 namespace ns3 {
   201 namespace ns3 {
   202 
   202 
   203 template <typename T1>
   203 template <typename T1>
   204 void 
   204 void 
   205 TraceContainer::SetCallback (char const *name, Callback<void,T1> callback)
   205 TraceContainer::SetCallback (std::string const&name, Callback<void,T1> callback)
   206 {
   206 {
   207   for (CallbackListI i = m_callbackList.begin (); i != m_callbackList.end (); i++) 
   207   for (CallbackListI i = m_callbackList.begin (); i != m_callbackList.end (); i++) 
   208     {
   208     {
   209       if (i->second == name) 
   209       if (i->second == name) 
   210         {
   210         {
   221     }
   221     }
   222   NS_ASSERT (false);
   222   NS_ASSERT (false);
   223 }
   223 }
   224 template <typename T1, typename T2>
   224 template <typename T1, typename T2>
   225 void 
   225 void 
   226 TraceContainer::SetCallback (char const *name, Callback<void,T1,T2> callback)
   226 TraceContainer::SetCallback (std::string const&name, Callback<void,T1,T2> callback)
   227 {
   227 {
   228   for (CallbackListI i = m_callbackList.begin (); i != m_callbackList.end (); i++) 
   228   for (CallbackListI i = m_callbackList.begin (); i != m_callbackList.end (); i++) 
   229     {
   229     {
   230       if (i->second == name) 
   230       if (i->second == name) 
   231         {
   231         {
   242     }
   242     }
   243   NS_ASSERT (false);
   243   NS_ASSERT (false);
   244 }
   244 }
   245 template <typename T1, typename T2, typename T3>
   245 template <typename T1, typename T2, typename T3>
   246 void 
   246 void 
   247 TraceContainer::SetCallback (char const *name, Callback<void,T1,T2,T3> callback)
   247 TraceContainer::SetCallback (std::string const&name, Callback<void,T1,T2,T3> callback)
   248 {
   248 {
   249   for (CallbackListI i = m_callbackList.begin (); i != m_callbackList.end (); i++) 
   249   for (CallbackListI i = m_callbackList.begin (); i != m_callbackList.end (); i++) 
   250     {
   250     {
   251       if (i->second == name) 
   251       if (i->second == name) 
   252         {
   252         {
   263     }
   263     }
   264   NS_ASSERT (false);
   264   NS_ASSERT (false);
   265 }
   265 }
   266 template <typename T1, typename T2, typename T3, typename T4>
   266 template <typename T1, typename T2, typename T3, typename T4>
   267 void 
   267 void 
   268 TraceContainer::SetCallback (char const *name, Callback<void,T1,T2,T3,T4> callback)
   268 TraceContainer::SetCallback (std::string const&name, Callback<void,T1,T2,T3,T4> callback)
   269 {
   269 {
   270   for (CallbackListI i = m_callbackList.begin (); i != m_callbackList.end (); i++) 
   270   for (CallbackListI i = m_callbackList.begin (); i != m_callbackList.end (); i++) 
   271     {
   271     {
   272       if (i->second == name) 
   272       if (i->second == name) 
   273         {
   273         {
   284     }
   284     }
   285   NS_ASSERT (false);
   285   NS_ASSERT (false);
   286 }
   286 }
   287 template <typename T1, typename T2, typename T3, typename T4, typename T5>
   287 template <typename T1, typename T2, typename T3, typename T4, typename T5>
   288 void 
   288 void 
   289 TraceContainer::SetCallback (char const *name, Callback<void,T1,T2,T3,T4,T5> callback)
   289 TraceContainer::SetCallback (std::string const&name, Callback<void,T1,T2,T3,T4,T5> callback)
   290 {
   290 {
   291   for (CallbackListI i = m_callbackList.begin (); i != m_callbackList.end (); i++) 
   291   for (CallbackListI i = m_callbackList.begin (); i != m_callbackList.end (); i++) 
   292     {
   292     {
   293       if (i->second == name) 
   293       if (i->second == name) 
   294         {
   294         {