EpcTools
An event based multi-threaded C++ development framework.
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | List of all members
ETimerPool Class Reference

#include <etimerpool.h>

Public Types

enum  Rounding { Rounding::up, Rounding::down }
 Defines how rounding will be performed. More...
 

Public Member Functions

 ETimerPool ()
 Default constructor. More...
 
 ~ETimerPool ()
 Class destructor. More...
 
LongLong getResolution (Bool raw=False)
 Retrieves the current timer resolution value. More...
 
Rounding getRounding ()
 Retrieves the current rounding value. More...
 
Int getTimerSignal ()
 Retrieves the current timer signal value. More...
 
Int getQuitSignal ()
 Retrieves the current quit signal value. More...
 
ETimerPoolsetResolution (LongLong ms)
 Assigns the timer resolution value. More...
 
ETimerPoolsetRounding (Rounding r)
 Assigns the timer rounding method. More...
 
ETimerPoolsetTimerSignal (Int sig)
 Assigns the timer signal value. More...
 
ETimerPoolsetQuitSignal (Int sig)
 Assigns the quit signal value. More...
 
ULong registerTimer (LongLong ms, _EThreadEventMessageBase *msg, _EThreadEventBase &thread)
 Registers an expiration timer. More...
 
ULong registerTimer (LongLong ms, ETimerPoolExpirationCallback func, pVoid data)
 Registers an expiration timer. More...
 
ETimerPoolunregisterTimer (ULong timerid)
 Unregisters an expiration timer. More...
 
Void init ()
 Initializes the ETimerPool. More...
 
Void uninit (Bool dumpit=False)
 Uninitializes the ETimerPool. More...
 
Void dump ()
 Prints the contents of the internal collections. More...
 

Static Public Member Functions

static ETimerPoolInstance ()
 Retrieves the single instance of the ETimerPool object. More...
 

Protected Types

typedef std::shared_ptr< Timer > TimerPtr
 
typedef std::list< TimerPtrTimerPtrList
 
typedef std::shared_ptr< Entry > EntryPtr
 
typedef std::unordered_map< ULong, EntryPtrEntryMap
 
typedef std::shared_ptr< ExpirationTimeEntry > ExpirationTimeEntryPtr
 
typedef std::unordered_map< LongLong, ExpirationTimeEntryPtrExpirationTimeEntryMap
 
typedef std::unordered_map< ULong, ExpirationTimeEntryPtrExpirationTimeEntryIdMap
 

Protected Attributes

friend ExpirationTime
 

Member Typedef Documentation

◆ EntryMap

typedef std::unordered_map<ULong,EntryPtr> ETimerPool::EntryMap
protected

◆ EntryPtr

typedef std::shared_ptr<Entry> ETimerPool::EntryPtr
protected

◆ ExpirationTimeEntryIdMap

typedef std::unordered_map<ULong,ExpirationTimeEntryPtr> ETimerPool::ExpirationTimeEntryIdMap
protected

◆ ExpirationTimeEntryMap

typedef std::unordered_map<LongLong,ExpirationTimeEntryPtr> ETimerPool::ExpirationTimeEntryMap
protected

◆ ExpirationTimeEntryPtr

typedef std::shared_ptr<ExpirationTimeEntry> ETimerPool::ExpirationTimeEntryPtr
protected

◆ TimerPtr

typedef std::shared_ptr<Timer> ETimerPool::TimerPtr
protected

◆ TimerPtrList

typedef std::list<TimerPtr> ETimerPool::TimerPtrList
protected

Member Enumeration Documentation

◆ Rounding

enum ETimerPool::Rounding
strong

Defines how rounding will be performed.

Enumerator
up 

Rounds up.

down 

Rounds down.

Constructor & Destructor Documentation

◆ ETimerPool()

ETimerPool::ETimerPool ( )

Default constructor.

◆ ~ETimerPool()

ETimerPool::~ETimerPool ( )

Class destructor.

Member Function Documentation

◆ dump()

Void ETimerPool::dump ( )

Prints the contents of the internal collections.

◆ getQuitSignal()

Int ETimerPool::getQuitSignal ( )
inline

Retrieves the current quit signal value.

Returns
the current quit signal value.

◆ getResolution()

LongLong ETimerPool::getResolution ( Bool  raw = False)
inline

Retrieves the current timer resolution value.

Parameters
rawTrue retrieves the value in milliseconds, otherwise microseconds.
Returns
the current timer resolution value.

◆ getRounding()

Rounding ETimerPool::getRounding ( )
inline

Retrieves the current rounding value.

Returns
the current rounding value.

◆ getTimerSignal()

Int ETimerPool::getTimerSignal ( )
inline

Retrieves the current timer signal value.

Returns
the current timer signal value.

◆ init()

Void ETimerPool::init ( )

Initializes the ETimerPool.

◆ Instance()

static ETimerPool& ETimerPool::Instance ( )
inlinestatic

Retrieves the single instance of the ETimerPool object.

Returns
a reference to the single instance of the ETimerPool object.

◆ registerTimer() [1/2]

ULong ETimerPool::registerTimer ( LongLong  ms,
_EThreadEventMessageBase msg,
_EThreadEventBase thread 
)

Registers an expiration timer.

Parameters
msthe length of the timer in milliseconds.
msgthe thread message to post when the timer expires.
threadthe thread to post the message to when the timer expires.
Returns
the ID for this timer.

◆ registerTimer() [2/2]

ULong ETimerPool::registerTimer ( LongLong  ms,
ETimerPoolExpirationCallback  func,
pVoid  data 
)

Registers an expiration timer.

Parameters
msthe length of the timer in milliseconds.
funca callback function pointer that will be called when the timer expires.
dataa void pointer that will be included as a parameter to the expiration callback function.
Returns
the ID for this timer.

◆ setQuitSignal()

ETimerPool& ETimerPool::setQuitSignal ( Int  sig)
inline

Assigns the quit signal value.

Parameters
sigthe quit signal value.
Returns
a reference to the ETimerPool object.

◆ setResolution()

ETimerPool& ETimerPool::setResolution ( LongLong  ms)
inline

Assigns the timer resolution value.

Parameters
msthe resolution in milliseconds.
Returns
a reference to the ETimerPool object.

◆ setRounding()

ETimerPool& ETimerPool::setRounding ( Rounding  r)
inline

Assigns the timer rounding method.

Parameters
rthe timer rounding method.
Returns
a reference to the ETimerPool object.

◆ setTimerSignal()

ETimerPool& ETimerPool::setTimerSignal ( Int  sig)
inline

Assigns the timer signal value.

Parameters
sigthe timer signal value.
Returns
a reference to the ETimerPool object.

◆ uninit()

Void ETimerPool::uninit ( Bool  dumpit = False)

Uninitializes the ETimerPool.

◆ unregisterTimer()

ETimerPool & ETimerPool::unregisterTimer ( ULong  timerid)

Unregisters an expiration timer.

Parameters
timeridthe ID of the timer to unregister (returned by registerTimer).
Returns
a reference to the ETimerPool object.

Member Data Documentation

◆ ExpirationTime

friend ETimerPool::ExpirationTime
protected

The documentation for this class was generated from the following files: