powerd++
0.4.4
|
Singleton class representing the sysctl table for this library. More...
Public Member Functions | |
void | addValue (mib_t const &mib, std::string const &value) |
Add a value to the sysctls map. More... | |
void | addValue (std::string const &name, std::string const &value) |
Add a value to the sysctls map. More... | |
const mib_t & | getMib (char const *const name) const |
Returns a mib for a given symbolic name. More... | |
const mib_t & | getBaseMib (char const *const name) const |
Retrieves the base mib for a given mib name. More... | |
SysctlValue & | operator[] (char const *const name) |
Returns a reference to a sysctl value container. More... | |
SysctlValue & | operator[] (mib_t const &mib) |
Returns a reference to a sysctl value container. More... | |
Private Types | |
typedef std::lock_guard< decltype(mtx)> | lock_guard |
The appropriate lock guard type for mtx. | |
Private Attributes | |
std::mutex | mtx |
A simple mutex. | |
std::unordered_map< std::string, mib_t > | mibs |
Maps name → mib. More... | |
std::map< mib_t, SysctlValue > | sysctls |
Maps mib → (type, value). More... | |
Singleton class representing the sysctl table for this library.
|
inline |
Add a value to the sysctls map.
mib | The mib to add the value for |
value | The value to store |
|
inline |
Add a value to the sysctls map.
name | The symbolic name of the mib to add the value for |
value | The value to store |
|
inline |
Retrieves the base mib for a given mib name.
E.g. the base mib for "dev.cpu.0.freq" is the mib for "dev.cpu.%d.freq".
name | The MIB name |
|
inline |
Returns a mib for a given symbolic name.
name | The MIB name |
|
inline |
Returns a reference to a sysctl value container.
name | The MIB name to return the reference for |
|
inline |
Returns a reference to a sysctl value container.
mib | The MIB to return the reference for |
|
private |
Maps name → mib.
|
private |
Maps mib → (type, value).