![]() |
OpenZWave Library
1.4.0
|
Platform-independent definition of a circular buffer. More...
#include <Stream.h>
Public Member Functions | |
Stream (uint32 _bufferSize) | |
void | SetSignalThreshold (uint32 _size) |
bool | Get (uint8 *_buffer, uint32 _size) |
bool | Put (uint8 *_buffer, uint32 _size) |
uint32 | GetDataSize () const |
void | Purge () |
![]() | |
void | AddWatcher (pfnWaitNotification_t _callback, void *_context) |
void | RemoveWatcher (pfnWaitNotification_t _callback, void *_context) |
![]() | |
Ref () | |
void | AddRef () |
int32 | Release () |
Protected Member Functions | |
void | LogData (uint8 *_buffer, uint32 _size, const string &_function) |
virtual bool | IsSignalled () |
~Stream () | |
![]() | |
Wait () | |
virtual | ~Wait () |
void | Notify () |
![]() | |
virtual | ~Ref () |
Friends | |
class | Wait |
Additional Inherited Members | |
![]() | |
enum | { Timeout_Immediate = 0, Timeout_Infinite = -1 } |
typedef void(* | pfnWaitNotification_t )(void *_context) |
![]() | |
static int32 | Single (Wait *_object, int32 _timeout=-1) |
static int32 | Multiple (Wait **_objects, uint32 _numObjects, int32 _timeout=-1) |
Platform-independent definition of a circular buffer.
Stream::Stream | ( | uint32 | _bufferSize | ) |
Constructor. Creates a cross-platform ring buffer object
|
protected |
Destructor. Destroys the ring buffer object.
Copies the requested amount of data from the stream, removing it from the stream as it does so. If there is insufficient data available, the method returns false, and no data is transferred.
_buffer | pointer to a block of memory that will be filled with the stream data. |
_size | the amount of data in bytes to copy from the stream. |
|
inline |
Returns the amount of data in bytes that is stored in the stream.
|
protectedvirtual |
Used by the Wait class to test whether the buffer contains sufficient data.
Implements OpenZWave::Wait.
Formats stream buffer data for output to the log.
_buffer | pointer to the stream buffer "head" location |
_size | number of valid bytes currently in the buffer |
_function | string containing text to display before the data |
void Stream::Purge | ( | ) |
Empties the stream bytes held in the buffer. This is called when the library gets out of sync with the controller and sends a "NAK" to the controller.
Copies the requested amount of data from the buffer into the stream. If there is insufficient room available in the stream's circular buffer, and no data is transferred.
_buffer | pointer to a block of memory that will be copied into the stream. |
_size | the amount of data in bytes to copy to the stream. |
void Stream::SetSignalThreshold | ( | uint32 | _size | ) |
Set the number of bytes the buffer must contain before it becomes signalled. Once the threshold is set, the application can use Wait::Single or Wait::Multiple to wait until the buffer has been filled with the desired amount of data.
_size | the amoutn of data in bytes that the buffer must contain for it to become signalled. |
|
friend |