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
boolean-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 BOOL_PROBE_H
13
#define BOOL_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 bool. This probe exports a trace source "Output" of type bool.
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
BooleanProbe
:
public
Probe
38
{
39
public
:
40
/**
41
* \brief Get the type ID.
42
* \return the object TypeId
43
*/
44
static
TypeId
GetTypeId
();
45
BooleanProbe
();
46
~BooleanProbe
()
override
;
47
48
/**
49
* \return the most recent value
50
*/
51
bool
GetValue
()
const
;
52
53
/**
54
* \param value set the traced bool to a new value
55
*/
56
void
SetValue
(
bool
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 bool to a new value
63
*/
64
static
void
SetValueByPath
(std::string path,
bool
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 bool
88
*
89
* \param oldData previous value of the bool
90
* \param newData new value of the bool
91
*/
92
void
TraceSink
(
bool
oldData,
bool
newData);
93
94
TracedValue<bool>
m_output
;
//!< Output trace source.
95
};
96
97
}
// namespace ns3
98
99
#endif
// BOOL_PROBE_H
ns3::BooleanProbe
This class is designed to probe an underlying ns3 TraceSource exporting a bool.
Definition
boolean-probe.h:38
ns3::BooleanProbe::SetValueByPath
static void SetValueByPath(std::string path, bool value)
Set a probe value by its name in the Config system.
Definition
boolean-probe.cc:67
ns3::BooleanProbe::m_output
TracedValue< bool > m_output
Output trace source.
Definition
boolean-probe.h:94
ns3::BooleanProbe::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
boolean-probe.cc:28
ns3::BooleanProbe::BooleanProbe
BooleanProbe()
Definition
boolean-probe.cc:41
ns3::BooleanProbe::TraceSink
void TraceSink(bool oldData, bool newData)
Method to connect to an underlying ns3::TraceSource of type bool.
Definition
boolean-probe.cc:95
ns3::BooleanProbe::SetValue
void SetValue(bool value)
Definition
boolean-probe.cc:60
ns3::BooleanProbe::ConnectByPath
void ConnectByPath(std::string path) override
connect to a trace source provided by a config path
Definition
boolean-probe.cc:87
ns3::BooleanProbe::GetValue
bool GetValue() const
Definition
boolean-probe.cc:53
ns3::BooleanProbe::ConnectByObject
bool ConnectByObject(std::string traceSource, Ptr< Object > obj) override
connect to a trace source attribute provided by a given object
Definition
boolean-probe.cc:76
ns3::BooleanProbe::~BooleanProbe
~BooleanProbe() override
Definition
boolean-probe.cc:47
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
boolean-probe.h
Generated on Fri Nov 8 2024 13:59:06 for ns-3 by
1.11.0