Definition of a scoped state. More...
#include <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 (const 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 (const 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 (void) | |
Free the memory of the internally allocated state. | |
const StateSpacePtr & | getSpace (void) 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. | |
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) | |
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 (void) |
Set this state to a random value (uniform) | |
void | enforceBounds (void) |
Enforce the bounds on the maintained state. | |
bool | satisfiesBounds (void) const |
Check if the maintained state satisfies bounds. | |
std::vector< double > | reals (void) 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. | |
StateType & | operator* (void) |
De-references to the contained state. | |
const StateType & | operator* (void) const |
De-references to the contained state. | |
StateType * | operator-> (void) |
Returns a pointer to the contained state. | |
const StateType * | operator-> (void) const |
Returns a pointer to the contained state. | |
StateType * | get (void) |
Returns a pointer to the contained state. | |
const StateType * | get (void) const |
Returns a pointer to the contained state. | |
StateType * | operator() (void) const |
Returns a pointer to the contained state (used for Python bindings) |
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.