ivutils
|
class for storing slices of data_t values d: i <– sequence length (size_t) i <– number of slices (size_t) d d d d d d <– slice0 d d d d d d <– slice1, etc. More...
#include <loggerio.h>
Public Member Functions | |
SeqRecord (size_t ds=sizeof(double), size_t dlen=1, bool if_header_=true) | |
constructor parameter dlen is the length of each slice | |
int | SetDataSize (size_t ds) |
returns -2 if file is open: can't change existing file | |
virtual int | SetSliceLookup (const std::vector< int > &slookup_, ptrdiff_t numslice_limit=-1) |
Lookup for slice number shift with respect to current position. | |
const size_t | GetCurrentSlice () const |
Gets the current slice (frame) being recorded. | |
virtual void | CopyHeader (const SeqRecord &orig) |
Copies data_size and seqlen from left argumnet to the right one. | |
virtual int | ReadHeaderFromFile (const std::string &name) |
Reads seqlen form file name and calculates data_size by means of numslices and seqlen written there. | |
virtual int | OpenRecord (const std::string &name, const char *mode="w", const int shift=-1) |
opens a file if the mode is "w" then replaces the old file if it exists and starts new record if the mode is "a" then appends the old file if it exists (after checking format ) or starts new record if not if the mode is "r" analyses the given file (checks it format) and can perform GetData() if the mode is "ar" can do both reading and appending other combinations of r and w are not supported record will start from shift slice, or from the last slice if shift<0 | |
virtual int | AppendData (const void *rec, size_t arrlen=1, bool recorded=true) |
appends next arrlen records to a file from rec array if arrlen exceeds the maximum number left for current slice, appends the correct number of elements only DATA IS APPENDED BY COPYING FROM MEMORY (using fwrite) <- this behaviour may be changed in the future... returns the number of elements appended | |
virtual int | SetTextHeader (const std::string &head) |
Set slice (frame) teaxt header . | |
virtual int | NextSlice (bool recorded=true) |
Switches to the next slice. | |
virtual int | CloseRecord () |
Closes the file. | |
virtual int | GetData (void *rec, size_t slicenum, size_t beg=0, size_t end=0) |
gets data from slice slicenum starting from beg till end all counters start from zero returns the number of elements read | |
class for storing slices of data_t values d: i <– sequence length (size_t) i <– number of slices (size_t) d d d d d d <– slice0 d d d d d d <– slice1, etc.
in a file the slices are of equal length header (i i) cab be skipped if flag if_header = false
error codes for all functions: -1 out of range -2 invalid file state (not open/ already open) -3 invalid file (can't open) -4 wrong file format
|
inlinevirtual |
|
inline |
Gets the current slice (frame) being recorded.
To start a new frame an explicit rewind is needed by calling NextSlice()
|
inlinevirtual |
Switches to the next slice.
All appended data will be forwarded to this slice until next call to this function.
Reimplemented in QPLTRecord.
|
inlinevirtual |
opens a file if the mode is "w" then replaces the old file if it exists and starts new record if the mode is "a" then appends the old file if it exists (after checking format ) or starts new record if not if the mode is "r" analyses the given file (checks it format) and can perform GetData() if the mode is "ar" can do both reading and appending other combinations of r and w are not supported record will start from shift slice, or from the last slice if shift<0
Reimplemented in QPLTRecord.
|
inlinevirtual |
Reads seqlen form file name and calculates data_size by means of numslices and seqlen written there.
This function was produced to automaticaly detect SeqRecord parameters for a file. The function does neiver set file parameter nor the numslices feild of SeqRecord rec.
Reimplemented in QPLTRecord.
|
inlinevirtual |
Set slice (frame) teaxt header .
Supported by QPLT format. The information will be used while writing the next slice header.
Reimplemented in QPLTRecord.