OpenMD 3.1
Molecular Dynamics in the Open
|
ifstrstream class provides a stream interface to read data from files. More...
#include "io/ifstrstream.hpp"
Public Types | |
using | char_type = char |
using | int_type = std::char_traits<char>::int_type |
using | pos_type = std::char_traits<char>::pos_type |
using | off_type = std::char_traits<char>::off_type |
using | traits_type = std::char_traits<char> |
using | _Basic_ios = std::basic_ios<char, std::char_traits<char>> |
using | _Base = std::basic_istream<char, std::char_traits<char>> |
using | _Buf = std::basic_streambuf<char, std::char_traits<char>> |
using | _StringBuf = std::basic_stringbuf<char, std::char_traits<char>> |
using | _FileBuf = std::basic_filebuf<char, std::char_traits<char>> |
Public Member Functions | |
ifstrstream () | |
Constructs an object of class ifstream. | |
ifstrstream (const char *filename, std::ios_base::openmode mode=std::ios_base::in, bool checkFilename=false) | |
Explicit constructor. | |
~ifstrstream () | |
virtual destructor will close the file(in single mode) and clear the stream buffer | |
void | open (const char *filename, std::ios_base::openmode mode=std::ios_base::in, bool checkFilename=false) |
Opens a file and associates a buffer with the specified file to perform the i/o operations (single mode). | |
bool | is_open () |
Tests if the stream is currently associated with a valid buffer. | |
void | close () |
In single mode, closes a file. | |
_Buf * | rdbuf () |
Gets the stream buffer object associated with the stream. | |
Static Public Attributes | |
static const int | FileNotExists = -1 |
static const int | FileIOError = -2 |
ifstrstream class provides a stream interface to read data from files.
In single mode, it falls back to ifstream, as we don't need to read the whole file into memory. In parallel mode, the primary node will read the whole file and broadcast it to other secondary nodes. After broadcasting, every node will fall back to stringstream.
Definition at line 83 of file ifstrstream.hpp.
using OpenMD::ifstrstream::_Base = std::basic_istream<char, std::char_traits<char>> |
Definition at line 93 of file ifstrstream.hpp.
using OpenMD::ifstrstream::_Basic_ios = std::basic_ios<char, std::char_traits<char>> |
Definition at line 92 of file ifstrstream.hpp.
using OpenMD::ifstrstream::_Buf = std::basic_streambuf<char, std::char_traits<char>> |
Definition at line 94 of file ifstrstream.hpp.
using OpenMD::ifstrstream::_FileBuf = std::basic_filebuf<char, std::char_traits<char>> |
Definition at line 96 of file ifstrstream.hpp.
using OpenMD::ifstrstream::_StringBuf = std::basic_stringbuf<char, std::char_traits<char>> |
Definition at line 95 of file ifstrstream.hpp.
using OpenMD::ifstrstream::char_type = char |
Definition at line 86 of file ifstrstream.hpp.
using OpenMD::ifstrstream::int_type = std::char_traits<char>::int_type |
Definition at line 87 of file ifstrstream.hpp.
using OpenMD::ifstrstream::off_type = std::char_traits<char>::off_type |
Definition at line 89 of file ifstrstream.hpp.
using OpenMD::ifstrstream::pos_type = std::char_traits<char>::pos_type |
Definition at line 88 of file ifstrstream.hpp.
using OpenMD::ifstrstream::traits_type = std::char_traits<char> |
Definition at line 90 of file ifstrstream.hpp.
OpenMD::ifstrstream::ifstrstream | ( | ) |
|
explicit |
Explicit constructor.
filename | String containing the name of the file to be opened |
mode | Flags describing the requested i/o mode for the file, default value is ios_base::in |
checkFilename | Flags indicating checking the file name in parallel |
Definition at line 83 of file ifstrstream.cpp.
OpenMD::ifstrstream::~ifstrstream | ( | ) |
virtual destructor will close the file(in single mode) and clear the stream buffer
virtual destructor will close the file (in single mode) and clear the stream buffer
Definition at line 115 of file ifstrstream.cpp.
References close().
void OpenMD::ifstrstream::close | ( | ) |
In single mode, closes a file.
The stream's file buffer is released from its association with the currently open file. In parallel mode, clean up.
The stream's file buffer is released from its association with the currently open file. In parallel mode, cleans up.
Definition at line 159 of file ifstrstream.cpp.
Referenced by OpenMD::ElementsTable::Init(), and ~ifstrstream().
bool OpenMD::ifstrstream::is_open | ( | ) |
Tests if the stream is currently associated with a valid buffer.
Definition at line 145 of file ifstrstream.cpp.
Referenced by OpenMD::ElementsTable::Init().
void OpenMD::ifstrstream::open | ( | const char * | filename, |
std::ios_base::openmode | mode = std::ios_base::in, | ||
bool | checkFilename = false ) |
Opens a file and associates a buffer with the specified file to perform the i/o operations (single mode).
The primary node reads a file and broadcasts its content to the other secondary nodes. After broadcasting, all nodes fall back to stringstream (parallel mode).
filename | String containing the name of the file to be opened |
mode | Flags describing the requested i/o mode for the file |
checkFilename | Flags indicating checking the file name in parallel |
The primary node reads a file and broadcasts its content to the secondary nodes. After broadcasting, all nodes fall back to stringstream (parallel mode).
filename | String containing the name of the file to be opened |
mode | Flags describing the requested i/o mode for the file |
checkFilename | Flags indicating checking the file name in parallel |
Definition at line 127 of file ifstrstream.cpp.
Referenced by OpenMD::ElementsTable::Init().
std::basic_streambuf< char, std::char_traits< char > > * OpenMD::ifstrstream::rdbuf | ( | ) |
Gets the stream buffer object associated with the stream.
Definition at line 173 of file ifstrstream.cpp.
|
static |
Definition at line 99 of file ifstrstream.hpp.
|
static |
Definition at line 98 of file ifstrstream.hpp.