RobWorkProject
23.9.11-
|
the StateStructure is responsible for handling a structure of StateData and Frames More...
#include <StateStructure.hpp>
Public Types | |
typedef rw::core::Ptr< StateStructure > | Ptr |
smart pointer type of this class | |
typedef boost::function< void(const kinematics::StateData *)> | StateDataAddedListener |
Defines a listener for StateData added events. More... | |
typedef boost::function< void(const kinematics::StateData *)> | StateDataRemovedListener |
Defines a listener for StateData removed events. More... | |
typedef rw::core::Event< StateDataAddedListener, const kinematics::StateData * > | StateDataAddedEvent |
Defines event for StateData added. | |
typedef rw::core::Event< StateDataRemovedListener, const kinematics::StateData * > | StateDataRemovedEvent |
Defines event for StateData removed. | |
Public Member Functions | |
StateStructure () | |
constructs a frame tree with a default root frame with the name "WORLD". | |
virtual | ~StateStructure () |
destructor | |
bool | has (rw::core::Ptr< const StateData > data) |
tests if StateData data exist in this StateStructure More... | |
int | getMaxID () const |
gets the max ID of any StateData/Frame currently in the tree. More... | |
void | addData (StateData *data) |
adds a statedata to the frame tree and allocates memory for its states. This method updates the default state. More... | |
void | addData (rw::core::Ptr< StateData > data) |
adds a statedata to the frame tree and allocates memory for its states. This method updates the default state. More... | |
void | addFrame (rw::core::Ptr< Frame > frame, rw::core::Ptr< Frame > parent=NULL) |
adds a frame to the frame tree and statically associates the frame with the parent frame. This method updates the default state. More... | |
void | addDAF (rw::core::Ptr< Frame > frame, rw::core::Ptr< Frame > parent) |
adds a DAF to the frame tree and dynamicly associates the frame with a parent frame. More... | |
void | remove (rw::core::Ptr< StateData > data) |
removes a StateData object from the tree. The actual deletion of the object will happen when no States depend on the StateData anymore. More... | |
State | upgradeState (const State &oldState) |
upgrades the state to the default state, but without clearing the values of the state. More... | |
const State & | getDefaultState () const |
get the default state of the frame tree More... | |
void | setDefaultState (const State &state) |
set the default state of the dynamic frame tree if the given state is an older state then states valid in both new and old version will be copied to the default state. | |
const std::vector< rw::core::Ptr< StateData > > & | getStateData () const |
All state data in the tree. More... | |
const std::vector< Frame * > & | getFrames () const |
All frames of the tree. Notice that elements in this vector can be NULL. More... | |
const std::vector< Frame * > & | getDAFs () const |
All DAFs of the tree. More... | |
const Frame * | getRoot () const |
get root of state structure More... | |
rw::kinematics::Frame * | getRoot () |
get root of state structure More... | |
void | cleanup (int ID=-1) |
destructs all frames and statedata that is not used any more. More... | |
kinematics::Frame * | findFrame (const std::string &name) const |
Returns frame with the specified name. More... | |
rw::core::Ptr< kinematics::StateData > | findData (const std::string &name) const |
Find data from name. More... | |
StateDataAddedEvent & | stateDataAddedEvent () |
Returns StateDataAddedEvent object needed for subscription to and firing of event. More... | |
StateDataRemovedEvent & | stateDataRemovedEvent () |
Returns StateDataRemovedEvent object needed for subscription to and firing of event. More... | |
the StateStructure is responsible for handling a structure of StateData and Frames
typedef boost::function<void(const kinematics::StateData*)> StateDataAddedListener |
typedef boost::function<void(const kinematics::StateData*)> StateDataRemovedListener |
void addDAF | ( | rw::core::Ptr< Frame > | frame, |
rw::core::Ptr< Frame > | parent | ||
) |
adds a DAF to the frame tree and dynamicly associates the frame with a parent frame.
void addData | ( | rw::core::Ptr< StateData > | data | ) |
adds a statedata to the frame tree and allocates memory for its states. This method updates the default state.
void addData | ( | StateData * | data | ) |
adds a statedata to the frame tree and allocates memory for its states. This method updates the default state.
void addFrame | ( | rw::core::Ptr< Frame > | frame, |
rw::core::Ptr< Frame > | parent = NULL |
||
) |
adds a frame to the frame tree and statically associates the frame with the parent frame. This method updates the default state.
If parent frame is null then the frame will be attached to the world frame.
void cleanup | ( | int | ID = -1 | ) |
destructs all frames and statedata that is not used any more.
ID | [in] used to include a specific StateData ID for destruction, defualt -1 to ignore this option. |
rw::core::Ptr<kinematics::StateData> findData | ( | const std::string & | name | ) | const |
Find data from name.
name | [in] the name. |
kinematics::Frame* findFrame | ( | const std::string & | name | ) | const |
Returns frame with the specified name.
If multiple frames has the same name, the first frame encountered will be returned. If no frame is found, the method returns NULL.
name | [in] name of Frame. |
|
inline |
All DAFs of the tree.
const State& getDefaultState | ( | ) | const |
get the default state of the frame tree
|
inline |
All frames of the tree. Notice that elements in this vector can be NULL.
|
inline |
gets the max ID of any StateData/Frame currently in the tree.
All frame/data IDs (see StateData::getID()) for the data of the tree are lower than this number (and greater than or equal to zero).
|
inline |
get root of state structure
|
inline |
get root of state structure
|
inline |
All state data in the tree.
bool has | ( | rw::core::Ptr< const StateData > | data | ) |
tests if StateData data exist in this StateStructure
void remove | ( | rw::core::Ptr< StateData > | data | ) |
removes a StateData object from the tree. The actual deletion of the object will happen when no States depend on the StateData anymore.
data | [in] pointer to object that is to be removed |
|
inline |
Returns StateDataAddedEvent object needed for subscription to and firing of event.
|
inline |
Returns StateDataRemovedEvent object needed for subscription to and firing of event.
upgrades the state to the default state, but without clearing the values of the state.
oldState | [in] the state that should be upgraded |