A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
double-probe.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011 Bucknell University
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Authors: L. Felipe Perrone (perrone@bucknell.edu)
7
* Tiago G. Rodrigues (tgr002@bucknell.edu)
8
*
9
* Modified by: Mitch Watrous (watrous@u.washington.edu)
10
*/
11
12
#ifndef DOUBLE_PROBE_H
13
#define DOUBLE_PROBE_H
14
15
#include "
probe.h
"
16
17
#include "ns3/boolean.h"
18
#include "ns3/callback.h"
19
#include "ns3/object.h"
20
#include "ns3/simulator.h"
21
#include "ns3/traced-value.h"
22
23
namespace
ns3
24
{
25
26
/**
27
* \ingroup probes
28
*
29
* This class is designed to probe an underlying ns3 TraceSource exporting
30
* a double. This probe exports a trace source "Output" of type double.
31
* The Output trace source emits a value when either the trace source
32
* emits a new value, or when SetValue () is called.
33
*
34
* The current value of the probe can be polled with the GetValue ()
35
* method.
36
*/
37
class
DoubleProbe
:
public
Probe
38
{
39
public
:
40
/**
41
* \brief Get the type ID.
42
* \return the object TypeId
43
*/
44
static
TypeId
GetTypeId
();
45
DoubleProbe
();
46
~DoubleProbe
()
override
;
47
48
/**
49
* \return the most recent value
50
*/
51
double
GetValue
()
const
;
52
53
/**
54
* \param value set the traced double to a new value
55
*/
56
void
SetValue
(
double
value);
57
58
/**
59
* \brief Set a probe value by its name in the Config system
60
*
61
* \param path Config path to access the probe
62
* \param value set the traced double to a new value
63
*/
64
static
void
SetValueByPath
(std::string path,
double
value);
65
66
/**
67
* \brief connect to a trace source attribute provided by a given object
68
*
69
* \param traceSource the name of the attribute TraceSource to connect to
70
* \param obj ns3::Object to connect to
71
* \return true if the trace source was successfully connected
72
*/
73
bool
ConnectByObject
(std::string traceSource,
Ptr<Object>
obj)
override
;
74
75
/**
76
* \brief connect to a trace source provided by a config path
77
*
78
* \param path Config path to bind to
79
*
80
* Note, if an invalid path is provided, the probe will not be connected
81
* to anything.
82
*/
83
void
ConnectByPath
(std::string path)
override
;
84
85
private
:
86
/**
87
* \brief Method to connect to an underlying ns3::TraceSource of type double
88
*
89
* \param oldData previous value of the double
90
* \param newData new value of the double
91
*/
92
void
TraceSink
(
double
oldData,
double
newData);
93
94
TracedValue<double>
m_output
;
//!< Output trace source.
95
};
96
97
}
// namespace ns3
98
99
#endif
// DOUBLE_PROBE_H
ns3::DoubleProbe
This class is designed to probe an underlying ns3 TraceSource exporting a double.
Definition
double-probe.h:38
ns3::DoubleProbe::DoubleProbe
DoubleProbe()
Definition
double-probe.cc:41
ns3::DoubleProbe::ConnectByPath
void ConnectByPath(std::string path) override
connect to a trace source provided by a config path
Definition
double-probe.cc:87
ns3::DoubleProbe::ConnectByObject
bool ConnectByObject(std::string traceSource, Ptr< Object > obj) override
connect to a trace source attribute provided by a given object
Definition
double-probe.cc:76
ns3::DoubleProbe::SetValueByPath
static void SetValueByPath(std::string path, double value)
Set a probe value by its name in the Config system.
Definition
double-probe.cc:67
ns3::DoubleProbe::SetValue
void SetValue(double value)
Definition
double-probe.cc:60
ns3::DoubleProbe::TraceSink
void TraceSink(double oldData, double newData)
Method to connect to an underlying ns3::TraceSource of type double.
Definition
double-probe.cc:95
ns3::DoubleProbe::GetValue
double GetValue() const
Definition
double-probe.cc:53
ns3::DoubleProbe::~DoubleProbe
~DoubleProbe() override
Definition
double-probe.cc:47
ns3::DoubleProbe::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
double-probe.cc:28
ns3::DoubleProbe::m_output
TracedValue< double > m_output
Output trace source.
Definition
double-probe.h:94
ns3::Probe
Base class for probes.
Definition
probe.h:30
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::TracedValue
Trace classes with value semantics.
Definition
traced-value.h:105
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
probe.h
src
stats
model
double-probe.h
Generated on Fri Nov 8 2024 13:59:06 for ns-3 by
1.11.0