1 #ifndef UTIL_BINARY_FILE_I_ARCHIVE_H 2 #define UTIL_BINARY_FILE_I_ARCHIVE_H 12 #include "serialize.h" 14 #include <util/space/Vector.h> 15 #include <util/space/IntVector.h> 68 std::ifstream&
file();
95 void unpack(T* array,
int n);
110 template <
typename T>
111 void unpack(T* array,
int m,
int n,
int np);
116 std::ifstream* filePtr_;
119 unsigned int version_;
139 template <
typename T>
142 serialize(*
this, data, version_);
149 template <
typename T>
152 serialize(*
this, data, version_);
161 template <
typename T>
163 { filePtr_->read( (
char*)(&data),
sizeof(T) ); }
168 template <
typename T>
171 for (
int i=0; i < n; ++i) {
172 filePtr_->read( (
char*)(&array[i]),
sizeof(T));
179 template <
typename T>
183 for (i = 0; i < m; ++i) {
184 for (j = 0; j < n; ++j) {
185 filePtr_->read( (
char*)(&array[i*np + j]),
sizeof(T));
197 const unsigned int version)
205 const unsigned int version)
213 const unsigned int version)
221 const unsigned int version)
229 const unsigned int version)
237 const unsigned int version)
245 const unsigned int version)
253 const unsigned int version)
259 template <
typename T>
261 const unsigned int version)
268 for (
size_t i = 0; i < size; ++i) {
270 data.push_back(element);
282 const unsigned int version)
291 const unsigned int version)
299 const unsigned int version);
308 const unsigned int version)
316 const unsigned int version)
A Vector is a Cartesian vector.
virtual ~BinaryFileIArchive()
Destructor.
static bool is_saving()
Returns true;.
BinaryFileIArchive & operator>>(T &data)
Read one object.
BinaryFileIArchive()
Constructor.
Utility classes for scientific computation.
BinaryFileIArchive & operator&(T &data)
Read one object.
static bool is_loading()
Returns false;.
void unpack(T &data)
Unpack a single T object.
Saving archive for binary istream.
std::ifstream & file()
Get the underlying ifstream by reference.
An IntVector is an integer Cartesian vector.