summaryrefslogtreecommitdiffstats
path: root/sysfs/sysfswrite.hpp
blob: 990855ea042cfd8625df129293d84eca20bb1b88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once

#include "interfaces.hpp"
#include "util.hpp"

#include <string>

/*
 * A WriteInterface that is expecting a path that's sysfs, but really could be
 * any filesystem path.
 */
class SysFsWritePercent : public WriteInterface
{
  public:
    SysFsWritePercent(const std::string& writePath, int64_t min, int64_t max) :
        WriteInterface(min, max), _writePath(FixupPath(writePath))
    {
    }

    void write(double value) override;

  private:
    std::string _writePath;
};

class SysFsWrite : public WriteInterface
{
  public:
    SysFsWrite(const std::string& writePath, int64_t min, int64_t max) :
        WriteInterface(min, max), _writePath(FixupPath(writePath))
    {
    }

    void write(double value) override;

  private:
    std::string _writePath;
};
OpenPOWER on IntegriCloud