ivutils
Loading...
Searching...
No Matches
file_manager Class Reference

Files manager. More...

#include <component.h>

Public Member Functions

int check (const std::string &fname)
 returns -1 if file cannot be opened (it is suspended or it is already finished), otherwise returns 1
 
FILE * open_file (const std::string &fname, int *count=NULL, int group_ind=0, int ap=0)
 gets file descriptor and open the file if it is not opened already if count > 0 then file was already opened, returns already stored file descriptor

 
int close_files (int group_ind=-1, int with=1)
 closes files within (if with=1) or outsude (if with=0) given group_ind or close all files if group_ind==-1
 
bool have_pending ()
 checks if there are pending files
 
void release_pending ()
 unmark all pending files to make them available for opening
 

Protected Attributes

map_t fmap
 file map
 
int no
 number of already opened files
 
int nlim
 maximal number of opened files
 

Detailed Description

Files manager.

Opens file with given name, collects its descriptor in some storage, if file with this name is required, retrieve its descriptor from the storage and doesn't open file second time. If number of opened files exceeds some limit (nlim), mark all files which need to be opened as suspended and don't open them. Suspended files can be opened only after some of already opened files will be closed, and number of opened files will be less than nlim.


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