File
classes¶The File
classes provide abstraction of the IO operation, allowing for the
same format to be used with on-disk files, network files, memory-mapped files,
compressed files, etc.
chemfiles::
File
¶Abstract base class for file representation.
Subclassed by chemfiles::NcFile, chemfiles::TextFile, chemfiles::TNGFile
Public Types
chemfiles::
TextFile
¶Abstract base class representing a text file. This class is inteded to be inherited by any form of text files: compressed files, memory-mapped files, etc.
All failling operations should throw a FileError
instead of waiting for the user of the class to the current state.
Inherits from chemfiles::File, iostream
Subclassed by chemfiles::BasicFile
Public Functions
readline
() = 0¶Read a line from the file.
readlines
(size_t n) = 0¶Read n
lines from the file.
rewind
() = 0¶Reset the file cursor.
eof
() = 0¶Are we at the end of the file ?
Public Static Functions
create
(const std::string &path, File::Mode mode)¶Open the most adaptated text file class for the given path
and mode
These classes implement the File
interface defined previously.
chemfiles::
BasicFile
¶Basic text file, only a thin wrapper on top of standard C++ fstreams.
Inherits from chemfiles::TextFile
chemfiles::
NcFile
¶RAII wrapper around NetCDF 3 binary files
This interface only provide basic functionalities needed by the Amber NetCDF format. All the operation are guaranteed to return a valid value or throw an error.
The template functions are manually specialized for float and char data types.
Inherits from chemfiles::File
chemfiles::
TNGFile
¶Simple RAII capsule for tng_trajectory_t
, handling the creation and destruction of the file as needed.
Inherits from chemfiles::File