5 #ifndef __pinocchio_python_utils_pickle_hpp__ 
    6 #define __pinocchio_python_utils_pickle_hpp__ 
   16     template<
typename Derived>
 
   21         return bp::make_tuple();
 
   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)
 
   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);
 
   49             "Pickle was not able to reconstruct the model from the loaded data.\n" 
   50             "The entry is not a string.");
 
   62 #endif // ifndef __pinocchio_python_utils_pickle_hpp__