RobWorkProject  24.5.15-
Public Member Functions | Friends | List of all members
StateSetup Class Reference

Utility class to help construct a State. More...

#include <StateSetup.hpp>

Public Member Functions

 StateSetup ()
 Creates an empty StateSetup.
 
 StateSetup (int version, StateStructure &tree, const std::vector< rw::core::Ptr< StateData >> &stateDatas)
 Creates a StateSetup from a StateStructure and a number of valid statedata. More...
 
 ~StateSetup ()
 destructor
 
int getOffset (const StateData &data) const
 The position in QState at which the configuration for frame is stored.
 
int getCacheIdx (const StateData &data) const
 Get the position in cache list where data is stored. More...
 
int size () const
 The total number of doubles allocated by all valid state data in the StateSetup. More...
 
int getVersion () const
 gets the version of the StateSetup More...
 
const FramegetFrame (int id) const
 gets the frame with index idx More...
 
FramegetFrame (int id)
 gets the frame with index idx More...
 
int getChildListIdx (rw::core::Ptr< const Frame > parent) const
 gets the index that maps a frame parent into all its daf children. More...
 
int getMaxChildListIdx () const
 gets the number of valid frames in the state setup
 
const std::vector< Frame * > & getDafs () const
 gets the list of DAFs that are valid in this state setup More...
 
int getDAFIdx (rw::core::Ptr< const Frame > daf) const
 gets the index that maps a DAF into its position in the TreeState daf list More...
 
int getMaxDAFIdx () const
 gets the nr of valid DAFs in the state setup More...
 
const StateStructuregetTree () const
 gets the state structure that the state setup is part of. More...
 
StateStructuregetTree ()
 gets the state structure that the state setup is part of. More...
 
const std::vector< rw::core::Ptr< StateData > > & getStateData () const
 gets all valid state data of the state setup. More...
 
int getCacheIdx (int id) const
 Get the position in cache list where state data with id is stored. More...
 
int getMaxCacheIdx () const
 Get the maximum number of caches possible. More...
 

Friends

class StateData
 

Detailed Description

Utility class to help construct a State.

StateSetup contains the data to share among QState objects and TreeState objects, namely the assignment of offsets to frames, the mapping of frame indexes to indexes in the QState, the mapping of frame indexes to daf and dafparent index in the TreeState,

Constructor & Destructor Documentation

◆ StateSetup()

StateSetup ( int  version,
StateStructure tree,
const std::vector< rw::core::Ptr< StateData >> &  stateDatas 
)
explicit

Creates a StateSetup from a StateStructure and a number of valid statedata.

Parameters
version[in] the version of the StateSetup
tree[in]
stateDatas[in] a list of valid statedatas for this version

Member Function Documentation

◆ getCacheIdx() [1/2]

int getCacheIdx ( const StateData data) const
inline

Get the position in cache list where data is stored.

Parameters
data[in] the data to look for.
Returns
the id or a negative value if not found.

◆ getCacheIdx() [2/2]

int getCacheIdx ( int  id) const
inline

Get the position in cache list where state data with id is stored.

Parameters
id[in] state data id.
Returns
the id or a negative value if not found.

◆ getChildListIdx()

int getChildListIdx ( rw::core::Ptr< const Frame parent) const
inline

gets the index that maps a frame parent into all its daf children.

Parameters
parent[in] the parent to the children list
Returns
index into the childlist array in tree state

◆ getDAFIdx()

int getDAFIdx ( rw::core::Ptr< const Frame daf) const
inline

gets the index that maps a DAF into its position in the TreeState daf list

Parameters
daf[in] the daf frame
Returns
index into the TreeState daf list

◆ getDafs()

const std::vector<Frame*>& getDafs ( ) const
inline

gets the list of DAFs that are valid in this state setup

Returns
list of DAFs

◆ getFrame() [1/2]

Frame* getFrame ( int  id)
inline

gets the frame with index idx

Parameters
id[in] the unique id of the frame
Returns
the frame with id id, else NULL

◆ getFrame() [2/2]

const Frame* getFrame ( int  id) const
inline

gets the frame with index idx

Parameters
id[in] the unique id of the frame
Returns
the frame with id id, else NULL

◆ getMaxCacheIdx()

int getMaxCacheIdx ( ) const
inline

Get the maximum number of caches possible.

Returns
number of caches.

◆ getMaxDAFIdx()

int getMaxDAFIdx ( ) const
inline

gets the nr of valid DAFs in the state setup

Returns
nr of valid DAFs

◆ getStateData()

const std::vector<rw::core::Ptr<StateData> >& getStateData ( ) const
inline

gets all valid state data of the state setup.

Returns
list of valid state datas
Note
elements in the list is invalid if they are NULL

◆ getTree() [1/2]

StateStructure* getTree ( )
inline

gets the state structure that the state setup is part of.

Returns
state structure

◆ getTree() [2/2]

const StateStructure* getTree ( ) const
inline

gets the state structure that the state setup is part of.

Returns
state structure

◆ getVersion()

int getVersion ( ) const
inline

gets the version of the StateSetup

Returns
the version of the state setup

◆ size()

int size ( ) const
inline

The total number of doubles allocated by all valid state data in the StateSetup.

Returns
the total number of allocated doubles
Note
This number equals the length of the QState array.

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