A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
data-calculator.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008 Drexel 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
* Author: Joe Kopena (tjkopena@cs.drexel.edu)
19
*/
20
21
#include "ns3/log.h"
22
#include "ns3/simulator.h"
23
24
#include "
data-calculator.h
"
25
26
using namespace
ns3;
27
28
NS_LOG_COMPONENT_DEFINE
(
"DataCalculator"
);
29
30
static
double
zero
= 0;
31
const
double
ns3::NaN
=
zero
/
zero
;
32
33
//--------------------------------------------------------------
34
//----------------------------------------------
35
DataCalculator::DataCalculator
() :
36
m_enabled (true)
37
{
38
NS_LOG_FUNCTION_NOARGS
();
39
}
40
41
DataCalculator::~DataCalculator
()
42
{
43
NS_LOG_FUNCTION_NOARGS
();
44
}
45
46
void
47
DataCalculator::DoDispose
(
void
)
48
{
49
NS_LOG_FUNCTION_NOARGS
();
50
51
Simulator::Cancel
(
m_startEvent
);
52
Simulator::Cancel
(
m_stopEvent
);
53
54
Object::DoDispose
();
55
// DataCalculator::DoDispose
56
}
57
58
//----------------------------------------------
59
void
60
DataCalculator::SetKey
(
const
std::string key)
61
{
62
m_key
= key;
63
// end DataCalculator::SetKey
64
}
65
66
std::string
67
DataCalculator::GetKey
()
const
68
{
69
return
m_key
;
70
// end DataCalculator::GetKey
71
}
72
73
//----------------------------------------------
74
void
75
DataCalculator::SetContext
(
const
std::string context)
76
{
77
m_context
= context;
78
// end DataCalculator::SetContext
79
}
80
81
std::string
82
DataCalculator::GetContext
()
const
83
{
84
return
m_context
;
85
// end DataCalculator::GetContext
86
}
87
//----------------------------------------------
88
void
89
DataCalculator::Enable
()
90
{
91
m_enabled
=
true
;
92
// end DataCalculator::Enable
93
}
94
95
void
96
DataCalculator::Disable
()
97
{
98
m_enabled
=
false
;
99
// end DataCalculator::Disable
100
}
101
102
bool
103
DataCalculator::GetEnabled
()
const
104
{
105
return
m_enabled
;
106
// end DataCalculator::GetEnabled
107
}
108
109
//----------------------------------------------
110
void
111
DataCalculator::Start
(
const
Time
&
startTime
)
112
{
113
114
m_startEvent
=
Simulator::Schedule
(startTime,
115
&
DataCalculator::Enable
,
this
);
116
117
// end DataCalculator::Start
118
}
119
120
void
121
DataCalculator::Stop
(
const
Time
&
stopTime
)
122
{
123
m_stopEvent
=
Simulator::Schedule
(stopTime,
124
&
DataCalculator::Disable
,
this
);
125
// end DataCalculator::Stop
126
}
ns3::Time
keep track of time values and allow control of global simulation resolution
Definition:
nstime.h:81
ns3::NS_LOG_COMPONENT_DEFINE
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
ns3::DataCalculator::SetKey
void SetKey(const std::string key)
Sets the DataCalculator key to the provided key.
Definition:
data-calculator.cc:60
ns3::DataCalculator::GetKey
std::string GetKey() const
Gets the DataCalculator key.
Definition:
data-calculator.cc:67
ns3::DataCalculator::m_enabled
bool m_enabled
Descendant classes must check & respect m_enabled!
Definition:
data-calculator.h:169
ns3::Object::DoDispose
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition:
object.cc:336
ns3::Simulator::Cancel
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
Definition:
simulator.cc:268
NS_LOG_FUNCTION_NOARGS
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Definition:
log.h:309
ns3::Simulator::Schedule
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
Definition:
simulator.h:824
zero
static double zero
Definition:
data-calculator.cc:30
ns3::DataCalculator::Stop
virtual void Stop(const Time &stopTime)
Stops DataCalculator at a given time in the simulation.
Definition:
data-calculator.cc:121
ns3::DataCalculator::Start
virtual void Start(const Time &startTime)
Starts DataCalculator at a given time in the simulation.
Definition:
data-calculator.cc:111
stopTime
double stopTime
Definition:
tcp-nsc-comparison.cc:42
ns3::DataCalculator::m_startEvent
EventId m_startEvent
Start event.
Definition:
data-calculator.h:177
ns3::DataCalculator::GetContext
std::string GetContext() const
Gets the DataCalculator context.
Definition:
data-calculator.cc:82
ns3::DataCalculator::Enable
void Enable()
Enables DataCalculator when simulation starts.
Definition:
data-calculator.cc:89
ns3::DataCalculator::GetEnabled
bool GetEnabled() const
Returns whether the DataCalculator is enabled.
Definition:
data-calculator.cc:103
startTime
double startTime
Definition:
tcp-nsc-comparison.cc:41
ns3::DataCalculator::m_stopEvent
EventId m_stopEvent
Stop event.
Definition:
data-calculator.h:178
data-calculator.h
ns3::DataCalculator::DoDispose
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition:
data-calculator.cc:47
ns3::NaN
const double NaN
Stored representation of NaN.
Definition:
data-calculator.cc:31
ns3::DataCalculator::Disable
void Disable()
Disables DataCalculator when simulation stops.
Definition:
data-calculator.cc:96
ns3::DataCalculator::~DataCalculator
virtual ~DataCalculator()
Definition:
data-calculator.cc:41
ns3::DataCalculator::m_context
std::string m_context
Context value.
Definition:
data-calculator.h:172
ns3::DataCalculator::SetContext
void SetContext(const std::string context)
Sets the DataCalculator context to the provided context.
Definition:
data-calculator.cc:75
ns3::DataCalculator::m_key
std::string m_key
Key value.
Definition:
data-calculator.h:171
ns3::DataCalculator::DataCalculator
DataCalculator()
Definition:
data-calculator.cc:35
src
stats
model
data-calculator.cc
Generated on Sat Apr 19 2014 14:07:08 for ns-3 by
1.8.6