blob: 3e46317eed76791ee4ad61989fa57cce7b3f41c0 [file] [log] [blame]
#pragma once
#include <chrono>
#include <memory>
#include <ostream>
#include <string>
#include <string_view>
#include <tuple>
#include <vector>
namespace interfaces
{
class SensorListener;
class Sensor
{
public:
struct Id
{
Id(std::string_view type, std::string_view service,
std::string_view path) :
type(type),
service(service), path(path)
{}
std::string type;
std::string service;
std::string path;
bool operator<(const Id& other) const
{
return std::tie(type, service, path) <
std::tie(other.type, other.service, other.path);
}
inline std::string str() const
{
return type + ":" + service + ":" + path;
}
};
virtual ~Sensor() = default;
virtual Id id() const = 0;
virtual void registerForUpdates(const std::weak_ptr<SensorListener>&) = 0;
};
} // namespace interfaces
using Sensors = std::vector<std::shared_ptr<interfaces::Sensor>>;