19 static bp::tuple getinitargs(
const Derived &)
21 return bp::make_tuple();
24 static bp::tuple getstate(
const Derived & obj)
26 const std::string str(obj.saveToString());
27 return bp::make_tuple(bp::str(str));
30 static void setstate(Derived & obj, bp::tuple tup)
32 if (bp::len(tup) == 0 || bp::len(tup) > 1)
34 throw eigenpy::Exception(
35 "Pickle was not able to reconstruct the object from the loaded data.\n" 36 "The pickle data structure contains too many elements.");
39 bp::object py_obj = tup[0];
40 boost::python::extract<std::string> obj_as_string(py_obj.ptr());
41 if (obj_as_string.check())
43 const std::string str = obj_as_string;
44 obj.loadFromString(str);
48 throw eigenpy::Exception(
49 "Pickle was not able to reconstruct the model from the loaded data.\n" 50 "The entry is not a string.");
54 static bool getstate_manages_dict()