diff options
author | Florent Le Coz <louiz@louiz.org> | 2014-05-30 15:51:43 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2014-05-30 15:51:43 +0200 |
commit | 5c9d2c23ba6a401bc9494a6023491bbf3ade8d34 (patch) | |
tree | 050ea0cafc49cbdbc75dede85770aa28440d60dd /src/utils | |
parent | 5cca518c2d946144f4fee1b15dcfd3884850dcb1 (diff) | |
download | biboumi-5c9d2c23ba6a401bc9494a6023491bbf3ade8d34.tar.gz biboumi-5c9d2c23ba6a401bc9494a6023491bbf3ade8d34.tar.bz2 biboumi-5c9d2c23ba6a401bc9494a6023491bbf3ade8d34.tar.xz biboumi-5c9d2c23ba6a401bc9494a6023491bbf3ade8d34.zip |
TimedEventsManager is now a singleton
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/timed_events.hpp | 6 | ||||
-rw-r--r-- | src/utils/timed_events_manager.cpp | 6 |
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() { } |