GNet::AbstractTimer Class Reference

A timer base class that calls a pure virtual method on expiry. More...

#include <gtimer.h>

Inheritance diagram for GNet::AbstractTimer:

GNet::Timer< T > GSmtp::ClientProtocol GSmtp::ServerProtocol

List of all members.

Public Member Functions

virtual ~AbstractTimer ()
 Destructor.
void startTimer (unsigned int time)
 Starts the timer.
void cancelTimer ()
 Cancels the timer.

Protected Member Functions

 AbstractTimer ()
 Default constructor.
virtual void onTimeout ()=0
 Called when the timer expires (or soon after).
virtual void onTimeoutException (std::exception &)=0
 Called by the event loop when the onTimeout() override throws.

Friends

class TimerList


Detailed Description

A timer base class that calls a pure virtual method on expiry.

Definition at line 41 of file gtimer.h.


Constructor & Destructor Documentation

GNet::AbstractTimer::~AbstractTimer (  )  [virtual]

Destructor.

Definition at line 58 of file gtimer.cpp.

References GNet::TimerList::instance(), and GNet::TimerList::remove().

GNet::AbstractTimer::AbstractTimer (  )  [protected]

Default constructor.

Definition at line 49 of file gtimer.cpp.

References GNet::TimerList::add(), GNet::EventLoop::exists(), G_ASSERT, and GNet::TimerList::instance().


Member Function Documentation

void GNet::AbstractTimer::startTimer ( unsigned int  time  ) 

Starts the timer.

Definition at line 74 of file gtimer.cpp.

References G::DateTime::now().

void GNet::AbstractTimer::cancelTimer (  ) 

Cancels the timer.

Definition at line 81 of file gtimer.cpp.

virtual void GNet::AbstractTimer::onTimeout (  )  [protected, pure virtual]

virtual void GNet::AbstractTimer::onTimeoutException ( std::exception &   )  [protected, pure virtual]

Called by the event loop when the onTimeout() override throws.

The implementation can just throw the current exception so that the event loop terminates.

Implemented in GNet::Timer< T >, GSmtp::ClientProtocol, GSmtp::ServerProtocol, GNet::Timer< GNet::ServerPeer >, GNet::Timer< GNet::Client >, GNet::Timer< GSmtp::RequestClient >, GNet::Timer< GNet::HeapClient >, and GNet::Timer< GSmtp::SpamClient >.


Friends And Related Function Documentation

friend class TimerList [friend]

Definition at line 72 of file gtimer.h.


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

Generated on Fri Apr 18 15:56:13 2008 for E-MailRelay by  doxygen 1.5.5