libglass::Event< T, T, T > Class Template Reference

#include <event.h>

Inheritance diagram for libglass::Event< T, T, T >:

libglass::_Event libglass::PluginInterface

List of all members.

Classes

struct  _EventData

Public Member Functions

 Event (const char *name, void(*func)(T &data)=NULL) throw (Exception)
 ~Event ()
void clear (void)
bool enqueueEvent (const T data, nodeId target=everybodyId, unsigned int len=1)
getEvent (nodeId id=everybodyId, unsigned int *used=0) throw (EmptyException)
bool isEmpty (void)
bool setHandler (void(*func)(T &data))
unsigned int queueSize (void)

Protected Member Functions

bool pushEvent (chain &c, nodeId sender)


Detailed Description

template<typename T, Serializer *, T = toString<T>, Unserializer *, T = fromString<T>>
class libglass::Event< T, T, T >

Event class.

Definition at line 160 of file event.h.


Constructor & Destructor Documentation

template<typename T , Serializer *, T = toString<T>, Unserializer *, T = fromString<T>>
libglass::Event< T, T, T >::Event ( const char *  name,
void(*)(T &data)  func = NULL 
) throw (Exception) [inline]

Definition at line 199 of file event.h.

template<typename T , Serializer *, T = toString<T>, Unserializer *, T = fromString<T>>
libglass::Event< T, T, T >::~Event (  )  [inline]

Definition at line 203 of file event.h.


Member Function Documentation

template<typename T , Serializer *, T = toString<T>, Unserializer *, T = fromString<T>>
void libglass::Event< T, T, T >::clear ( void   )  [inline]

Clears queue.

Definition at line 209 of file event.h.

template<typename T , Serializer *, T = toString<T>, Unserializer *, T = fromString<T>>
bool libglass::Event< T, T, T >::enqueueEvent ( const T  data,
nodeId  target = everybodyId,
unsigned int  len = 1 
) [inline]

Enqueues data.

Parameters:
data The data to enqueue.
target The target node.
size Length of the data, if appliable. If you are transferring arrays, set this to the array length.
Return values:
true if successfully sent.
false if an error occurred.

Definition at line 227 of file event.h.

References libglass::_Event::_enqueueEvent().

template<typename T , Serializer *, T = toString<T>, Unserializer *, T = fromString<T>>
T libglass::Event< T, T, T >::getEvent ( nodeId  id = everybodyId,
unsigned int *  used = 0 
) throw (EmptyException) [inline]

Returns first event in queue.

Returns:
First event in queue.

Definition at line 254 of file event.h.

References libglass::everybodyId.

template<typename T , Serializer *, T = toString<T>, Unserializer *, T = fromString<T>>
bool libglass::Event< T, T, T >::isEmpty ( void   )  [inline]

Checks queue for emptiness.

Return values:
True if empty.
False if not empty.

Definition at line 277 of file event.h.

template<typename T , Serializer *, T = toString<T>, Unserializer *, T = fromString<T>>
bool libglass::Event< T, T, T >::pushEvent ( chain c,
nodeId  sender 
) [inline, protected, virtual]

Pushes

Parameters:
c The serialized event data.
Return values:
True if successfully pushed to the stack.
False otherwise.

Implements libglass::_Event.

Definition at line 178 of file event.h.

template<typename T , Serializer *, T = toString<T>, Unserializer *, T = fromString<T>>
unsigned int libglass::Event< T, T, T >::queueSize ( void   )  [inline]

Returns the number of entries in queue.

Returns:
The number of entries in queue.

Definition at line 311 of file event.h.

template<typename T , Serializer *, T = toString<T>, Unserializer *, T = fromString<T>>
bool libglass::Event< T, T, T >::setHandler ( void(*)(T &data)  func  )  [inline]

Sets a handler.

If the queue is not empty, the handler is called for every event in queue.

Parameters:
func The handler function. If NULL, event changes to queueing mode.
Return values:
True if successfull.
False otherwise.

Definition at line 292 of file event.h.


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

Generated on Fri May 28 13:19:01 2010 for libGlass by  doxygen 1.5.8