1863b9246SPatrick Venture #pragma once 2863b9246SPatrick Venture 3863b9246SPatrick Venture #include "interfaces.hpp" 4863b9246SPatrick Venture #include "sysfs/util.hpp" 5863b9246SPatrick Venture 6*da4a5dd1SPatrick Venture #include <string> 7863b9246SPatrick Venture 8863b9246SPatrick Venture /* 9863b9246SPatrick Venture * A WriteInterface that is expecting a path that's sysfs, but really could be 10863b9246SPatrick Venture * any filesystem path. 11863b9246SPatrick Venture */ 12863b9246SPatrick Venture class SysFsWritePercent : public WriteInterface 13863b9246SPatrick Venture { 14863b9246SPatrick Venture public: 15*da4a5dd1SPatrick Venture SysFsWritePercent(const std::string& writepath, int64_t min, int64_t max) : 16*da4a5dd1SPatrick Venture WriteInterface(min, max), _writepath(FixupPath(writepath)) 17*da4a5dd1SPatrick Venture { 18*da4a5dd1SPatrick Venture } 19863b9246SPatrick Venture 20863b9246SPatrick Venture void write(double value) override; 21863b9246SPatrick Venture 22863b9246SPatrick Venture private: 23863b9246SPatrick Venture std::string _writepath; 24863b9246SPatrick Venture }; 25863b9246SPatrick Venture 26863b9246SPatrick Venture class SysFsWrite : public WriteInterface 27863b9246SPatrick Venture { 28863b9246SPatrick Venture public: 29*da4a5dd1SPatrick Venture SysFsWrite(const std::string& writepath, int64_t min, int64_t max) : 30*da4a5dd1SPatrick Venture WriteInterface(min, max), _writepath(FixupPath(writepath)) 31*da4a5dd1SPatrick Venture { 32*da4a5dd1SPatrick Venture } 33863b9246SPatrick Venture 34863b9246SPatrick Venture void write(double value) override; 35863b9246SPatrick Venture 36863b9246SPatrick Venture private: 37863b9246SPatrick Venture std::string _writepath; 38863b9246SPatrick Venture }; 39