Create empty action groups
This introduces the framework for set speed events to have the groups
within an event assign directly on the event action. When a group is
defined directly to an action, it will be used in place of the group(s)
on the event. This allows a single event, driven by trigger(s), to call
multiple actions on different groups with differing parameters to those
actions.
Change-Id: I5c648d912641b3006a77eab27457e3ddb220c2ad
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/zone.cpp b/control/zone.cpp
index 32a297b..7c09727 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -325,10 +325,38 @@
std::get<triggerPos>(event).end(),
[this, &event](auto const& trigger)
{
- trigger(*this,
- std::get<sseNamePos>(event),
- std::get<groupPos>(event),
- std::get<actionsPos>(event));
+ if (!std::get<actionsPos>(event).empty())
+ {
+ std::for_each(
+ std::get<actionsPos>(event).begin(),
+ std::get<actionsPos>(event).end(),
+ [this, &trigger, &event](auto const& action)
+ {
+ // Default to use group defined with action if exists
+ if (!std::get<adGroupPos>(action).empty())
+ {
+ trigger(*this,
+ std::get<sseNamePos>(event),
+ std::get<adGroupPos>(action),
+ std::get<adActionsPos>(action));
+ }
+ else
+ {
+ trigger(*this,
+ std::get<sseNamePos>(event),
+ std::get<groupPos>(event),
+ std::get<adActionsPos>(action));
+ }
+ }
+ );
+ }
+ else
+ {
+ trigger(*this,
+ std::get<sseNamePos>(event),
+ std::get<groupPos>(event),
+ {});
+ }
}
);
}