A timer base class that calls a pure virtual method on expiry. More...
#include <gtimer.h>
Public Member Functions | |
virtual | ~AbstractTimer () |
Destructor. More... | |
void | startTimer (unsigned int time) |
Starts the timer. More... | |
void | cancelTimer () |
Cancels the timer. More... | |
Protected Member Functions | |
AbstractTimer () | |
Default constructor. More... | |
virtual void | onTimeout ()=0 |
Called when the timer expires (or soon after). More... | |
virtual void | onTimeoutException (std::exception &)=0 |
Called by the event loop when the onTimeout() override throws. More... | |
Friends | |
class | TimerList |
A timer base class that calls a pure virtual method on expiry.
|
virtual |
Destructor.
Definition at line 58 of file gtimer.cpp.
References GNet::TimerList::instance(), and GNet::TimerList::remove().
|
protected |
Default constructor.
Definition at line 49 of file gtimer.cpp.
References GNet::TimerList::add(), GNet::EventLoop::exists(), G_ASSERT, and GNet::TimerList::instance().
void GNet::AbstractTimer::cancelTimer | ( | ) |
Cancels the timer.
Definition at line 81 of file gtimer.cpp.
|
protectedpure virtual |
Called when the timer expires (or soon after).
Implemented in GSmtp::ClientProtocol, GSmtp::ServerProtocol, GNet::Timer< T >, GNet::Timer< GNet::ServerPeer >, GNet::Timer< GNet::Client >, GNet::Timer< GSmtp::RequestClient >, GNet::Timer< GNet::HeapClient >, GNet::Timer< GSmtp::SpamClient >, and GNet::Timer< GNet::SocketProtocolImp >.
|
protectedpure 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 GSmtp::ClientProtocol, GSmtp::ServerProtocol, GNet::Timer< T >, GNet::Timer< GNet::ServerPeer >, GNet::Timer< GNet::Client >, GNet::Timer< GSmtp::RequestClient >, GNet::Timer< GNet::HeapClient >, GNet::Timer< GSmtp::SpamClient >, and GNet::Timer< GNet::SocketProtocolImp >.
void GNet::AbstractTimer::startTimer | ( | unsigned int | time | ) |