blob: 989f8004f62004421c32f7c6086701f6a8b53fb5 [file] [log] [blame]
Patrick Venture863b9242018-03-08 08:29:23 -08001#pragma once
2
3#include <string>
4
5#include "interfaces.hpp"
6#include "sysfs/util.hpp"
7
8
9/*
10 * A WriteInterface that is expecting a path that's sysfs, but really could be
11 * any filesystem path.
12 */
13class SysFsWritePercent : public WriteInterface
14{
15 public:
Patrick Venturee49bbfc2018-06-11 09:39:57 -070016 SysFsWritePercent(const std::string& writepath, int64_t min,
17 int64_t max)
Patrick Venture863b9242018-03-08 08:29:23 -080018 : WriteInterface(min, max),
19 _writepath(FixupPath(writepath))
20 { }
21
22 void write(double value) override;
23
24 private:
25 std::string _writepath;
26};
27
28class SysFsWrite : public WriteInterface
29{
30 public:
Patrick Venturee49bbfc2018-06-11 09:39:57 -070031 SysFsWrite(const std::string& writepath, int64_t min, int64_t max)
Patrick Venture863b9242018-03-08 08:29:23 -080032 : WriteInterface(min, max),
33 _writepath(FixupPath(writepath))
34 { }
35
36 void write(double value) override;
37
38 private:
39 std::string _writepath;
40};