Gromacs
2026.0-dev-20250711-6857db4
|
#include <gromacs/fileio/xdr_serializer.h>
Serializer to read/write XDR data.
Most methods on this class throw FileIOError when the serialization failed.
Public Member Functions | |
XdrSerializer (const std::filesystem::path &filename, const char *mode) | |
bool | reading () const override |
If file is open in reading mode. | |
void | setDoublePrecision (bool doublePrecision) |
Set when file should read in double-precision mode. More... | |
void | doBool (bool *value) override |
Handle bool I/O. | |
void | doUChar (unsigned char *value) override |
Handle unsigned char I/O. | |
void | doChar (char *value) override |
Handle char I/O. | |
void | doUShort (unsigned short *value) override |
Handle unsigned short I/O. | |
void | doInt (int *value) override |
Handle default integer I/O. | |
void | doInt32 (int32_t *value) override |
Handle int32 I/O. | |
void | doInt64 (int64_t *value) override |
Handle int64 I/O. | |
void | doFloat (float *value) override |
Handle single precision float I/O. | |
void | doDouble (double *value) override |
Handle double precision float I/O. | |
void | doReal (real *value) override |
Handle GROMACS floating point number I/O. | |
void | doIvec (ivec *value) override |
Handle I/O of integer vector of size DIM. | |
void | doIvec (IVec *value) override |
Handle I/O of integer vector of size DIM. | |
void | doRvec (rvec *value) override |
Handle I/O of GROMACS real vector of size DIM. | |
void | doRvec (RVec *value) override |
Handle I/O of GROMACS real vector of size DIM. | |
void | doString (std::string *value) override |
Handle I/O if string. | |
void | doOpaque (char *data, std::size_t size) override |
Handle opaque data. | |
void | doCharArray (char *values, int elements) override |
Special case for handling I/O of a vector of characters. | |
void | doUCharArray (unsigned char *values, int elements) override |
Special case for handling I/O of a vector of unsigned characters. | |
void | doRvecArray (ArrayRef< RVec > values) override |
Special case for handling I/O of an ArrayRef of RVec. | |
XDR * | xdr () |
Temporary getter while XDR serialization still uses legacy interfaces. | |
![]() | |
template<typename EnumType > | |
void | doEnumAsInt (EnumType *enumValue) |
Serialize enum value with underlying type int. | |
template<typename EnumType > | |
void | doEnumArrayAsInt (EnumType *values, int elements) |
Serialize array of enum values with underlying type. | |
void | doBoolArray (bool *values, int elements) |
Serialize arrays of values of different types. | |
void | doUShortArray (unsigned short *values, int elements) |
void | doIntArray (int *values, int elements) |
void | doInt32Array (int32_t *values, int elements) |
void | doInt64Array (int64_t *values, int elements) |
void | doFloatArray (float *values, int elements) |
void | doDoubleArray (double *values, int elements) |
void | doRealArray (real *values, int elements) |
void | doIVecs (ArrayRef< IVec > values) |
void | doIvecArray (ArrayRef< IVec > values) |
void gmx::XdrSerializer::setDoublePrecision | ( | bool | doublePrecision | ) |
Set when file should read in double-precision mode.
Often this is described in the GROMACS header of an XDR file, so when reading from a build of GROMACS that does not match the one that wrote the XDR file, the serializer needs to be able to be told how to expect "real" values to look on disk.