summaryrefslogtreecommitdiffstats
path: root/src/templates
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2017-05-23 19:16:21 -0400
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2017-06-19 16:26:47 -0400
commit49e661750ceed68ada3f3ae00d6d1620800c1f5f (patch)
tree4dd9ae109b41aa488b360d36e52f7deb2ee02782 /src/templates
parent3ce5c484aa9d25927b106f9bd3f819ec861176ad (diff)
downloadphosphor-dbus-monitor-49e661750ceed68ada3f3ae00d6d1620800c1f5f.tar.gz
phosphor-dbus-monitor-49e661750ceed68ada3f3ae00d6d1620800c1f5f.zip
Add callback groups
Allow named collections of callbacks to be defined and used anywhere callbacks are used. Change-Id: I3224aa06b2250e9a055bc70d20c186caecd033af Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'src/templates')
-rw-r--r--src/templates/callbackgroup.mako.cpp2
-rw-r--r--src/templates/generated.mako.hpp17
2 files changed, 19 insertions, 0 deletions
diff --git a/src/templates/callbackgroup.mako.cpp b/src/templates/callbackgroup.mako.cpp
new file mode 100644
index 0000000..6cc6813
--- /dev/null
+++ b/src/templates/callbackgroup.mako.cpp
@@ -0,0 +1,2 @@
+std::make_unique<GroupOfCallbacks<ConfigPropertyCallbacks>>(
+${indent(1)}ConfigPropertyCallbackGroups::get()[${c.graph}])\
diff --git a/src/templates/generated.mako.hpp b/src/templates/generated.mako.hpp
index 61c2b6f..67b9149 100644
--- a/src/templates/generated.mako.hpp
+++ b/src/templates/generated.mako.hpp
@@ -128,6 +128,23 @@ struct ConfigPropertyIndicies
}
};
+struct ConfigPropertyCallbackGroups
+{
+ using CallbackGroups = std::array<std::vector<size_t>, ${len(callbackgroups)}>;
+ static auto& get()
+ {
+ static const CallbackGroups propertyCallbackGraph =
+ {
+ {
+% for g in callbackgroups:
+ {${', '.join([str(x) for x in g.members])}},
+% endfor
+ }
+ };
+ return propertyCallbackGraph;
+ }
+};
+
struct ConfigPropertyCallbacks
{
using Callbacks = std::array<std::unique_ptr<Callback>, ${len(callbacks)}>;
OpenPOWER on IntegriCloud