1 #pragma once
2 #include <org/open_power/Sensor/Aggregation/History/Average/server.hpp>
3 
4 #include <functional>
5 
6 namespace phosphor
7 {
8 namespace power
9 {
10 namespace history
11 {
12 
13 template <typename T>
14 using ServerObject = typename sdbusplus::server::object::object<T>;
15 
16 using AverageInterface =
17     sdbusplus::org::open_power::Sensor::Aggregation::History::server::Average;
18 
19 /**
20  * @class Average
21  *
22  * Implements Sensor.Aggregation.History.Average
23  *
24  * This includes a property that is an array of timestamp/average tuples
25  * and a property to specify the scale.
26  */
27 class Average : public ServerObject<AverageInterface>
28 {
29   public:
30     static constexpr auto name = "average";
31 
32     Average() = delete;
33     Average(const Average&) = delete;
34     Average& operator=(const Average&) = delete;
35     Average(Average&&) = delete;
36     Average& operator=(Average&&) = delete;
37     ~Average() = default;
38 
39     /**
40      * @brief Constructor
41      *
42      * @param[in] bus - D-Bus object
43      * @param[in] objectPath - the D-Bus object path
44      */
45     Average(sdbusplus::bus::bus& bus, const std::string& objectPath) :
46         ServerObject<AverageInterface>(bus, objectPath.c_str())
47     {
48         unit(Average::Unit::Watts);
49         scale(0);
50     }
51 };
52 
53 } // namespace history
54 } // namespace power
55 } // namespace phosphor
56