OpenZWave Library: OpenZWave::Wait Class Reference

| OpenZWave Library 1.6.0

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
OpenZWave::Wait Class Referenceabstract
Platform Abstraction Support

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

`#include <Wait.h>`

Inheritance 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

## ◆ pfnWaitNotification_t

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

## Member Enumeration Documentation

## ◆ anonymous enum

anonymous enum

Enumerator
Timeout_Immediate |
Timeout_Infinite |

## Constructor & Destructor Documentation

## ◆ Wait()

Wait::Wait | ( |  | ) |
| protected

## ◆ ~Wait()

Wait::~Wait | ( |  | ) |
| protectedvirtual

## Member Function Documentation

## ◆ AddWatcher()

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

  _callback | pointer to the function that will be called when the wait is over.
  _context | pointer to custom data that will be sent with the callback.

## ◆ IsSignalled()

virtual bool OpenZWave::Wait::IsSignalled | ( |  | ) |
| protectedpure virtual

Test whether an object is signalled.

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

## ◆ Multiple()

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

  _objects | array of pointers to objects to wait on.
  _numObjects | number of objects in the array.
  _timeout | optional 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.

## ◆ Notify()

void Wait::Notify | ( |  | ) |
| protected

Notify the watchers that the object is signalled.

## ◆ RemoveWatcher()

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

  _callback | pointer to the function that will be called when the wait is over.
  _context | pointer to custom data that will be sent with the callback.

## ◆ Single()

static int32 OpenZWave::Wait::Single | ( | Wait * | _object,
|  | int32 | _timeout = `-1`
| ) |  |
| inlinestatic

Wait for a single object to become signalled.

Parameters

  _object | pointer to the object to wait on.
  _timeout | optional 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

## ◆ ThreadImpl

friend class ThreadImpl
| friend

## ◆ WaitImpl

friend class WaitImpl
| friend

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

- Wait.h
- Wait.cpp