Gazebo Math

API Reference

8.1.0
SignalStats.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 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 GZ_MATH_SIGNALSTATS_HH_
18#define GZ_MATH_SIGNALSTATS_HH_
19
20#include <map>
21#include <memory>
22#include <string>
23#include <gz/math/Helpers.hh>
24#include <gz/math/config.hh>
25#include <gz/utils/ImplPtr.hh>
26
27namespace gz::math
28{
29 // Inline bracket to help doxygen filtering.
30 inline namespace GZ_MATH_VERSION_NAMESPACE {
31 //
34
38 {
40 public: SignalStatistic();
41
43 public: virtual ~SignalStatistic() = default;
44
45 // Since we have to declare the destructor virtual, we have to declare the
46 // all the special member functions as defaulted.
47 // See https://en.cppreference.com/w/cpp/language/rule_of_three
48
51 public: SignalStatistic(const SignalStatistic &_ss) = default;
52
55 public: SignalStatistic(SignalStatistic &&_ss) = default;
56
60 public: SignalStatistic &operator=(const SignalStatistic &_s) = default;
61
66
69 public: virtual double Value() const = 0;
70
73 public: virtual std::string ShortName() const = 0;
74
77 public: virtual size_t Count() const;
78
81 public: virtual void InsertData(const double _data) = 0;
82
84 public: virtual void Reset();
85
87 public: class Implementation;
89 protected: ::gz::utils::ImplPtr<Implementation> dataPtr;
91 };
92
96 {
97 // Documentation inherited.
98 public: virtual double Value() const override;
99
102 public: virtual std::string ShortName() const override;
103
104 // Documentation inherited.
105 public: virtual void InsertData(const double _data) override;
106 };
107
111 {
112 // Documentation inherited.
113 public: virtual double Value() const override;
114
117 public: virtual std::string ShortName() const override;
118
119 // Documentation inherited.
120 public: virtual void InsertData(const double _data) override;
121 };
122
126 {
127 // Documentation inherited.
128 public: virtual double Value() const override;
129
132 public: virtual std::string ShortName() const override;
133
134 // Documentation inherited.
135 public: virtual void InsertData(const double _data) override;
136 };
137
142 {
143 // Documentation inherited.
144 public: virtual double Value() const override;
145
148 public: virtual std::string ShortName() const override;
149
150 // Documentation inherited.
151 public: virtual void InsertData(const double _data) override;
152 };
153
160 {
161 // Documentation inherited.
162 public: virtual double Value() const override;
163
166 public: virtual std::string ShortName() const override;
167
168 // Documentation inherited.
169 public: virtual void InsertData(const double _data) override;
170 };
171
176 {
177 // Documentation inherited.
178 public: virtual double Value() const override;
179
182 public: virtual std::string ShortName() const override;
183
184 // Documentation inherited.
185 public: virtual void InsertData(const double _data) override;
186 };
187
191 {
193 public: SignalStats();
194
200 public: size_t Count() const;
201
207
210 public: void InsertData(const double _data);
211
221 public: bool InsertStatistic(const std::string &_name);
222
230 public: bool InsertStatistics(const std::string &_names);
231
233 public: void Reset();
234
236 GZ_UTILS_IMPL_PTR(dataPtr)
237 };
238 } // namespace GZ_MATH_VERSION_NAMESPACE
239} // namespace gz::math
240#endif // GZ_MATH_SIGNALSTATS_HH_