Add method Actions::has( action_name )
This commit is contained in:
parent
5e5dd48cee
commit
45a6e4fb15
@ -57,6 +57,7 @@ public:
|
||||
std::vector<const ActionX *> pending(const State& state, std::time_t sim_time) const;
|
||||
std::vector<const PyAction *> pending_python() const;
|
||||
|
||||
bool has(const std::string& name) const;
|
||||
std::vector<ActionX>::const_iterator begin() const;
|
||||
std::vector<ActionX>::const_iterator end() const;
|
||||
|
||||
|
@ -82,6 +82,12 @@ const ActionX& Actions::operator[](const std::string& name) const {
|
||||
return *iter;
|
||||
}
|
||||
|
||||
bool Actions::has(const std::string& name) const {
|
||||
const auto iter = std::find_if( this->actions.begin(), this->actions.end(), [&name](const ActionX& action) { return action.name() == name; });
|
||||
return (iter != this->actions.end());
|
||||
}
|
||||
|
||||
|
||||
const ActionX& Actions::operator[](std::size_t index) const {
|
||||
return this->actions[index];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user