Public Types | |
enum | SetTimerIf { SetTimerAlways, SetTimerIfNotSet } |
Set a timer that was previously created with CreateTimer(). Returns true if the timer was previously pending for another timeout and false if the timer was not already pending. Note that calling SetTimer() will cause any timers that have expired to be processed before the new timer is set. More... | |
enum | UpdateTimerIf { UpdateTimerIfNewTimeIsSooner, UpdateTimerIfNewTimeIsLater, UpdateAlways, UpdateAlwaysNoTimeoutChange } |
Update a timer if it is set and if the condition is true and set the timer if it is not set. Updating a timer will set the timeout, timer and user data to the newly supplied values. If the timer is not updated because the condition is false then nothing is changed. UpdateAlways will always update. UpdateAlwaysNoTimeoutChange will always update JUST timer and user data. If you supply pWasUpdated then it is set to true if anything was changed and false if not. More... | |
typedef ULONG_PTR | UserData |
User data that can be passed to Timer via the OnTimer() call when the timeout expires. | |
typedef ULONG_PTR | Handle |
A handle to a timer that has been created. This can be passed to SetTimer(), CancelTimer() and DestroyTimer() and is created with CreateTimer(). | |
Public Member Functions | |
CCallbackTimerWheel (Milliseconds maximumTimeout) | |
CCallbackTimerWheel (IMonitorCallbackTimerQueue &monitor, Milliseconds maximumTimeout) | |
CCallbackTimerWheel (Milliseconds maximumTimeout, Milliseconds timerGranularity) | |
CCallbackTimerWheel (IMonitorCallbackTimerQueue &monitor, Milliseconds maximumTimeout, Milliseconds timerGranularity) | |
CCallbackTimerWheel (Milliseconds maximumTimeout, const IProvideTickCount &tickCountProvider) | |
CCallbackTimerWheel (IMonitorCallbackTimerQueue &monitor, Milliseconds maximumTimeout, const IProvideTickCount &tickCountProvider) | |
CCallbackTimerWheel (Milliseconds maximumTimeout, Milliseconds timerGranularity, const IProvideTickCount &tickCountProvider) | |
CCallbackTimerWheel (IMonitorCallbackTimerQueue &monitor, Milliseconds maximumTimeout, Milliseconds timerGranularity, const IProvideTickCount &tickCountProvider) | |
CCallbackTimerWheel (const CCallbackTimerWheel &rhs) | |
~CCallbackTimerWheel () override | |
CCallbackTimerWheel & | operator= (const CCallbackTimerWheel &rhs) |
Milliseconds | GetNextTimeout () override |
Get the number of milliseconds until the next timer is due to fire. Or INFINITE if no timer is set. | |
bool | BeginTimeoutHandling () override |
Returns true if timers need to be handled. You should then call HandleTimeout() to handle the timeouts and finally call EndTimeoutHandling() to tell the queue that you are done. | |
size_t | HandleTimeout () override |
Handle the timeout for the given timer handle. Note that in an implementation that is safe for use in a multi-threaded situation it is NOT acceptable to hold a lock that will prevent concurrent calls to any of the methods on IQueueTimers. | |
void | EndTimeoutHandling () override |
Complete the handling of a timeout that was started with BeginTimeoutHandling(). Note that in an implementation that is safe for use in a multi-threaded situation it is acceptable to hold a lock whilst this method is called to prevent concurrent calls to any of the methods on IQueueTimers. | |
Handle | CreateTimer () override |
Create a timer and return a Handle to it. | |
bool | TimerIsSet (const Handle &handle) const override |
bool | SetTimer (const Handle &handle, Timer &timer, Milliseconds timeout, UserData userData, SetTimerIf setTimerIf=SetTimerAlways, bool *pOptionalFirstToExpireHasChanged=nullptr) override |
bool | UpdateTimer (const Handle &handle, Timer &timer, Milliseconds timeout, UserData userData, UpdateTimerIf updateIf, bool *pWasUpdated=nullptr, bool *pOptionalFirstToExpireHasChanged=nullptr) override |
bool | CancelTimer (const Handle &handle, bool *pOptionalFirstToExpireHasChanged=nullptr) override |
bool | DestroyTimer (Handle &handle, bool *pOptionalFirstToExpireHasChanged=nullptr) override |
void | SetTimer (Timer &timer, Milliseconds timeout, UserData userData, bool *pOptionalFirstToExpireHasChanged=nullptr) override |
Milliseconds | GetMaximumTimeout () const override |
Returns the maximum timeout value that can be set. Note that this may differ between instances of the objects that implement this interface. | |
virtual bool | TimerIsSet (const Handle &handle) const =0 |
Returns true if the timer is currently set. | |
virtual bool | SetTimer (const Handle &handle, Timer &timer, Milliseconds timeout, UserData userData, SetTimerIf setTimerIf=SetTimerAlways, bool *pOptionalFirstToExpireHasChanged=nullptr)=0 |
virtual void | SetTimer (Timer &timer, Milliseconds timeout, UserData userData, bool *pOptionalFirstToExpireHasChanged=nullptr)=0 |
Create and set a single use timer. Note that calling SetTimer() will cause any timers that have expired to be processed before the new timer is set. | |
template<typename T> | |
bool | SetTimerWithRefCountedUserData (const Handle &handle, Timer &timer, Milliseconds timeout, T *pUserData, SetTimerIf setTimerIf=SetTimerAlways, bool *pOptionalFirstToExpireHasChanged=nullptr) |
template<typename T> | |
bool | SetTimerWithRefCountedTimer (const Handle &handle, T &timer, Milliseconds timeout, UserData userData, SetTimerIf setTimerIf=SetTimerAlways, bool *pOptionalFirstToExpireHasChanged=nullptr) |
virtual bool | UpdateTimer (const Handle &handle, Timer &timer, Milliseconds timeout, UserData userData, UpdateTimerIf updateIf, bool *pWasUpdated=nullptr, bool *pOptionalFirstToExpireHasChanged=nullptr)=0 |
template<typename T> | |
bool | UpdateTimerWithRefCountedUserData (const Handle &handle, Timer &timer, Milliseconds timeout, T *pUserData, UpdateTimerIf updateIf, bool *pWasUpdated=nullptr, bool *pOptionalFirstToExpireHasChanged=nullptr) |
template<typename T> | |
bool | UpdateTimerWithRefCountedTimer (const Handle &handle, T &timer, Milliseconds timeout, UserData userData, UpdateTimerIf updateIf, bool *pWasUpdated=nullptr, bool *pOptionalFirstToExpireHasChanged=nullptr) |
virtual bool | CancelTimer (const Handle &handle, bool *pOptionalFirstToExpireHasChanged=nullptr)=0 |
Cancel a timer that was previously set with SetTimer(). Returns true if the timer was pending and false if the timer was not pending. | |
template<typename T> | |
bool | CancelTimerWithRefCountedUserData (const Handle &handle, T &userData, bool *pOptionalFirstToExpireHasChanged=nullptr) |
template<typename T> | |
bool | CancelTimerWithRefCountedUserData (const Handle &handle, T *pUserData, bool *pOptionalFirstToExpireHasChanged=nullptr) |
template<typename T> | |
bool | CancelTimerWithRefCountedTimer (const Handle &handle, T &timer, bool *pOptionalFirstToExpireHasChanged=nullptr) |
virtual bool | DestroyTimer (Handle &handle, bool *pOptionalFirstToExpireHasChanged=nullptr)=0 |
Destroy a timer that was previously created with CreateTimer() and update the variable passed in to contain InvalidHandleValue. Note that it is not permitted to call DestroyHandle() on a handle that contains the InvalidHandleValue value and an exception is thrown in this case. Returns true if the timer was pending and false if the timer was not pending. | |
virtual bool | DestroyTimer (const Handle &handle, bool *pOptionalFirstToExpireHasChanged=nullptr) |
Destroy a timer that was previously created with CreateTimer(). Returns true if the timer was pending and false if the timer was not pending. | |
template<typename T, typename H> | |
bool | DestroyTimerWithRefCountedUserData (H &handle, T &userData, bool *pOptionalFirstToExpireHasChanged=nullptr) |
template<typename T, typename H> | |
bool | DestroyTimerWithRefCountedUserData (H &handle, T *pUserData, bool *pOptionalFirstToExpireHasChanged=nullptr) |
template<typename T, typename H> | |
bool | DestroyTimerWithRefCountedTimer (H &handle, T &timer, bool *pOptionalFirstToExpireHasChanged=nullptr) |
Static Public Attributes | |
static Handle | InvalidHandleValue = 0 |
The value that represents an invalid handle that cannot be used. |
User data that can be passed to Timer via the OnTimer() call when the timeout expires.
A handle to a timer that has been created. This can be passed to SetTimer(), CancelTimer() and DestroyTimer() and is created with CreateTimer().
enum SetTimerIf [inherited] |
Set a timer that was previously created with CreateTimer(). Returns true if the timer was previously pending for another timeout and false if the timer was not already pending. Note that calling SetTimer() will cause any timers that have expired to be processed before the new timer is set.
enum UpdateTimerIf [inherited] |
Update a timer if it is set and if the condition is true and set the timer if it is not set. Updating a timer will set the timeout, timer and user data to the newly supplied values. If the timer is not updated because the condition is false then nothing is changed. UpdateAlways will always update. UpdateAlwaysNoTimeoutChange will always update JUST timer and user data. If you supply pWasUpdated then it is set to true if anything was changed and false if not.
CCallbackTimerWheel | ( | Milliseconds | maximumTimeout | ) | [explicit] |
CCallbackTimerWheel | ( | IMonitorCallbackTimerQueue & | monitor, | |
Milliseconds | maximumTimeout | |||
) | [explicit] |
CCallbackTimerWheel | ( | Milliseconds | maximumTimeout, | |
Milliseconds | timerGranularity | |||
) |
CCallbackTimerWheel | ( | IMonitorCallbackTimerQueue & | monitor, | |
Milliseconds | maximumTimeout, | |||
Milliseconds | timerGranularity | |||
) |
CCallbackTimerWheel | ( | Milliseconds | maximumTimeout, | |
const IProvideTickCount & | tickCountProvider | |||
) |
CCallbackTimerWheel | ( | IMonitorCallbackTimerQueue & | monitor, | |
Milliseconds | maximumTimeout, | |||
const IProvideTickCount & | tickCountProvider | |||
) |
CCallbackTimerWheel | ( | Milliseconds | maximumTimeout, | |
Milliseconds | timerGranularity, | |||
const IProvideTickCount & | tickCountProvider | |||
) |
CCallbackTimerWheel | ( | IMonitorCallbackTimerQueue & | monitor, | |
Milliseconds | maximumTimeout, | |||
Milliseconds | timerGranularity, | |||
const IProvideTickCount & | tickCountProvider | |||
) |
CCallbackTimerWheel | ( | const CCallbackTimerWheel & | rhs | ) |
~CCallbackTimerWheel | ( | ) | [override] |
CCallbackTimerWheel& operator= | ( | const CCallbackTimerWheel & | rhs | ) |
Milliseconds GetNextTimeout | ( | ) | [override, virtual] |
Get the number of milliseconds until the next timer is due to fire. Or INFINITE if no timer is set.
Implements IManageTimerQueue.
bool BeginTimeoutHandling | ( | ) | [override, virtual] |
Returns true if timers need to be handled. You should then call HandleTimeout() to handle the timeouts and finally call EndTimeoutHandling() to tell the queue that you are done.
Implements IManageTimerQueue.
size_t HandleTimeout | ( | ) | [override, virtual] |
Handle the timeout for the given timer handle. Note that in an implementation that is safe for use in a multi-threaded situation it is NOT acceptable to hold a lock that will prevent concurrent calls to any of the methods on IQueueTimers.
Implements IManageTimerQueue.
void EndTimeoutHandling | ( | ) | [override, virtual] |
Complete the handling of a timeout that was started with BeginTimeoutHandling(). Note that in an implementation that is safe for use in a multi-threaded situation it is acceptable to hold a lock whilst this method is called to prevent concurrent calls to any of the methods on IQueueTimers.
Implements IManageTimerQueue.
CCallbackTimerWheel::Handle CreateTimer | ( | ) | [override, virtual] |
bool SetTimer | ( | const Handle & | handle, | |
Timer & | timer, | |||
Milliseconds | timeout, | |||
UserData | userData, | |||
SetTimerIf | setTimerIf = SetTimerAlways , |
|||
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [override] |
bool UpdateTimer | ( | const Handle & | handle, | |
Timer & | timer, | |||
Milliseconds | timeout, | |||
UserData | userData, | |||
UpdateTimerIf | updateIf, | |||
bool * | pWasUpdated = nullptr , |
|||
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [override] |
bool CancelTimer | ( | const Handle & | handle, | |
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [override] |
void SetTimer | ( | Timer & | timer, | |
Milliseconds | timeout, | |||
UserData | userData, | |||
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [override] |
Milliseconds GetMaximumTimeout | ( | ) | const [override, virtual] |
Returns the maximum timeout value that can be set. Note that this may differ between instances of the objects that implement this interface.
Implements IQueueTimers.
Returns true if the timer is currently set.
virtual bool SetTimer | ( | const Handle & | handle, | |
Timer & | timer, | |||
Milliseconds | timeout, | |||
UserData | userData, | |||
SetTimerIf | setTimerIf = SetTimerAlways , |
|||
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [pure virtual, inherited] |
virtual void SetTimer | ( | Timer & | timer, | |
Milliseconds | timeout, | |||
UserData | userData, | |||
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [pure virtual, inherited] |
Create and set a single use timer. Note that calling SetTimer() will cause any timers that have expired to be processed before the new timer is set.
bool SetTimerWithRefCountedUserData | ( | const Handle & | handle, | |
Timer & | timer, | |||
Milliseconds | timeout, | |||
T * | pUserData, | |||
SetTimerIf | setTimerIf = SetTimerAlways , |
|||
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [inline, inherited] |
bool SetTimerWithRefCountedTimer | ( | const Handle & | handle, | |
T & | timer, | |||
Milliseconds | timeout, | |||
UserData | userData, | |||
SetTimerIf | setTimerIf = SetTimerAlways , |
|||
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [inline, inherited] |
virtual bool UpdateTimer | ( | const Handle & | handle, | |
Timer & | timer, | |||
Milliseconds | timeout, | |||
UserData | userData, | |||
UpdateTimerIf | updateIf, | |||
bool * | pWasUpdated = nullptr , |
|||
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [pure virtual, inherited] |
bool UpdateTimerWithRefCountedUserData | ( | const Handle & | handle, | |
Timer & | timer, | |||
Milliseconds | timeout, | |||
T * | pUserData, | |||
UpdateTimerIf | updateIf, | |||
bool * | pWasUpdated = nullptr , |
|||
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [inline, inherited] |
bool UpdateTimerWithRefCountedTimer | ( | const Handle & | handle, | |
T & | timer, | |||
Milliseconds | timeout, | |||
UserData | userData, | |||
UpdateTimerIf | updateIf, | |||
bool * | pWasUpdated = nullptr , |
|||
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [inline, inherited] |
virtual bool CancelTimer | ( | const Handle & | handle, | |
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [pure virtual, inherited] |
Cancel a timer that was previously set with SetTimer(). Returns true if the timer was pending and false if the timer was not pending.
bool CancelTimerWithRefCountedUserData | ( | const Handle & | handle, | |
T & | userData, | |||
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [inline, inherited] |
bool CancelTimerWithRefCountedUserData | ( | const Handle & | handle, | |
T * | pUserData, | |||
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [inline, inherited] |
bool CancelTimerWithRefCountedTimer | ( | const Handle & | handle, | |
T & | timer, | |||
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [inline, inherited] |
virtual bool DestroyTimer | ( | Handle & | handle, | |
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [pure virtual, inherited] |
Destroy a timer that was previously created with CreateTimer() and update the variable passed in to contain InvalidHandleValue. Note that it is not permitted to call DestroyHandle() on a handle that contains the InvalidHandleValue value and an exception is thrown in this case. Returns true if the timer was pending and false if the timer was not pending.
virtual bool DestroyTimer | ( | const Handle & | handle, | |
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [inline, virtual, inherited] |
Destroy a timer that was previously created with CreateTimer(). Returns true if the timer was pending and false if the timer was not pending.
bool DestroyTimerWithRefCountedUserData | ( | H & | handle, | |
T & | userData, | |||
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [inline, inherited] |
bool DestroyTimerWithRefCountedUserData | ( | H & | handle, | |
T * | pUserData, | |||
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [inline, inherited] |
bool DestroyTimerWithRefCountedTimer | ( | H & | handle, | |
T & | timer, | |||
bool * | pOptionalFirstToExpireHasChanged = nullptr | |||
) | [inline, inherited] |
IQueueTimers::Handle InvalidHandleValue = 0 [static, inherited] |
The value that represents an invalid handle that cannot be used.