Loading...
Searching...
No Matches
ompl::base::PlannerDataStorage Class Reference

Object that handles loading/storing a PlannerData object to/from a binary stream. Serialization of vertices and edges is performed using the Boost archive method serialize. Derived vertex/edge classes are handled, presuming those classes implement the serialize method. More...

#include <ompl/base/PlannerDataStorage.h>

Inheritance diagram for ompl::base::PlannerDataStorage:

Classes

struct  Header
 Information stored at the beginning of the PlannerData archive. More...
struct  PlannerDataVertexData
 The object containing all vertex data that will be stored. More...
struct  PlannerDataEdgeData
 The object containing all edge data that will be stored. More...

Public Member Functions

 PlannerDataStorage ()
 Default constructor.
virtual ~PlannerDataStorage ()
 Destructor.
virtual bool store (const PlannerData &pd, const char *filename)
 Store (serialize) the PlannerData structure to the given filename.
virtual bool store (const PlannerData &pd, std::ostream &out)
 Store (serialize) the PlannerData structure to the given stream.
virtual bool load (const char *filename, PlannerData &pd)
 Load the PlannerData structure from the given stream. The StateSpace that was used to store the data must match the StateSpace inside of the argument PlannerData.
virtual bool load (std::istream &in, PlannerData &pd)
 Load the PlannerData structure from the given stream. The StateSpace that was used to store the data must match the StateSpace inside of the argument PlannerData.

Protected Member Functions

virtual void loadVertices (PlannerData &pd, unsigned int numVertices, boost::archive::binary_iarchive &ia)
 Read numVertices from the binary input ia and store them as PlannerData.
virtual void storeVertices (const PlannerData &pd, boost::archive::binary_oarchive &oa)
 Serialize and store all vertices in pd to the binary archive.
virtual void loadEdges (PlannerData &pd, unsigned int numEdges, boost::archive::binary_iarchive &ia)
 Read numEdges from the binary input ia and store them as PlannerData.
virtual void storeEdges (const PlannerData &pd, boost::archive::binary_oarchive &oa)
 Serialize and store all edges in pd to the binary archive.

Detailed Description

Object that handles loading/storing a PlannerData object to/from a binary stream. Serialization of vertices and edges is performed using the Boost archive method serialize. Derived vertex/edge classes are handled, presuming those classes implement the serialize method.

Remarks
Since the serialize method for vertices and edges is templated, it cannot be virtual. To serialize a derived class AND the base class data, a special call can be invoked inside of serialize that instructs the serializer to also serialize the base class. The derived class must also have a GUID exposed to the serializer for proper deserialization at runtime. This is performed with the BOOST_CLASS_EXPORT macro. An example of these items is given below:
#include <boost/serialization/export.hpp>
class MyVertexClass : public ompl::base::PlannerDataVertex
{
// ---SNIP---
template <class Archive>
void serialize(Archive & ar, const unsigned int version)
{
ar & boost::serialization::base_object<ompl::base::PlannerDataVertex>(*this);
// ... (The other members of MyVertexClass)
}
};
BOOST_CLASS_EXPORT(MyVertexClass);
Base class for a vertex in the PlannerData structure. All derived classes must implement the clone an...
Definition PlannerData.h:59

Definition at line 79 of file PlannerDataStorage.h.

Constructor & Destructor Documentation

◆ ~PlannerDataStorage()

ompl::base::PlannerDataStorage::~PlannerDataStorage ( )
virtualdefault

Destructor.

Reimplemented in ompl::control::PlannerDataStorage.

Member Function Documentation

◆ load() [1/2]

bool ompl::base::PlannerDataStorage::load ( const char * filename,
PlannerData & pd )
virtual

Load the PlannerData structure from the given stream. The StateSpace that was used to store the data must match the StateSpace inside of the argument PlannerData.

Returns
True on success, false on failure.

Reimplemented in ompl::control::PlannerDataStorage.

Definition at line 92 of file PlannerDataStorage.cpp.

◆ load() [2/2]

bool ompl::base::PlannerDataStorage::load ( std::istream & in,
PlannerData & pd )
virtual

Load the PlannerData structure from the given stream. The StateSpace that was used to store the data must match the StateSpace inside of the argument PlannerData.

Returns
True on success, false on failure.

Reimplemented in ompl::control::PlannerDataStorage.

Definition at line 101 of file PlannerDataStorage.cpp.

◆ loadEdges()

virtual void ompl::base::PlannerDataStorage::loadEdges ( PlannerData & pd,
unsigned int numEdges,
boost::archive::binary_iarchive & ia )
inlineprotectedvirtual

Read numEdges from the binary input ia and store them as PlannerData.

Reimplemented in ompl::control::PlannerDataStorage.

Definition at line 247 of file PlannerDataStorage.h.

◆ loadVertices()

virtual void ompl::base::PlannerDataStorage::loadVertices ( PlannerData & pd,
unsigned int numVertices,
boost::archive::binary_iarchive & ia )
inlineprotectedvirtual

Read numVertices from the binary input ia and store them as PlannerData.

Definition at line 175 of file PlannerDataStorage.h.

◆ store() [1/2]

bool ompl::base::PlannerDataStorage::store ( const PlannerData & pd,
const char * filename )
virtual

Store (serialize) the PlannerData structure to the given filename.

Returns
True on success, false on failure.

Reimplemented in ompl::control::PlannerDataStorage.

Definition at line 46 of file PlannerDataStorage.cpp.

◆ store() [2/2]

bool ompl::base::PlannerDataStorage::store ( const PlannerData & pd,
std::ostream & out )
virtual

Store (serialize) the PlannerData structure to the given stream.

Returns
True on success, false on failure.

Reimplemented in ompl::control::PlannerDataStorage.

Definition at line 55 of file PlannerDataStorage.cpp.

◆ storeEdges()

virtual void ompl::base::PlannerDataStorage::storeEdges ( const PlannerData & pd,
boost::archive::binary_oarchive & oa )
inlineprotectedvirtual

Serialize and store all edges in pd to the binary archive.

Reimplemented in ompl::control::PlannerDataStorage.

Definition at line 263 of file PlannerDataStorage.h.

◆ storeVertices()

virtual void ompl::base::PlannerDataStorage::storeVertices ( const PlannerData & pd,
boost::archive::binary_oarchive & oa )
inlineprotectedvirtual

Serialize and store all vertices in pd to the binary archive.

Definition at line 218 of file PlannerDataStorage.h.


The documentation for this class was generated from the following files: