Class for input files. More...
#include <IFile.h>
Classes | |
class | Field |
Public Member Functions | |
IFile () | |
Constructor. More... | |
~IFile () | |
Destructor. More... | |
IFile & | open (const std::string &name) |
Opens the file. More... | |
IFile & | scanFieldList (std::vector< std::string > &) |
Gets the list of all fields. More... | |
IFile & | scanField (const std::string &, double &) |
Read a double field. More... | |
IFile & | scanField (const std::string &, int &) |
Read a int field. More... | |
IFile & | scanField (const std::string &, std::string &) |
Read a string field. More... | |
IFile & | scanField () |
Ends a field-formatted line. More... | |
IFile & | getline (std::string &) |
Get a full line as a string. More... | |
void | reset (bool) |
Reset end of file. More... | |
bool | FieldExist (const std::string &s) |
Check if a field exist. More... | |
IFile & | scanField (Value *val) |
Read in a value. More... | |
void | allowIgnoredFields () |
Allow some of the fields in the input to be ignored. More... | |
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... | |
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 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 | |
size_t | llread (char *, size_t) |
Low-level read. More... | |
IFile & | advanceField () |
Advance to next field (= read one line) More... | |
unsigned | findField (const std::string &name) const |
Find field index by name. More... | |
Private Attributes | |
std::vector< Field > | fields |
All the defined fields. More... | |
bool | inMiddleOfField |
Flag set in the middle of a field reading. More... | |
bool | ignoreFields |
Set to true if you want to allow fields to be ignored in the read in file. More... | |
Class for input files.
This class provides features similar to those in the standard C "FILE*" type, but only for sequential input. See OFile for sequential output.
|
private |
void PLMD::IFile::allowIgnoredFields | ( | ) |
|
inherited |
Closes the file Should be used only for explicitely opened files.
Definition at line 140 of file FileBase.cpp.
bool PLMD::IFile::FieldExist | ( | const std::string & | s | ) |
|
inherited |
Check if the file exists.
Definition at line 118 of file FileBase.cpp.
|
private |
|
inherited |
Flushes the file to disk.
Definition at line 70 of file FileBase.cpp.
IFile & PLMD::IFile::getline | ( | std::string & | str | ) |
|
inherited |
Check if a file is open.
Definition at line 134 of file FileBase.cpp.
|
inherited |
Link to an already open filed.
Definition at line 64 of file FileBase.cpp.
|
inherited |
Link to a PlumedMain object Automatically links also the corresponding Communicator.
Definition at line 85 of file FileBase.cpp.
|
inherited |
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.
|
private |
IFile & PLMD::IFile::open | ( | const std::string & | name | ) |
|
inherited |
Opens the file (without auto-backup)
Definition at line 99 of file FileBase.cpp.
|
inherited |
Check for error/eof.
Definition at line 166 of file FileBase.cpp.
IFile & PLMD::IFile::scanField | ( | const std::string & | name, |
double & | x | ||
) |
IFile & PLMD::IFile::scanField | ( | const std::string & | name, |
int & | x | ||
) |
IFile & PLMD::IFile::scanField | ( | const std::string & | name, |
std::string & | str | ||
) |
IFile & PLMD::IFile::scanField | ( | ) |
IFile & PLMD::IFile::scanFieldList | ( | std::vector< std::string > & | s | ) |
|
inlineinherited |
Set heavyFlush flag.
Definition at line 101 of file FileBase.h.
|
staticinherited |
Runs a small testcase.
Definition at line 37 of file FileBase.cpp.
|
protectedinherited |
pointer to corresponding action. NULL if not linked
Definition at line 63 of file FileBase.h.
|
protectedinherited |
Control closing on destructor.
If true, file will not be closed in destructor
Definition at line 66 of file FileBase.h.
|
protectedinherited |
communicator. NULL if not set
Definition at line 59 of file FileBase.h.
|
protectedinherited |
Set to true when end of file is encountered.
Definition at line 71 of file FileBase.h.
|
protectedinherited |
Set to true when error is encountered.
Definition at line 73 of file FileBase.h.
|
private |
|
protectedinherited |
file pointer
Definition at line 57 of file FileBase.h.
|
protectedinherited |
Set to true if you want flush to be heavy (close/reopen)
Definition at line 77 of file FileBase.h.
|
private |
|
private |
|
protectedinherited |
path of the opened file
Definition at line 75 of file FileBase.h.
|
protectedinherited |
pointer to main plumed object. NULL if not linked
Definition at line 61 of file FileBase.h.
Hosted by GitHub
![]() |
![]() |