DAQpp::FileIOManager Class Reference
[DAQ++ IO tools]

Class FileIOManager. More...

#include <FileIOManager.h>

Collaboration diagram for DAQpp::FileIOManager:

Collaboration graph

List of all members.

Public Types

typedef int(* HeaderFunc )(const char **, char *)

Public Member Functions

 FileIOManager (bool use_compression, unsigned long mx_size)
virtual ~FileIOManager ()
int open (const std::string &)
 Opens a new file with a given base name.
int close ()
 Closes the file sequence.
int write (const char *, size_t)
 Writes data into the file.
virtual std::string new_name ()
 changes the base name of the file
int file_number ()
 returns the serial number of the output file
void set_max_size (unsigned long x)
 sets the maximum size of each file in the sequence
unsigned long size ()
 returns the size of the current file
double relative_size ()
 returns the relative size of the current file
void Compress (bool t)
 Sets the compresion option.
bool Compress ()
 Returns the compression option.
const std::string & get_file_name () const
 Returns the name of the current file.
void set_header_func (HeaderFunc ff, char *dt)
 Sets the header "getter".
void reset_header_func ()
 removes the header "getter" pointer
void set_tail_func (HeaderFunc ff, char *dt)
 Sets the tail "getter".
void reset_tail_func ()

Public Attributes

HeaderFunc get_header
 called when a new file is opened.
char * header_data
 Data that will be passed to HeaderFunc.
HeaderFunc get_tail
 called when a file is about to close.
char * tail_data

Private Member Functions

void spy_size ()
 spies the size of the current file
void spy_size_intr ()
int new_file ()
 creates a new file in the file sequence
int write_header_tail (HeaderFunc, char *)
 calls the header/tail function

Private Attributes

int fd
 File handler.
gzFile zfd
 Compression file handle.
Mutex mtx
IOthread thread
 This is the thread that will spy the file size.
std::string base_name
 File name.
std::string extension
 File extension.
int ifile
 File index.
bool zcomp
 flag to activate data compression
unsigned long _size
 Current file size.
unsigned long _max_size
 Maximum file size.
std::string file_name
 actual file name
bool doSpy
 spying flag.


class IOthread


class  IOthread
 thread to spy the file size More...

Detailed Description

Class FileIOManager.

This class takes care of data logging into a file. It provides the posibility of compressing the data to reduce the file size. To compress it uses zlib.

One should specify a maximum size for the output file in the constructor. FileIOManager will split the data into a sequence of files that will share a common base name and will have appended in the name the serial number.

Carlos Lacasta

Member Data Documentation

spying flag.

If true, FileIOmanager will spy the size of the file to check that it is not bigger than the maximum allowed

Referenced by close().

called when a new file is opened.

Every time a new file is opened this fuction is called.

Referenced by new_file(), reset_header_func(), and set_header_func().

called when a file is about to close.

Berofe a file is closed this function is closed

Referenced by close(), new_file(), and set_tail_func().

The documentation for this class was generated from the following files:

Generated on Mon Apr 21 10:00:04 2008 for DAQ++ by  doxygen 1.5.5