ompl::base::ScopedState< T > Class Template Reference

Definition of a scoped state. More...

#include <ompl/base/ScopedState.h>

## Public Types

typedef T::StateType StateType
The type of the contained state.

## Public Member Functions

ScopedState (const SpaceInformationPtr &si)
Given the space that we are working with, allocate a state from the corresponding state space.

ScopedState (StateSpacePtr space)
Given the state space that we are working with, allocate a state.

ScopedState (const ScopedState< T > &other)
Copy constructor.

template<class O >
ScopedState (const ScopedState< O > &other)
Copy constructor that allows instantiation from states of other type.

ScopedState (StateSpacePtr space, const State *state)
Given the state space that we are working with, allocate a state and fill that state with a given value.

~ScopedState ()
Free the memory of the internally allocated state.

const StateSpacePtrgetSpace () const
Get the state space that the state corresponds to.

ScopedState< T > & operator= (const ScopedState< T > &other)
Assignment operator.

ScopedState< T > & operator= (const State *other)
Assignment operator.

ScopedState< T > & operator= (const State &other)
Assignment operator.

template<class O >
ScopedState< T > & operator= (const ScopedState< O > &other)
Assignment operator that allows conversion of states.

ScopedState< T > & operator= (const std::vector< double > &reals)
Partial assignment operator. Only sets the double values of the state to specified real values.

ScopedState< T > & operator= (const double value)
Partial assignment operator. Only sets the double values of the state to a fixed value.

template<class O >
bool operator== (const ScopedState< O > &other) const
Checks equality of two states.

template<class O >
bool operator!= (const ScopedState< O > &other) const
Checks equality of two states.

const ScopedState operator[] (const StateSpacePtr &s) const
Extract a state that corresponds to the components in state space s. Those components will have the same value as the current state (only the ones included in the current state; others will be uninitialised). Note: a new state is constructed and data is copied.

double & operator[] (const unsigned int index)
Access the indexth double value this state contains.

double operator[] (const unsigned int index) const
Access the indexth double value this state contains.

double & operator[] (const std::string &name)
Access a double value from this state contains using its name.

double operator[] (const std::string &name) const
Access a double value from this state contains using its name.

template<class O >
double distance (const ScopedState< O > &other) const
Compute the distance to another state.

double distance (const State *state) const
Compute the distance to another state.

void random ()
Set this state to a random value (uniform)

void enforceBounds ()
Enforce the bounds on the maintained state.

bool satisfiesBounds () const
Check if the maintained state satisfies bounds.

std::vector< double > reals () const
Return the real values corresponding to this state. If a conversion is not possible, an exception is thrown.

void print (std::ostream &out=std::cout) const
Print this state to a stream.

StateTypeoperator* ()
De-references to the contained state.

const StateTypeoperator* () const
De-references to the contained state.

StateTypeoperator-> ()
Returns a pointer to the contained state.

const StateTypeoperator-> () const
Returns a pointer to the contained state.

StateTypeget ()
Returns a pointer to the contained state.

const StateTypeget () const
Returns a pointer to the contained state.

StateTypeoperator() () const
Returns a pointer to the contained state (used for Python bindings)

## Detailed Description

### template<class T = StateSpace> class ompl::base::ScopedState< T >

Definition of a scoped state.

This class allocates a state of a desired type using the allocation mechanism of the corresponding state space. The state is then freed when the instance goes out of scope using the corresponding free mechanism.

Definition at line 56 of file ScopedState.h.

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