Package org.robwork.sdurw_kinematics
Class StateStructurePtr
- java.lang.Object
-
- org.robwork.sdurw_kinematics.StateStructurePtr
-
public class StateStructurePtr extends java.lang.ObjectPtr stores a pointer and optionally takes ownership of the value.
-
-
Constructor Summary
Constructors Constructor Description StateStructurePtr()Default constructor yielding a NULL-pointer.StateStructurePtr(long cPtr, boolean cMemoryOwn)StateStructurePtr(StateStructure ptr)Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StateStructure__ref__()Dereferencing operator.voidaddDAF(FramePtr frame, FramePtr parent)adds a DAF to the frame tree and dynamicly associates
the frame with a parent frame.
Note: the parent frame must exist in the frame tree and cannot be
NULL.voidaddData(StateData data)adds a statedata to the frame tree and allocates memory
for its states.voidaddData(StateDataPtr data)adds a statedata to the frame tree and allocates memory
for its states.voidaddFrame(FramePtr frame)adds a frame to the frame tree and statically associates
the frame with the parent frame.voidaddFrame(FramePtr frame, FramePtr parent)adds a frame to the frame tree and statically associates
the frame with the parent frame.voidcleanup()destructs all frames and statedata that is not used any more.voidcleanup(int ID)destructs all frames and statedata that is not used any more.StateStructureCPtrcptr()voiddelete()StateStructurederef()The pointer stored in the object.booleanequals(StateStructure p)StateDataPtrfindData(java.lang.String name)Find data from name.FramefindFrame(java.lang.String name)Returns frame with the specified name.
If multiple frames has the same name, the first frame encountered
will be returned.static longgetCPtr(StateStructurePtr obj)FrameVectorgetDAFs()All DAFs of the tree.
StategetDefaultState()get the default state of the frame treeStateStructuregetDeref()Member access operator.FrameVectorgetFrames()All frames of the tree.intgetMaxID()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).FramegetRoot()get root of state structureVectorStateDataPtrgetStateData()All state data in the tree.booleanhas(StateDataCPtr data)tests if StateData data exist in this StateStructure
booleanisNull()checks if the pointer is nullbooleanisShared()check if this Ptr has shared ownership or none
ownershipvoidremove(StateDataPtr data)removes a StateData object from the tree.voidsetDefaultState(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.StateupgradeState(State oldState)upgrades the state to the default state, but without
clearing the values of the state.
-
-
-
Constructor Detail
-
StateStructurePtr
public StateStructurePtr(long cPtr, boolean cMemoryOwn)
-
StateStructurePtr
public StateStructurePtr()
Default constructor yielding a NULL-pointer.
-
StateStructurePtr
public StateStructurePtr(StateStructure ptr)
Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
-
Method Detail
-
getCPtr
public static long getCPtr(StateStructurePtr obj)
-
delete
public void delete()
-
deref
public StateStructure deref()
The pointer stored in the object.
-
__ref__
public StateStructure __ref__()
Dereferencing operator.
-
getDeref
public StateStructure getDeref()
Member access operator.
-
equals
public boolean equals(StateStructure p)
-
isShared
public boolean isShared()
check if this Ptr has shared ownership or none
ownership- Returns:
- true if Ptr has shared ownership, false if it has no ownership.
-
isNull
public boolean isNull()
checks if the pointer is null- Returns:
- Returns true if the pointer is null
-
cptr
public StateStructureCPtr cptr()
-
has
public boolean has(StateDataCPtr data)
tests if StateData data exist in this StateStructure
- Returns:
- true if the data was found, false otherwise
Note: the search includes the union of StateData in all
StateSetup's that belong to the StateStructure
-
getMaxID
public int getMaxID()
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).
-
addData
public void addData(StateData data)
adds a statedata to the frame tree and allocates memory
for its states. This method updates the default
state.
Note: Ownership is taken, the data object may not have been added to
any StateStructure before.
-
addData
public void addData(StateDataPtr data)
adds a statedata to the frame tree and allocates memory
for its states. This method updates the default
state.
Note: Ownership is not taken, the data object may not have been added to
any StateStructure before.
-
addFrame
public void addFrame(FramePtr frame, FramePtr parent)
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.
-
addFrame
public void addFrame(FramePtr frame)
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.
-
addDAF
public void addDAF(FramePtr frame, FramePtr parent)
adds a DAF to the frame tree and dynamicly associates
the frame with a parent frame.
Note: the parent frame must exist in the frame tree and cannot be
NULL.
-
remove
public void remove(StateDataPtr data)
removes a StateData object from the tree. The actual
deletion of the object will happen when no States depend on
the StateData anymore.- Parameters:
data- [in] pointer to object that is to be removed
Note: if the data object is a frame and it has staticly connected
children then the remove operation is illigal.
Note: if the data object is a frame and it has dynamicly attached
children then all of these will change parent relation ship such that
world will become their parent.
-
upgradeState
public State upgradeState(State oldState)
upgrades the state to the default state, but without
clearing the values of the state.- Parameters:
oldState- [in] the state that should be upgraded- Returns:
- the upgraded state
-
getDefaultState
public State getDefaultState()
get the default state of the frame tree- Returns:
- the default tree state
-
setDefaultState
public void setDefaultState(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.
-
getStateData
public VectorStateDataPtr getStateData()
All state data in the tree.- Returns:
- All state data in the tree
-
getFrames
public FrameVector getFrames()
All frames of the tree. Notice that elements in
this vector can be NULL
- Returns:
- All frames of the tree.
-
getDAFs
public FrameVector getDAFs()
All DAFs of the tree.
- Returns:
- All DAFs of the tree.
-
getRoot
public Frame getRoot()
get root of state structure- Returns:
- the root frame of the StateStructure
-
cleanup
public void cleanup(int ID)
destructs all frames and statedata that is not used any more.- Parameters:
ID- [in] used to include a specific StateData ID for destruction, defualt -1 to
ignore this option.
-
cleanup
public void cleanup()
destructs all frames and statedata that is not used any more.
-
findFrame
public Frame findFrame(java.lang.String name)
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.
- Parameters:
name- [in] name of Frame.
- Returns:
- The frame with name name or NULL if no such frame.
-
findData
public StateDataPtr findData(java.lang.String name)
Find data from name.- Parameters:
name- [in] the name.- Returns:
- the data if found.
-
-