Belle II Software development
|
A class to manage I/O for a chain of blocked files. More...
#include <SeqFile.h>
Public Member Functions | |
SeqFile (const std::string &filename, const std::string &rwflag, char *streamerinfo=nullptr, int streamerinfo_size=0, bool filenameIsPattern=false) | |
Constructor. | |
~SeqFile () | |
Destructor. | |
SeqFile (const SeqFile &)=delete | |
No copying. | |
SeqFile & | operator= (const SeqFile &)=delete |
No assignment. | |
int | status () const |
Returns status after constructor call. | |
int | write (const char *buf) |
Write a record to a file. | |
int | read (char *buf, int max) |
Read a record from a file. | |
Private Member Functions | |
void | openFile (std::string filename, bool readonly) |
actually open the file | |
Private Attributes | |
std::string | m_filename |
Name of the opened file. | |
std::string | m_filenamePattern |
Pattern for creating the file from the sequence number. | |
int | m_fd { -1} |
file descriptor. | |
int | m_nb {0} |
when saving a file, the total number of bytes written, 0 when reading. | |
int | m_nfile {0} |
file counter, starting at 0 (files are split after c_MaxFileSize bytes). | |
bool | m_compressed {false} |
is file gzipped compressed? | |
std::unique_ptr< std::ios > | m_stream |
pointer to the filtering input or output stream | |
char * | m_streamerinfo |
StreamerInfo. | |
int | m_streamerinfo_size |
size(bytes) of StreamerInfo | |
Static Private Attributes | |
static const int | c_MaxFileSize {512000000 * 4} |
maximal size of one file (in Bytes). | |
SeqFile | ( | const std::string & | filename, |
const std::string & | rwflag, | ||
char * | streamerinfo = nullptr , |
||
int | streamerinfo_size = 0 , |
||
bool | filenameIsPattern = false |
||
) |
Constructor.
filename | name of the file |
rwflag | should probably be r or rw |
streamerinfo | String containing the streamer info |
streamerinfo_size | Size of the string containing the streamer info |
filenameIsPattern | if true interpret the filename as a boost::format pattern which takes the sequence number as argument instead of producing .sroot-N files |
Definition at line 25 of file SeqFile.cc.
~SeqFile | ( | ) |
Destructor.
Definition at line 128 of file SeqFile.cc.
|
private |
actually open the file
Definition at line 81 of file SeqFile.cc.
int read | ( | char * | buf, |
int | max | ||
) |
Read a record from a file.
The record length is returned.
Definition at line 174 of file SeqFile.cc.
int status | ( | ) | const |
Returns status after constructor call.
If success, fd is returned. If not, -1
Definition at line 135 of file SeqFile.cc.
int write | ( | const char * | buf | ) |
Write a record to a file.
First word of the record should contain number of words.
Definition at line 140 of file SeqFile.cc.
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |