IMP logo
IMP Reference Guide  2.14.0
The Integrative Modeling Platform
io.h
Go to the documentation of this file.
1 /**
2  * \file IMP/io.h
3  * \brief Write/read the state of the particles to/from a buffer in memory.
4  *
5  * Copyright 2007-2020 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPKERNEL_IO_H
10 #define IMPKERNEL_IO_H
11 
12 #include <IMP/kernel_config.h>
13 #include "OptimizerState.h"
14 #include "internal/utility.h"
15 #include <boost/format.hpp>
16 
17 IMPKERNEL_BEGIN_NAMESPACE
18 
19 /** \name Buffer I/O
20  Write/read the state of the particles to/from a buffer in memory.
21  \note Not all particles need to have all the attributes,
22  missing attributes will be skipped. However, the set of attributes
23  must match on the write and read particles.
24 
25  \note There is no handling of architectural issues. That is, this
26  is only guaranteed to work if it is read and written on the same
27  operating system and system bit length. We could probably fix this.
28 
29  \note both these methods should be considered unstable.
30  @{
31 */
32 //! return a binary buffer with the data
33 IMPKERNELEXPORT Vector<char> write_particles_to_buffer(
34  const ParticlesTemp &particles, const FloatKeys &keys);
35 //! load found attributes into the particles
36 IMPKERNELEXPORT void read_particles_from_buffer(
37  const Vector<char> &buffer, const ParticlesTemp &particles,
38  const FloatKeys &keys);
39 
40 /** @} */
41 
42 IMPKERNEL_END_NAMESPACE
43 
44 #endif /* IMPKERNEL_IO_H */
Vector< char > write_particles_to_buffer(const ParticlesTemp &particles, const FloatKeys &keys)
return a binary buffer with the data
IMP::Vector< FloatKey > FloatKeys
Definition: base_types.h:33
Shared optimizer state.
void read_particles_from_buffer(const Vector< char > &buffer, const ParticlesTemp &particles, const FloatKeys &keys)
load found attributes into the particles