Initial read-daemon for hwmon entries
Discoveres hwmon entries for fans, input voltage, and temperature
sensors. Polls entries on a 1s interval and displays a message to
stdout if one of the entries have changed.
diff --git a/sensorcache.H b/sensorcache.H
new file mode 100644
index 0000000..64333d8
--- /dev/null
+++ b/sensorcache.H
@@ -0,0 +1,27 @@
+#ifndef __SENSORCACHE_H
+#define __SENSORCACHE_H
+
+#include <map>
+
+class SensorCache
+{
+ public:
+ typedef std::map<std::pair<std::string, std::string>,
+ int> container_t;
+
+ bool update(const container_t::key_type& k,
+ const container_t::mapped_type& v)
+ {
+ auto& i = container[k];
+ if (v == i) return false;
+ else
+ {
+ i = v;
+ return true;
+ }
+ }
+ private:
+ container_t container;
+};
+
+#endif