Add conditional callbacks

Enable conditional application of callbacks.

Change-Id: I9d765e5f585aac40994b65da3b51ea891beae9bf
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
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 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)}>;