control: count_state_target: Use default name
This action can just use the getUniqueName() from the base class to give
a more meaningful key name when shown in a dump:
"target_holds": {
"count_state_before_target-1(fan rotor(s) faulted)": 11300
}
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ia8e874ffd7a27ec239a4a2a082f616554f831af1
diff --git a/control/json/actions/count_state_target.cpp b/control/json/actions/count_state_target.cpp
index 1017ae6..dcbd70d 100644
--- a/control/json/actions/count_state_target.cpp
+++ b/control/json/actions/count_state_target.cpp
@@ -29,9 +29,6 @@
using json = nlohmann::json;
-// Instance id for setting the unique id of each instance of this action
-size_t CountStateTarget::instanceId = 0;
-
CountStateTarget::CountStateTarget(const json& jsonObj,
const std::vector<Group>& groups) :
ActionBase(jsonObj, groups)
@@ -39,8 +36,6 @@
setCount(jsonObj);
setState(jsonObj);
setTarget(jsonObj);
-
- _id = instanceId++;
}
void CountStateTarget::run(Zone& zone)
@@ -74,8 +69,7 @@
}
// Update zone's target hold based on action results
- zone.setTargetHold(ActionBase::getName() + std::to_string(_id), _target,
- (numAtState >= _count));
+ zone.setTargetHold(getUniqueName(), _target, (numAtState >= _count));
}
void CountStateTarget::setCount(const json& jsonObj)
diff --git a/control/json/actions/count_state_target.hpp b/control/json/actions/count_state_target.hpp
index b1b4eb9..3874847 100644
--- a/control/json/actions/count_state_target.hpp
+++ b/control/json/actions/count_state_target.hpp
@@ -70,10 +70,6 @@
*/
void run(Zone& zone) override;
- protected:
- /* Instance id for each instance of this action */
- static size_t instanceId;
-
private:
/* Number of group members */
size_t _count;