XDispatch 0.7.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Slots | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions
QDispatchTimer Class Reference

Provides a timer executing a block or runnable each time it fires on a given queue. More...

#include <QtDispatch/qdispatchtimer.h>

+ Inheritance diagram for QDispatchTimer:

List of all members.

Public Slots

void start ()
 Starts the timer.
void stop ()
 Stops the timer.

Public Member Functions

 QDispatchTimer (int msec, QObject *parent=NULL)
 Constructs a new timer firing every msec milliseconds.
 QDispatchTimer (const QDispatchTimer &)
 QDispatchTimer (const xdispatch::timer &, QObject *parent=NULL)
 ~QDispatchTimer ()
void setInterval (int msec)
 Changes the interval of the timer to msec.
void setTargetQueue (const xdispatch::queue &)
 Sets the queue the timer will execute on.
void setHandler (QRunnable *)
 Sets the runnable that will be executed every time the timer fires.
void setHandler (dispatch_block_t b)
 Sets a block that will be executed every time the timer fires.
void setLatency (int usec)
 Sets the latency, i.e.
bool operator== (const QDispatchTimer &)

Static Public Member Functions

static void singleShot (dispatch_time_t, const xdispatch::queue &, QRunnable *)
 Creates a single shot timer executing the given runnable on the given queue at the given time.
static void singleShot (const QTime &, const xdispatch::queue &, QRunnable *)
 Creates a single shot timer executing the given runnable on the given queue at the given time.
static void singleShot (dispatch_time_t t, const xdispatch::queue &q, dispatch_block_t b)
 Creates a single shot timer executing the given block on the given queue at the given time.
static void singleShot (const QTime &t, const xdispatch::queue &q, dispatch_block_t b)
 Creates a single shot timer executing the given block on the given queue at the given time.
static QDispatchTimercurrent ()

Private Member Functions

void interval (uint64_t)
 Use this to set the interval in nanoseconds.
void latency (uint64_t)
 Use this to set the latency in nanoseconds which the timer might be early or late.
void resume ()
 Resumes the invocation of operations or blocks assigned to the object.
void suspend ()
 Suspends the invocation of operations or blocks assigned to the object.
void handler (xdispatch::operation *)
 Sets the handler to dispatch each time the source becomes ready.
virtual void handler (dispatch_block_t b)
 Sets the handler to dispatch each time the source becomes ready.
void target_queue (const xdispatch::queue &)
 Sets the queue the handler will be executed on.
xdispatch::queue target_queue () const
virtual dispatch_object_t native () const
dispatch_source_t native_source () const
void cancel ()
 Asynchronously cancels the dispatch source, preventing any further invocation of its event handler block.
void cancel_handler (xdispatch::operation *)
 Sets the cancellation handler block for the given dispatch source.
virtual void cancel_handler (dispatch_block_t b)
 Sets the cancellation handler block for the given dispatch source.
bool operator== (const object &)
bool operator== (const dispatch_object_t &)
bool operator!= (const object &)
bool operator!= (const dispatch_object_t &)

Static Private Member Functions

static void single_shot (dispatch_time_t, const xdispatch::queue &, xdispatch::operation *)
 Creates a single shot timer executing the given operation on the given queue at the given time.
static void single_shot (struct tm *, const xdispatch::queue &, xdispatch::operation *)
 Creates a single shot timer executing the given operation on the given queue at the given time.
static void single_shot (dispatch_time_t t, const xdispatch::queue &q, dispatch_block_t b)
 Creates a single shot timer executing the given block on the given queue at the given time.
static void single_shot (struct tm *t, const xdispatch::queue &q, dispatch_block_t b)
 Creates a single shot timer executing the given block on the given queue at the given time.
template<typename T >
static T data ()

Detailed Description

Provides a timer executing a block or runnable each time it fires on a given queue.

The default queue for dispatch timers is the global queue.

The timer may have a divergence from the exact interval, the allowed size of this divergence can be influenced by using setLatency().

Definition at line 52 of file qdispatchtimer.h.


Constructor & Destructor Documentation

QDispatchTimer::QDispatchTimer ( int  msec,
QObject *  parent = NULL 
)

Constructs a new timer firing every msec milliseconds.

The timer will be constructed in a stopped state, use start() to launch it.

Remarks:
Never pass a value less than zero here
QDispatchTimer::QDispatchTimer ( const xdispatch::timer ,
QObject *  parent = NULL 
)

Member Function Documentation

Returns:
The timer responsible for the handler to be executed or NULL if the handler was not executed because of a timer firing

Reimplemented from xdispatch::timer.

bool QDispatchTimer::operator== ( const QDispatchTimer )
void QDispatchTimer::setHandler ( QRunnable *  )

Sets the runnable that will be executed every time the timer fires.

Sets a block that will be executed every time the timer fires.

Definition at line 86 of file qdispatchtimer.h.

void QDispatchTimer::setInterval ( int  msec)

Changes the interval of the timer to msec.

void QDispatchTimer::setLatency ( int  usec)

Sets the latency, i.e.

the divergence the timer may have. Please note that this can only be regarded as a hint and is not garuanted to be followed strictly.

Sets the queue the timer will execute on.

static void QDispatchTimer::singleShot ( dispatch_time_t  ,
const xdispatch::queue ,
QRunnable *   
) [static]

Creates a single shot timer executing the given runnable on the given queue at the given time.

This is quite similar to using QDispatchQueue::after()

static void QDispatchTimer::singleShot ( const QTime &  ,
const xdispatch::queue ,
QRunnable *   
) [static]

Creates a single shot timer executing the given runnable on the given queue at the given time.

This is quite similar to using QDispatchQueue::after()

static void QDispatchTimer::singleShot ( dispatch_time_t  t,
const xdispatch::queue q,
dispatch_block_t  b 
) [inline, static]

Creates a single shot timer executing the given block on the given queue at the given time.

This is quite similar to using QDispatchQueue::after()

Definition at line 112 of file qdispatchtimer.h.

static void QDispatchTimer::singleShot ( const QTime &  t,
const xdispatch::queue q,
dispatch_block_t  b 
) [inline, static]

Creates a single shot timer executing the given block on the given queue at the given time.

This is quite similar to using QDispatchQueue::after()

Definition at line 119 of file qdispatchtimer.h.

void QDispatchTimer::start ( ) [slot]

Starts the timer.

Remarks:
A new created timer will be stopped.

Reimplemented from xdispatch::timer.

void QDispatchTimer::stop ( ) [slot]

Stops the timer.

Remarks:
Calls to start() and stop() need to be balanced

Reimplemented from xdispatch::timer.


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

Generated on Tue Jun 12 2012 14:11:48 for XDispatch by Doxygen 1.8.0
© 2010-2012 MLBA (about | privacy) All Rights reserved.