xref: /openbmc/telemetry/src/interfaces/sensor.hpp (revision 7f06f613)
1 #pragma once
2 
3 #include <ostream>
4 #include <string>
5 #include <string_view>
6 #include <tuple>
7 
8 namespace interfaces
9 {
10 
11 class Sensor
12 {
13   public:
14     struct Id
15     {
16         Id(std::string_view type, std::string_view service,
17            std::string_view path) :
18             type(type),
19             service(service), path(path)
20         {}
21 
22         std::string type;
23         std::string service;
24         std::string path;
25 
26         bool operator<(const Id& other) const
27         {
28             return std::tie(type, service, path) <
29                    std::tie(other.type, other.service, other.path);
30         }
31     };
32 
33     virtual ~Sensor() = default;
34 
35     virtual Id id() const = 0;
36 };
37 
38 } // namespace interfaces
39