ost::Buffer(3) | Library Functions Manual | ost::Buffer(3) |
NAME¶
ost::Buffer - The buffer class represents an IPC service that is built upon a buffer of fixed capacity that can be used to transfer objects between one or more producer and consumer threads.SYNOPSIS¶
#include <buffer.h> Inherits ost::Conditional. Inherited by ost::FixedBuffer.Public Member Functions¶
Buffer (size_t capacity)
Static Public Attributes¶
static const size_t timeout
Protected Member Functions¶
virtual size_t onPeek (void *buf)=0
Related Functions¶
(Note that these are not member functions.)size_t get (Buffer &b, void *o, timeout_t t=0)
Detailed Description¶
The buffer class represents an IPC service that is built upon a buffer of fixed capacity that can be used to transfer objects between one or more producer and consumer threads.David Sugar dyfet@ostel.com Producer/Consumer
buffer for use between threads.
Constructor & Destructor Documentation¶
ost::Buffer::Buffer (size_tcapacity)¶
Create a buffer object of known capacity. Parameters:capacity is the integer capacity of the
buffer.
virtual ost::Buffer::~Buffer () [virtual]¶
In derived functions, may be used to free the actual memory used to hold buffered data.Member Function Documentation¶
size_t ost::Buffer::getSize (void) [inline]¶
Return the capacity of the buffer as specified at creation. Returns:size of buffer.
size_t ost::Buffer::getUsed (void) [inline]¶
Return the current capacity in use for the buffer. Free space is technically getSize() - getUsed(). Returns:integer used capacity of the buffer.
See also:
getSize
virtual bool ost::Buffer::isValid (void) [virtual]¶
New virtual to test if buffer is a valid object. Returns:true if object is valid.
virtual size_t ost::Buffer::onPeek (void *buf) [protected], [pure virtual]¶
Invoke derived class buffer peeking method. Returns:size of object found.
Parameters:
buf pointer to copy contents of head of
buffer to.
virtual size_t ost::Buffer::onPost (void *buf) [protected], [pure virtual]¶
Invoke derived class posting of object to buffer. Returns:size of object posted.
Parameters:
buf pointer to object being posted to
the buffer.
virtual size_t ost::Buffer::onWait (void *buf) [protected], [pure virtual]¶
Invoke derived class object request from buffer. Returns:size of object returned.
Parameters:
buf pointer to hold object returned
from the buffer.
size_t ost::Buffer::peek (void *buf)¶
Peek at the current content (first object) in the buffer. Returns:size of object in the buffer.
Parameters:
buf pointer to store object found in
the buffer.
size_t ost::Buffer::post (void *buf, timeout_ttimeout = 0)¶
Post an object into the buffer and enable a waiting thread to receive it. Returns:size of object posted in bytes.
Parameters:
buf pointer to object to store in the
buffer.
timeout time to wait.
size_t ost::Buffer::wait (void *buf, timeout_ttimeout = 0)¶
Let one or more threads wait for an object to become available in the buffer. The waiting thread(s) will wait forever if no object is ever placed into the buffer. Returns:size of object passed by buffer in
bytes.
Parameters:
buf pointer to store object retrieved
from the buffer.
timeout time to wait.
Friends And Related Function Documentation¶
size_t get (Buffer &b, void *o, timeout_tt = 0) [related]¶
size_t peek (Buffer &b, void *o) [related]¶
Examples:SampleSocketPort.cpp. References peek().
size_t put (Buffer &b, void *o, timeout_tt = 0) [related]¶
References post().Member Data Documentation¶
const size_t ost::Buffer::timeout [static]¶
value to return when a timed operation returned with a timeout.Author¶
Generated automatically by Doxygen for GNU CommonC++ from the source code.Sat Jun 23 2012 | GNU CommonC++ |