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.h
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
#ifndef DATA_CALCULATOR_H
22
#define DATA_CALCULATOR_H
23
24
#include "ns3/object.h"
25
#include "ns3/nstime.h"
26
#include "ns3/simulator.h"
27
28
namespace
ns3 {
29
extern
const
double
NaN
;
30
inline
bool
isNaN
(
double
x
) {
return
x !=
x
; }
31
32
class
DataOutputCallback;
33
34
class
StatisticalSummary
{
35
public
:
39
virtual
~StatisticalSummary
()
40
{
41
}
45
virtual
long
getCount
()
const
= 0;
46
51
virtual
double
getSum
()
const
= 0;
52
57
virtual
double
getSqrSum
()
const
= 0;
58
62
virtual
double
getMin
()
const
= 0;
63
67
virtual
double
getMax
()
const
= 0;
68
72
virtual
double
getMean
()
const
= 0;
73
77
virtual
double
getStddev
()
const
= 0;
78
82
virtual
double
getVariance
()
const
= 0;
83
};
84
85
//------------------------------------------------------------
86
//--------------------------------------------
87
class
DataCalculator
:
public
Object
{
88
public
:
89
DataCalculator
();
90
virtual
~DataCalculator
();
91
92
bool
GetEnabled
()
const
;
93
void
Enable
();
94
void
Disable
();
95
96
void
SetKey
(
const
std::string key);
97
std::string
GetKey
()
const
;
98
99
void
SetContext
(
const
std::string context);
100
std::string
GetContext
()
const
;
101
102
virtual
void
Start
(
const
Time
& startTime);
103
virtual
void
Stop
(
const
Time
& stopTime);
104
105
virtual
void
Output
(
DataOutputCallback
&callback)
const
= 0;
106
107
protected
:
108
bool
m_enabled
;
// Descendant classes *must* check & respect m_enabled!
109
110
std::string
m_key
;
111
std::string
m_context
;
112
113
virtual
void
DoDispose
(
void
);
114
115
private
:
116
EventId
m_startEvent
;
117
EventId
m_stopEvent
;
118
119
// end class DataCalculator
120
};
121
122
123
// end namespace ns3
124
};
125
126
127
#endif
/* DATA_CALCULATOR_H */
src
stats
model
data-calculator.h
Generated on Tue Nov 13 2012 10:32:22 for ns-3 by
1.8.1.2