sensorset.hpp (a4353bcfd0d1274f9454c9731d26ff49d3d40cb7) | sensorset.hpp (043d32306e00484afc446a44789b61869ea14f84) |
---|---|
1#pragma once 2 3#include <map> 4#include <set> 5#include <string> 6 7/** 8 * @class SensorSet --- 5 unchanged lines hidden (view full) --- 14 * 15 * For example, a file named temp5_input will have a map entry of: 16 * 17 * key: pair<string, string> = {"temp", "5"} 18 * value: std::string = "input" 19 */ 20class SensorSet 21{ | 1#pragma once 2 3#include <map> 4#include <set> 5#include <string> 6 7/** 8 * @class SensorSet --- 5 unchanged lines hidden (view full) --- 14 * 15 * For example, a file named temp5_input will have a map entry of: 16 * 17 * key: pair<string, string> = {"temp", "5"} 18 * value: std::string = "input" 19 */ 20class SensorSet 21{ |
22 public: 23 typedef std::map<std::pair<std::string, std::string>, 24 std::set<std::string>> container_t; 25 using mapped_type = container_t::mapped_type; 26 using key_type = container_t::key_type; | 22 public: 23 typedef std::map<std::pair<std::string, std::string>, std::set<std::string>> 24 container_t; 25 using mapped_type = container_t::mapped_type; 26 using key_type = container_t::key_type; |
27 | 27 |
28 /** 29 * @brief Constructor 30 * @details Builds a map of the hwmon sysfs files in the passed 31 * in directory. 32 * 33 * @param[in] path - path to the hwmon device directory 34 * 35 */ 36 explicit SensorSet(const std::string& path); 37 ~SensorSet() = default; 38 SensorSet() = delete; 39 SensorSet(const SensorSet&) = delete; 40 SensorSet& operator=(const SensorSet&) = delete; 41 SensorSet(SensorSet&&) = default; 42 SensorSet& operator=(SensorSet&&) = default; | 28 /** 29 * @brief Constructor 30 * @details Builds a map of the hwmon sysfs files in the passed 31 * in directory. 32 * 33 * @param[in] path - path to the hwmon device directory 34 * 35 */ 36 explicit SensorSet(const std::string& path); 37 ~SensorSet() = default; 38 SensorSet() = delete; 39 SensorSet(const SensorSet&) = delete; 40 SensorSet& operator=(const SensorSet&) = delete; 41 SensorSet(SensorSet&&) = default; 42 SensorSet& operator=(SensorSet&&) = default; |
43 | 43 |
44 /** 45 * @brief Returns an iterator to the beginning of the map 46 * 47 * @return const_iterator 48 */ 49 container_t::const_iterator begin() 50 { 51 return const_cast<const container_t&>(container).begin(); 52 } | 44 /** 45 * @brief Returns an iterator to the beginning of the map 46 * 47 * @return const_iterator 48 */ 49 container_t::const_iterator begin() 50 { 51 return const_cast<const container_t&>(container).begin(); 52 } |
53 | 53 |
54 /** 55 * @brief Returns an iterator to the end of the map 56 * 57 * @return const_iterator 58 */ 59 container_t::const_iterator end() 60 { 61 return const_cast<const container_t&>(container).end(); 62 } | 54 /** 55 * @brief Returns an iterator to the end of the map 56 * 57 * @return const_iterator 58 */ 59 container_t::const_iterator end() 60 { 61 return const_cast<const container_t&>(container).end(); 62 } |
63 | 63 |
64 private: 65 66 /** 67 * @brief The map of hwmon files in the directory 68 * @details For example: 69 * key = pair("temp", "1") 70 * value = "input" 71 */ 72 container_t container; 73 | 64 private: 65 /** 66 * @brief The map of hwmon files in the directory 67 * @details For example: 68 * key = pair("temp", "1") 69 * value = "input" 70 */ 71 container_t container; |
74}; 75 76// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 | 72}; 73 74// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 |