RunningAverage.h
1 /**************************************************************************************
2 Copyright 2015 Applied Research Associates, Inc.
3 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 this file except in compliance with the License. You may obtain a copy of the License
5 at:
6 http://www.apache.org/licenses/LICENSE-2.0
7 Unless required by applicable law or agreed to in writing, software distributed under
8 the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
9 CONDITIONS OF ANY KIND, either express or implied. See the License for the
10 specific language governing permissions and limitations under the License.
11 **************************************************************************************/
12 #pragma once
13 #include <biogears/cdm/CommonDataModel.h>
14 
15 #include <biogears/exports.h>
16 CDM_BIND_DECL(RunningAverageData);
17 
18 namespace biogears {
19 class BIOGEARS_API RunningAverage {
20 public:
22  virtual ~RunningAverage();
23 
24  bool Load(const CDM::RunningAverageData& in);
25  CDM::RunningAverageData* Unload() const;
26 
27 protected:
28  void Unload(CDM::RunningAverageData& data) const;
29 
30 public:
32  void Reset();
34  double Sample(double d);
36  double Value();
37 
38  unsigned int NumSamples() { return m_NumSamples; }
39 
40 protected:
41  double m_Sum;
42  unsigned int m_NumSamples;
43 };
44 }
Class corresponding to the RunningAverageData schema type.
Definition: Properties.hxx:2809
unsigned int NumSamples()
Definition: RunningAverage.h:38
double m_Sum
Definition: RunningAverage.h:41
Definition: RunningAverage.h:19
Definition: SEElectricalCircuit.h:18
unsigned int m_NumSamples
Definition: RunningAverage.h:42