LEFT | RIGHT |
(no file at all) | |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2008 Drexel University | 3 * Copyright (c) 2008 Drexel University |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 /** | 67 /** |
68 * Returns the count | 68 * Returns the count |
69 * \return Count | 69 * \return Count |
70 */ | 70 */ |
71 long getCount () const { return m_count; } | 71 long getCount () const { return m_count; } |
72 /** | 72 /** |
73 * Returns the sum | 73 * Returns the sum |
74 * \return Total | 74 * \return Total |
75 */ | 75 */ |
76 double getSum () const { return m_total; } | 76 double getSum () const { return static_cast<double> (m_total); } |
77 /** | 77 /** |
78 * Returns the minimum value | 78 * Returns the minimum value |
79 * \return Min | 79 * \return Min |
80 */ | 80 */ |
81 double getMin () const { return m_min; } | 81 double getMin () const { return static_cast<double> (m_min); } |
82 /** | 82 /** |
83 * Returns the maximum value | 83 * Returns the maximum value |
84 * \return Max | 84 * \return Max |
85 */ | 85 */ |
86 double getMax () const { return m_max; } | 86 double getMax () const { return static_cast<double> (m_max); } |
87 /** | 87 /** |
88 * Returns the mean value | 88 * Returns the mean value |
89 * \return Mean | 89 * \return Mean |
90 */ | 90 */ |
91 double getMean () const { return m_meanCurr; } | 91 double getMean () const { return m_meanCurr; } |
92 /** | 92 /** |
93 * Returns the standard deviation | 93 * Returns the standard deviation |
94 * \return Standard deviation | 94 * \return Standard deviation |
95 */ | 95 */ |
96 double getStddev () const { return std::sqrt (m_varianceCurr); } | 96 double getStddev () const { return std::sqrt (m_varianceCurr); } |
97 /** | 97 /** |
98 * Returns the current variance | 98 * Returns the current variance |
99 * \return Variance | 99 * \return Variance |
100 */ | 100 */ |
101 double getVariance () const { return m_varianceCurr; } | 101 double getVariance () const { return m_varianceCurr; } |
102 /** | 102 /** |
103 * Returns the sum of squares | 103 * Returns the sum of squares |
104 * \return Sum of squares | 104 * \return Sum of squares |
105 */ | 105 */ |
106 double getSqrSum () const { return m_squareTotal; } | 106 double getSqrSum () const { return static_cast<double> (m_squareTotal); } |
107 | 107 |
108 protected: | 108 protected: |
109 virtual void DoDispose (void); | 109 virtual void DoDispose (void); |
110 | 110 |
111 uint32_t m_count; //!< Count value of MinMaxAvgTotalCalculator | 111 uint32_t m_count; //!< Count value of MinMaxAvgTotalCalculator |
112 | 112 |
113 T m_total; //!< Total value of MinMaxAvgTotalCalculator | 113 T m_total; //!< Total value of MinMaxAvgTotalCalculator |
114 T m_squareTotal; //!< Sum of squares value of MinMaxAvgTotalCalculator | 114 T m_squareTotal; //!< Sum of squares value of MinMaxAvgTotalCalculator |
115 T m_min; //!< Minimum value of MinMaxAvgTotalCalculator | 115 T m_min; //!< Minimum value of MinMaxAvgTotalCalculator |
116 T m_max; //!< Maximum value of MinMaxAvgTotalCalculator | 116 T m_max; //!< Maximum value of MinMaxAvgTotalCalculator |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // count - 1 | 204 // count - 1 |
205 // | 205 // |
206 // ------------- | 206 // ------------- |
207 // / | 207 // / |
208 // standard_deviation = / variance | 208 // standard_deviation = / variance |
209 // \/ | 209 // \/ |
210 // | 210 // |
211 if (m_count == 1) | 211 if (m_count == 1) |
212 { | 212 { |
213 // Set the very first values. | 213 // Set the very first values. |
214 m_meanCurr = i; | 214 m_meanCurr = static_cast<double> (i); |
215 m_sCurr = 0; | 215 m_sCurr = 0; |
216 m_varianceCurr = m_sCurr; | 216 m_varianceCurr = m_sCurr; |
217 } | 217 } |
218 else | 218 else |
219 { | 219 { |
220 // Save the previous values. | 220 // Save the previous values. |
221 m_meanPrev = m_meanCurr; | 221 m_meanPrev = m_meanCurr; |
222 m_sPrev = m_sCurr; | 222 m_sPrev = m_sCurr; |
223 | 223 |
224 // Update the current values. | 224 // Update the current values. |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 { | 375 { |
376 callback.OutputSingleton (m_context, m_key, m_count); | 376 callback.OutputSingleton (m_context, m_key, m_count); |
377 // end CounterCalculator::Output | 377 // end CounterCalculator::Output |
378 } | 378 } |
379 | 379 |
380 // end namespace ns3 | 380 // end namespace ns3 |
381 }; | 381 }; |
382 | 382 |
383 | 383 |
384 #endif /* BASIC_DATA_CALCULATORS_H */ | 384 #endif /* BASIC_DATA_CALCULATORS_H */ |
LEFT | RIGHT |