ompl::base::StateStorageWithMetadata< M > Class Template Reference

State storage that allows storing state metadata as well. More...

#include <ompl/base/StateStorage.h>

Inheritance diagram for ompl::base::StateStorageWithMetadata< M >:

Public Types

typedef M MetadataType
 the datatype of the metadata
 

Public Member Functions

 StateStorageWithMetadata (const StateSpacePtr &space)
 The state space to store states for is specified as argument.
 
void addState (const State *state) override
 Add a state to the set of states maintained by this storage structure. The state is copied to internal storage and metadata with default values is stored as well.
 
virtual void addState (const State *state, const M &metadata)
 Add a state to the set of states maintained by this storage structure. The state is copied to internal storage. Corresponding metadata is stored too.
 
void clear () override
 Clear the stored states. This frees all the memory.
 
const M & getMetadata (unsigned int index) const
 Get const access to the metadata of a state at a particular index.
 
M & getMetadata (unsigned int index)
 Get write access to the metadata of a state at a particular index.
 
- Public Member Functions inherited from ompl::base::StateStorage
 StateStorage (StateSpacePtr space)
 The state space to store states for is specified as argument.
 
const StateSpacePtrgetStateSpace () const
 Get the state space this class maintains states for.
 
void load (const char *filename)
 Load a set of states from a specified file.
 
virtual void load (std::istream &in)
 Load a set of states from a stream.
 
void store (const char *filename)
 Save a set of states to a file.
 
virtual void store (std::ostream &out)
 Save a set of states to a stream.
 
virtual void generateSamples (unsigned int count)
 Generate count states uniformly at random and store them in this structure.
 
std::size_t size () const
 Return the number of stored states.
 
const std::vector< const State * > & getStates () const
 Get the stored states.
 
StategetState (unsigned int index)
 Get a particular state for non-const access.
 
const StategetState (unsigned int index) const
 Get a particular state.
 
bool hasMetadata () const
 Return a flag that indicates whether there is metadata associated to the states in this storage.
 
void sort (const std::function< bool(const State *, const State *)> &op)
 Sort the states according to the less-equal operator op. Metadata is NOT sorted; if metadata was added, the index values of the metadata will not match after the sort.
 
StateSamplerAllocator getStateSamplerAllocator () const
 Get a sampler allocator to a sampler that can be specified for a StateSpace, such that all sampled states are actually from this storage structure.
 
StateSamplerAllocator getStateSamplerAllocatorRangeUntil (std::size_t until) const
 Get a sampler allocator to a sampler that can be specified for a StateSpace, such that all sampled states are actually from this storage structure at an index less than or equal to until.
 
StateSamplerAllocator getStateSamplerAllocatorRangeAfter (std::size_t after) const
 Get a sampler allocator to a sampler that can be specified for a StateSpace, such that all sampled states are actually from this storage structure at an index above or equal to after.
 
virtual StateSamplerAllocator getStateSamplerAllocatorRange (std::size_t from, std::size_t to) const
 Get a sampler allocator to a sampler that can be specified for a StateSpace, such that all sampled states are actually from this storage structure at an index in the range [from, to] (inclusive)
 
virtual void print (std::ostream &out=std::cout) const
 Output the set of states to a specified stream, in a human readable fashion.
 

Protected Member Functions

void loadMetadata (const Header &, boost::archive::binary_iarchive &ia) override
 Load the state metadata from a binary archive ia, given the loaded header is h. No metadata is actually loaded unless the StateStorageWithMetadata class is used.
 
void storeMetadata (const Header &, boost::archive::binary_oarchive &oa) override
 Save the state metadata to a binary archive oa, given the stored header is h. No metadata is actually saved unless the StateStorageWithMetadata class is used.
 
- Protected Member Functions inherited from ompl::base::StateStorage
virtual void loadStates (const Header &h, boost::archive::binary_iarchive &ia)
 Load the states from a binary archive ia, given the loaded header is h.
 
virtual void storeStates (const Header &h, boost::archive::binary_oarchive &oa)
 Store the states to a binary archive oa, given the stored header is h.
 
void freeMemory ()
 Free the memory allocated for states.
 

Protected Attributes

std::vector< M > metadata_
 The metadata for each state.
 
- Protected Attributes inherited from ompl::base::StateStorage
StateSpacePtr space_
 State space that corresponds to maintained states.
 
std::vector< const State * > states_
 The list of maintained states.
 
bool hasMetadata_
 Flag indicating whether there is metadata associated to the states in this storage.
 

Detailed Description

template<typename M>
class ompl::base::StateStorageWithMetadata< M >

State storage that allows storing state metadata as well.

Template Parameters
Mthe datatype for the stored metadata. boost::serialization operation needs to be defined

Definition at line 214 of file StateStorage.h.


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