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
}
src
stats
model
data-calculator.cc
Generated on Tue Oct 9 2012 16:45:46 for ns-3 by
1.8.1.2