NAMD
Public Member Functions | List of all members
ofstream_namd Class Reference

#include <fstream_namd.h>

Inheritance diagram for ofstream_namd:

Public Member Functions

 ofstream_namd ()
 
 ofstream_namd (const char *_fname, std::ios_base::openmode _mode=std::ios_base::out)
 
 ofstream_namd (const char *_fname, const char *_ext)
 
void open (const char *_fname, std::ios_base::openmode _mode=std::ios_base::out)
 
void open (const char *_fname, const char *_ext)
 
bool is_open () const
 
ofstream_namdflush ()
 
void close ()
 
 ~ofstream_namd ()
 
bool good () const
 
bool fail () const
 
bool bad () const
 
bool operator! () const
 
 operator bool () const
 
void clear ()
 

Detailed Description

Definition at line 8 of file fstream_namd.h.

Constructor & Destructor Documentation

ofstream_namd::ofstream_namd ( )
inline

Definition at line 16 of file fstream_namd.h.

16 : fd(0) { ; }
ofstream_namd::ofstream_namd ( const char *  _fname,
std::ios_base::openmode  _mode = std::ios_base::out 
)
inlineexplicit

Definition at line 18 of file fstream_namd.h.

References open().

18  : fd(0) {
19  open(_fname, _mode);
20  }
void open(const char *_fname, std::ios_base::openmode _mode=std::ios_base::out)
Definition: fstream_namd.C:11
ofstream_namd::ofstream_namd ( const char *  _fname,
const char *  _ext 
)
inlineexplicit

Definition at line 22 of file fstream_namd.h.

References open().

22  : fd(0) {
23  open(_fname, _ext);
24  }
void open(const char *_fname, std::ios_base::openmode _mode=std::ios_base::out)
Definition: fstream_namd.C:11
ofstream_namd::~ofstream_namd ( )
inline

Definition at line 36 of file fstream_namd.h.

References close().

36  {
37  if ( fd ) close();
38  }

Member Function Documentation

bool ofstream_namd::bad ( ) const
inline

Definition at line 42 of file fstream_namd.h.

42 { return false; }
void ofstream_namd::clear ( )
inline

Definition at line 45 of file fstream_namd.h.

Referenced by Controller::outputExtendedSystem().

45 { ; }
void ofstream_namd::close ( )

Definition at line 25 of file fstream_namd.C.

References flush(), NAMD_bug(), and NAMD_close.

Referenced by Controller::outputExtendedSystem(), and ~ofstream_namd().

25  {
26  if ( ! fd ) NAMD_bug("ofstream_namd::close() called when file is not open");
27  flush();
28  NAMD_close(fd, fname.c_str());
29  fd = 0;
30 }
ofstream_namd & flush()
Definition: fstream_namd.C:17
#define NAMD_close
Definition: Output.C:52
void NAMD_bug(const char *err_msg)
Definition: common.C:129
bool ofstream_namd::fail ( ) const
inline

Definition at line 41 of file fstream_namd.h.

41 { return false; }
ofstream_namd & ofstream_namd::flush ( )

Definition at line 17 of file fstream_namd.C.

References NAMD_bug(), and NAMD_write.

Referenced by Controller::adaptTempWriteRestart(), close(), Controller::outputExtendedSystem(), Controller::outputFepEnergy(), and Controller::outputTiEnergy().

17  {
18  if ( ! fd ) NAMD_bug("ofstream_namd::flush() called when file is not open");
19  const std::string text = str();
20  NAMD_write(fd, text.c_str(), text.size(), fname.c_str());
21  str("");
22  return *this;
23 }
#define NAMD_write
Definition: dcdlib.C:24
void NAMD_bug(const char *err_msg)
Definition: common.C:129
bool ofstream_namd::good ( ) const
inline

Definition at line 40 of file fstream_namd.h.

40 { return true; }
bool ofstream_namd::is_open ( ) const
inline
void ofstream_namd::open ( const char *  _fname,
std::ios_base::openmode  _mode = std::ios_base::out 
)

Definition at line 11 of file fstream_namd.C.

References NAMD_bug(), and NAMD_open_text().

Referenced by Controller::adaptTempInit(), ofstream_namd(), open(), Controller::outputExtendedSystem(), Controller::outputFepEnergy(), and Controller::outputTiEnergy().

11  {
12  if ( fd ) NAMD_bug("ofstream_namd::open() called when file is already open");
13  fname = _fname;
14  fd = NAMD_open_text(_fname, _mode & std::ios_base::app);
15 }
int NAMD_open_text(const char *fname, int append)
Definition: common.C:202
void NAMD_bug(const char *err_msg)
Definition: common.C:129
void ofstream_namd::open ( const char *  _fname,
const char *  _ext 
)

Definition at line 5 of file fstream_namd.C.

References NAMD_backup_file(), NAMD_bug(), and open().

5  {
6  if ( fd ) NAMD_bug("ofstream_namd::open() called when file is already open");
7  NAMD_backup_file(_fname, _ext);
8  open(_fname);
9 }
void NAMD_bug(const char *err_msg)
Definition: common.C:129
void NAMD_backup_file(const char *filename, const char *extension)
Definition: common.C:167
void open(const char *_fname, std::ios_base::openmode _mode=std::ios_base::out)
Definition: fstream_namd.C:11
ofstream_namd::operator bool ( ) const
inline

Definition at line 44 of file fstream_namd.h.

44 { return true; }
bool ofstream_namd::operator! ( ) const
inline

Definition at line 43 of file fstream_namd.h.

43 { return false; }

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