SignalStats.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-2016 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef _GAZEBO_SIGNAL_STATS_HH_
18 #define _GAZEBO_SIGNAL_STATS_HH_
19 
20 #include <map>
21 #include <string>
22 #include "gazebo/util/system.hh"
23 
24 namespace gazebo
25 {
26  namespace math
27  {
30 
32  class SignalStatisticPrivate;
33 
36  class GZ_MATH_VISIBLE SignalStatistic
37  {
39  public: SignalStatistic();
40 
42  public: virtual ~SignalStatistic();
43 
46  public: virtual double Value() const = 0;
47 
50  public: virtual std::string ShortName() const = 0;
51 
54  public: virtual size_t Count() const;
55 
58  public: virtual void InsertData(const double _data) = 0;
59 
61  public: virtual void Reset();
62 
64  protected: SignalStatisticPrivate *dataPtr;
65  };
67 
70  class GZ_MATH_VISIBLE SignalMean : public SignalStatistic
71  {
72  // Documentation inherited.
73  public: virtual double Value() const;
74 
77  public: virtual std::string ShortName() const;
78 
79  // Documentation inherited.
80  public: virtual void InsertData(const double _data);
81  };
83 
87  class GZ_MATH_VISIBLE SignalRootMeanSquare : public SignalStatistic
88  {
89  // Documentation inherited.
90  public: virtual double Value() const;
91 
94  public: virtual std::string ShortName() const;
95 
96  // Documentation inherited.
97  public: virtual void InsertData(const double _data);
98  };
100 
105  class GZ_MATH_VISIBLE SignalMaxAbsoluteValue : public SignalStatistic
106  {
107  // Documentation inherited.
108  public: virtual double Value() const;
109 
112  public: virtual std::string ShortName() const;
113 
114  // Documentation inherited.
115  public: virtual void InsertData(const double _data);
116  };
118 
120  class SignalStatsPrivate;
121 
124  class GZ_MATH_VISIBLE SignalStats
125  {
127  public: SignalStats();
128 
130  public: ~SignalStats();
131 
137  public: size_t Count() const;
138 
143  public: std::map<std::string, double> Map() const;
144 
147  public: void InsertData(const double _data);
148 
158  public: bool InsertStatistic(const std::string &_name);
159 
167  public: bool InsertStatistics(const std::string &_names);
168 
170  public: void Reset();
171 
173  protected: SignalStatsPrivate *dataPtr;
174  };
176  }
177 }
178 #endif
179 
Computing the mean value of a discretely sampled signal.
Definition: SignalStats.hh:70
Forward declarations for the common classes.
Definition: Animation.hh:33
Collection of statistics for a scalar signal.
Definition: SignalStats.hh:124
Computing the square root of the mean squared value of a discretely sampled signal.
Definition: SignalStats.hh:87
SignalStatsPrivate * dataPtr
Pointer to private data.
Definition: SignalStats.hh:173
Computing the maximum of the absolute value of a discretely sampled signal.
Definition: SignalStats.hh:105
Statistical properties of a discrete time scalar signal.
Definition: SignalStats.hh:36
SignalStatisticPrivate * dataPtr
Pointer to private data.
Definition: SignalStats.hh:64