![]() |
TrinityCore
|
#include <EventMap.h>
Public Member Functions | |||||||||||
| EventMap () | |||||||||||
| EventMap (EventMap const &other) | |||||||||||
| EventMap (EventMap &&other) noexcept=default | |||||||||||
| EventMap & | operator= (EventMap const &other) | ||||||||||
| EventMap & | operator= (EventMap &&other) noexcept=default | ||||||||||
| ~EventMap () | |||||||||||
Reset | |||||||||||
Removes all scheduled events and resets time and phase. | |||||||||||
| void | Reset () | ||||||||||
Update | |||||||||||
Updates the timer of the event map.
| |||||||||||
| void | Update (uint32 time) | ||||||||||
| void | Update (Milliseconds time) | ||||||||||
GetPhaseMask | |||||||||||
| |||||||||||
| uint8 | GetPhaseMask () const | ||||||||||
Empty | |||||||||||
| |||||||||||
| bool | Empty () const | ||||||||||
SetPhase | |||||||||||
Sets the phase of the map (absolute).
| |||||||||||
| void | SetPhase (uint8 phase) | ||||||||||
AddPhase | |||||||||||
Activates the given phase (bitwise).
| |||||||||||
| void | AddPhase (uint8 phase) | ||||||||||
RemovePhase | |||||||||||
Deactivates the given phase (bitwise).
| |||||||||||
| void | RemovePhase (uint8 phase) | ||||||||||
ScheduleEvent | |||||||||||
Schedules a new event. An existing event is not canceled.
| |||||||||||
| void | ScheduleEvent (uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0) | ||||||||||
| void | ScheduleEvent (uint32 eventId, Milliseconds minTime, Milliseconds maxTime, uint32 group=0, uint8 phase=0) | ||||||||||
RescheduleEvent | |||||||||||
Cancels the given event and reschedules it.
| |||||||||||
| void | RescheduleEvent (uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0) | ||||||||||
| void | RescheduleEvent (uint32 eventId, Milliseconds minTime, Milliseconds maxTime, uint32 group=0, uint8 phase=0) | ||||||||||
RepeatEvent | |||||||||||
Repeats the most recently executed event.
| |||||||||||
| void | Repeat (Milliseconds time) | ||||||||||
| void | Repeat (Milliseconds minTime, Milliseconds maxTime) | ||||||||||
ExecuteEvent | |||||||||||
Returns the next event to be executed and removes it from map.
| |||||||||||
| uint32 | ExecuteEvent () | ||||||||||
DelayEvents | |||||||||||
Delay all events of the same group.
| |||||||||||
| void | DelayEvents (Milliseconds delay) | ||||||||||
| void | DelayEvents (Milliseconds delay, uint32 group) | ||||||||||
CancelEvent | |||||||||||
Cancels all events of the specified id.
| |||||||||||
| void | CancelEvent (uint32 eventId) | ||||||||||
CancelEventGroup | |||||||||||
Cancel events belonging to specified group.
| |||||||||||
| void | CancelEventGroup (uint32 group) | ||||||||||
IsInPhase | |||||||||||
Returns whether event map is in specified phase or not.
| |||||||||||
| bool | IsInPhase (uint8 phase) const | ||||||||||
GetTimeUntilEvent | |||||||||||
Returns time as std::chrono type until next event.
| |||||||||||
| Milliseconds | GetTimeUntilEvent (uint32 eventId) const | ||||||||||
ScheduleNextFromSeries | |||||||||||
Schedules specified event with next timer from series
| |||||||||||
| void | ScheduleNextFromSeries (uint32 eventData) | ||||||||||
ScheduleEventSeries | |||||||||||
Schedules specified event with first value of the series and then requeues with the next
| |||||||||||
| void | ScheduleEventSeries (uint32 eventId, uint8 group, uint8 phase, std::initializer_list< Milliseconds > timeSeries) | ||||||||||
| void | ScheduleEventSeries (uint32 eventId, std::initializer_list< Milliseconds > series) | ||||||||||
Private Types | |
| typedef std::multimap< TimePoint, uint32 > | EventStore |
| typedef std::map< uint32, std::vector< Milliseconds > > | EventSeriesStore |
Private Attributes | |
_time | |
Internal timer. This does not represent the real date/time value. It's more like a stopwatch: It can run, it can be stopped, it can be resetted and so on. Events occur when this timer has reached their time value. Its value is changed in the Update method. | |
| TimePoint | _time |
_phase | |
Phase mask of the event map. Contains the phases the event map is in. Multiple phases from 1 to 8 can be set with SetPhase or AddPhase. RemovePhase deactives a phase. | |
| uint8 | _phase |
_eventMap | |
Internal event storage map. Contains the scheduled events. See typedef at the beginning of the class for more details. | |
| EventStore | _eventMap |
_lastEvent | |
Stores information on the most recently executed event | |
| uint32 | _lastEvent |
_timerSeries | |
Stores information about time series which requeue itself until series is empty | |
| EventSeriesStore | _timerSeries |
Definition at line 26 of file EventMap.h.
|
private |
Definition at line 40 of file EventMap.h.
|
private |
Internal storage type. Key: Time as TimePoint when the event should occur. Value: The event data as uint32.
Structure of event data:
Definition at line 39 of file EventMap.h.
|
inline |
Definition at line 43 of file EventMap.h.
|
default |
|
defaultnoexcept |
|
default |
|
inline |
Definition at line 106 of file EventMap.h.
| void EventMap::CancelEvent | ( | uint32 | eventId | ) |
Definition at line 135 of file EventMap.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void EventMap::CancelEventGroup | ( | uint32 | group | ) |
Definition at line 157 of file EventMap.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void EventMap::DelayEvents | ( | Milliseconds | delay | ) |
Definition at line 100 of file EventMap.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void EventMap::DelayEvents | ( | Milliseconds | delay, |
| uint32 | group | ||
| ) |
|
inline |
| uint32 EventMap::ExecuteEvent | ( | ) |
|
inline |
| Milliseconds EventMap::GetTimeUntilEvent | ( | uint32 | eventId | ) | const |
|
inline |
|
inline |
Definition at line 117 of file EventMap.h.
| void EventMap::Repeat | ( | Milliseconds | minTime, |
| Milliseconds | maxTime | ||
| ) |
| void EventMap::Repeat | ( | Milliseconds | time | ) |
Definition at line 67 of file EventMap.cpp.
| void EventMap::RescheduleEvent | ( | uint32 | eventId, |
| Milliseconds | minTime, | ||
| Milliseconds | maxTime, | ||
| uint32 | group = 0, |
||
| uint8 | phase = 0 |
||
| ) |
| void EventMap::RescheduleEvent | ( | uint32 | eventId, |
| Milliseconds | time, | ||
| uint32 | group = 0, |
||
| uint8 | phase = 0 |
||
| ) |
Definition at line 56 of file EventMap.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void EventMap::Reset | ( | ) |
Definition at line 25 of file EventMap.cpp.
| void EventMap::ScheduleEvent | ( | uint32 | eventId, |
| Milliseconds | minTime, | ||
| Milliseconds | maxTime, | ||
| uint32 | group = 0, |
||
| uint8 | phase = 0 |
||
| ) |
| void EventMap::ScheduleEvent | ( | uint32 | eventId, |
| Milliseconds | time, | ||
| uint32 | group = 0, |
||
| uint8 | phase = 0 |
||
| ) |
Definition at line 40 of file EventMap.cpp.
| void EventMap::ScheduleEventSeries | ( | uint32 | eventId, |
| std::initializer_list< Milliseconds > | series | ||
| ) |
| void EventMap::ScheduleEventSeries | ( | uint32 | eventId, |
| uint8 | group, | ||
| uint8 | phase, | ||
| std::initializer_list< Milliseconds > | timeSeries | ||
| ) |
Definition at line 202 of file EventMap.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void EventMap::ScheduleNextFromSeries | ( | uint32 | eventData | ) |
Definition at line 188 of file EventMap.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void EventMap::SetPhase | ( | uint8 | phase | ) |
Definition at line 32 of file EventMap.cpp.
|
inline |
Definition at line 71 of file EventMap.h.
|
inline |
Definition at line 61 of file EventMap.h.
|
private |
Definition at line 290 of file EventMap.h.
|
private |
Definition at line 296 of file EventMap.h.
|
private |
Definition at line 281 of file EventMap.h.
|
private |
Definition at line 271 of file EventMap.h.
|
private |
Definition at line 302 of file EventMap.h.