Loading...
Searching...
No Matches
ompl::base::ScopedState< T > Class Template Reference

Definition of a scoped state. More...

#include <ompl/base/ScopedState.h>

Public Types

using StateType = typename T::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.

Member Typedef Documentation

◆ StateType

template<class T = StateSpace>
using ompl::base::ScopedState< T >::StateType = typename T::StateType

The type of the contained state.

Definition at line 66 of file ScopedState.h.

Constructor & Destructor Documentation

◆ ScopedState() [1/5]

template<class T = StateSpace>
ompl::base::ScopedState< T >::ScopedState ( const SpaceInformationPtr & si)
inlineexplicit

Given the space that we are working with, allocate a state from the corresponding state space.

Definition at line 71 of file ScopedState.h.

◆ ScopedState() [2/5]

template<class T = StateSpace>
ompl::base::ScopedState< T >::ScopedState ( StateSpacePtr space)
inlineexplicit

Given the state space that we are working with, allocate a state.

Definition at line 84 of file ScopedState.h.

◆ ScopedState() [3/5]

template<class T = StateSpace>
ompl::base::ScopedState< T >::ScopedState ( const ScopedState< T > & other)
inline

Copy constructor.

Definition at line 96 of file ScopedState.h.

◆ ScopedState() [4/5]

template<class T = StateSpace>
template<class O>
ompl::base::ScopedState< T >::ScopedState ( const ScopedState< O > & other)
inline

Copy constructor that allows instantiation from states of other type.

Definition at line 105 of file ScopedState.h.

◆ ScopedState() [5/5]

template<class T = StateSpace>
ompl::base::ScopedState< T >::ScopedState ( StateSpacePtr space,
const State * state )
inline

Given the state space that we are working with, allocate a state and fill that state with a given value.

Definition at line 123 of file ScopedState.h.

◆ ~ScopedState()

template<class T = StateSpace>
ompl::base::ScopedState< T >::~ScopedState ( )
inline

Free the memory of the internally allocated state.

Definition at line 136 of file ScopedState.h.

Member Function Documentation

◆ distance() [1/2]

template<class T = StateSpace>
template<class O>
double ompl::base::ScopedState< T >::distance ( const ScopedState< O > & other) const
inline

Compute the distance to another state.

Definition at line 317 of file ScopedState.h.

◆ distance() [2/2]

template<class T = StateSpace>
double ompl::base::ScopedState< T >::distance ( const State * state) const
inline

Compute the distance to another state.

Definition at line 325 of file ScopedState.h.

◆ enforceBounds()

template<class T = StateSpace>
void ompl::base::ScopedState< T >::enforceBounds ( )
inline

Enforce the bounds on the maintained state.

Definition at line 339 of file ScopedState.h.

◆ get() [1/2]

template<class T = StateSpace>
StateType * ompl::base::ScopedState< T >::get ( )
inline

Returns a pointer to the contained state.

Definition at line 393 of file ScopedState.h.

◆ get() [2/2]

template<class T = StateSpace>
const StateType * ompl::base::ScopedState< T >::get ( ) const
inline

Returns a pointer to the contained state.

Definition at line 399 of file ScopedState.h.

◆ getSpace()

template<class T = StateSpace>
const StateSpacePtr & ompl::base::ScopedState< T >::getSpace ( ) const
inline

Get the state space that the state corresponds to.

Definition at line 142 of file ScopedState.h.

◆ operator!=()

template<class T = StateSpace>
template<class O>
bool ompl::base::ScopedState< T >::operator!= ( const ScopedState< O > & other) const
inline

Checks equality of two states.

Definition at line 257 of file ScopedState.h.

◆ operator()()

template<class T = StateSpace>
StateType * ompl::base::ScopedState< T >::operator() ( ) const
inline

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

Definition at line 405 of file ScopedState.h.

◆ operator*() [1/2]

template<class T = StateSpace>
StateType & ompl::base::ScopedState< T >::operator* ( )
inline

De-references to the contained state.

Definition at line 369 of file ScopedState.h.

◆ operator*() [2/2]

template<class T = StateSpace>
const StateType & ompl::base::ScopedState< T >::operator* ( ) const
inline

De-references to the contained state.

Definition at line 375 of file ScopedState.h.

◆ operator->() [1/2]

template<class T = StateSpace>
StateType * ompl::base::ScopedState< T >::operator-> ( )
inline

Returns a pointer to the contained state.

Definition at line 381 of file ScopedState.h.

◆ operator->() [2/2]

template<class T = StateSpace>
const StateType * ompl::base::ScopedState< T >::operator-> ( ) const
inline

Returns a pointer to the contained state.

Definition at line 387 of file ScopedState.h.

◆ operator=() [1/6]

template<class T = StateSpace>
ScopedState< T > & ompl::base::ScopedState< T >::operator= ( const double value)
inline

Partial assignment operator. Only sets the double values of the state to a fixed value.

Definition at line 231 of file ScopedState.h.

◆ operator=() [2/6]

template<class T = StateSpace>
template<class O>
ScopedState< T > & ompl::base::ScopedState< T >::operator= ( const ScopedState< O > & other)
inline

Assignment operator that allows conversion of states.

Definition at line 196 of file ScopedState.h.

◆ operator=() [3/6]

template<class T = StateSpace>
ScopedState< T > & ompl::base::ScopedState< T >::operator= ( const ScopedState< T > & other)
inline

Assignment operator.

Definition at line 148 of file ScopedState.h.

◆ operator=() [4/6]

template<class T = StateSpace>
ScopedState< T > & ompl::base::ScopedState< T >::operator= ( const State & other)
inline

Assignment operator.

Definition at line 179 of file ScopedState.h.

◆ operator=() [5/6]

template<class T = StateSpace>
ScopedState< T > & ompl::base::ScopedState< T >::operator= ( const State * other)
inline

Assignment operator.

Definition at line 163 of file ScopedState.h.

◆ operator=() [6/6]

template<class T = StateSpace>
ScopedState< T > & ompl::base::ScopedState< T >::operator= ( const std::vector< double > & reals)
inline

Partial assignment operator. Only sets the double values of the state to specified real values.

Definition at line 220 of file ScopedState.h.

◆ operator==()

template<class T = StateSpace>
template<class O>
bool ompl::base::ScopedState< T >::operator== ( const ScopedState< O > & other) const
inline

Checks equality of two states.

Definition at line 241 of file ScopedState.h.

◆ operator[]() [1/5]

template<class T>
const ScopedState ompl::base::ScopedState< T >::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.

Definition at line 542 of file ScopedState.h.

◆ operator[]() [2/5]

template<class T = StateSpace>
double & ompl::base::ScopedState< T >::operator[] ( const std::string & name)
inline

Access a double value from this state contains using its name.

Definition at line 288 of file ScopedState.h.

◆ operator[]() [3/5]

template<class T = StateSpace>
double ompl::base::ScopedState< T >::operator[] ( const std::string & name) const
inline

Access a double value from this state contains using its name.

Definition at line 302 of file ScopedState.h.

◆ operator[]() [4/5]

template<class T = StateSpace>
double & ompl::base::ScopedState< T >::operator[] ( const unsigned int index)
inline

Access the indexth double value this state contains.

Definition at line 270 of file ScopedState.h.

◆ operator[]() [5/5]

template<class T = StateSpace>
double ompl::base::ScopedState< T >::operator[] ( const unsigned int index) const
inline

Access the indexth double value this state contains.

Definition at line 279 of file ScopedState.h.

◆ print()

template<class T = StateSpace>
void ompl::base::ScopedState< T >::print ( std::ostream & out = std::cout) const
inline

Print this state to a stream.

Definition at line 363 of file ScopedState.h.

◆ random()

template<class T = StateSpace>
void ompl::base::ScopedState< T >::random ( )
inline

Set this state to a random value (uniform)

Definition at line 331 of file ScopedState.h.

◆ reals()

template<class T = StateSpace>
std::vector< double > ompl::base::ScopedState< T >::reals ( ) const
inline

Return the real values corresponding to this state. If a conversion is not possible, an exception is thrown.

Definition at line 353 of file ScopedState.h.

◆ satisfiesBounds()

template<class T = StateSpace>
bool ompl::base::ScopedState< T >::satisfiesBounds ( ) const
inline

Check if the maintained state satisfies bounds.

Definition at line 345 of file ScopedState.h.


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