summaryrefslogtreecommitdiffstats
path: root/src/templates/generated.mako.hpp
diff options
context:
space:
mode:
authorMarri Devender Rao <devenrao@in.ibm.com>2018-04-12 09:22:55 -0500
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-06-05 02:10:49 +0000
commit80c70610a0ea96cf609387638f9f3f9bee0c581d (patch)
treee07a5f96bff47280cf47980f63b6bce78b491caf /src/templates/generated.mako.hpp
parent0dabe5924d56be25a9bf2277effd2b87c698a9fe (diff)
downloadphosphor-dbus-monitor-80c70610a0ea96cf609387638f9f3f9bee0c581d.tar.gz
phosphor-dbus-monitor-80c70610a0ea96cf609387638f9f3f9bee0c581d.zip
Modify parser and add mako scripts for watch on object path
Added support for watch and callback on 'interface added' signal for the specified object paths. Added mako scripts for events to auto create callback and watch objects for the specified object path groups. Clients specify object paths to watch and callbacks to invoke in the config.yaml file Change-Id: I3fa2ea1520649120b927c0cb83a16e5cace2f24e Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
Diffstat (limited to 'src/templates/generated.mako.hpp')
-rw-r--r--src/templates/generated.mako.hpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/templates/generated.mako.hpp b/src/templates/generated.mako.hpp
index 1b73198..8dbaa20 100644
--- a/src/templates/generated.mako.hpp
+++ b/src/templates/generated.mako.hpp
@@ -12,9 +12,11 @@
#include "errors.hpp"
#include "method.hpp"
#include "propertywatchimpl.hpp"
+#include "pathwatchimpl.hpp"
#include "resolve_errors.hpp"
#include "sdbusplus.hpp"
#include "event.hpp"
+#include "snmp_trap.hpp"
#include "sdevent.hpp"
using namespace std::string_literals;
@@ -75,6 +77,22 @@ struct ConfigInterfaces
}
};
+struct ConfigIntfAddPaths
+{
+ using Paths = std::array<std::string, ${len(pathinstances)}>;
+
+ static auto& get()
+ {
+ static const Paths paths =
+ {
+% for p in pathinstances:
+ "${p.path}"s,
+% endfor
+ };
+ return paths;
+ }
+};
+
struct ConfigProperties
{
using Properties = std::array<std::string, ${len(propertynames)}>;
@@ -186,6 +204,22 @@ struct ConfigPropertyCallbacks
}
};
+struct ConfigPathCallbacks
+{
+ using Callbacks = std::array<std::unique_ptr<Callback>, ${len(pathcallbacks)}>;
+
+ static auto& get()
+ {
+ static const Callbacks pathCallbacks =
+ {
+% for c in pathcallbacks:
+ ${c.construct(loader, indent=indent +3)},
+% endfor
+ };
+ return pathCallbacks;
+ }
+};
+
struct ConfigPropertyWatches
{
using PropertyWatches = std::array<std::unique_ptr<Watch>, ${len(watches)}>;
@@ -207,6 +241,28 @@ struct ConfigPropertyWatches
return propertyWatches;
}
};
+
+struct ConfigPathWatches
+{
+ using PathWatches = std::array<std::unique_ptr<Watch>, ${len(pathwatches)}>;
+
+ static auto& get()
+ {
+ static const PathWatches pathWatches =
+ {
+% for w in pathwatches:
+ std::make_unique<PathWatch<SDBusPlus>>(
+ % if w.pathcallback is None:
+ ConfigIntfAddPaths::get()[${w.pathinstances}]),
+ % else:
+ ConfigIntfAddPaths::get()[${w.pathinstances}],
+ *ConfigPathCallbacks::get()[${w.pathcallback}]),
+ % endif
+% endfor
+ };
+ return pathWatches;
+ }
+};
} // namespace monitoring
} // namespace dbus
} // namespace phosphor
OpenPOWER on IntegriCloud