Patrick Venture | 863b924 | 2018-03-08 08:29:23 -0800 | [diff] [blame] | 1 | #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 | */ |
| 13 | class SysFsWritePercent : public WriteInterface |
| 14 | { |
| 15 | public: |
Patrick Venture | e49bbfc | 2018-06-11 09:39:57 -0700 | [diff] [blame] | 16 | SysFsWritePercent(const std::string& writepath, int64_t min, |
| 17 | int64_t max) |
Patrick Venture | 863b924 | 2018-03-08 08:29:23 -0800 | [diff] [blame] | 18 | : WriteInterface(min, max), |
| 19 | _writepath(FixupPath(writepath)) |
| 20 | { } |
| 21 | |
| 22 | void write(double value) override; |
| 23 | |
| 24 | private: |
| 25 | std::string _writepath; |
| 26 | }; |
| 27 | |
| 28 | class SysFsWrite : public WriteInterface |
| 29 | { |
| 30 | public: |
Patrick Venture | e49bbfc | 2018-06-11 09:39:57 -0700 | [diff] [blame] | 31 | SysFsWrite(const std::string& writepath, int64_t min, int64_t max) |
Patrick Venture | 863b924 | 2018-03-08 08:29:23 -0800 | [diff] [blame] | 32 | : WriteInterface(min, max), |
| 33 | _writepath(FixupPath(writepath)) |
| 34 | { } |
| 35 | |
| 36 | void write(double value) override; |
| 37 | |
| 38 | private: |
| 39 | std::string _writepath; |
| 40 | }; |