A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
probe.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011 Bucknell University
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Authors: L. Felipe Perrone (perrone@bucknell.edu)
18
* Tiago G. Rodrigues (tgr002@bucknell.edu)
19
*/
20
21
#include "
probe.h
"
22
23
#include "ns3/log.h"
24
#include "ns3/object.h"
25
#include "ns3/simulator.h"
26
27
namespace
ns3
28
{
29
30
NS_LOG_COMPONENT_DEFINE
(
"Probe"
);
31
32
NS_OBJECT_ENSURE_REGISTERED
(Probe);
33
34
TypeId
35
Probe::GetTypeId
()
36
{
37
static
TypeId
tid =
TypeId
(
"ns3::Probe"
)
38
.
SetParent
<
DataCollectionObject
>()
39
.SetGroupName(
"Stats"
)
40
.AddAttribute(
"Start"
,
41
"Time data collection starts"
,
42
TimeValue
(
Seconds
(0)),
43
MakeTimeAccessor
(&
Probe::m_start
),
44
MakeTimeChecker
())
45
.AddAttribute(
"Stop"
,
46
"Time when data collection stops. The special time "
47
"value of 0 disables this attribute"
,
48
TimeValue
(
Seconds
(0)),
49
MakeTimeAccessor
(&
Probe::m_stop
),
50
MakeTimeChecker
());
51
return
tid;
52
}
53
54
Probe::Probe
()
55
{
56
NS_LOG_FUNCTION
(
this
);
57
}
58
59
Probe::~Probe
()
60
{
61
NS_LOG_FUNCTION
(
this
);
62
}
63
64
bool
65
Probe::IsEnabled
()
const
66
{
67
return
(
DataCollectionObject::IsEnabled
() &&
Simulator::Now
() >=
m_start
&&
68
(
m_stop
==
Seconds
(0) ||
Simulator::Now
() <
m_stop
));
69
}
70
71
}
// namespace ns3
ns3::DataCollectionObject
Base class for data collection framework objects.
Definition:
data-collection-object.h:39
ns3::DataCollectionObject::IsEnabled
virtual bool IsEnabled() const
Check the status of an individual object.
Definition:
data-collection-object.cc:64
ns3::Probe::m_start
Time m_start
Time when logging starts.
Definition:
probe.h:77
ns3::Probe::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
probe.cc:35
ns3::Probe::IsEnabled
bool IsEnabled() const override
Definition:
probe.cc:65
ns3::Probe::m_stop
Time m_stop
Time when logging stops.
Definition:
probe.h:80
ns3::Probe::~Probe
~Probe() override
Definition:
probe.cc:59
ns3::Probe::Probe
Probe()
Definition:
probe.cc:54
ns3::Simulator::Now
static Time Now()
Return the current simulation virtual time.
Definition:
simulator.cc:208
ns3::TimeValue
Definition:
nstime.h:1413
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:931
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:202
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:240
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:46
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition:
nstime.h:1326
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:1414
ns3::MakeTimeChecker
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition:
time.cc:533
probe.h
src
stats
model
probe.cc
Generated on Sun Mar 3 2024 17:11:08 for ns-3 by
1.9.1