ofstream_namd Class Reference

#include <fstream_namd.h>

List of all members.

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.

00016 : fd(0) { ; }

ofstream_namd::ofstream_namd ( const char *  _fname,
std::ios_base::openmode  _mode = std::ios_base::out 
) [inline, explicit]

Definition at line 18 of file fstream_namd.h.

References open().

00018                                                                                          : fd(0) {
00019     open(_fname, _mode);
00020   }

ofstream_namd::ofstream_namd ( const char *  _fname,
const char *  _ext 
) [inline, explicit]

Definition at line 22 of file fstream_namd.h.

References open().

00022                                                                : fd(0) {
00023     open(_fname, _ext);
00024   }

ofstream_namd::~ofstream_namd (  )  [inline]

Definition at line 36 of file fstream_namd.h.

References close().

00036                    {
00037     if ( fd ) close();
00038   }


Member Function Documentation

bool ofstream_namd::bad (  )  const [inline]

Definition at line 42 of file fstream_namd.h.

00042 { return false; }

void ofstream_namd::clear (  )  [inline]

Definition at line 45 of file fstream_namd.h.

Referenced by Controller::outputExtendedSystem().

00045 { ; }

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().

00025                           {
00026   if ( ! fd ) NAMD_bug("ofstream_namd::close() called when file is not open");
00027   flush();
00028   NAMD_close(fd, fname.c_str());
00029   fd = 0;
00030 }

bool ofstream_namd::fail (  )  const [inline]

Definition at line 41 of file fstream_namd.h.

00041 { 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().

00017                                     {
00018   if ( ! fd ) NAMD_bug("ofstream_namd::flush() called when file is not open");
00019   const std::string text = str();
00020   NAMD_write(fd, text.c_str(), text.size(), fname.c_str());
00021   str("");
00022   return *this;
00023 }

bool ofstream_namd::good (  )  const [inline]

Definition at line 40 of file fstream_namd.h.

00040 { return true; }

bool ofstream_namd::is_open (  )  const [inline]

Definition at line 30 of file fstream_namd.h.

Referenced by colvarproxy_namd::output_stream(), Controller::outputExtendedSystem(), Controller::outputFepEnergy(), and Controller::outputTiEnergy().

00030 { return ! ! fd; }

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().

00005                                                              {
00006   if ( fd ) NAMD_bug("ofstream_namd::open() called when file is already open");
00007   NAMD_backup_file(_fname, _ext);
00008   open(_fname);
00009 }

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 ofstream_namd(), open(), Controller::outputExtendedSystem(), Controller::outputFepEnergy(), and Controller::outputTiEnergy().

00011                                                                       {
00012   if ( fd ) NAMD_bug("ofstream_namd::open() called when file is already open");
00013   fname = _fname;
00014   fd = NAMD_open_text(_fname, _mode & std::ios_base::app);
00015 }

ofstream_namd::operator bool (  )  const [inline]

Definition at line 44 of file fstream_namd.h.

00044 { return true; }

bool ofstream_namd::operator! (  )  const [inline]

Definition at line 43 of file fstream_namd.h.

00043 { return false; }


The documentation for this class was generated from the following files:
Generated on Sat Sep 23 01:17:20 2017 for NAMD by  doxygen 1.4.7