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 #ifndef TERMINAL_TRACE_RESOLVER_H |
|
22 #define TERMINAL_TRACE_RESOLVER_H |
|
23 |
|
24 #include "trace-resolver.h" |
|
25 |
|
26 namespace ns3 { |
|
27 |
|
28 class TraceContext; |
|
29 |
|
30 template <typename T> |
|
31 class TerminalTraceResolver : public TraceResolver |
|
32 { |
|
33 public: |
|
34 TerminalTraceResolver (T &traceSource, TraceContext const &context); |
|
35 private: |
|
36 virtual void DoConnect (CallbackBase const &cb); |
|
37 virtual void DoDisconnect (CallbackBase const &cb); |
|
38 T &m_traceSource; |
|
39 }; |
|
40 |
|
41 }//namespace ns3 |
|
42 |
|
43 namespace ns3 { |
|
44 |
|
45 template <typename T> |
|
46 TerminalTraceResolver<T>::TerminalTraceResolver (T &traceSource, |
|
47 TraceContext const &context) |
|
48 : TraceResolver (context), |
|
49 m_traceSource (traceSource) |
|
50 {} |
|
51 template <typename T> |
|
52 void |
|
53 TerminalTraceResolver<T>::DoConnect (CallbackBase const &cb) |
|
54 { |
|
55 m_traceSource.AddCallback (cb, GetContext ()); |
|
56 } |
|
57 template <typename T> |
|
58 void |
|
59 TerminalTraceResolver<T>::DoDisconnect (CallbackBase const &cb) |
|
60 { |
|
61 m_traceSource.RemoveCallback (cb); |
|
62 } |
|
63 |
|
64 }//namespace ns3 |
|
65 |
|
66 #endif /* TERMINAL_TRACE_RESOLVER_H */ |
|