37 #ifndef OMPL_BASE_PLANNER_DATA_STORAGE_
38 #define OMPL_BASE_PLANNER_DATA_STORAGE_
41 #include <boost/version.hpp>
42 #if BOOST_VERSION < 104400
43 #warning Boost version >= 1.44 is required for PlannerDataStorage classes
46 #include "ompl/base/PlannerData.h"
48 #include <boost/archive/binary_oarchive.hpp>
49 #include <boost/archive/binary_iarchive.hpp>
50 #include <boost/serialization/vector.hpp>
51 #include <boost/serialization/utility.hpp>
127 template<
typename Archive>
128 void serialize(Archive & ar,
const unsigned int version)
147 template<
typename Archive>
148 void serialize(Archive & ar,
const unsigned int version)
156 std::vector<unsigned char> state_;
163 template<
typename Archive>
164 void serialize(Archive & ar,
const unsigned int version)
172 std::pair<unsigned int, unsigned int> endpoints_;
179 logDebug(
"Loading %d PlannerDataVertex objects", numVertices);
182 std::vector<State*> states;
183 for (
unsigned int i = 0; i < numVertices; ++i)
192 State* state = space->allocState();
193 states.push_back(state);
194 space->deserialize (state, &vertexData.state_[0]);
198 if (vertexData.type_ == PlannerDataVertexData::START)
200 else if (vertexData.type_ == PlannerDataVertexData::GOAL)
207 delete vertexData.v_;
217 for (
size_t i = 0; i < states.size(); ++i)
218 space->freeState(states[i]);
227 std::vector<unsigned char> state (space->getSerializationLength());
228 for (
unsigned int i = 0; i < pd.
numVertices(); ++i)
238 vertexData.type_ = PlannerDataVertexData::START;
240 vertexData.type_ = PlannerDataVertexData::GOAL;
241 else vertexData.type_ = PlannerDataVertexData::STANDARD;
244 space->serialize (&state[0], v.
getState());
245 vertexData.state_ = state;
254 logDebug(
"Loading %d PlannerDataEdge objects", numEdges);
256 for (
unsigned int i = 0; i < numEdges; ++i)
260 pd.
addEdge(edgeData.endpoints_.first, edgeData.endpoints_.second, *edgeData.e_, edgeData.weight_);
273 for (
unsigned int i = 0; i < pd.
numVertices(); ++i)
274 for (
unsigned int j = 0; j < pd.
numVertices(); ++j)
279 edgeData.e_ = &pd.
getEdge(i, j);
280 edgeData.endpoints_.first = i;
281 edgeData.endpoints_.second = j;