Binary files implementations¶
-
class LittleEndianFile : public chemfiles::BinaryFile¶
Public Functions
-
virtual void read_i16(int16_t *data, size_t count) final override¶
Read exactly
count
16-bit signed integers, and store them in thedata
array
-
virtual void read_u16(uint16_t *data, size_t count) final override¶
Read exactly
count
16-bit unsigned integers, and store them in thedata
array
-
virtual void read_i32(int32_t *data, size_t count) final override¶
Read exactly
count
32-bit signed integers, and store them in thedata
array
-
virtual void read_u32(uint32_t *data, size_t count) final override¶
Read exactly
count
32-bit unsigned integers, and store them in thedata
array
-
virtual void read_i64(int64_t *data, size_t count) final override¶
Read exactly
count
64-bit signed integers, and store them in thedata
array
-
virtual void read_u64(uint64_t *data, size_t count) final override¶
Read exactly
count
64-bit unsigned integers, and store them in thedata
array
-
virtual void read_f32(float *data, size_t count) final override¶
Read exactly
count
32-bit floating point numbers, and store them in thedata
array
-
virtual void read_f64(double *data, size_t count) final override¶
Read exactly
count
64-bit floating point numbers, and store them in thedata
array
-
virtual void write_i16(const int16_t *data, size_t count) final override¶
Write exactly
count
16-bit signed integers taken from thedata
array to the file
-
virtual void write_u16(const uint16_t *data, size_t count) final override¶
Write exactly
count
16-bit unsigned integers taken from thedata
array to the file
-
virtual void write_i32(const int32_t *data, size_t count) final override¶
Write exactly
count
32-bit signed integers taken from thedata
array to the file
-
virtual void write_u32(const uint32_t *data, size_t count) final override¶
Write exactly
count
32-bit unsigned integers taken from thedata
array to the file
-
virtual void write_i64(const int64_t *data, size_t count) final override¶
Write exactly
count
64-bit signed integers taken from thedata
array to the file
-
virtual void write_u64(const uint64_t *data, size_t count) final override¶
Write exactly
count
64-bit unsigned integers taken from thedata
array to the file
-
virtual void write_f32(const float *data, size_t count) final override¶
Write exactly
count
32-bit floating point numbers taken from thedata
array to the file
-
virtual void write_f64(const double *data, size_t count) final override¶
Write exactly
count
64-bit floating point numbers taken from thedata
array to the file
-
virtual void read_i16(int16_t *data, size_t count) final override¶
-
class BigEndianFile : public chemfiles::BinaryFile¶
Subclassed by chemfiles::netcdf3::Netcdf3File, chemfiles::XDRFile
Public Functions
-
virtual void read_i16(int16_t *data, size_t count) final override¶
Read exactly
count
16-bit signed integers, and store them in thedata
array
-
virtual void read_u16(uint16_t *data, size_t count) final override¶
Read exactly
count
16-bit unsigned integers, and store them in thedata
array
-
virtual void read_i32(int32_t *data, size_t count) final override¶
Read exactly
count
32-bit signed integers, and store them in thedata
array
-
virtual void read_u32(uint32_t *data, size_t count) final override¶
Read exactly
count
32-bit unsigned integers, and store them in thedata
array
-
virtual void read_i64(int64_t *data, size_t count) final override¶
Read exactly
count
64-bit signed integers, and store them in thedata
array
-
virtual void read_u64(uint64_t *data, size_t count) final override¶
Read exactly
count
64-bit unsigned integers, and store them in thedata
array
-
virtual void read_f32(float *data, size_t count) final override¶
Read exactly
count
32-bit floating point numbers, and store them in thedata
array
-
virtual void read_f64(double *data, size_t count) final override¶
Read exactly
count
64-bit floating point numbers, and store them in thedata
array
-
virtual void write_i16(const int16_t *data, size_t count) final override¶
Write exactly
count
16-bit signed integers taken from thedata
array to the file
-
virtual void write_u16(const uint16_t *data, size_t count) final override¶
Write exactly
count
16-bit unsigned integers taken from thedata
array to the file
-
virtual void write_i32(const int32_t *data, size_t count) final override¶
Write exactly
count
32-bit signed integers taken from thedata
array to the file
-
virtual void write_u32(const uint32_t *data, size_t count) final override¶
Write exactly
count
32-bit unsigned integers taken from thedata
array to the file
-
virtual void write_i64(const int64_t *data, size_t count) final override¶
Write exactly
count
64-bit signed integers taken from thedata
array to the file
-
virtual void write_u64(const uint64_t *data, size_t count) final override¶
Write exactly
count
64-bit unsigned integers taken from thedata
array to the file
-
virtual void write_f32(const float *data, size_t count) final override¶
Write exactly
count
32-bit floating point numbers taken from thedata
array to the file
-
virtual void write_f64(const double *data, size_t count) final override¶
Write exactly
count
64-bit floating point numbers taken from thedata
array to the file
-
virtual void read_i16(int16_t *data, size_t count) final override¶
-
class Netcdf3File : public chemfiles::BigEndianFile¶
An implementation of NetCDF version 3 (or classic) binary files, using 64-bit offsets for variables.
A NetCDF 3 file contains global attributes (i.e. key/values associated with the file); a set of named and sized dimensions, one of which can be unlimited (called the record dimension in the code); and a set of variables. Each variable is linked to some dimensions, and can have its own attributes. Variables which use the record dimension are stored separately, and have a different API in this implementation.
NetCDF 3 files are stored using big endian, regardless of the native system endianess.
Public Functions
-
inline const std::map<std::string, Value> &attributes() const¶
Get all the global attribute for this file.
-
optional<const Value&> attribute(const std::string &name) const¶
Get the global attribute with the given
name
for this file, if it exists.
-
inline const std::map<std::string, Variable> &variables() const¶
Get all the variables for this file.
-
optional<Variable&> variable(const std::string &name)¶
Get the variable with the given name in this file if it exists.
-
inline const std::vector<std::shared_ptr<Dimension>> &dimensions() const¶
Get all the dimensions defined in this file.
-
void add_record()¶
Add an empty new record to this file, increasing the record dimension by one
-
inline uint64_t n_records() const¶
get the current number of records in the file
-
inline uint64_t record_size() const¶
get the size in bytes of a full record entry, including all record variables
-
inline bool initialized() const¶
Was this file already intialized (i.e. all variables/dimensions/etc. have been defined)?
-
inline const std::map<std::string, Value> &attributes() const¶
-
class TNGFile : public chemfiles::File¶
Simple RAII capsule for
tng_trajectory_t
, handling the creation and destruction of the file as needed.
-
class XDRFile : public chemfiles::BigEndianFile¶
Partial implementation of XDR according to RFC 4506 (see: https://datatracker.ietf.org/doc/html/rfc4506) Including additional helper routines for GROMACS
Public Functions
-
std::string read_gmx_string()¶
Read a non-compliant GROMACS string A GROMACS string stores the length of the string including the NULL terminator as int32 before the XDR compliant string data without the terminator. An XDR string has the same representation as opaque data.
-
void write_gmx_string(const std::string &value)¶
Write a non-compliant GROMACS string.
-
float read_gmx_compressed_floats(std::vector<float> &data)¶
Read compressed GROMACS floats and returns the precision.
-
void write_gmx_compressed_floats(const std::vector<float> &data, float precision)¶
Write compressed GROMACS floats with a given precision.
-
size_t read_single_size_as_i32()¶
Read an unsigned size value as i32 by performing a checked conversion.
-
void read_f32(float *data, size_t count) = 0¶
Read exactly
count
32-bit floating point numbers, and store them in thedata
array
-
inline void read_f32(std::vector<float> &data)¶
Read exactly as many 32-bit floating point numbers as fit in the pre-allocated vector.
-
void read_f64(double *data, size_t count) = 0¶
Read exactly
count
64-bit floating point numbers, and store them in thedata
array
-
inline void read_f64(std::vector<double> &data)¶
Read exactly as many 64-bit floating point numbers as fit in the pre-allocated vector.
-
void read_i32(int32_t *data, size_t count) = 0¶
Read exactly
count
32-bit signed integers, and store them in thedata
array
-
inline void read_i32(std::vector<int32_t> &data)¶
Read exactly as many 32-bit signed integers as fit in the pre-allocated vector.
-
void write_f32(const float *data, size_t count) = 0¶
Write exactly
count
32-bit floating point numbers taken from thedata
array to the file
-
inline void write_f32(const std::vector<float> data)¶
Write all 32-bit floating point numbers from the pre-allocated vector.
-
std::string read_gmx_string()¶