![]() |
Image Component Library (ICL)
|
This is used for concurrent writing and reading of Buffers. More...
#include <OpenNIUtils.h>
Public Member Functions | |
| ReadWriteBuffer (ReadWriteBufferHandler< T > *buffer_handler) | |
| Constructor creates and initializes resources. More... | |
| ~ReadWriteBuffer () | |
| Destructor frees allocated memory. More... | |
| T * | getNextReadBuffer () |
| returns a pointer to the most recent actualized buffer. More... | |
| T * | getNextReadBuffer (bool omit_double_frames=false, int omit_max_wait_millis=1000, int omit_sleep_micros=1000) |
| returns pointer to most recent buffer. More... | |
| T * | getNextWriteBuffer () |
| returns a pointer to the next write Buffer. More... | |
| void | setReset () |
| mark buffers to be reset on next write-access. More... | |
| void | switchHandler (ReadWriteBufferHandler< T > *new_handler) |
| switches the handler More... | |
| bool | newAvailable () |
| tells whether a new ConvBuffers is available More... | |
Private Attributes | |
| ReadWriteBufferHandler< T > * | m_BufferHandler |
| the handler used to create new buffers More... | |
| T * | m_Buffers [3] |
| current objects which alternately are read and written. More... | |
| bool | m_ResetBuffers [3] |
| a bool for every buffer telling whether it needs a reset More... | |
| utils::Mutex | m_Mutex |
| the mutex is used for concurrent reading and writing. More... | |
| int | m_Write |
| the object currently written to. More... | |
| int | m_Next |
| the write object currently not written to. More... | |
| int | m_Read |
| the object currently read from. More... | |
| bool | m_Avail |
| tells whether an actualized object was written. More... | |
This is used for concurrent writing and reading of Buffers.
This class holds three pointers to T of which one is the currently read and the other two are alternately written to.
|
inline |
Constructor creates and initializes resources.
|
inline |
Destructor frees allocated memory.
|
inline |
returns a pointer to the most recent actualized buffer.
Buffer will then be marked and not overwritten till the next call to getNextReadBuffer()
|
inline |
returns pointer to most recent buffer.
if omit_double_frames is true, this function will call sleep for omit_sleep_millis and retry until a new buffer is available or omit_max_wait_millis is reached. when no new buffer could be returned NULL will be returned.
| omit_double_frames | whether double frames should be omitted default value is false. |
| omit_max_wait_millis | how long to wait for a new image before returning null. |
| omit_sleep_micros | how long to sleep between checking for new buffer (in microseconds). will return null when no new ReadBuffer available. |
|
inline |
returns a pointer to the next write Buffer.
sets the returned Buffer as current writeable and marks the old writeable as new.
|
inline |
tells whether a new ConvBuffers is available
|
inline |
mark buffers to be reset on next write-access.
|
inline |
switches the handler
|
private |
tells whether an actualized object was written.
|
private |
the handler used to create new buffers
|
private |
current objects which alternately are read and written.
|
private |
the mutex is used for concurrent reading and writing.
|
private |
the write object currently not written to.
|
private |
the object currently read from.
|
private |
a bool for every buffer telling whether it needs a reset
|
private |
the object currently written to.
1.8.15