HardwareState: HWMon data reader

Ported HWMon driver from
cla-sysrepo@19163e50ab062a8b5b75f754b30c22fdbd62b03a.

In cla-sysrepo, these drivers provided a property-based API, i.e., you
asked for a specific property (i.e., a filename) and the contents of the
file was returned.

In velia, we do not need this one-by-one property access. We provide all
attributes with a single call.

Change-Id: Ife783f21d4552e3b8bc69436d2f8fa53eb6745b7
diff --git a/src/utils/io.cpp b/src/utils/io.cpp
index 4a18668..86dbd7c 100644
--- a/src/utils/io.cpp
+++ b/src/utils/io.cpp
@@ -53,4 +53,17 @@
     return bytes;
 }
 
+/** @brief Reads a int64_t number from a file. */
+int64_t readFileInt64(const std::filesystem::path& path)
+{
+    std::ifstream ifs(openStream(path));
+    int64_t res;
+
+    if (ifs >> res) {
+        return res;
+    }
+
+    throw std::domain_error("Could not read int64_t value from '" + std::string(path) + "'.");
+}
+
 }
diff --git a/src/utils/io.h b/src/utils/io.h
index a23069d..6d8123a 100644
--- a/src/utils/io.h
+++ b/src/utils/io.h
@@ -14,5 +14,6 @@
 namespace velia::utils {
 
 std::string readFileString(const std::filesystem::path& path);
+int64_t readFileInt64(const std::filesystem::path& path);
 std::vector<uint32_t> readFileWords(const std::filesystem::path& path, int valuesCount);
 }