geopm  3.1.1.dev214+gba4f9f6d
GEOPM - Global Extensible Open Power Manager
RatioSignal.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 RATIOSIGNAL_HPP_INCLUDE
7 #define RATIOSIGNAL_HPP_INCLUDE
8 
9 #include <memory>
10 
11 #include "Signal.hpp"
12 
13 namespace geopm
14 {
17  class RatioSignal : public Signal
18  {
19  public:
20  RatioSignal(std::shared_ptr<Signal> numerator,
21  std::shared_ptr<Signal> denominator);
22  RatioSignal(const RatioSignal &other) = delete;
23  RatioSignal &operator=(const RatioSignal &other) = delete;
24  virtual ~RatioSignal() = 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_numerator;
30  std::shared_ptr<Signal> m_denominator;
31  bool m_is_batch_ready;
32  };
33 }
34 
35 #endif
A composite signal used by an IOGroup to produce a signal as the Ratio of two signals.
Definition: RatioSignal.hpp:18
void setup_batch(void) override
Prepare the signal for being updated through side effects by the owner's read_batch step....
Definition: RatioSignal.cpp:28
RatioSignal(const RatioSignal &other)=delete
RatioSignal & operator=(const RatioSignal &other)=delete
double sample(void) override
Apply any conversions necessary to interpret the latest stored value as a double.
Definition: RatioSignal.cpp:37
double read(void) const override
Read directly the value of the signal without affecting any pushed batch signals.
Definition: RatioSignal.cpp:54
virtual ~RatioSignal()=default
RatioSignal(std::shared_ptr< Signal > numerator, std::shared_ptr< Signal > denominator)
Definition: RatioSignal.cpp:18
Definition: Signal.hpp:16
Definition: Agg.cpp:20