32 #ifndef MADNESS_WORLD_BUFFER_ARCHIVE_H__INCLUDED
33 #define MADNESS_WORLD_BUFFER_ARCHIVE_H__INCLUDED
41 #include <type_traits>
61 unsigned char *
const ptr;
63 mutable std::size_t
i;
87 typename std::enable_if< madness::is_trivially_serializable<T>::value,
void >
::type
89 std::size_t
m = n*
sizeof(
T);
94 madness::print(
"BufferOutputArchive:ptr,nbyte,i,n,m,i+m:",(
void *)
ptr,
nbyte,
i,n,
m,
i+
m);
123 inline std::size_t
size()
const {
136 const unsigned char*
const ptr;
138 mutable std::size_t
i;
157 typename std::enable_if< madness::is_trivially_serializable<T>::value,
void >
::type
159 std::size_t
m = n*
sizeof(
T);
161 memcpy((
unsigned char*) t,
ptr+
i,
m);
Interface templates for the archives (serialization).
Base class for output archive classes.
Definition: archive.h:382
Wraps an archive around a memory buffer for output.
Definition: buffer_archive.h:59
BufferOutputArchive()
Default constructor; the buffer will only count data.
Definition: buffer_archive.h:68
std::size_t i
Definition: buffer_archive.h:63
std::enable_if< madness::is_trivially_serializable< T >::value, void >::type store(const T *t, long n) const
Stores (counts) data into the memory buffer.
Definition: buffer_archive.h:88
bool count_only() const
Determine if this buffer is used for counting.
Definition: buffer_archive.h:118
void open(std::size_t)
Open a buffer with a specific size.
Definition: buffer_archive.h:107
const std::size_t nbyte
Buffer size.
Definition: buffer_archive.h:62
bool countonly
Current output location.
Definition: buffer_archive.h:64
void close()
Close the archive.
Definition: buffer_archive.h:110
BufferOutputArchive(void *ptr, std::size_t nbyte)
Constructor that assigns a buffer.
Definition: buffer_archive.h:75
unsigned char *const ptr
The memory buffer.
Definition: buffer_archive.h:61
std::size_t size() const
Return the amount of data stored (counted) in the buffer.
Definition: buffer_archive.h:123
void flush()
Flush the archive.
Definition: buffer_archive.h:113
const double m
Definition: gfit.cc:199
auto T(World &world, response_space &f) -> response_space
Definition: global_functions.cc:34
#define MADNESS_PRAGMA_GCC(x)
Definition: madness_config.h:205
#define MADNESS_ASSERT(condition)
Assert a condition that should be free of side-effects since in release builds this might be a no-op.
Definition: madness_exception.h:134
File holds all helper structures necessary for the CC_Operator and CC2 class.
Definition: DFParameters.h:10
static double pop(std::vector< double > &v)
Definition: SCF.cc:113
void print(const T &t, const Ts &... ts)
Print items to std::cout (items separated by spaces) and terminate with a new line.
Definition: print.h:225
std::string type(const PairType &n)
Definition: PNOParameters.h:18
Defines simple templates for printing to std::cout "a la Python".
static void preamble_load(const BufferInputArchive &)
Load the preamble.
Definition: buffer_archive.h:204
static void postamble_load(const BufferInputArchive &)
Load the postamble.
Definition: buffer_archive.h:207
static void postamble_store(const BufferOutputArchive &)
Write the postamble to the archive.
Definition: buffer_archive.h:194
static void preamble_store(const BufferOutputArchive &)
Write the preamble to the archive.
Definition: buffer_archive.h:191
Default implementation of the pre/postamble for type checking.
Definition: archive.h:509