#include <TapeReader.hpp>
|
int | read (void *buf, int req_size) |
|
|
static int | open (const char *szPath, bool &bTape) |
|
Object for reading the tape or several files.
Enumerator |
---|
Normal |
All data are in buffer.
|
EndOfBlock |
End of block is reached, so actual data are shorter than expected.
|
EndOfFile |
Data are absent since end of tape file is reached.
|
EndOfTape |
Data are absent since end to end of tape is reached.
|
ReadError |
Data are absent due to error.
|
TapeReader::TapeReader |
( |
const char * |
szPath, |
|
|
int |
nSize = TapeReaderBlockSize |
|
) |
| |
Create object for reading given tape (or other medium). Maximum block size is set here for tape devices too (64K by default).
In case of disk file reading szPath is a mask like /path/A*B for matching all files "AaB", "A12B", "AabcB" etc in directory /path. Each file is supposed to be equivalent to tape file. Block boundary is not detected. Buffer size is allocated to the maximum size among matched files. Unique subpart of filename of the current file can be accessed via file_signature().
virtual TapeReader::~TapeReader |
( |
| ) |
|
|
virtual |
Destroy the object and release all catched resources.
bool TapeReader::get_block_mode |
( |
| ) |
const |
Get block mode flag. True means reading is performed by blocks. False means no EndOfBlock status will be ever returned by read() method.
int TapeReader::get_max_block_size |
( |
| ) |
const |
Get maximum tape block size in bytes.
int TapeReader::get_max_errors |
( |
| ) |
const |
Get maximum number of reading errors.
bool TapeReader::is_tape |
( |
| ) |
const |
Get the tape device flag. True in case of tape device and false in case of other (normal) file.
static int TapeReader::open |
( |
const char * |
szPath, |
|
|
bool & |
bTape |
|
) |
| |
|
staticprotected |
Open the tape or other medium and return file descriptor. bTape contains whether file is tape (character oriented device) or other type. 'static' since the method does not use and touch internal object state.
int TapeReader::read |
( |
ReadStatus & |
status, |
|
|
void * |
buffer, |
|
|
int |
req_size = 0 |
|
) |
| |
Read requested number of bytes inside the block (in case of block mode is on). Actual number of bytes in data buffer is returned.
int TapeReader::read |
( |
void * |
buf, |
|
|
int |
req_size |
|
) |
| |
|
protected |
Read needed number of bytes from file. Tries to read several times in case of tape. Returns number of actually bytes read or error hint (-1). errno contains error code as usual.
void TapeReader::set_block_mode |
( |
bool |
bFlag | ) |
|
Set block mode flag. True means reading is performed by blocks. False means no EndOfBlock status will be ever returned by read() method.
void TapeReader::set_max_errors |
( |
int |
nErrors | ) |
|
Setup maximum number of reading errors until ReadError will be returned.
void TapeReader::undo_read |
( |
void * |
buffer, |
|
|
int |
undo_size |
|
) |
| |
Put given bytes back to read buffer. Number of bytes should be less than size of internal block.
bool TapeReader::bBlockMode |
|
protected |
bool TapeReader::bTapeDevice |
|
protected |
Previous actual device read status.
File descriptor of opened tape
int TapeReader::nDataOffset |
|
protected |
Offset to unread data bytes in the buffer.
int TapeReader::nDataSize |
|
protected |
Actual number of bytes in the buffer.
int TapeReader::nMaxBlockSize |
|
protected |
Maximum length of tape record.
int TapeReader::nMaxErrors |
|
protected |
Maximum allowed number of read errors.
char* TapeReader::pBlockBuffer |
|
protected |
Preallocated buffer for the most long tape record.
The documentation for this class was generated from the following file:
- /net/opt/univers/ubp-i-15.3-centos7-x64.urij/include/mix/TapeReader.hpp