Manage loading and storing for a set of states of a specified state space. More...
#include <ompl/base/StateStorage.h>

Classes | |
struct | Header |
Information stored at the beginning of the archive. More... | |
Public Member Functions | |
StateStorage (StateSpacePtr space) | |
The state space to store states for is specified as argument. | |
const StateSpacePtr & | getStateSpace () 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 | addState (const State *state) |
Add a state to the set of states maintained by this storage structure. The state is copied to internal storage. | |
virtual void | generateSamples (unsigned int count) |
Generate count states uniformly at random and store them in this structure. | |
virtual void | clear () |
Clear the stored states. This frees all the memory. | |
std::size_t | size () const |
Return the number of stored states. | |
const std::vector< const State * > & | getStates () const |
Get the stored states. | |
State * | getState (unsigned int index) |
Get a particular state for non-const access. | |
const State * | getState (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 | |
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 | loadMetadata (const Header &h, boost::archive::binary_iarchive &ia) |
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. | |
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. | |
virtual void | storeMetadata (const Header &h, boost::archive::binary_oarchive &oa) |
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. | |
void | freeMemory () |
Free the memory allocated for states. | |
Protected Attributes | |
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
Manage loading and storing for a set of states of a specified state space.
- Deprecated
- This class is deprecated and will be removed in the future. Please use the improved PlannerDataStorage.
Definition at line 61 of file StateStorage.h.
Constructor & Destructor Documentation
◆ StateStorage()
ompl::base::StateStorage::StateStorage | ( | StateSpacePtr | space | ) |
The state space to store states for is specified as argument.
Definition at line 74 of file StateStorage.cpp.
◆ ~StateStorage()
|
virtual |
Definition at line 78 of file StateStorage.cpp.
Member Function Documentation
◆ addState()
|
virtual |
Add a state to the set of states maintained by this storage structure. The state is copied to internal storage.
Reimplemented in ompl::base::StateStorageWithMetadata< M >, ompl::base::StateStorageWithMetadata< std::vector< std::size_t > >, and ompl::base::StateStorageWithMetadata< std::vector< std::size_t > >.
Definition at line 198 of file StateStorage.cpp.
◆ clear()
|
virtual |
Clear the stored states. This frees all the memory.
Reimplemented in ompl::base::StateStorageWithMetadata< M >, ompl::base::StateStorageWithMetadata< std::vector< std::size_t > >, and ompl::base::StateStorageWithMetadata< std::vector< std::size_t > >.
Definition at line 224 of file StateStorage.cpp.
◆ freeMemory()
|
protected |
Free the memory allocated for states.
Definition at line 218 of file StateStorage.cpp.
◆ generateSamples()
|
virtual |
Generate count states uniformly at random and store them in this structure.
Definition at line 205 of file StateStorage.cpp.
◆ getState() [1/2]
|
inline |
Get a particular state for non-const access.
Definition at line 109 of file StateStorage.h.
◆ getState() [2/2]
|
inline |
Get a particular state.
Definition at line 116 of file StateStorage.h.
◆ getStates()
|
inline |
Get the stored states.
Definition at line 103 of file StateStorage.h.
◆ getStateSamplerAllocator()
ompl::base::StateSamplerAllocator ompl::base::StateStorage::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.
Definition at line 235 of file StateStorage.cpp.
◆ getStateSamplerAllocatorRange()
|
virtual |
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)
Definition at line 250 of file StateStorage.cpp.
◆ getStateSamplerAllocatorRangeAfter()
ompl::base::StateSamplerAllocator ompl::base::StateStorage::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.
Definition at line 245 of file StateStorage.cpp.
◆ getStateSamplerAllocatorRangeUntil()
ompl::base::StateSamplerAllocator ompl::base::StateStorage::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.
Definition at line 240 of file StateStorage.cpp.
◆ getStateSpace()
|
inline |
Get the state space this class maintains states for.
Definition at line 69 of file StateStorage.h.
◆ hasMetadata()
|
inline |
Return a flag that indicates whether there is metadata associated to the states in this storage.
Definition at line 124 of file StateStorage.h.
◆ load() [1/2]
void ompl::base::StateStorage::load | ( | const char * | filename | ) |
Load a set of states from a specified file.
Definition at line 83 of file StateStorage.cpp.
◆ load() [2/2]
|
virtual |
Load a set of states from a stream.
Definition at line 97 of file StateStorage.cpp.
◆ loadMetadata()
|
protectedvirtual |
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.
Reimplemented in ompl::base::StateStorageWithMetadata< M >, ompl::base::StateStorageWithMetadata< std::vector< std::size_t > >, and ompl::base::StateStorageWithMetadata< std::vector< std::size_t > >.
Definition at line 150 of file StateStorage.cpp.
◆ loadStates()
|
protectedvirtual |
Load the states from a binary archive ia, given the loaded header is h.
Definition at line 133 of file StateStorage.cpp.
◆ print()
|
virtual |
Output the set of states to a specified stream, in a human readable fashion.
Definition at line 263 of file StateStorage.cpp.
◆ size()
|
inline |
Return the number of stored states.
Definition at line 97 of file StateStorage.h.
◆ sort()
void ompl::base::StateStorage::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.
Definition at line 230 of file StateStorage.cpp.
◆ store() [1/2]
void ompl::base::StateStorage::store | ( | const char * | filename | ) |
Save a set of states to a file.
Definition at line 90 of file StateStorage.cpp.
◆ store() [2/2]
|
virtual |
Save a set of states to a stream.
Definition at line 154 of file StateStorage.cpp.
◆ storeMetadata()
|
protectedvirtual |
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.
Reimplemented in ompl::base::StateStorageWithMetadata< M >, ompl::base::StateStorageWithMetadata< std::vector< std::size_t > >, and ompl::base::StateStorageWithMetadata< std::vector< std::size_t > >.
Definition at line 194 of file StateStorage.cpp.
◆ storeStates()
|
protectedvirtual |
Store the states to a binary archive oa, given the stored header is h.
Definition at line 180 of file StateStorage.cpp.
Member Data Documentation
◆ hasMetadata_
|
protected |
Flag indicating whether there is metadata associated to the states in this storage.
Definition at line 208 of file StateStorage.h.
◆ space_
|
protected |
State space that corresponds to maintained states.
Definition at line 202 of file StateStorage.h.
◆ states_
|
protected |
The list of maintained states.
Definition at line 205 of file StateStorage.h.
The documentation for this class was generated from the following files:
- ompl/base/StateStorage.h
- ompl/base/src/StateStorage.cpp