OpenZWave Library  1.4.3015
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
OpenZWave::Wait Class Referenceabstract

Platform-independent definition of Wait objects. More...

#include <Wait.h>

+ Inheritance diagram for OpenZWave::Wait:
+ Collaboration diagram for OpenZWave::Wait:

Public Types

enum  { Timeout_Immediate = 0, Timeout_Infinite = -1 }
 
typedef void(* pfnWaitNotification_t) (void *_context)
 

Public Member Functions

void AddWatcher (pfnWaitNotification_t _callback, void *_context)
 
void RemoveWatcher (pfnWaitNotification_t _callback, void *_context)
 
- Public Member Functions inherited from OpenZWave::Ref
 Ref ()
 
void AddRef ()
 
int32 Release ()
 

Static Public Member Functions

static int32 Single (Wait *_object, int32 _timeout=-1)
 
static int32 Multiple (Wait **_objects, uint32 _numObjects, int32 _timeout=-1)
 

Protected Member Functions

 Wait ()
 
virtual ~Wait ()
 
void Notify ()
 
virtual bool IsSignalled ()=0
 
- Protected Member Functions inherited from OpenZWave::Ref
virtual ~Ref ()
 

Friends

class WaitImpl
 
class ThreadImpl
 

Detailed Description

Platform-independent definition of Wait objects.

Member Typedef Documentation

typedef void(* OpenZWave::Wait::pfnWaitNotification_t) (void *_context)

Member Enumeration Documentation

anonymous enum
Enumerator
Timeout_Immediate 
Timeout_Infinite 

Constructor & Destructor Documentation

Wait::Wait ( )
protected
Wait::~Wait ( )
protectedvirtual

Member Function Documentation

void Wait::AddWatcher ( pfnWaitNotification_t  _callback,
void *  _context 
)

Add a watcher to our object. The watcher will be triggered by the derived class, when it enters a certain state.

Parameters
_callbackpointer to the function that will be called when the wait is over.
_contextpointer to custom data that will be sent with the callback.
virtual bool OpenZWave::Wait::IsSignalled ( )
protectedpure virtual

Test whether an object is signalled.

Implemented in OpenZWave::Stream, OpenZWave::Thread, OpenZWave::Mutex, and OpenZWave::Event.

int32 Wait::Multiple ( Wait **  _objects,
uint32  _numObjects,
int32  _timeout = -1 
)
static

Wait for one of multiple objects to become signalled. If more than one object is in a signalled state, the lowest array index will be returned.

Parameters
_objectsarray of pointers to objects to wait on.
_numObjectsnumber of objects in the array.
_timeoutoptional maximum time to wait. Defaults to -1, which means wait forever.
Returns
index into the array of the object that was signalled, -1 if the wait timed out.
void Wait::Notify ( )
protected

Notify the watchers that the object is signalled.

void Wait::RemoveWatcher ( pfnWaitNotification_t  _callback,
void *  _context 
)

Remove a watcher from our object. Both the _callback and _context pointers must match those used in a previous call to AddWatcher.

Parameters
_callbackpointer to the function that will be called when the wait is over.
_contextpointer to custom data that will be sent with the callback.
static int32 OpenZWave::Wait::Single ( Wait _object,
int32  _timeout = -1 
)
inlinestatic

Wait for a single object to become signalled.

Parameters
_objectpointer to the object to wait on.
_timeoutoptional maximum time to wait. Defaults to -1, which means wait forever.
Returns
zero if the object was signalled, -1 if the wait timed out.

Friends And Related Function Documentation

friend class ThreadImpl
friend
friend class WaitImpl
friend

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