37 #ifndef OMPL_BASE_STATE_SAMPLER_ARRAY_
38 #define OMPL_BASE_STATE_SAMPLER_ARRAY_
40 #include "ompl/base/SpaceInformation.h"
41 #include "ompl/base/StateSampler.h"
42 #include "ompl/base/ValidStateSampler.h"
74 struct SamplerSelector<ValidStateSampler>
76 typedef ValidStateSampler Sampler;
77 typedef ValidStateSamplerPtr SamplerPtr;
79 SamplerPtr allocStateSampler(
const SpaceInformation *si)
81 return si->allocValidStateSampler();
116 return samplers_[index].get();
122 if (samplers_.size() > count)
123 samplers_.resize(count);
125 if (samplers_.size() < count)
127 std::size_t c = samplers_.size();
128 samplers_.resize(count);
129 for (std::size_t i = c ; i < count ; ++i)
130 samplers_[i] = ss_.allocStateSampler(si_);
137 return samplers_.size();
150 std::vector<SamplerPtr> samplers_;
std::size_t size(void) const
Get the count of samplers currently available.
A boost shared pointer wrapper for ompl::base::StateSampler.
Class to ease the creation of a set of samplers. This is especially useful for multi-threaded planner...
StateSamplerArray(const SpaceInformation *si)
Constructor.
SamplerSelector< T >::Sampler Sampler
The type of sampler allocated.
SamplerSelector< T >::SamplerPtr SamplerPtr
Pointer to the type of sampler allocated.
Sampler * operator[](std::size_t index) const
Access operator for a specific sampler. For performance reasons, the bounds are not checked...
StateSamplerArray(const SpaceInformationPtr &si)
Constructor.
Depending on the type of state sampler, we have different allocation routines.
void clear(void)
Clear all allocated samplers.
Abstract definition of a state space sampler.
void resize(std::size_t count)
Create or release some state samplers.