38 #include <boost/version.hpp>
39 #if BOOST_VERSION < 104400
40 #warning Boost version >= 1.44 is required for PlannerDataStorage classes
43 #include "ompl/base/PlannerDataStorage.h"
44 #include <boost/archive/archive_exception.hpp>
46 static const boost::uint32_t OMPL_PLANNER_DATA_ARCHIVE_MARKER = 0x5044414D;
58 std::ofstream out(filename, std::ios::binary);
68 OMPL_ERROR(
"Failed to store PlannerData: output stream is invalid");
73 OMPL_ERROR(
"Failed to store PlannerData: SpaceInformation is invalid");
78 boost::archive::binary_oarchive oa(out);
82 h.
marker = OMPL_PLANNER_DATA_ARCHIVE_MARKER;
85 si->getStateSpace()->computeSignature(h.
signature);
88 storeVertices(pd, oa);
91 catch (boost::archive::archive_exception &ae)
93 OMPL_ERROR(
"Failed to store PlannerData: %s", ae.what());
99 std::ifstream in(filename, std::ios::binary);
111 OMPL_ERROR(
"Failed to load PlannerData: input stream is invalid");
116 OMPL_ERROR(
"Failed to load PlannerData: SpaceInformation is invalid");
122 boost::archive::binary_iarchive ia(in);
129 if (h.marker != OMPL_PLANNER_DATA_ARCHIVE_MARKER)
131 OMPL_ERROR(
"Failed to load PlannerData: PlannerData archive marker not found");
136 std::vector<int> sig;
137 si->getStateSpace()->computeSignature(sig);
138 if (h.signature != sig)
140 OMPL_ERROR(
"Failed to load PlannerData: StateSpace signature mismatch");
145 loadVertices(pd, h.vertex_count, ia);
146 loadEdges(pd, h.edge_count, ia);
148 catch (boost::archive::archive_exception &ae)
150 OMPL_ERROR(
"Failed to load PlannerData: %s", ae.what());