All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
PLMD::FileBase Class Reference

Base class for dealing with files. More...

#include <FileBase.h>

Inheritance diagram for PLMD::FileBase:
Inheritance graph
[legend]

Classes

class  FieldBase
 Internal tool. More...
 

Public Member Functions

FileBaselink (FILE *)
 Link to an already open filed. More...
 
FileBaselink (PlumedMain &)
 Link to a PlumedMain object Automatically links also the corresponding Communicator. More...
 
FileBaselink (Communicator &)
 Link to a Communicator object. More...
 
FileBaselink (Action &)
 Link to an Action object. More...
 
FileBaseflush ()
 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...
 
FileBaseopen (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...
 
Communicatorcomm
 communicator. NULL if not set More...
 
PlumedMainplumed
 pointer to main plumed object. NULL if not linked More...
 
Actionaction
 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...
 
FileBaseoperator= (const FileBase &)
 Assignment operator is disabled (private and unimplemented) More...
 

Detailed Description

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.

Constructor & Destructor Documentation

PLMD::FileBase::FileBase ( const FileBase )
private

Copy constructor is disabled (private and unimplemented)

PLMD::FileBase::FileBase ( )
protected

Private constructor.

In this manner one cannot instantiate a FileBase object

Definition at line 148 of file FileBase.cpp.

PLMD::FileBase::~FileBase ( )
virtual

Virtual destructor (allows inheritance)

Definition at line 160 of file FileBase.cpp.

Member Function Documentation

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.

FileBase & PLMD::FileBase::link ( Action action)

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.

FileBase& PLMD::FileBase::operator= ( const FileBase )
private

Assignment operator is disabled (private and unimplemented)

void PLMD::FileBase::setHeavyFlush ( )
inline

Set heavyFlush flag.

Definition at line 101 of file FileBase.h.

void PLMD::FileBase::test ( )
static

Runs a small testcase.

Definition at line 37 of file FileBase.cpp.

Member Data Documentation

Action* PLMD::FileBase::action
protected

pointer to corresponding action. NULL if not linked

Definition at line 63 of file FileBase.h.

bool PLMD::FileBase::cloned
protected

Control closing on destructor.

If true, file will not be closed in destructor

Definition at line 66 of file FileBase.h.

Communicator* PLMD::FileBase::comm
protected

communicator. NULL if not set

Definition at line 59 of file FileBase.h.

bool PLMD::FileBase::eof
protected

Set to true when end of file is encountered.

Definition at line 71 of file FileBase.h.

bool PLMD::FileBase::err
protected

Set to true when error is encountered.

Definition at line 73 of file FileBase.h.

FILE* PLMD::FileBase::fp
protected

file pointer

Definition at line 57 of file FileBase.h.

bool PLMD::FileBase::heavyFlush
protected

Set to true if you want flush to be heavy (close/reopen)

Definition at line 77 of file FileBase.h.

std::string PLMD::FileBase::path
protected

path of the opened file

Definition at line 75 of file FileBase.h.

PlumedMain* PLMD::FileBase::plumed
protected

pointer to main plumed object. NULL if not linked

Definition at line 61 of file FileBase.h.


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