19#ifndef TRACE_SOURCE_ACCESSOR_H
20#define TRACE_SOURCE_ACCESSOR_H
150template <
typename T,
typename SOURCE>
151Ptr<const TraceSourceAccessor>
158 T* p =
dynamic_cast<T*
>(obj);
163 (p->*m_source).ConnectWithoutContext(cb);
169 T* p =
dynamic_cast<T*
>(obj);
174 (p->*m_source).Connect(cb, context);
180 T* p =
dynamic_cast<T*
>(obj);
185 (p->*m_source).DisconnectWithoutContext(cb);
191 T* p =
dynamic_cast<T*
>(obj);
196 (p->*m_source).Disconnect(cb, context);
201 }* accessor =
new Accessor();
203 accessor->m_source = a;
208Ptr<const TraceSourceAccessor>
Declaration of the various callback functions.
Base class for Callback class.
Anchor the ns-3 type and attribute system.
Smart pointer class similar to boost::intrusive_ptr.
A template-based reference counting class.
Control access to objects' trace sources.
virtual bool ConnectWithoutContext(ObjectBase *obj, const CallbackBase &cb) const =0
Connect a Callback to a TraceSource (without context.)
virtual bool Connect(ObjectBase *obj, std::string context, const CallbackBase &cb) const =0
Connect a Callback to a TraceSource with a context string.
virtual bool Disconnect(ObjectBase *obj, std::string context, const CallbackBase &cb) const =0
Disconnect a Callback from a TraceSource with a context string.
TraceSourceAccessor()
Constructor.
virtual bool DisconnectWithoutContext(ObjectBase *obj, const CallbackBase &cb) const =0
Disconnect a Callback from a TraceSource (without context).
virtual ~TraceSourceAccessor()
Destructor.
static Ptr< const TraceSourceAccessor > MakeEmptyTraceSourceAccessor()
Create an empty TraceSourceAccessor.
Ptr< const TraceSourceAccessor > DoMakeTraceSourceAccessor(SOURCE T::*a)
MakeTraceSourceAccessor() implementation.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Ptr smart pointer declaration and implementation.
ns3::SimpleRefCount declaration and template implementation.