6 #ifndef ACCUMULATOR_HPP_INCLUDE
7 #define ACCUMULATOR_HPP_INCLUDE
47 static std::unique_ptr<SumAccumulator>
make_unique(
void);
60 virtual void update(
double delta_signal) = 0;
76 virtual void exit(
void) = 0;
84 virtual double total(
void)
const = 0;
120 static std::unique_ptr<AvgAccumulator>
make_unique(
void);
135 virtual void update(
double delta_time,
double signal) = 0;
186 void update(
double delta_signal)
override;
187 void enter(
void)
override;
188 void exit(
void)
override;
189 double total(
void)
const override;
202 void update(
double delta_time,
double signal)
override;
203 void enter(
void)
override;
204 void exit(
void)
override;
205 double average(
void)
const override;
211 double m_curr_weight;
Class to track the average value of a signal while a condition is true.
Definition: Accumulator.hpp:117
virtual double interval_average(void) const =0
Average of the signal tracked while the condition is true.
static std::unique_ptr< AvgAccumulator > make_unique(void)
Factory constructor.
Definition: Accumulator.cpp:19
virtual void update(double delta_time, double signal)=0
Called in control loop to update state.
virtual double average(void) const =0
Average of the signal tracked while the condition is true.
virtual void enter(void)=0
Mark the beginning of an interval.
virtual ~AvgAccumulator()=default
Virtual destructor.
virtual void exit(void)=0
Mark the end of an interval.
Definition: Accumulator.hpp:198
void update(double delta_time, double signal) override
Called in control loop to update state.
Definition: Accumulator.cpp:70
void enter(void) override
Mark the beginning of an interval.
Definition: Accumulator.cpp:80
AvgAccumulatorImp()
Definition: Accumulator.cpp:60
double average(void) const override
Average of the signal tracked while the condition is true.
Definition: Accumulator.cpp:92
double interval_average(void) const override
Average of the signal tracked while the condition is true.
Definition: Accumulator.cpp:98
virtual ~AvgAccumulatorImp()=default
void exit(void) override
Mark the end of an interval.
Definition: Accumulator.cpp:86
Class to track the total increase of a signal while a condition is true.
Definition: Accumulator.hpp:44
virtual void enter(void)=0
Mark the beginning of an interval.
virtual double interval_total(void) const =0
Increase of tracked signal over last interval.
virtual void update(double delta_signal)=0
Called in control loop to update state.
virtual double total(void) const =0
Total increase of tracked signal when condition is true.
virtual void exit(void)=0
Mark the end of an interval.
virtual ~SumAccumulator()=default
Virtual destructor.
static std::unique_ptr< SumAccumulator > make_unique(void)
Factory constructor.
Definition: Accumulator.cpp:14
Definition: Accumulator.hpp:182
void enter(void) override
Mark the beginning of an interval.
Definition: Accumulator.cpp:40
void update(double delta_signal) override
Called in control loop to update state.
Definition: Accumulator.cpp:32
SumAccumulatorImp()
Definition: Accumulator.cpp:24
double interval_total(void) const override
Increase of tracked signal over last interval.
Definition: Accumulator.cpp:55
double total(void) const override
Total increase of tracked signal when condition is true.
Definition: Accumulator.cpp:50
void exit(void) override
Mark the end of an interval.
Definition: Accumulator.cpp:45
virtual ~SumAccumulatorImp()=default
Definition: Accumulator.cpp:12