Save properties to persistent storage when host is on

1. When host is on, set properties as requested properties instead
of notify listeners;
2. When host becomes off, and requested properties are not empty, notify
the listners and reset the requested properties.

Add unit tests.

Change-Id: I9359c801c698df0c6e5eab43e12427bb5a6da611
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/utils.hpp b/utils.hpp
new file mode 100644
index 0000000..0589613
--- /dev/null
+++ b/utils.hpp
@@ -0,0 +1,47 @@
+#pragma once
+
+#include <fstream>
+
+namespace phosphor
+{
+namespace time
+{
+namespace utils
+{
+
+/** @brief Read data with type T from file
+ *
+ * @param[in] fileName - The name of file to read from
+ *
+ * @return The data with type T
+ */
+template <typename T>
+T readData(const char* fileName)
+{
+    T data{};
+    std::ifstream fs(fileName);
+    if (fs.is_open())
+    {
+        fs >> data;
+    }
+    return data;
+}
+
+/** @brief Write data with type T to file
+ *
+ * @param[in] fileName - The name of file to write to
+ * @param[in] data - The data with type T to write to file
+ */
+template <typename T>
+void writeData(const char* fileName, T&& data)
+{
+    std::ofstream fs(fileName, std::ios::out);
+    if (fs.is_open())
+    {
+        fs << std::forward<T>(data);
+    }
+}
+
+}
+}
+}