The C++ framework for developing highly scalable, high performance servers on Windows platforms.

IQueueTimers Class Reference
[Timer managementInterfacesProtected destructors on abstract base classes]

Inheritance diagram for IQueueTimers:
Collaboration diagram for IQueueTimers:

List of all members.


Detailed Description

An interface representing a class that manages timers that implement the IQueueTimers::Timer interface and and which have their IQueueTimers::Timer::OnTimer() method called when the the timer expires. See here for more details.

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

virtual Handle CreateTimer ()=0
 Create a timer and return a Handle to it.
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
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.
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)
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.
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.
virtual Milliseconds GetMaximumTimeout () const =0
 Returns the maximum timeout value that can be set. Note that this may differ between instances of the objects that implement this interface.

Static Public Attributes

static Handle InvalidHandleValue = 0
 The value that represents an invalid handle that cannot be used.

Protected Member Functions

virtual ~IQueueTimers ()
 We never delete instances of this interface; you must manage the lifetime of the class that implements it.

Classes

class  RefCountedTimer
class  Timer
 An interface to a timer that can be set with IQueueTimers. More...

Member Typedef Documentation

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().


Member Enumeration Documentation

enum SetTimerIf

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.

Enumerator:
SetTimerAlways 
SetTimerIfNotSet 

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.

Enumerator:
UpdateTimerIfNewTimeIsSooner 
UpdateTimerIfNewTimeIsLater 
UpdateAlways 
UpdateAlwaysNoTimeoutChange 


Constructor & Destructor Documentation

virtual ~IQueueTimers (  )  [protected, virtual]

We never delete instances of this interface; you must manage the lifetime of the class that implements it.


Member Function Documentation

virtual Handle CreateTimer (  )  [pure virtual]

Create a timer and return a Handle to it.

Implemented in CCallbackTimerQueueEx, CCallbackTimerWheel, and CThreadedCallbackTimerQueue.

virtual bool TimerIsSet ( const Handle handle  )  const [pure virtual]

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]

bool SetTimerWithRefCountedUserData ( const Handle handle,
Timer timer,
Milliseconds  timeout,
T *  pUserData,
SetTimerIf  setTimerIf = SetTimerAlways,
bool pOptionalFirstToExpireHasChanged = nullptr 
) [inline]

bool SetTimerWithRefCountedTimer ( const Handle handle,
T &  timer,
Milliseconds  timeout,
UserData  userData,
SetTimerIf  setTimerIf = SetTimerAlways,
bool pOptionalFirstToExpireHasChanged = nullptr 
) [inline]

virtual bool UpdateTimer ( const Handle handle,
Timer timer,
Milliseconds  timeout,
UserData  userData,
UpdateTimerIf  updateIf,
bool pWasUpdated = nullptr,
bool pOptionalFirstToExpireHasChanged = nullptr 
) [pure virtual]

bool UpdateTimerWithRefCountedUserData ( const Handle handle,
Timer timer,
Milliseconds  timeout,
T *  pUserData,
UpdateTimerIf  updateIf,
bool pWasUpdated = nullptr,
bool pOptionalFirstToExpireHasChanged = nullptr 
) [inline]

bool UpdateTimerWithRefCountedTimer ( const Handle handle,
T &  timer,
Milliseconds  timeout,
UserData  userData,
UpdateTimerIf  updateIf,
bool pWasUpdated = nullptr,
bool pOptionalFirstToExpireHasChanged = nullptr 
) [inline]

virtual bool CancelTimer ( const Handle handle,
bool pOptionalFirstToExpireHasChanged = nullptr 
) [pure virtual]

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]

bool CancelTimerWithRefCountedUserData ( const Handle handle,
T *  pUserData,
bool pOptionalFirstToExpireHasChanged = nullptr 
) [inline]

bool CancelTimerWithRefCountedTimer ( const Handle handle,
T &  timer,
bool pOptionalFirstToExpireHasChanged = nullptr 
) [inline]

virtual bool DestroyTimer ( Handle handle,
bool pOptionalFirstToExpireHasChanged = nullptr 
) [pure virtual]

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.

bool DestroyTimerWithRefCountedUserData ( H &  handle,
T &  userData,
bool pOptionalFirstToExpireHasChanged = nullptr 
) [inline]

bool DestroyTimerWithRefCountedUserData ( H &  handle,
T *  pUserData,
bool pOptionalFirstToExpireHasChanged = nullptr 
) [inline]

bool DestroyTimerWithRefCountedTimer ( H &  handle,
T &  timer,
bool pOptionalFirstToExpireHasChanged = nullptr 
) [inline]

virtual bool DestroyTimer ( const Handle handle,
bool pOptionalFirstToExpireHasChanged = nullptr 
) [inline, virtual]

Destroy a timer that was previously created with CreateTimer(). Returns true if the timer was pending and false if the timer was not pending.

virtual void SetTimer ( Timer timer,
Milliseconds  timeout,
UserData  userData,
bool pOptionalFirstToExpireHasChanged = nullptr 
) [pure virtual]

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.

virtual Milliseconds GetMaximumTimeout (  )  const [pure virtual]

Returns the maximum timeout value that can be set. Note that this may differ between instances of the objects that implement this interface.

Implemented in CCallbackTimerQueueEx, CCallbackTimerWheel, and CThreadedCallbackTimerQueue.


Member Data Documentation

The value that represents an invalid handle that cannot be used.


Generated on Sun Sep 12 19:08:36 2021 for The Server Framework - v7.4 by doxygen 1.5.3