RobWorkProject  23.9.11-
Public Member Functions | List of all members
StatelessData< DATA > Class Template Reference

class for enabling statelessness in classes that are data containers More...

#include <StatelessData.hpp>

Public Member Functions

 StatelessData (int dN=1)
 constructor More...
 
 StatelessData (int dN, rw::core::Ptr< StateCache > cache)
 constructor More...
 
virtual ~StatelessData ()
 destructor
 
void init (State &state)
 initialize this stateless data to a specific state More...
 
DATA * getArray (const rw::kinematics::State &state)
 get the data from the state More...
 
DATA & get (const rw::kinematics::State &state)
 get the data from the state More...
 
const DATA & get (const rw::kinematics::State &state) const
 get the data from the state More...
 
DATA & get (int i, const rw::kinematics::State &state)
 get the data from the state More...
 
const DATA & get (int i, const rw::kinematics::State &state) const
 get the data from the state More...
 
void set (const DATA &data, rw::kinematics::State &state)
 set data element in state More...
 
void set (const DATA &data, int i, rw::kinematics::State &state)
 set data element in state More...
 
int getN () const
 number of array elements More...
 
template<class CACHE_TYPE >
CACHE_TYPE * getStateCache (rw::kinematics::State &state) const
 get the cache of this statedata object. If it has no cache then the returned pointer will be NULL. More...
 
template<class CACHE_TYPE >
CACHE_TYPE * getStateCache (const rw::kinematics::State &state) const
 get the cache of this statedata object. If it has no cache then the returned pointer will be NULL. More...
 
rw::core::Ptr< StateDatagetStateData ()
 Get the state data. More...
 

Detailed Description

template<class DATA>
class rw::kinematics::StatelessData< DATA >

class for enabling statelessness in classes that are data containers

Constructor & Destructor Documentation

◆ StatelessData() [1/2]

StatelessData ( int  dN = 1)
inline

constructor

Parameters
dN[in] the number of elements of type DATA that should be allocated in the state.

◆ StatelessData() [2/2]

StatelessData ( int  dN,
rw::core::Ptr< StateCache cache 
)
inline

constructor

Parameters
dN[in] the number of elements of type DATA that should be allocated in the state.
cache[in] data cache.

Member Function Documentation

◆ get() [1/4]

DATA& get ( const rw::kinematics::State state)
inline

get the data from the state

Parameters
state[in] the state in which the data is saved
Returns
reference to data

◆ get() [2/4]

const DATA& get ( const rw::kinematics::State state) const
inline

get the data from the state

Parameters
state[in] the state in which the data is saved
Returns
reference to data

◆ get() [3/4]

DATA& get ( int  i,
const rw::kinematics::State state 
)
inline

get the data from the state

Parameters
i[in] the index of the data.
state[in] the state in which the data is saved
Returns
reference to data

◆ get() [4/4]

const DATA& get ( int  i,
const rw::kinematics::State state 
) const
inline

get the data from the state

Parameters
i[in] the index of the data.
state[in] the state in which the data is saved
Returns
reference to data

◆ getArray()

DATA* getArray ( const rw::kinematics::State state)
inline

get the data from the state

Parameters
state[in] the state in which the data is saved
Returns
reference to data

◆ getN()

int getN ( ) const
inline

number of array elements

Returns
number of elements in array

◆ getStateCache() [1/2]

CACHE_TYPE* getStateCache ( const rw::kinematics::State state) const
inline

get the cache of this statedata object. If it has no cache then the returned pointer will be NULL.

Parameters
state[in] state in which to get cache from.
Returns

◆ getStateCache() [2/2]

CACHE_TYPE* getStateCache ( rw::kinematics::State state) const
inline

get the cache of this statedata object. If it has no cache then the returned pointer will be NULL.

Parameters
state[in] state in which to get cache from.
Returns

◆ getStateData()

rw::core::Ptr<StateData> getStateData ( )
inline

Get the state data.

Returns
state data.

◆ init()

void init ( State state)
inline

initialize this stateless data to a specific state

Parameters
state[in] the state in which to register the data.
Note
the data will be registered in the state structure of the state and any copies or other instances of the state will therefore also contain the added states.

◆ set() [1/2]

void set ( const DATA &  data,
int  i,
rw::kinematics::State state 
)
inline

set data element in state

Parameters
data[in] data to copy into state
i[in] the index of the data.
state[in] the state in which to change data

◆ set() [2/2]

void set ( const DATA &  data,
rw::kinematics::State state 
)
inline

set data element in state

Parameters
data[in] data to copy into state
state[in] the state in which to change data

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