Arc::DataBuffer Class Reference
Represents set of buffers.
More...
#include <DataBuffer.h>
Data Structures |
struct | buf_desc |
class | checksum_desc |
Public Member Functions |
| operator bool () const |
| DataBuffer (unsigned int size=65536, int blocks=3) |
| DataBuffer (CheckSum *cksum, unsigned int size=65536, int blocks=3) |
| ~DataBuffer () |
bool | set (CheckSum *cksum=NULL, unsigned int size=65536, int blocks=3) |
int | add (CheckSum *cksum) |
char * | operator[] (int n) |
bool | for_read (int &handle, unsigned int &length, bool wait) |
bool | for_read () |
bool | is_read (int handle, unsigned int length, unsigned long long int offset) |
bool | is_read (char *buf, unsigned int length, unsigned long long int offset) |
bool | for_write (int &handle, unsigned int &length, unsigned long long int &offset, bool wait) |
bool | for_write () |
bool | is_written (int handle) |
bool | is_written (char *buf) |
bool | is_notwritten (int handle) |
bool | is_notwritten (char *buf) |
void | eof_read (bool v) |
void | eof_write (bool v) |
void | error_read (bool v) |
void | error_write (bool v) |
bool | eof_read () |
bool | eof_write () |
bool | error_read () |
bool | error_write () |
bool | error_transfer () |
bool | error () |
bool | wait_any () |
bool | wait_used () |
bool | wait_for_read () |
bool | wait_for_write () |
bool | checksum_valid () const |
const CheckSum * | checksum_object () const |
bool | wait_eof_read () |
bool | wait_read () |
bool | wait_eof_write () |
bool | wait_write () |
bool | wait_eof () |
unsigned long long int | eof_position () const |
unsigned int | buffer_size () const |
Data Fields |
DataSpeed | speed |
Detailed Description
Represents set of buffers.
This class is used used during data transfer using DataPoint classes.
Constructor & Destructor Documentation
Arc::DataBuffer::DataBuffer |
( |
unsigned int |
size = 65536 , |
|
|
int |
blocks = 3 | |
|
) |
| | |
Contructor
- Parameters:
-
| size | size of every buffer in bytes. |
| blocks | number of buffers. |
Arc::DataBuffer::DataBuffer |
( |
CheckSum * |
cksum, |
|
|
unsigned int |
size = 65536 , |
|
|
int |
blocks = 3 | |
|
) |
| | |
Contructor
- Parameters:
-
| size | size of every buffer in bytes. |
| blocks | number of buffers. |
| cksum | object which will compute checksum. Should not be destroyed till DataBuffer itself. |
Member Function Documentation
int Arc::DataBuffer::add |
( |
CheckSum * |
cksum |
) |
|
Add a checksum object which will compute checksum of buffer.
- Parameters:
-
| cksum | object which will compute checksum. Should not be destroyed till DataBuffer itself. |
- Returns:
- integer position in the list of checksum objects.
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 |
( |
|
) |
const |
Returns CheckSum object specified in constructor, returns NULL if index is not in list.
- Parameters:
-
| index | of the checksum in question. |
bool Arc::DataBuffer::checksum_valid |
( |
|
) |
const |
Returns true if checksum was successfully computed, returns false if index is not in list.
- Parameters:
-
| index | of the checksum in question. |
bool Arc::DataBuffer::eof_read |
( |
|
) |
|
Returns true if object was informed about end of transfer on 'read' side.
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_write |
( |
|
) |
|
Returns true if object was informed about end of transfer on 'write' 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::error |
( |
|
) |
|
Returns true if object was informed about error or internal error occured.
void Arc::DataBuffer::error_read |
( |
bool |
v |
) |
|
Informs object if error accured on 'read' side.
- Parameters:
-
void Arc::DataBuffer::error_write |
( |
bool |
v |
) |
|
Informs object if error accured on 'write' side.
- Parameters:
-
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_read |
( |
int & |
handle, |
|
|
unsigned int & |
length, |
|
|
bool |
wait | |
|
) |
| | |
Request buffer for READING INTO it.
- Parameters:
-
| handle | returns buffer's number. |
| length | returns size of buffer |
| wait | if true and there are no free buffers, method will wait for one. |
- Returns:
- true on success For python bindings pattern of this method is (bool, handle, length) for_read(wait). Here buffer for reading to be provided by external code and provided to DataBuffer object through is_read() method. Content of buffer must not exceed provided length.
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::for_write |
( |
int & |
handle, |
|
|
unsigned int & |
length, |
|
|
unsigned long long int & |
offset, |
|
|
bool |
wait | |
|
) |
| | |
Request buffer for WRITING FROM it.
- Parameters:
-
| handle | returns buffer's number. |
| length | returns size of buffer |
| wait | if true and there are no free buffers, method will wait for one. For python bindings pattern of this method is (bool, handle, length, offset, buffer) for_write(wait). Here buffer is string with content of buffer provided by DataBuffer object; |
bool Arc::DataBuffer::is_notwritten |
( |
char * |
buf |
) |
|
Informs object that data was NOT written from buffer (and releases buffer).
- Parameters:
-
bool Arc::DataBuffer::is_notwritten |
( |
int |
handle |
) |
|
Informs object that data was NOT written from buffer (and releases buffer).
- Parameters:
-
bool Arc::DataBuffer::is_read |
( |
char * |
buf, |
|
|
unsigned int |
length, |
|
|
unsigned long long int |
offset | |
|
) |
| | |
Informs object that data was read into buffer.
- Parameters:
-
| buf | - address of buffer |
| length | amount of data. |
| offset | offset in stream, file, etc. |
bool Arc::DataBuffer::is_read |
( |
int |
handle, |
|
|
unsigned int |
length, |
|
|
unsigned long long int |
offset | |
|
) |
| | |
Informs object that data was read into buffer.
- Parameters:
-
| handle | buffer's number. |
| length | amount of data. |
| offset | offset in stream, file, etc. For python bindings pattern of that method is bool is_read(handle,buffer,offset). Here buffer is string containing content of buffer to be passed to DataBuffer object. |
bool Arc::DataBuffer::is_written |
( |
char * |
buf |
) |
|
Informs object that data was written from buffer.
- Parameters:
-
bool Arc::DataBuffer::is_written |
( |
int |
handle |
) |
|
Informs object that data was written from buffer.
- Parameters:
-
bool Arc::DataBuffer::set |
( |
CheckSum * |
cksum = NULL , |
|
|
unsigned int |
size = 65536 , |
|
|
int |
blocks = 3 | |
|
) |
| | |
Reinitialize buffers with different parameters.
- Parameters:
-
| size | size of every buffer in bytes. |
| blocks | number of buffers. |
| cksum | object which will compute checksum. Should not be destroyed till DataBuffer itself. |
bool Arc::DataBuffer::wait_any |
( |
|
) |
|
Wait (max 60 sec.) till any action happens in object. Returns true if action is eof on any side.
The documentation for this class was generated from the following file: