27 #include "ns3/core-module.h"
28 #include "ns3/double-probe.h"
41 static TypeId GetTypeId (
void);
44 void DoInitialize (
void);
61 .AddTraceSource (
"Counter",
72 m_var = CreateObject<ExponentialRandomVariable> ();
105 NS_LOG_DEBUG (
"context: " << context <<
" old " << oldVal <<
" new " << newVal);
112 NS_LOG_DEBUG (
"context: " << context <<
" old " << oldVal <<
" new " << newVal);
115 int main (
int argc,
char *argv[])
118 cmd.
Parse (argc, argv);
143 probe1->
SetName (
"ObjectProbe");
147 NS_ASSERT_MSG (connected,
"Trace source not connected to probe1");
153 NS_ASSERT_MSG (connected,
"Trace source not connected to probe1 Output");
171 NS_ASSERT_MSG (connected,
"Trace source not connected to probe2 Output");
178 probe3->
SetName (
"StaticallyAccessedProbe");
186 NS_ASSERT_MSG (connected,
"Trace source not connected to probe3 Output");
#define NS_LOG_FUNCTION(parameters)
TypeId AddConstructor(void)
std::string GetName(void) const
Get the object's name.
void NotifyViaProbe(std::string context, double oldVal, double newVal)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
static TypeId GetTypeId(void)
static void Add(std::string name, Ptr< Object > object)
Add the association between the string "name" and the Ptr
virtual void ConnectByPath(std::string path)
connect to a trace source provided by a config path
Ptr< ExponentialRandomVariable > m_var
static void SetValueByPath(std::string path, double value)
Set a probe value by its name in the Config system.
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Parse command-line arguments.
static void Destroy(void)
TracedValue< double > m_counter
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
int main(int argc, char *argv[])
#define NS_ASSERT_MSG(condition, message)
virtual bool ConnectByObject(std::string traceSource, Ptr< Object > obj)
connect to a trace source attribute provided by a given object
NS_LOG_COMPONENT_DEFINE("PacketLossCounter")
void SetName(std::string name)
Set the object's name. All spaces are replaced by underscores.
#define NS_LOG_DEBUG(msg)
bool TraceConnect(std::string name, std::string context, const CallbackBase &cb)
void NotifyViaTraceSource(std::string context, double oldVal, double newVal)
void Parse(int argc, char *argv[])
a base class which provides memory management and object aggregation
a unique identifier for an interface.