8#ifndef TRACE_SOURCE_ACCESSOR_H
9#define TRACE_SOURCE_ACCESSOR_H
139template <
typename T,
typename SOURCE>
140Ptr<const TraceSourceAccessor>
147 T* p =
dynamic_cast<T*
>(obj);
152 (p->*m_source).ConnectWithoutContext(cb);
158 T* p =
dynamic_cast<T*
>(obj);
163 (p->*m_source).Connect(cb, context);
169 T* p =
dynamic_cast<T*
>(obj);
174 (p->*m_source).DisconnectWithoutContext(cb);
180 T* p =
dynamic_cast<T*
>(obj);
185 (p->*m_source).Disconnect(cb, context);
190 }* accessor =
new Accessor();
192 accessor->m_source = a;
197Ptr<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.