Functions | |
| template<typename ValueType > | |
| std::vector< ValueType > | read_array (std::istream &stream) |
| Matrix3x3 | read_matrix (std::istream &stream) |
| template<typename ValueType > | |
| std::vector< std::vector< ValueType > > | read_nested_arrays (std::istream &stream) |
| template<typename ValueType > | |
| ValueType | read_scalar (std::istream &stream) |
| std::string | read_string (std::istream &stream) |
| Vector3D | read_vector3d (std::istream &stream) |
| void | require_bytes_available (std::istream &stream, std::uint64_t bytes) |
| template<typename ValueType > | |
| void | write_array (std::ostream &stream, const std::vector< ValueType > &values) |
| Length-prefixed array of trivially copyable values. | |
| void | write_matrix (std::ostream &stream, const Matrix3x3 &matrix) |
| template<typename ValueType > | |
| void | write_nested_arrays (std::ostream &stream, const std::vector< std::vector< ValueType > > &rows) |
| template<typename ValueType > | |
| void | write_scalar (std::ostream &stream, const ValueType &value) |
| void | write_string (std::ostream &stream, const std::string &text) |
| void | write_vector3d (std::ostream &stream, const Vector3D &vector) |
Length-prefixed little-endian primitives for Q3's own binary records.
Every read is bounded before it allocates: a count is checked against the bytes actually left in the file, so a corrupt or foreign length field is diagnosed as a corrupt file rather than becoming a multi-gigabyte allocation that surfaces as std::bad_alloc or libc++'s bare "vector".
io/mean_field_record/checkpoint.hpp carries its own copy of these, which has already diverged: it returns zero-filled values on a truncated read where these throw. Unifying the two is worth doing and is deliberately not done here, since it changes the behaviour of a record this branch does not otherwise touch.
| std::vector< ValueType > q3::internal::interpolation_stream::read_array | ( | std::istream & | stream | ) |
Definition at line 117 of file binary_stream.hpp.
References require_bytes_available().
|
inline |
Definition at line 99 of file binary_stream.hpp.
References read_vector3d().
| std::vector< std::vector< ValueType > > q3::internal::interpolation_stream::read_nested_arrays | ( | std::istream & | stream | ) |
Definition at line 145 of file binary_stream.hpp.
References require_bytes_available().
| ValueType q3::internal::interpolation_stream::read_scalar | ( | std::istream & | stream | ) |
Definition at line 34 of file binary_stream.hpp.
|
inline |
Definition at line 65 of file binary_stream.hpp.
|
inline |
Definition at line 85 of file binary_stream.hpp.
References q3::Vector3D::x, q3::Vector3D::y, and q3::Vector3D::z.
Referenced by q3::internal::wannier_payload::read(), and read_matrix().
|
inline |
A count read from the file, times an element size, must fit in what is left of the file. Without this a corrupt or foreign length field becomes a multi-gigabyte allocation (std::bad_alloc, or libc++'s bare "vector" length_error) instead of the "corrupt" diagnosis every other check gives.
Definition at line 49 of file binary_stream.hpp.
Referenced by q3::internal::wannier_payload::read(), read_array(), and read_nested_arrays().
| void q3::internal::interpolation_stream::write_array | ( | std::ostream & | stream, |
| const std::vector< ValueType > & | values | ||
| ) |
Length-prefixed array of trivially copyable values.
Definition at line 109 of file binary_stream.hpp.
Referenced by write_nested_arrays().
|
inline |
Definition at line 93 of file binary_stream.hpp.
References write_vector3d().
| void q3::internal::interpolation_stream::write_nested_arrays | ( | std::ostream & | stream, |
| const std::vector< std::vector< ValueType > > & | rows | ||
| ) |
Definition at line 137 of file binary_stream.hpp.
References write_array().
Referenced by q3::internal::wannier_payload::write().
| void q3::internal::interpolation_stream::write_scalar | ( | std::ostream & | stream, |
| const ValueType & | value | ||
| ) |
Definition at line 30 of file binary_stream.hpp.
|
inline |
Definition at line 60 of file binary_stream.hpp.
|
inline |
Definition at line 79 of file binary_stream.hpp.
References q3::Vector3D::x, q3::Vector3D::y, and q3::Vector3D::z.
Referenced by q3::internal::wannier_payload::write(), and write_matrix().