Package org.robwork.sdurw_kinematics
Class StateDataPtr
- java.lang.Object
-
- org.robwork.sdurw_kinematics.StateDataPtr
-
public class StateDataPtr extends java.lang.ObjectPtr stores a pointer and optionally takes ownership of the value.
-
-
Constructor Summary
Constructors Constructor Description StateDataPtr()Default constructor yielding a NULL-pointer.StateDataPtr(long cPtr, boolean cMemoryOwn)StateDataPtr(StateData 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 StateData__ref__()Dereferencing operator.StateDataCPtrcptr()voiddelete()StateDataderef()The pointer stored in the object.booleanequals(StateData p)StateCachePtrgetCache(State state)Get the cache.static longgetCPtr(StateDataPtr obj)vector_dgetData(State state)An array of length size() containing the values for
the state data.
It is OK to call this method also for a StateData with zero size.
StateCachePtrgetDefaultCache()Get default cache.StateDatagetDeref()Member access operator.intgetID()An integer ID for the StateData.
IDs are assigned to the state data upon insertion State.
StateData that are not in a State have an ID of -1.
StateData present in different trees may have identical IDs.
IDs are used for the efficient implementation of State.java.lang.StringgetName()The name of the state data.
StateStructuregetStateStructure()Get the state structure.booleanhasCache()Check is state data includes a cache.booleanisNull()checks if the pointer is nullbooleanisShared()check if this Ptr has shared ownership or none
ownershipbooleannotEqual(StateData rhs)Check if not equalvoidsetCache(StateCachePtr cache, State state)Set the cache values.voidsetData(State state, double val)Assign for state data the size() of values of the array
vals.
The array vals must be of length at least size().
voidsetData(State state, vector_d vals)Assign for state data the size() of values of the array
vals.
The array vals must be of length at least size().
intsize()The number of doubles allocated by this StateData in
each State object.
-
-
-
Constructor Detail
-
StateDataPtr
public StateDataPtr(long cPtr, boolean cMemoryOwn)
-
StateDataPtr
public StateDataPtr()
Default constructor yielding a NULL-pointer.
-
StateDataPtr
public StateDataPtr(StateData ptr)
Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
-
Method Detail
-
getCPtr
public static long getCPtr(StateDataPtr obj)
-
delete
public void delete()
-
deref
public StateData deref()
The pointer stored in the object.
-
__ref__
public StateData __ref__()
Dereferencing operator.
-
getDeref
public StateData getDeref()
Member access operator.
-
equals
public boolean equals(StateData 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 StateDataCPtr cptr()
-
getID
public int getID()
An integer ID for the StateData.
IDs are assigned to the state data upon insertion State.
StateData that are not in a State have an ID of -1.
StateData present in different trees may have identical IDs.
IDs are used for the efficient implementation of State. Normally,
you should not make use of StateData IDs yourself.
- Returns:
- An integer ID for the frame.
-
getName
public java.lang.String getName()
The name of the state data.
- Returns:
- The name of the state data.
-
size
public int size()
The number of doubles allocated by this StateData in
each State object.
- Returns:
- The number of doubles allocated by the StateData
-
setData
public void setData(State state, vector_d vals)
Assign for state data the size() of values of the array
vals.
The array vals must be of length at least size().
- Parameters:
state- [inout] The state to which vals are written.
vals- [in] The joint values to assign.
setData() and getData() are related as follows:
data.setData(state, q_in); const double* q_out = data.getData(state); for (int i = 0; i < data.getDOF(); i++) q_in[i] == q_out[i];
-
setData
public void setData(State state, double val)
Assign for state data the size() of values of the array
vals.
The array vals must be of length at least size().
- Parameters:
state- [inout] The state to which vals are written.
setData() and getData() are related as follows:
data.setData(state, q_in); const double* q_out = data.getData(state); for (int i = 0; i < data.getDOF(); i++) q_in[i] == q_out[i];
-
hasCache
public boolean hasCache()
Check is state data includes a cache.- Returns:
- true if cache, false otherwise.
-
getCache
public StateCachePtr getCache(State state)
Get the cache.- Parameters:
state- [in] the state.- Returns:
- the cache.
-
getDefaultCache
public StateCachePtr getDefaultCache()
Get default cache.- Returns:
- the cache.
-
setCache
public void setCache(StateCachePtr cache, State state)
Set the cache values.- Parameters:
cache- [in] the cache.state- [in/out] state updated with new cache.
-
getStateStructure
public StateStructure getStateStructure()
Get the state structure.- Returns:
- the state structure.
-
notEqual
public boolean notEqual(StateData rhs)
Check if not equal- Parameters:
rhs- [in] the StateData to compare with- Returns:
- true if not equal
-
-