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... | |
FileBase & | enforceSuffix (const std::string &suffix) |
Enforce suffix. 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... | |
std::string | getPath () const |
Retrieve the path. More... | |
std::string | getMode () const |
Retrieve the mode. More... | |
std::string | getSuffix () const |
Get the file suffix. More... | |
Static Public Member Functions | |
static std::string | appendSuffix (const std::string &path, const std::string &suffix) |
Append suffix. More... | |
Protected Member Functions | |
FileBase () | |
Private constructor. 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... | |
std::string | mode |
mode 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... | |
Private Attributes | |
std::string | enforcedSuffix |
Enforced suffix: More... | |
bool | enforcedSuffix_ |
If true, use enforcedSuffix, else get it from PlumedMain. More... | |
Base class for dealing with files.
This class just provides things which are common among OFile and IFile
|
explicitprivate |
Copy constructor is disabled (private and unimplemented)
|
protected |
Private constructor.
In this manner one cannot instantiate a FileBase object
|
virtual |
Virtual destructor (allows inheritance)
|
static |
Append suffix.
It appends the desired suffix to the string. Notice that it conserves some suffix (e.g. gz/xtc/trr).
void PLMD::FileBase::close | ( | ) |
Closes the file Should be used only for explicitely opened files.
FileBase & PLMD::FileBase::enforceSuffix | ( | const std::string & | suffix | ) |
Enforce suffix.
Overrides the one set in PlumedMain&
bool PLMD::FileBase::FileExist | ( | const std::string & | path | ) |
Check if the file exists.
|
virtual |
Flushes the file to disk.
Reimplemented in PLMD::OFile.
|
inline |
Retrieve the mode.
|
inline |
Retrieve the path.
std::string PLMD::FileBase::getSuffix | ( | ) | const |
Get the file suffix.
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.
|
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
|
private |
Enforced suffix:
|
private |
If true, use enforcedSuffix, else get it from PlumedMain.
|
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 |
mode of the opened file
|
protected |
path of the opened file
|
protected |
pointer to main plumed object. NULL if not linked
Hosted by GitHub | 1.8.14 |