ARC SDK
|
Represents set of buffers. More...
#include <arc/data/DataBuffer.h>
Public Member Functions | |
operator bool () const | |
Returns true if DataBuffer object is initialized. More... | |
DataBuffer (unsigned int size=1048576, int blocks=3) | |
Construct a new DataBuffer object. More... | |
DataBuffer (CheckSum *cksum, unsigned int size=1048576, int blocks=3) | |
Construct a new DataBuffer object with checksum computation. More... | |
~DataBuffer () | |
Destructor. More... | |
bool | set (CheckSum *cksum=NULL, unsigned int size=1048576, int blocks=3) |
Reinitialize buffers with different parameters. More... | |
int | add (CheckSum *cksum) |
Add a checksum object which will compute checksum of buffer. More... | |
char * | operator[] (int n) |
Direct access to buffer by number. More... | |
bool | for_read (int &handle, unsigned int &length, bool wait) |
Request buffer for READING INTO it. More... | |
bool | for_read () |
Check if there are buffers which can be taken by for_read(). More... | |
bool | is_read (int handle, unsigned int length, unsigned long long int offset) |
Informs object that data was read into buffer. More... | |
bool | is_read (char *buf, unsigned int length, unsigned long long int offset) |
Informs object that data was read into buffer. More... | |
bool | for_write (int &handle, unsigned int &length, unsigned long long int &offset, bool wait) |
Request buffer for WRITING FROM it. More... | |
bool | for_write () |
Check if there are buffers which can be taken by for_write(). More... | |
bool | is_written (int handle) |
Informs object that data was written from buffer. More... | |
bool | is_written (char *buf) |
Informs object that data was written from buffer. More... | |
bool | is_notwritten (int handle) |
Informs object that data was NOT written from buffer (and releases buffer). More... | |
bool | is_notwritten (char *buf) |
Informs object that data was NOT written from buffer (and releases buffer). More... | |
void | eof_read (bool v) |
Informs object if there will be no more request for 'read' buffers. More... | |
void | eof_write (bool v) |
Informs object if there will be no more request for 'write' buffers. More... | |
void | error_read (bool v) |
Informs object if error occurred on 'read' side. More... | |
void | error_write (bool v) |
Informs object if error occurred on 'write' side. More... | |
bool | eof_read () |
Returns true if object was informed about end of transfer on 'read' side. More... | |
bool | eof_write () |
Returns true if object was informed about end of transfer on 'write' side. More... | |
bool | error_read () |
Returns true if object was informed about error on 'read' side. More... | |
bool | error_write () |
Returns true if object was informed about error on 'write' side. More... | |
bool | error_transfer () |
Returns true if transfer was slower than limits set in speed object. More... | |
bool | error () |
Returns true if object was informed about error or internal error occurred. More... | |
bool | wait_any () |
Wait (max 60 sec.) till any action happens in object. More... | |
bool | wait_used () |
Wait till there are no more used buffers left in object. More... | |
bool | wait_for_read () |
Wait till no more buffers taken for "READING INTO" left in object. More... | |
bool | wait_for_write () |
Wait till no more buffers taken for "WRITING FROM" left in object. More... | |
bool | checksum_valid (int index) const |
Returns true if the specified checksum was successfully computed. More... | |
bool | checksum_valid () const |
Returns true if the checksum was successfully computed. More... | |
const CheckSum * | checksum_object (int index) const |
Returns CheckSum object at specified index or NULL if index is not in list. More... | |
const CheckSum * | checksum_object () const |
Returns first checksum object in checksum list or NULL if list is empty. More... | |
bool | wait_eof_read () |
Wait until end of transfer happens on 'read' side. Always returns true. More... | |
bool | wait_read () |
Wait until end of transfer or error happens on 'read' side. Always returns true. More... | |
bool | wait_eof_write () |
Wait until end of transfer happens on 'write' side. Always returns true. More... | |
bool | wait_write () |
Wait until end of transfer or error happens on 'write' side. Always returns true. More... | |
bool | wait_eof () |
Wait until end of transfer happens on any side. Always returns true. More... | |
unsigned long long int | eof_position () const |
Returns offset following last piece of data transferred. More... | |
unsigned int | buffer_size () const |
Returns size of buffer in object. More... | |
Data Fields | |
DataSpeed | speed |
This object controls transfer speed. More... | |
Represents set of buffers.
This class is used during data transfer using DataPoint classes.
Arc::DataBuffer::DataBuffer | ( | unsigned int | size = 1048576 , |
int | blocks = 3 |
||
) |
Construct a new DataBuffer object.
size | size of every buffer in bytes. |
blocks | number of buffers. |
Arc::DataBuffer::DataBuffer | ( | CheckSum * | cksum, |
unsigned int | size = 1048576 , |
||
int | blocks = 3 |
||
) |
Construct a new DataBuffer object with checksum computation.
size | size of every buffer in bytes. |
blocks | number of buffers. |
cksum | object which will compute checksum. Should not be destroyed until DataBuffer itself. |
Arc::DataBuffer::~DataBuffer | ( | ) |
Destructor.
int Arc::DataBuffer::add | ( | CheckSum * | cksum | ) |
Add a checksum object which will compute checksum of buffer.
cksum | object which will compute checksum. Should not be destroyed until DataBuffer itself. |
unsigned int Arc::DataBuffer::buffer_size | ( | ) | const |
Returns size of buffer in object.
If not initialized then this number represents size of default buffer.
const CheckSum* Arc::DataBuffer::checksum_object | ( | int | index | ) | const |
Returns CheckSum object at specified index or NULL if index is not in list.
index | of the checksum in question. |
const CheckSum* Arc::DataBuffer::checksum_object | ( | ) | const |
Returns first checksum object in checksum list or NULL if list is empty.
bool Arc::DataBuffer::checksum_valid | ( | int | index | ) | const |
Returns true if the specified checksum was successfully computed.
index | of the checksum in question. |
bool Arc::DataBuffer::checksum_valid | ( | ) | const |
Returns true if the checksum was successfully computed.
|
inline |
Returns offset following last piece of data transferred.
void Arc::DataBuffer::eof_read | ( | bool | v | ) |
Informs object if there will be no more request for 'read' buffers.
v | true if no more requests. |
bool Arc::DataBuffer::eof_read | ( | ) |
Returns true if object was informed about end of transfer on 'read' side.
void Arc::DataBuffer::eof_write | ( | bool | v | ) |
Informs object if there will be no more request for 'write' buffers.
v | true if no more requests. |
bool Arc::DataBuffer::eof_write | ( | ) |
Returns true if object was informed about end of transfer on 'write' side.
bool Arc::DataBuffer::error | ( | ) |
Returns true if object was informed about error or internal error occurred.
void Arc::DataBuffer::error_read | ( | bool | v | ) |
Informs object if error occurred on 'read' side.
v | true if error |
bool Arc::DataBuffer::error_read | ( | ) |
Returns true if object was informed about error on 'read' side.
bool Arc::DataBuffer::error_transfer | ( | ) |
Returns true if transfer was slower than limits set in speed object.
void Arc::DataBuffer::error_write | ( | bool | v | ) |
Informs object if error occurred on 'write' side.
v | true if error |
bool Arc::DataBuffer::error_write | ( | ) |
Returns true if object was informed about error on 'write' side.
bool Arc::DataBuffer::for_read | ( | int & | handle, |
unsigned int & | length, | ||
bool | wait | ||
) |
Request buffer for READING INTO it.
Should be called when data is being read from a source. The calling code should write data into the returned buffer and then call is_read().
handle | filled with buffer's number. |
length | filled with size of buffer |
wait | if true and there are no free buffers, method will wait for one. |
bool Arc::DataBuffer::for_read | ( | ) |
Check if there are buffers which can be taken by for_read().
This function checks only for buffers and does not take eof and error conditions into account.
bool Arc::DataBuffer::for_write | ( | int & | handle, |
unsigned int & | length, | ||
unsigned long long int & | offset, | ||
bool | wait | ||
) |
Request buffer for WRITING FROM it.
Should be called when data is being written to a destination. The calling code should write the data contained in the returned buffer and then call is_written().
handle | returns buffer's number. |
length | returns size of buffer |
offset | returns buffer offset |
wait | if true and there are no available buffers, method will wait for one. |
bool Arc::DataBuffer::for_write | ( | ) |
Check if there are buffers which can be taken by for_write().
This function checks only for buffers and does not take eof and error conditions into account.
bool Arc::DataBuffer::is_notwritten | ( | int | handle | ) |
Informs object that data was NOT written from buffer (and releases buffer).
handle | buffer's number. |
bool Arc::DataBuffer::is_notwritten | ( | char * | buf | ) |
Informs object that data was NOT written from buffer (and releases buffer).
buf | - address of buffer |
bool Arc::DataBuffer::is_read | ( | int | handle, |
unsigned int | length, | ||
unsigned long long int | offset | ||
) |
Informs object that data was read into buffer.
handle | buffer's number. |
length | amount of data. |
offset | offset in stream, file, etc. |
bool Arc::DataBuffer::is_read | ( | char * | buf, |
unsigned int | length, | ||
unsigned long long int | offset | ||
) |
Informs object that data was read into buffer.
buf | address of buffer |
length | amount of data. |
offset | offset in stream, file, etc. |
bool Arc::DataBuffer::is_written | ( | int | handle | ) |
Informs object that data was written from buffer.
handle | buffer's number. |
bool Arc::DataBuffer::is_written | ( | char * | buf | ) |
Informs object that data was written from buffer.
buf | - address of buffer |
|
inline |
Returns true if DataBuffer object is initialized.
char* Arc::DataBuffer::operator[] | ( | int | n | ) |
Direct access to buffer by number.
n | buffer number |
bool Arc::DataBuffer::set | ( | CheckSum * | cksum = NULL , |
unsigned int | size = 1048576 , |
||
int | blocks = 3 |
||
) |
Reinitialize buffers with different parameters.
size | size of every buffer in bytes. |
blocks | number of buffers. |
cksum | object which will compute checksum. Should not be destroyed until DataBuffer itself. |
bool Arc::DataBuffer::wait_any | ( | ) |
Wait (max 60 sec.) till any action happens in object.
bool Arc::DataBuffer::wait_eof | ( | ) |
Wait until end of transfer happens on any side. Always returns true.
bool Arc::DataBuffer::wait_eof_read | ( | ) |
Wait until end of transfer happens on 'read' side. Always returns true.
bool Arc::DataBuffer::wait_eof_write | ( | ) |
Wait until end of transfer happens on 'write' side. Always returns true.
bool Arc::DataBuffer::wait_for_read | ( | ) |
Wait till no more buffers taken for "READING INTO" left in object.
bool Arc::DataBuffer::wait_for_write | ( | ) |
Wait till no more buffers taken for "WRITING FROM" left in object.
bool Arc::DataBuffer::wait_read | ( | ) |
Wait until end of transfer or error happens on 'read' side. Always returns true.
bool Arc::DataBuffer::wait_used | ( | ) |
Wait till there are no more used buffers left in object.
bool Arc::DataBuffer::wait_write | ( | ) |
Wait until end of transfer or error happens on 'write' side. Always returns true.
DataSpeed Arc::DataBuffer::speed |
This object controls transfer speed.