aikido
Public Types | Public Member Functions | Protected Attributes | List of all members
aikido::statespace::StateHandle< _StateSpace, _QualifiedState > Class Template Reference

Wrap a State with its StateSpace to provide convenient accessor methods. More...

#include <StateHandle.hpp>

Public Types

using StateSpace = _StateSpace
 
using QualifiedState = _QualifiedState
 
using State = typename StateSpace::State
 
using ConstState = typename std::conditional< std::is_const< QualifiedState >::value, QualifiedState, const QualifiedState >::type
 

Public Member Functions

 StateHandle ()
 Constructs a nullptr handle.
 
 StateHandle (const StateSpace *space, QualifiedState *state)
 Wrap state, which must be form the provided StateSpace. More...
 
 StateHandle (const StateHandle &)=default
 
 StateHandle (StateHandle &&)=default
 
StateHandleoperator= (StateHandle &&)=default
 
StateHandleoperator= (const StateHandle &)=default
 
 operator QualifiedState * () const
 Implicitly convert to a State pointer.
 
void reset ()
 Resets StateHandle to nullptr.
 
void reset (const StateSpace *space, QualifiedState *state)
 Resets the state, which must be from the provided StateSpace. More...
 
template<typename Q = QualifiedState>
auto getState () -> typename std::enable_if<!std::is_const< Q >::value, Q *>::type
 Returns the State. More...
 
template<typename Q = QualifiedState>
auto getState () const -> typename std::conditional< std::is_const< Q >::value, Q *, const Q *>::type
 Returns the State. More...
 
const StateSpace * getStateSpace () const
 Returns the state space that created this state. More...
 

Protected Attributes

const StateSpace * mSpace
 State space of the sate that is managed by this handler.
 
QualifiedState * mState
 State managed by this handler. This can be either const or non-const type.
 

Detailed Description

template<class _StateSpace, class _QualifiedState>
class aikido::statespace::StateHandle< _StateSpace, _QualifiedState >

Wrap a State with its StateSpace to provide convenient accessor methods.

The template parameter _QualifiedState is necessary to support both const and non-const states.

Template Parameters
_StateSpaceType of StateSpace this state is a member of
_QualifiedStateType of State being wrapped

Constructor & Destructor Documentation

§ StateHandle()

template<class StateSpace , class QualifiedState >
aikido::statespace::StateHandle< StateSpace, QualifiedState >::StateHandle ( const StateSpace *  space,
QualifiedState *  state 
)

Wrap state, which must be form the provided StateSpace.

Parameters
spaceState space that created state.
stateState created by space.

Member Function Documentation

§ getState() [1/2]

template<class StateSpace , class QualifiedState >
template<typename Q >
auto aikido::statespace::StateHandle< StateSpace, QualifiedState >::getState ( ) -> typename std::enable_if<!std::is_const<Q>::value, Q*>::type

Returns the State.

This function is enabled only if QualifiedState is a non-const State type.

Returns
state wrapped by this handle

§ getState() [2/2]

template<class StateSpace , class QualifiedState >
template<typename Q >
auto aikido::statespace::StateHandle< StateSpace, QualifiedState >::getState ( ) const -> typename std::conditional<std::is_const<Q>::value, Q*, const Q*>::type

Returns the State.

Returns
State wrapped by this handle

§ getStateSpace()

template<class _StateSpace , class _QualifiedState >
auto aikido::statespace::StateHandle< _StateSpace, _QualifiedState >::getStateSpace ( ) const

Returns the state space that created this state.

Returns
State space created this state

§ reset()

template<class StateSpace , class QualifiedState >
void aikido::statespace::StateHandle< StateSpace, QualifiedState >::reset ( const StateSpace *  space,
QualifiedState *  state 
)

Resets the state, which must be from the provided StateSpace.

Parameters
spaceState space that created state.
stateState created by space.

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