Note! This project has moved to github.com/armmbed/mbed-events

Dependents:   SimpleHTTPExample

Embed: (wiki syntax)

« Back to documentation index

EventQueue Class Reference

EventQueue Class Reference

Flexible queue for managing events. More...

#include <EventQueue.h>

Inherited by EventLoop.

Public Member Functions

 EventQueue (unsigned event_count=32, unsigned event_context=0, unsigned char *event_pointer=NULL)
 Create an event queue.
 ~EventQueue ()
 Clean up event queue.
void dispatch (int ms=-1)
 Dispatch pending events.
unsigned get_tick ()
 Get current tick of the event queue.
bool past_tick (unsigned tick)
 Determine if tick has been passed.
template<typename F , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 >
bool trigger (F func, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4)
 Immediately post an event to the queue.
template<typename F , typename A0 , typename A1 , typename A2 , typename A3 >
bool trigger (F func, A0 a0, A1 a1, A2 a2, A3 a3)
 Immediately post an event to the queue.
template<typename F , typename A0 , typename A1 , typename A2 >
bool trigger (F func, A0 a0, A1 a1, A2 a2)
 Immediately post an event to the queue.
template<typename F , typename A0 , typename A1 >
bool trigger (F func, A0 a0, A1 a1)
 Immediately post an event to the queue.
template<typename F , typename A0 >
bool trigger (F func, A0 a0)
 Immediately post an event to the queue.
template<typename F >
bool trigger (F func)
 Immediately post an event to the queue.
template<typename F , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 >
bool trigger_in (F func, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, int ms)
 Post an event after a specified time.
template<typename F , typename A0 , typename A1 , typename A2 , typename A3 >
bool trigger_in (F func, A0 a0, A1 a1, A2 a2, A3 a3, int ms)
 Post an event after a specified time.
template<typename F , typename A0 , typename A1 , typename A2 >
bool trigger_in (F func, A0 a0, A1 a1, A2 a2, int ms)
 Post an event after a specified time.
template<typename F , typename A0 , typename A1 >
bool trigger_in (F func, A0 a0, A1 a1, int ms)
 Post an event after a specified time.
template<typename F , typename A0 >
bool trigger_in (F func, A0 a0, int ms)
 Post an event after a specified time.
template<typename F >
bool trigger_in (F func, int ms)
 Post an event after a specified time.
template<typename F , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 >
bool trigger_every (F func, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, int ms)
 Post an event periodically.
template<typename F , typename A0 , typename A1 , typename A2 , typename A3 >
bool trigger_every (F func, A0 a0, A1 a1, A2 a2, A3 a3, int ms)
 Post an event periodically.
template<typename F , typename A0 , typename A1 , typename A2 >
bool trigger_every (F func, A0 a0, A1 a1, A2 a2, int ms)
 Post an event periodically.
template<typename F , typename A0 , typename A1 >
bool trigger_every (F func, A0 a0, A1 a1, int ms)
 Post an event periodically.
template<typename F , typename A0 >
bool trigger_every (F func, A0 a0, int ms)
 Post an event periodically.
template<typename F >
bool trigger_every (F func, int ms)
 Post an event periodically.

Detailed Description

Flexible queue for managing events.

Definition at line 16 of file EventQueue.h.


Constructor & Destructor Documentation

EventQueue ( unsigned  event_count = 32,
unsigned  event_context = 0,
unsigned char *  event_pointer = NULL 
)

Create an event queue.

Parameters:
event_countNumber of events to allow enqueueing at once (default: 32)
event_contextMax size of arguments passed with an event (default: 0)
event_pointerPointer to memory area to be used for events (default: NULL)

Definition at line 20 of file EventQueue.cpp.

~EventQueue (  )

Clean up event queue.

Definition at line 48 of file EventQueue.cpp.


Member Function Documentation

void dispatch ( int  ms = -1 )

Dispatch pending events.

Parameters:
msTime to wait for events in milliseconds, 0 indicates to return immediately if no events are pending

Definition at line 65 of file EventQueue.cpp.

unsigned get_tick (  )

Get current tick of the event queue.

Returns:
Number of milliseconds since the queue was instantiated, this count intentionally overflows to 0 after 2^32-1

Definition at line 52 of file EventQueue.cpp.

bool past_tick ( unsigned  tick )

Determine if tick has been passed.

Parameters:
Tickto check
Trueif tick has been passed

Definition at line 56 of file EventQueue.cpp.

bool trigger ( func,
A0  a0,
A1  a1,
A2  a2,
A3  a3,
A4  a4 
)

Immediately post an event to the queue.

Definition at line 111 of file EventQueue.h.

bool trigger ( func,
A0  a0 
)

Immediately post an event to the queue.

Definition at line 179 of file EventQueue.h.

bool trigger ( func )

Immediately post an event to the queue.

Definition at line 196 of file EventQueue.h.

bool trigger ( func,
A0  a0,
A1  a1,
A2  a2 
)

Immediately post an event to the queue.

Definition at line 145 of file EventQueue.h.

bool trigger ( func,
A0  a0,
A1  a1 
)

Immediately post an event to the queue.

Definition at line 162 of file EventQueue.h.

bool trigger ( func,
A0  a0,
A1  a1,
A2  a2,
A3  a3 
)

Immediately post an event to the queue.

Definition at line 128 of file EventQueue.h.

bool trigger_every ( func,
int  ms 
)

Post an event periodically.

Parameters:
msDelay in milliseconds

Definition at line 412 of file EventQueue.h.

bool trigger_every ( func,
A0  a0,
A1  a1,
A2  a2,
A3  a3,
A4  a4,
int  ms 
)

Post an event periodically.

Parameters:
msDelay in milliseconds

Definition at line 322 of file EventQueue.h.

bool trigger_every ( func,
A0  a0,
int  ms 
)

Post an event periodically.

Parameters:
msDelay in milliseconds

Definition at line 394 of file EventQueue.h.

bool trigger_every ( func,
A0  a0,
A1  a1,
A2  a2,
int  ms 
)

Post an event periodically.

Parameters:
msDelay in milliseconds

Definition at line 358 of file EventQueue.h.

bool trigger_every ( func,
A0  a0,
A1  a1,
int  ms 
)

Post an event periodically.

Parameters:
msDelay in milliseconds

Definition at line 376 of file EventQueue.h.

bool trigger_every ( func,
A0  a0,
A1  a1,
A2  a2,
A3  a3,
int  ms 
)

Post an event periodically.

Parameters:
msDelay in milliseconds

Definition at line 340 of file EventQueue.h.

bool trigger_in ( func,
int  ms 
)

Post an event after a specified time.

Parameters:
msDelay in milliseconds

Definition at line 304 of file EventQueue.h.

bool trigger_in ( func,
A0  a0,
A1  a1,
A2  a2,
A3  a3,
int  ms 
)

Post an event after a specified time.

Parameters:
msDelay in milliseconds

Definition at line 232 of file EventQueue.h.

bool trigger_in ( func,
A0  a0,
A1  a1,
A2  a2,
int  ms 
)

Post an event after a specified time.

Parameters:
msDelay in milliseconds

Definition at line 250 of file EventQueue.h.

bool trigger_in ( func,
A0  a0,
A1  a1,
A2  a2,
A3  a3,
A4  a4,
int  ms 
)

Post an event after a specified time.

Parameters:
msDelay in milliseconds

Definition at line 214 of file EventQueue.h.

bool trigger_in ( func,
A0  a0,
A1  a1,
int  ms 
)

Post an event after a specified time.

Parameters:
msDelay in milliseconds

Definition at line 268 of file EventQueue.h.

bool trigger_in ( func,
A0  a0,
int  ms 
)

Post an event after a specified time.

Parameters:
msDelay in milliseconds

Definition at line 286 of file EventQueue.h.