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 & | 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... | |
FileBase & | open (const std::string &name, const std::string &mode) |
Opens the file (without auto-backup) 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... | |
Protected Attributes | |
FILE * | fp |
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
Definition at line 39 of file FileBase.h.
|
private |
Copy constructor is disabled (private and unimplemented)
|
protected |
Private constructor.
In this manner one cannot instantiate a FileBase object
Definition at line 148 of file FileBase.cpp.
|
virtual |
Virtual destructor (allows inheritance)
Definition at line 160 of file FileBase.cpp.
void PLMD::FileBase::close | ( | ) |
Closes the file Should be used only for explicitely opened files.
Definition at line 140 of file FileBase.cpp.
bool PLMD::FileBase::FileExist | ( | const std::string & | path | ) |
Check if the file exists.
Definition at line 118 of file FileBase.cpp.
FileBase & PLMD::FileBase::flush | ( | ) |
Flushes the file to disk.
Definition at line 70 of file FileBase.cpp.
bool PLMD::FileBase::isOpen | ( | ) |
Check if a file is open.
Definition at line 134 of file FileBase.cpp.
FileBase & PLMD::FileBase::link | ( | FILE * | fp | ) |
Link to an already open filed.
Definition at line 64 of file FileBase.cpp.
FileBase & PLMD::FileBase::link | ( | PlumedMain & | plumed | ) |
Link to a PlumedMain object Automatically links also the corresponding Communicator.
Definition at line 85 of file FileBase.cpp.
FileBase & PLMD::FileBase::link | ( | Communicator & | comm | ) |
Link to a Communicator object.
Definition at line 79 of file FileBase.cpp.
Link to an Action object.
Automatically links also the corresponding PlumedMain and Communicator.
Definition at line 92 of file FileBase.cpp.
FileBase & PLMD::FileBase::open | ( | const std::string & | name, |
const std::string & | mode | ||
) |
Opens the file (without auto-backup)
Definition at line 99 of file FileBase.cpp.
PLMD::FileBase::operator bool | ( | ) | const |
Check for error/eof.
Definition at line 166 of file FileBase.cpp.
Assignment operator is disabled (private and unimplemented)
|
inline |
Set heavyFlush flag.
Definition at line 101 of file FileBase.h.
|
static |
Runs a small testcase.
Definition at line 37 of file FileBase.cpp.
|
protected |
pointer to corresponding action. NULL if not linked
Definition at line 63 of file FileBase.h.
|
protected |
Control closing on destructor.
If true, file will not be closed in destructor
Definition at line 66 of file FileBase.h.
|
protected |
communicator. NULL if not set
Definition at line 59 of file FileBase.h.
|
protected |
Set to true when end of file is encountered.
Definition at line 71 of file FileBase.h.
|
protected |
Set to true when error is encountered.
Definition at line 73 of file FileBase.h.
|
protected |
file pointer
Definition at line 57 of file FileBase.h.
|
protected |
Set to true if you want flush to be heavy (close/reopen)
Definition at line 77 of file FileBase.h.
|
protected |
path of the opened file
Definition at line 75 of file FileBase.h.
|
protected |
pointer to main plumed object. NULL if not linked
Definition at line 61 of file FileBase.h.
Hosted by GitHub
![]() |
![]() |