diff options
Diffstat (limited to 'src/utils/timed_events_manager.cpp')
-rw-r--r-- | src/utils/timed_events_manager.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/utils/timed_events_manager.cpp b/src/utils/timed_events_manager.cpp index c3e260c..a03444e 100644 --- a/src/utils/timed_events_manager.cpp +++ b/src/utils/timed_events_manager.cpp @@ -53,3 +53,23 @@ std::size_t TimedEventsManager::execute_expired_events() return count; } +std::size_t TimedEventsManager::cancel(const std::string& name) +{ + std::size_t res = 0; + for (auto it = this->events.begin(); it != this->events.end();) + { + if (it->get_name() == name) + { + it = this->events.erase(it); + res++; + } + else + ++it; + } + return res; +} + +std::size_t TimedEventsManager::size() const +{ + return this->events.size(); +} |