summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/count.hpp4
-rw-r--r--src/data_types.hpp5
-rw-r--r--src/event.hpp7
-rw-r--r--src/journal.cpp5
-rw-r--r--src/propertywatchimpl.hpp3
-rw-r--r--src/templates/generated.mako.hpp2
-rw-r--r--src/test/propertywatchtest.cpp4
7 files changed, 17 insertions, 13 deletions
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 @@ class CountCondition : public IndexedConditional
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_PATH = "/xyz/openbmc_project/object_mapper";
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 @@ using PropertyIndex = TupleRefMap <
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 @@ class EventBase : public IndexedCallback
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 @@ void JournalBase::operator()(Context ctx)
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 @@ void PropertyWatchOfType<T, DBusInterfaceType>::propertiesChanged(
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 ConfigProperties
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::array<std::string, 2> properties =
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 @@ void testStart()
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;
}
OpenPOWER on IntegriCloud