A Discrete-Event Network Simulator
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 
31 
33 
34 TypeId
36 {
37  static TypeId tid = TypeId("ns3::Probe")
39  .SetGroupName("Stats")
40  .AddAttribute("Start",
41  "Time data collection starts",
42  TimeValue(Seconds(0)),
45  .AddAttribute("Stop",
46  "Time when data collection stops. The special time "
47  "value of 0 disables this attribute",
48  TimeValue(Seconds(0)),
50  MakeTimeChecker());
51  return tid;
52 }
53 
55 {
56  NS_LOG_FUNCTION(this);
57 }
58 
60 {
61  NS_LOG_FUNCTION(this);
62 }
63 
64 bool
66 {
68  (m_stop == Seconds(0) || Simulator::Now() < m_stop));
69 }
70 
71 } // namespace ns3
Base class for data collection framework objects.
virtual bool IsEnabled() const
Check the status of an individual object.
Time m_start
Time when logging starts.
Definition: probe.h:77
static TypeId GetTypeId()
Get the type ID.
Definition: probe.cc:35
bool IsEnabled() const override
Definition: probe.cc:65
Time m_stop
Time when logging stops.
Definition: probe.h:80
~Probe() override
Definition: probe.cc:59
Probe()
Definition: probe.cc:54
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:931
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1326
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition: nstime.h:1414
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:533