diff options
author | ModoX <moardox@gmail.com> | 2023-11-10 20:15:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-10 20:15:37 +0100 |
commit | c5735edcc882e0a52a26a8cea5031e4de9a6b328 (patch) | |
tree | 0b687a2e3492208ce328ce21b165a0c38b8134bc /src/common/Utilities/EventMap.h | |
parent | 42c44bd787458a8a0c7a12bbab874388537d61ed (diff) |
Core/Utilities: Added timer series queuing to EventMap (#29420)
Diffstat (limited to 'src/common/Utilities/EventMap.h')
-rw-r--r-- | src/common/Utilities/EventMap.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/common/Utilities/EventMap.h b/src/common/Utilities/EventMap.h index 7bea23bf7e4..82c466408cd 100644 --- a/src/common/Utilities/EventMap.h +++ b/src/common/Utilities/EventMap.h @@ -21,6 +21,7 @@ #include "Define.h" #include "Duration.h" #include <map> +#include <queue> class TC_COMMON_API EventMap { @@ -36,6 +37,7 @@ class TC_COMMON_API EventMap * - Pattern: 0xPPGGEEEE */ typedef std::multimap<TimePoint, uint32> EventStore; + typedef std::map<uint32 /*event data*/, std::queue<Milliseconds>> EventSeriesStore; public: EventMap() : _time(TimePoint::min()), _phase(0), _lastEvent(0) { } @@ -225,6 +227,31 @@ public: */ Milliseconds GetTimeUntilEvent(uint32 eventId) const; + /** + * @name ScheduleNextFromSeries + * @brief Schedules specified event with next timer from series + * @param full event data, including group and phase + */ + void ScheduleNextFromSeries(uint32 eventData); + + /** + * @name ScheduleEventSeries + * @brief Schedules specified event with first value of the series and then requeues with the next + * @param eventId of the event. + * @param group of the event. + * @param phase of the event. + * @param timeSeries specifying the times the event should be automatically scheduled after each trigger (first value is initial schedule) + */ + void ScheduleEventSeries(uint32 eventId, uint8 group, uint8 phase, std::initializer_list<Milliseconds> const& timeSeries); + + /** + * @name ScheduleEventSeries + * @brief Schedules specified event with first value of the series and then requeues with the next + * @param eventId of the event. + * @param timeSeries specifying the times the event should be automatically scheduled after each trigger (first value is initial schedule) + */ + void ScheduleEventSeries(uint32 eventId, std::initializer_list<Milliseconds> const& series); + private: /** * @name _time @@ -262,6 +289,12 @@ private: * @brief Stores information on the most recently executed event */ uint32 _lastEvent; + + /** + * @name _timerSeries + * @brief Stores information about time series which requeue itself until series is empty + */ + EventSeriesStore _timerSeries; }; #endif // _EVENT_MAP_H_ |