1#ifndef UTIL_BINARY_FILE_I_ARCHIVE_H
2#define UTIL_BINARY_FILE_I_ARCHIVE_H
14#include <util/space/Vector.h>
15#include <util/space/IntVector.h>
72 std::ifstream&
file();
101 template <
typename T,
size_t N>
111 template <
typename T,
size_t N>
118 template <
typename T>
127 template <
typename T>
128 void unpack(T* array,
int n);
143 template <
typename T>
144 void unpack(T* array,
int m,
int n,
int np);
149 std::ifstream* filePtr_;
152 unsigned int version_;
172 template <
typename T>
175 serialize(*
this, data, version_);
182 template <
typename T>
185 serialize(*
this, data, version_);
192 template <
typename T,
size_t N>
196 for (
size_t i=0; i < N; ++i) {
197 serialize(*
this, data[i], version_);
205 template <
typename T,
size_t N>
209 for (
size_t i=0; i < N; ++i) {
210 serialize(*
this, data[i], version_);
220 template <
typename T>
222 { filePtr_->read( (
char*)(&data),
sizeof(T) ); }
227 template <
typename T>
230 for (
int i=0; i < n; ++i) {
231 filePtr_->read( (
char*)(&array[i]),
sizeof(T));
238 template <
typename T>
242 for (i = 0; i < m; ++i) {
243 for (j = 0; j < n; ++j) {
244 filePtr_->read( (
char*)(&array[i*np + j]),
sizeof(T));
256 const unsigned int version)
263 inline void serialize(BinaryFileIArchive& ar,
char& data,
264 const unsigned int version)
272 const unsigned int version)
280 const unsigned int version)
288 const unsigned int version)
296 const unsigned int version)
304 const unsigned int version)
312 const unsigned int version)
318 template <
typename T>
320 const unsigned int version)
327 for (
size_t i = 0; i < size; ++i) {
329 data.push_back(element);
341 const unsigned int version)
350 const unsigned int version)
358 const unsigned int version);
367 const unsigned int version)
375 const unsigned int version)
Loading (input) archive for binary istream.
BinaryFileIArchive & operator>>(T &data)
Load (read) one object of type T via the & operator.
static bool is_loading()
Is this a loading (input) archive?
void unpack(T &data)
Unpack a single T object.
std::ifstream & file()
Get the underlying ifstream by reference.
virtual ~BinaryFileIArchive()
Destructor.
BinaryFileIArchive & operator&(T &data)
Load (read) one object of type T via the & operator.
static bool is_saving()
Is this a saving (output) archive?
BinaryFileIArchive()
Constructor.
An IntVector is an integer Cartesian vector.
A Vector is a Cartesian vector.
Utility classes for scientific computation.