Base class for dealing with files. More...
#include <FileBase.h>
Classes | |
class | FieldBase |
Internal tool. More... | |
Public Member Functions | |
FileBase & | link (FILE *) |
Link to an already open filed. More... | |
FileBase & | link (PlumedMain &) |
Link to a PlumedMain object Automatically links also the corresponding Communicator. More... | |
FileBase & | link (Communicator &) |
Link to a Communicator object. More... | |
FileBase & | link (Action &) |
Link to an Action object. More... | |
virtual FileBase & | flush () |
Flushes the file to disk. More... | |
void | close () |
Closes the file Should be used only for explicitely opened files. More... | |
virtual | ~FileBase () |
Virtual destructor (allows inheritance) More... | |
operator bool () const | |
Check for error/eof. More... | |
void | setHeavyFlush () |
Set heavyFlush flag. More... | |
virtual FileBase & | open (const std::string &name)=0 |
Opens the file. More... | |
bool | FileExist (const std::string &path) |
Check if the file exists. More... | |
bool | isOpen () |
Check if a file is open. More... | |
Static Public Member Functions | |
static void | test () |
Runs a small testcase. More... | |
Protected Member Functions | |
FileBase () | |
Private constructor. More... | |
Static Protected Member Functions | |
static std::string | appendSuffix (const std::string &path, const std::string &suffix) |
Append suffix. More... | |
Protected Attributes | |
FILE * | fp |
file pointer More... | |
void * | gzfp |
zip file pointer. More... | |
Communicator * | comm |
communicator. NULL if not set More... | |
PlumedMain * | plumed |
pointer to main plumed object. NULL if not linked More... | |
Action * | action |
pointer to corresponding action. NULL if not linked More... | |
bool | cloned |
Control closing on destructor. More... | |
bool | eof |
Set to true when end of file is encountered. More... | |
bool | err |
Set to true when error is encountered. More... | |
std::string | path |
path of the opened file More... | |
bool | heavyFlush |
Set to true if you want flush to be heavy (close/reopen) More... | |
Private Member Functions | |
FileBase (const FileBase &) | |
Copy constructor is disabled (private and unimplemented) More... | |
FileBase & | operator= (const FileBase &) |
Assignment operator is disabled (private and unimplemented) More... | |
Base class for dealing with files.
This class just provides things which are common among OFile and IFile
|
private |
Copy constructor is disabled (private and unimplemented)
|
protected |
Private constructor.
In this manner one cannot instantiate a FileBase object
|
virtual |
Virtual destructor (allows inheritance)
|
staticprotected |
Append suffix.
It appends the desired suffix to the string. Notice that it conserves a possible ".gz" suffix.
void PLMD::FileBase::close | ( | ) |
Closes the file Should be used only for explicitely opened files.
bool PLMD::FileBase::FileExist | ( | const std::string & | path | ) |
Check if the file exists.
|
virtual |
Flushes the file to disk.
Reimplemented in PLMD::OFile.
bool PLMD::FileBase::isOpen | ( | ) |
Check if a file is open.
FileBase & PLMD::FileBase::link | ( | FILE * | fp | ) |
Link to an already open filed.
FileBase & PLMD::FileBase::link | ( | PlumedMain & | plumed | ) |
Link to a PlumedMain object Automatically links also the corresponding Communicator.
FileBase & PLMD::FileBase::link | ( | Communicator & | comm | ) |
Link to a Communicator object.
Link to an Action object.
Automatically links also the corresponding PlumedMain and Communicator.
|
pure virtual |
Opens the file.
Implemented in PLMD::OFile, and PLMD::IFile.
PLMD::FileBase::operator bool | ( | ) | const |
Check for error/eof.
Assignment operator is disabled (private and unimplemented)
|
inline |
Set heavyFlush flag.
|
static |
Runs a small testcase.
|
protected |
pointer to corresponding action. NULL if not linked
|
protected |
Control closing on destructor.
If true, file will not be closed in destructor
|
protected |
communicator. NULL if not set
|
protected |
Set to true when end of file is encountered.
|
protected |
Set to true when error is encountered.
|
protected |
file pointer
|
protected |
zip file pointer.
|
protected |
Set to true if you want flush to be heavy (close/reopen)
|
protected |
path of the opened file
|
protected |
pointer to main plumed object. NULL if not linked
Hosted by GitHub | 1.8.7 |