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