geopm  3.1.1.dev214+gba4f9f6d
GEOPM - Global Extensible Open Power Manager
DifferenceSignal.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 - 2024 Intel Corporation
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef DIFFERENCESIGNAL_HPP_INCLUDE
7 #define DIFFERENCESIGNAL_HPP_INCLUDE
8 
9 #include <memory>
10 
11 #include "Signal.hpp"
12 
13 namespace geopm
14 {
17  class DifferenceSignal : public Signal
18  {
19  public:
20  DifferenceSignal(std::shared_ptr<Signal> minuend,
21  std::shared_ptr<Signal> subtrahend);
22  DifferenceSignal(const DifferenceSignal &other) = delete;
23  DifferenceSignal &operator=(const DifferenceSignal &other) = delete;
24  virtual ~DifferenceSignal() = default;
25  void setup_batch(void) override;
26  double sample(void) override;
27  double read(void) const override;
28  private:
29  std::shared_ptr<Signal> m_minuend;
30  std::shared_ptr<Signal> m_subtrahend;
31  bool m_is_batch_ready;
32  };
33 }
34 
35 #endif
Definition: DifferenceSignal.hpp:18
virtual ~DifferenceSignal()=default
double read(void) const override
Read directly the value of the signal without affecting any pushed batch signals.
Definition: DifferenceSignal.cpp:43
double sample(void) override
Apply any conversions necessary to interpret the latest stored value as a double.
Definition: DifferenceSignal.cpp:34
void setup_batch(void) override
Prepare the signal for being updated through side effects by the owner's read_batch step....
Definition: DifferenceSignal.cpp:25
DifferenceSignal & operator=(const DifferenceSignal &other)=delete
DifferenceSignal(const DifferenceSignal &other)=delete
DifferenceSignal(std::shared_ptr< Signal > minuend, std::shared_ptr< Signal > subtrahend)
Definition: DifferenceSignal.cpp:15
Definition: Signal.hpp:16
Definition: Agg.cpp:20