20#ifndef LIBMESH_XDR_CXX_H
21#define LIBMESH_XDR_CXX_H
24#include "libmesh/libmesh_common.h"
25#include "libmesh/libmesh.h"
26#include "libmesh/enum_xdr_mode.h"
31#ifdef LIBMESH_HAVE_XDR
33#include "libmesh/ignore_warnings.h"
36#include "libmesh/restore_warnings.h"
47#ifndef LIBMESH_DEFAULT_SINGLE_PRECISION
48#define xdr_REAL xdr_double
50#define xdr_REAL xdr_float
82 Xdr (std::ostream & stream);
87 Xdr (std::istream & stream);
97 void open (std::string name);
142 template <
typename T>
148 template <
typename T>
154 template <
typename T>
160 template <
typename T>
183 template <
typename T>
186 template <
typename T>
187 void do_read(std::complex<T> & a);
189 template <
typename T>
190 void do_read(std::vector<T> & a);
192 template <
typename T>
193 void do_read(std::vector<std::complex<T>> & a);
198 template <
typename T>
201 template <
typename T>
204 template <
typename T>
207 template <
typename T>
208 void do_write(std::vector<std::complex<T>> & a);
213 template <
typename T>
215 const unsigned int line_break);
220 template <
typename XFP>
222#ifdef LIBMESH_HAVE_XDR
228 const unsigned int line_break,
241#ifdef LIBMESH_HAVE_XDR
259 std::unique_ptr<std::istream>
in;
264 std::unique_ptr<std::ostream>
out;
This class implements a C++ interface to the XDR (eXternal Data Representation) format.
void _xfp_data_stream(XFP *val, const unsigned int len, #ifdef LIBMESH_HAVE_XDR xdrproc_t #else void *#endif xdr_proc, const unsigned int line_break, const int n_digits)
Helper method for extended FP types.
std::string file_name
The file name.
Xdr & operator<<(T &a)
Same, but provides an ostream like interface.
void _complex_data_stream(std::complex< T > *val, const unsigned int len, const unsigned int line_break)
Helper method for complex types.
void data_stream(T *val, const unsigned int len, const unsigned int line_break=libMesh::invalid_uint)
Inputs or outputs a raw data stream.
void set_version(int ver)
Sets the version of the file that is being read.
const int comm_len
A buffer to put comment strings into.
char comm[xdr_MAX_STRING_LENGTH]
const XdrMODE mode
The mode used for accessing the file.
void do_write(T &a)
Helper method for writing different data types.
XdrMODE access_mode() const
void comment(std::string &)
Writes or reads (ignores) a comment line.
int version() const
Gets the version of the file that is being read.
std::unique_ptr< XDR > xdrs
Pointer to the standard XDR struct.
bool gzipped_file
Are we reading/writing zipped files?
std::unique_ptr< std::istream > in
The input file stream.
Xdr & operator>>(T &a)
Same, but provides an istream like interface.
std::unique_ptr< std::ostream > out
The output file stream.
int version_number
Version of the file being read.
void do_read(T &a)
Helper method for reading different data types.
void open(std::string name)
Opens the file.
void close()
Closes the file if it is open.
void data(T &a, std::string_view comment="")
Inputs or outputs a single value.
The libMesh namespace provides an interface to certain functionality in the library.
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
XdrMODE
Defines an enum for read/write mode in Xdr format.
const unsigned int xdr_MAX_STRING_LENGTH