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: |
| 16 | SysFsWritePercent(std::string& writepath, int64_t min, int64_t max) |
| 17 | : WriteInterface(min, max), |
| 18 | _writepath(FixupPath(writepath)) |
| 19 | { } |
| 20 | |
| 21 | void write(double value) override; |
| 22 | |
| 23 | private: |
| 24 | std::string _writepath; |
| 25 | }; |
| 26 | |
| 27 | class SysFsWrite : public WriteInterface |
| 28 | { |
| 29 | public: |
| 30 | SysFsWrite(std::string& writepath, int64_t min, int64_t max) |
| 31 | : WriteInterface(min, max), |
| 32 | _writepath(FixupPath(writepath)) |
| 33 | { } |
| 34 | |
| 35 | void write(double value) override; |
| 36 | |
| 37 | private: |
| 38 | std::string _writepath; |
| 39 | }; |