A timer class template in which the timeout is delivered to the specified method.
More...
|
| Timer (T &t, method_type m, ExceptionSink) |
| Constructor. More...
|
|
void | startTimer (unsigned int interval_s, unsigned int interval_us=0U) |
| Starts or restarts the timer so that it expires after the given interval. More...
|
|
void | startTimer (const G::TimeInterval &) |
| Starts or restarts the timer so that it expires after the given interval. More...
|
|
void | cancelTimer () |
| Cancels the timer. Does nothing if not running. More...
|
|
bool | active () const noexcept |
| Returns true if the timer is running. More...
|
|
| Timer (const Timer< T > &)=delete |
|
| Timer (Timer< T > &&)=delete |
|
void | operator= (const Timer< T > &)=delete |
|
void | operator= (Timer< T > &&)=delete |
|
template<typename T>
class GNet::Timer< T >
A timer class template in which the timeout is delivered to the specified method.
Any exception thrown out of the timeout handler is delivered to the specified ExceptionHandler interface so that it can be handled or rethrown.
Eg:
struct Foo
{
Timer<Foo> m_timer ;
Foo( ExceptionSink es ) : m_timer(*this,&Foo::onTimeout,es) {}
void onTimeout() { throw "oops" ; }
} ;
Definition at line 128 of file gtimer.h.