summaryrefslogtreecommitdiff
path: root/src/utils/timed_events_manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/timed_events_manager.cpp')
-rw-r--r--src/utils/timed_events_manager.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/utils/timed_events_manager.cpp b/src/utils/timed_events_manager.cpp
index 67d61fe..75e6338 100644
--- a/src/utils/timed_events_manager.cpp
+++ b/src/utils/timed_events_manager.cpp
@@ -1,5 +1,7 @@
#include <utils/timed_events.hpp>
+#include <algorithm>
+
TimedEventsManager& TimedEventsManager::instance()
{
static TimedEventsManager inst;
@@ -67,7 +69,19 @@ std::size_t TimedEventsManager::cancel(const std::string& name)
return res;
}
+
+
std::size_t TimedEventsManager::size() const
{
return this->events.size();
}
+
+const TimedEvent* TimedEventsManager::find_event(const std::string& name) const
+{
+ const auto it = std::find_if(this->events.begin(), this->events.end(), [&name](const TimedEvent& o) {
+ return o.get_name() == name;
+ });
+ if (it == this->events.end())
+ return nullptr;
+ return &*it;
+}