Operators for States and State Spaces

Functions

StateSpacePtr ompl::base::operator* (const StateSpacePtr &a, const StateSpacePtr &b)
 Construct a compound state space that contains subspaces that are in both a and b.
StateSpacePtr ompl::base::operator+ (const StateSpacePtr &a, const StateSpacePtr &b)
 Construct a compound state space from two existing state spaces. The components of this compound space are a (or the components of a, if a is compound) and b (or the components of b, if b is compound). State spaces are identified by name. Duplicates are checked for and added only once. If the compound state space would end up containing solely one component, that component is returned instead.
StateSpacePtr ompl::base::operator- (const StateSpacePtr &a, const std::string &name)
 Construct a compound state space that contains subspaces only from a, except for maybe the one named name.
StateSpacePtr ompl::base::operator- (const StateSpacePtr &a, const StateSpacePtr &b)
 Construct a compound state space that contains subspaces only from a. If a is compound, b (or the components from b, if b is compound) are removed and the remaining components are returned as a compound state space. If the compound space would end up containing solely one component, that component is returned instead.
template<class T , class Y >
ScopedState< T > & ompl::base::operator<< (ScopedState< T > &to, const ScopedState< Y > &from)
 This is a fancy version of the assignment operator. It is a partial assignment, in some sense. The difference is that if the states are part of compound state spaces, the data is copied from from to to on a component by component basis. State spaces are matched by name. If the state space for to contains any subspace whose name matches any subspace of the state space for from, the corresponding state components are copied.
template<class T >
std::ostream & ompl::base::operator<< (std::ostream &out, const ScopedState< T > &state)
 Overload stream output operator. Calls ompl::base::StateSpace::printState().
template<class T , class Y >
const ScopedState< T > & ompl::base::operator>> (const ScopedState< T > &from, ScopedState< Y > &to)
 This is a fancy version of the assignment operator. It is a partial assignment, in some sense. The difference is that if the states are part of compound state spaces, the data is copied from from to to on a component by component basis. State spaces are matched by name. If the state space for to contains any subspace whose name matches any subspace of the state space for from, the corresponding state components are copied.
template<class T , class Y >
ScopedState ompl::base::operator^ (const ScopedState< T > &a, const ScopedState< Y > &b)
 Given state a from state space A and state b from state space B, construct a state from state space A + B. The resulting state contains all the information from the input states (the states are concatenated).

Detailed Description

These operators are intended to simplify code that manipulates states and state spaces. They rely on the fact that state spaces have unique names. Here are some examples for using these operators:

           // Assume X, Y, Z, W are state space instances, none of
           // which inherits from ompl::base::CompoundStateSpace.
           // Denote a compound state space as C[...], where "..." is the
           // list of subspaces.

           ompl::base::StateSpacePtr X;
           ompl::base::StateSpacePtr Y;
           ompl::base::StateSpacePtr Z;
           ompl::base::StateSpacePtr W;

           // the following line will construct a state space C1 = C[X, Y]
           ompl::base::StateSpacePtr C1 = X + Y;

           // the following line will construct a state space C2 = C[X, Y, Z]
           ompl::base::StateSpacePtr C2 = C1 + Z;

           // the following line will leave C2 as C[X, Y, Z]
           ompl::base::StateSpacePtr C2 = C1 + C2;

           // the following line will construct a state space C2 = C[X, Y, Z, W]
           ompl::base::StateSpacePtr C2 = C2 + W;

           // the following line will construct a state space C3 = C[X, Z, Y]
           ompl::base::StateSpacePtr C3 = X + Z + Y;

           // the following line will construct a state space C4 = C[Z, W]
           ompl::base::StateSpacePtr C4 = C2 - C1;

           // the following line will construct a state space C5 = W
           ompl::base::StateSpacePtr C5 = C2 - C3;

           // the following line will construct an empty state space C6 = C[]
           ompl::base::StateSpacePtr C6 = X - X;

           // the following line will construct an empty state space C7 = Y
           ompl::base::StateSpacePtr C7 = Y + C6;

These state spaces can be used when operating with states:

           ompl::base::ScopedState<> sX(X);
           ompl::base::ScopedState<> sXY(X + Y);
           ompl::base::ScopedState<> sY(Y);
           ompl::base::ScopedState<> sZX(Z + X);
           ompl::base::ScopedState<> sXZW(X + Z + W);

           // the following line will copy the content of the state sX to
           // the corresponding locations in sXZW. The components of the state
           // corresponding to the Z and W state spaces are not touched
           sX >> sXZW;

           // the following line will initialize the X component of sXY with
           // the X component of sXZW;
           sXY << sXZW;

           // the following line will initialize both components of sZX, using
           // the X and Z components of sXZW;
           sZX << sXZW;

           // the following line compares the concatenation of states sX and sY with sXY
           // the concatenation will automatically construct the state space X + Y and a state
           // from that state space containing the information from sX and sY. Since sXY is
           // constructed from the state space X + Y, the two are comparable.
           bool eq = (sX ^ sY) == sXY;

Function Documentation

StateSpacePtr ompl::base::operator* ( const StateSpacePtr &  a,
const StateSpacePtr &  b 
)

Construct a compound state space that contains subspaces that are in both a and b.

StateSpacePtr ompl::base::operator+ ( const StateSpacePtr &  a,
const StateSpacePtr &  b 
)

Construct a compound state space from two existing state spaces. The components of this compound space are a (or the components of a, if a is compound) and b (or the components of b, if b is compound). State spaces are identified by name. Duplicates are checked for and added only once. If the compound state space would end up containing solely one component, that component is returned instead.

StateSpacePtr ompl::base::operator- ( const StateSpacePtr &  a,
const std::string &  name 
)

Construct a compound state space that contains subspaces only from a, except for maybe the one named name.

StateSpacePtr ompl::base::operator- ( const StateSpacePtr &  a,
const StateSpacePtr &  b 
)

Construct a compound state space that contains subspaces only from a. If a is compound, b (or the components from b, if b is compound) are removed and the remaining components are returned as a compound state space. If the compound space would end up containing solely one component, that component is returned instead.

template<class T , class Y >
ScopedState<T>& ompl::base::operator<< ( ScopedState< T > &  to,
const ScopedState< Y > &  from 
) [inline]

This is a fancy version of the assignment operator. It is a partial assignment, in some sense. The difference is that if the states are part of compound state spaces, the data is copied from from to to on a component by component basis. State spaces are matched by name. If the state space for to contains any subspace whose name matches any subspace of the state space for from, the corresponding state components are copied.

Definition at line 485 of file ScopedState.h.

template<class T >
std::ostream& ompl::base::operator<< ( std::ostream &  out,
const ScopedState< T > &  state 
) [inline]

Overload stream output operator. Calls ompl::base::StateSpace::printState().

Definition at line 469 of file ScopedState.h.

template<class T , class Y >
const ScopedState<T>& ompl::base::operator>> ( const ScopedState< T > &  from,
ScopedState< Y > &  to 
) [inline]

This is a fancy version of the assignment operator. It is a partial assignment, in some sense. The difference is that if the states are part of compound state spaces, the data is copied from from to to on a component by component basis. State spaces are matched by name. If the state space for to contains any subspace whose name matches any subspace of the state space for from, the corresponding state components are copied.

Definition at line 501 of file ScopedState.h.

template<class T , class Y >
ScopedState ompl::base::operator^ ( const ScopedState< T > &  a,
const ScopedState< Y > &  b 
) [inline]

Given state a from state space A and state b from state space B, construct a state from state space A + B. The resulting state contains all the information from the input states (the states are concatenated).

Definition at line 513 of file ScopedState.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


ompl
Author(s): Ioan Sucan/isucan@rice.edu, Mark Moll/mmoll@rice.edu, Lydia Kavraki/kavraki@rice.edu
autogenerated on Fri Jan 11 09:33:55 2013