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
probe.cc
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
10
#include "
probe.h
"
11
12
#include "ns3/log.h"
13
#include "ns3/object.h"
14
#include "ns3/simulator.h"
15
16
namespace
ns3
17
{
18
19
NS_LOG_COMPONENT_DEFINE
(
"Probe"
);
20
21
NS_OBJECT_ENSURE_REGISTERED
(Probe);
22
23
TypeId
24
Probe::GetTypeId
()
25
{
26
static
TypeId
tid =
TypeId
(
"ns3::Probe"
)
27
.
SetParent
<
DataCollectionObject
>()
28
.SetGroupName(
"Stats"
)
29
.AddAttribute(
"Start"
,
30
"Time data collection starts"
,
31
TimeValue
(
Seconds
(0)),
32
MakeTimeAccessor
(&
Probe::m_start
),
33
MakeTimeChecker
())
34
.AddAttribute(
"Stop"
,
35
"Time when data collection stops. The special time "
36
"value of 0 disables this attribute"
,
37
TimeValue
(
Seconds
(0)),
38
MakeTimeAccessor
(&
Probe::m_stop
),
39
MakeTimeChecker
());
40
return
tid;
41
}
42
43
Probe::Probe
()
44
{
45
NS_LOG_FUNCTION
(
this
);
46
}
47
48
Probe::~Probe
()
49
{
50
NS_LOG_FUNCTION
(
this
);
51
}
52
53
bool
54
Probe::IsEnabled
()
const
55
{
56
return
(
DataCollectionObject::IsEnabled
() &&
Simulator::Now
() >=
m_start
&&
57
(
m_stop
==
Seconds
(0) ||
Simulator::Now
() <
m_stop
));
58
}
59
60
}
// namespace ns3
ns3::DataCollectionObject
Base class for data collection framework objects.
Definition
data-collection-object.h:28
ns3::DataCollectionObject::IsEnabled
virtual bool IsEnabled() const
Check the status of an individual object.
Definition
data-collection-object.cc:53
ns3::Probe::m_start
Time m_start
Time when logging starts.
Definition
probe.h:66
ns3::Probe::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
probe.cc:24
ns3::Probe::IsEnabled
bool IsEnabled() const override
Definition
probe.cc:54
ns3::Probe::m_stop
Time m_stop
Time when logging stops.
Definition
probe.h:69
ns3::Probe::~Probe
~Probe() override
Definition
probe.cc:48
ns3::Probe::Probe
Probe()
Definition
probe.cc:43
ns3::Simulator::Now
static Time Now()
Return the current simulation virtual time.
Definition
simulator.cc:197
ns3::TimeValue
Definition
nstime.h:1395
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition
log-macros-enabled.h:229
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition
nstime.h:1308
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::MakeTimeAccessor
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition
nstime.h:1396
ns3::MakeTimeChecker
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Definition
nstime.h:1416
probe.h
src
stats
model
probe.cc
Generated on Fri Nov 8 2024 13:59:06 for ns-3 by
1.11.0