Extend storage array to contain additional data

This array was originally just an array of objects of
type 'any'.  This commit changes it to be an array of
tuples of type <any, any> to add an extra field for
use by anything that needs it.

For example, the storage is currently used to store
property values, and a future change to the CountCondition
class will now also store the result of the comparisons done
between the property values and another value specified in
the rule YAML.  Then, a callback will be able to see the
result of whether each property passed the check.

Tested:  Build and run unit tests

Change-Id: I58f32c9f4068b15a02b1ff7f28871161cafebddb
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/src/count.hpp b/src/count.hpp
index 51a76eb..0ac6420 100644
--- a/src/count.hpp
+++ b/src/count.hpp
@@ -64,12 +64,12 @@
                                  const auto& storage = std::get<2>(
                                      item.second);
                                  // Don't count properties that don't exist.
-                                 if (storage.get().empty())
+                                 if (std::get<0>(storage.get()).empty())
                                  {
                                      return false;
                                  }
                                  const auto& value = any_ns::any_cast<T>(
-                                     storage);
+                                     std::get<0>(storage.get()));
                                  return propertyOp(value);
                              });
             // *INDENT-ON*
diff --git a/src/data_types.hpp b/src/data_types.hpp
index 12d1d6d..f1512db 100644
--- a/src/data_types.hpp
+++ b/src/data_types.hpp
@@ -18,7 +18,8 @@
 constexpr auto MAPPER_INTERFACE = "xyz.openbmc_project.ObjectMapper";
 constexpr auto pathIndex = 0;
 constexpr auto propertyIndex = 2;
-constexpr auto valueIndex = 2;
+constexpr auto storageIndex = 2;
+constexpr auto valueIndex = 0;
 constexpr auto metaIndex = 1;
 
 enum class Context
@@ -70,7 +71,7 @@
         TupleOfRefs<
             const std::string,
             const std::string,
-            any_ns::any>,
+            std::tuple<any_ns::any, any_ns::any>>,
         const std::string,
         const std::string,
         const std::string >;
diff --git a/src/event.hpp b/src/event.hpp
index ad02986..b5f1e90 100644
--- a/src/event.hpp
+++ b/src/event.hpp
@@ -46,10 +46,11 @@
             for (const auto& n : index)
             {
                 const auto& path = std::get<pathIndex>(n.first);
-                const auto& propertyMeta = std::get<propertyIndex>(n.first);
-                const auto& value = std::get<valueIndex>(n.second);
+                const auto& propertyMeta = std::get<metaIndex>(n.first);
+                const auto& storage = std::get<storageIndex>(n.second);
+                const auto& value = std::get<valueIndex>(storage.get());
 
-                if (!value.get().empty())
+                if (!value.empty())
                 {
                     createEvent(
                             path,
diff --git a/src/journal.cpp b/src/journal.cpp
index c348cfb..7069c74 100644
--- a/src/journal.cpp
+++ b/src/journal.cpp
@@ -29,9 +29,10 @@
         const auto& path = std::get<0>(n.first);
         const auto& pathMeta = std::get<0>(n.second);
         const auto& propertyMeta = std::get<1>(n.second);
-        const auto& value = std::get<2>(n.second);
+        const auto& storage = std::get<2>(n.second);
+        const auto& value = std::get<0>(storage.get());
 
-        if (!value.get().empty())
+        if (!value.empty())
         {
             log(message,
                 pathMeta,
diff --git a/src/propertywatchimpl.hpp b/src/propertywatchimpl.hpp
index 43875b9..9fe57d5 100644
--- a/src/propertywatchimpl.hpp
+++ b/src/propertywatchimpl.hpp
@@ -146,7 +146,8 @@
             continue;
         }
 
-        std::get<2>(item->second).get() = p.second.template get<T>();
+        std::get<0>(std::get<2>(item->second).get()) =
+                p.second.template get<T>();
 
         // Invoke callback if present.
         this->callback(Context::SIGNAL);
diff --git a/src/templates/generated.mako.hpp b/src/templates/generated.mako.hpp
index 4a5b87c..1b73198 100644
--- a/src/templates/generated.mako.hpp
+++ b/src/templates/generated.mako.hpp
@@ -93,7 +93,7 @@
 
 struct ConfigPropertyStorage
 {
-    using Storage = std::array<any_ns::any, ${len(instances)}>;
+    using Storage = std::array<std::tuple<any_ns::any, any_ns::any>, ${len(instances)}>;
 
     static auto& get()
     {
diff --git a/src/test/propertywatchtest.cpp b/src/test/propertywatchtest.cpp
index b92dbec..c97e8d3 100644
--- a/src/test/propertywatchtest.cpp
+++ b/src/test/propertywatchtest.cpp
@@ -27,7 +27,7 @@
 
 const std::string meta;
 
-std::array<any_ns::any, 8> storage = { };
+std::array<std::tuple<any_ns::any, any_ns::any>, 8> storage = { };
 
 const PropertyIndex watchIndex =
 {
@@ -204,7 +204,7 @@
     ndx = 0;
     for (auto s : storage)
     {
-        ASSERT_EQ(s.empty(), false);
+        ASSERT_EQ(std::get<0>(s).empty(), false);
         ASSERT_EQ(any_ns::any_cast<T>(s), ExpectedValues<T>::get(ndx));
         ++ndx;
     }