mlpack  3.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
serialization.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_BINDINGS_PYTHON_MLPACK_SERIALIZATION_HPP
13 #define MLPACK_BINDINGS_PYTHON_MLPACK_SERIALIZATION_HPP
14 
15 #include <mlpack/core.hpp>
16 
17 namespace mlpack {
18 namespace bindings {
19 namespace python {
20 
21 template<typename T>
23 {
24  std::ostringstream oss;
25  {
26  boost::archive::binary_oarchive b(oss);
27 
28  b << boost::serialization::make_nvp(name.c_str(), *t);
29  }
30  return oss.str();
31 }
32 
33 template<typename T>
34 void SerializeIn(T* t, const std::string& str, const std::string& name)
35 {
36  std::istringstream iss(str);
37  boost::archive::binary_iarchive b(iss);
38 
39  b >> boost::serialization::make_nvp(name.c_str(), *t);
40 }
41 
42 } // namespace python
43 } // namespace bindings
44 } // namespace mlpack
45 
46 #endif
python
Definition: CMakeLists.txt:61
Include all of the base components required to write mlpack methods, and the main mlpack Doxygen docu...
std::string SerializeOut(T *t, const std::string &name)
void SerializeIn(T *t, const std::string &str, const std::string &name)
src mlpack core util version hpp VERSION_HPP_CONTENTS string(REGEX REPLACE".*#define MLPACK_VERSION_MAJOR ([0-9]+).*""\\1"MLPACK_VERSION_MAJOR"${VERSION_HPP_CONTENTS}") string(REGEX REPLACE".* MLPACK_VERSION_MINOR "$
Definition: CMakeLists.txt:79