summaryrefslogtreecommitdiffstats
path: root/src/templates
diff options
context:
space:
mode:
Diffstat (limited to 'src/templates')
-rw-r--r--src/templates/conditional.mako.cpp3
-rw-r--r--src/templates/count.mako.cpp4
-rw-r--r--src/templates/generated.mako.hpp17
3 files changed, 24 insertions, 0 deletions
diff --git a/src/templates/conditional.mako.cpp b/src/templates/conditional.mako.cpp
new file mode 100644
index 0000000..3cc9564
--- /dev/null
+++ b/src/templates/conditional.mako.cpp
@@ -0,0 +1,3 @@
+std::make_unique<ConditionalCallback<ConfigPropertyCallbacks>>(
+${indent(1)}ConfigPropertyCallbackGroups::get()[${c.graph}],
+${indent(1)}*ConfigConditions::get()[${c.condition}])\
diff --git a/src/templates/count.mako.cpp b/src/templates/count.mako.cpp
new file mode 100644
index 0000000..d348518
--- /dev/null
+++ b/src/templates/count.mako.cpp
@@ -0,0 +1,4 @@
+std::make_unique<CountCondition<${c.datatype}>>(
+${indent(1)}ConfigPropertyIndicies::get()[${c.instances}],
+${indent(1)}[](const auto& item){return item ${c.countop} ${c.countbound};},
+${indent(1)}[](const auto& item){return item ${c.op} ${c.bound};})\
diff --git a/src/templates/generated.mako.hpp b/src/templates/generated.mako.hpp
index 67b9149..a4819e2 100644
--- a/src/templates/generated.mako.hpp
+++ b/src/templates/generated.mako.hpp
@@ -4,6 +4,7 @@
#include <array>
#include <string>
+#include "count.hpp"
#include "data_types.hpp"
#include "journal.hpp"
#include "propertywatchimpl.hpp"
@@ -145,6 +146,22 @@ struct ConfigPropertyCallbackGroups
}
};
+struct ConfigConditions
+{
+ using Conditions = std::array<std::unique_ptr<Conditional>, ${len(conditions)}>;
+
+ static auto& get()
+ {
+ static const Conditions propertyConditions =
+ {
+% for c in conditions:
+ ${c.construct(loader, indent=indent +3)},
+% endfor
+ };
+ return propertyConditions;
+ }
+};
+
struct ConfigPropertyCallbacks
{
using Callbacks = std::array<std::unique_ptr<Callback>, ${len(callbacks)}>;
OpenPOWER on IntegriCloud