summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/timed_events.hpp6
-rw-r--r--src/utils/timed_events_manager.cpp6
2 files changed, 11 insertions, 1 deletions
diff --git a/src/utils/timed_events.hpp b/src/utils/timed_events.hpp
index f601cae..aafe532 100644
--- a/src/utils/timed_events.hpp
+++ b/src/utils/timed_events.hpp
@@ -83,9 +83,12 @@ private:
class TimedEventsManager
{
public:
- explicit TimedEventsManager();
~TimedEventsManager();
/**
+ * Return the unique instance of this class
+ */
+ static TimedEventsManager& instance();
+ /**
* Add an event to the list of managed events. The list is sorted after
* this call.
*/
@@ -117,6 +120,7 @@ public:
std::size_t size() const;
private:
+ explicit TimedEventsManager();
std::list<TimedEvent> events;
TimedEventsManager(const TimedEventsManager&) = delete;
TimedEventsManager(TimedEventsManager&&) = delete;
diff --git a/src/utils/timed_events_manager.cpp b/src/utils/timed_events_manager.cpp
index a03444e..2c75e48 100644
--- a/src/utils/timed_events_manager.cpp
+++ b/src/utils/timed_events_manager.cpp
@@ -1,5 +1,11 @@
#include <utils/timed_events.hpp>
+TimedEventsManager& TimedEventsManager::instance()
+{
+ static TimedEventsManager inst;
+ return inst;
+}
+
TimedEventsManager::TimedEventsManager()
{
}