cisst-saw
Loading...
Searching...
No Matches
mtsStateArray< _elementType > Class Template Reference

#include <mtsStateArray.h>

Inheritance diagram for mtsStateArray< _elementType >:
mtsStateArrayBase

Public Types

typedef _elementType value_type
typedef std::vector< value_typeVectorType
typedef VectorType::iterator iterator
typedef VectorType::const_iterator const_iterator
Public Types inherited from mtsStateArrayBase
typedef size_t index_type
typedef size_t size_type

Public Member Functions

 mtsStateArray (const value_type &objectExample, size_type size=0)
virtual ~mtsStateArray ()
bool SetDataSize (const size_t size)
const value_typeElement (index_type index) const
value_typeElement (index_type index)
mtsGenericObjectoperator[] (index_type index)
const mtsGenericObjectoperator[] (index_type index) const
mtsStateArrayBaseCreate (const mtsGenericObject *objectExample, size_type size)
void Copy (index_type indexTo, index_type indexFrom)
bool Get (index_type index, mtsGenericObject &object) const
bool Set (index_type index, const mtsGenericObject &object)
Public Member Functions inherited from mtsStateArrayBase
virtual ~mtsStateArrayBase (void)
bool SetSize (const size_t size)

Protected Attributes

VectorType Data
Protected Attributes inherited from mtsStateArrayBase
const cmnClassServicesBaseDataClassServices

Additional Inherited Members

Protected Member Functions inherited from mtsStateArrayBase
 mtsStateArrayBase (void)

Detailed Description

template<class _elementType>
class mtsStateArray< _elementType >

Individual state array classes can be created from an instance of the following template, where _elementType represents the type of data used by the particular state element. It is assumed that _elementType is derived from mtsGenericObject.

Member Typedef Documentation

◆ const_iterator

template<class _elementType>
typedef VectorType::const_iterator mtsStateArray< _elementType >::const_iterator

◆ iterator

template<class _elementType>
typedef VectorType::iterator mtsStateArray< _elementType >::iterator

◆ value_type

template<class _elementType>
typedef _elementType mtsStateArray< _elementType >::value_type

◆ VectorType

template<class _elementType>
typedef std::vector<value_type> mtsStateArray< _elementType >::VectorType

Constructor & Destructor Documentation

◆ mtsStateArray()

template<class _elementType>
mtsStateArray< _elementType >::mtsStateArray ( const value_type & objectExample,
size_type size = 0 )
inline

Default constructor. Does nothing

◆ ~mtsStateArray()

template<class _elementType>
virtual mtsStateArray< _elementType >::~mtsStateArray ( )
inlinevirtual

Default destructor.

Member Function Documentation

◆ Copy()

template<class _elementType>
void mtsStateArray< _elementType >::Copy ( index_type indexTo,
index_type indexFrom )
inlinevirtual

Copy data from one index to another within the same array.

Implements mtsStateArrayBase.

◆ Create()

template<class _elementType>
mtsStateArrayBase * mtsStateArray< _elementType >::Create ( const mtsGenericObject * objectExample,
size_type size )
inlinevirtual

Create the array of data. This is currently unused.

Implements mtsStateArrayBase.

◆ Element() [1/2]

template<class _elementType>
value_type & mtsStateArray< _elementType >::Element ( index_type index)
inline

◆ Element() [2/2]

template<class _elementType>
const value_type & mtsStateArray< _elementType >::Element ( index_type index) const
inline

Access element at index. This returns the data of the derived type (value_type) rather than the base type (mtsGenericObject), which is returned by the overloaded operator [].

◆ Get()

template<class _elementType>
bool mtsStateArray< _elementType >::Get ( index_type index,
mtsGenericObject & object ) const
virtual

Get and Set data from array. The Get and Set member functions deserve special mention because they must overcome a limitation of C++ – namely, that it does not fully support containers of heterogeneous objects. In particular, we expect the 'object' parameter to be of type _elementType& (the derived class) rather than mtsGenericObject& (the base class). This can be handled using C++ Run Time Type Information (RTTI) features such as dynamic cast.

Implements mtsStateArrayBase.

◆ operator[]() [1/2]

template<class _elementType>
mtsGenericObject & mtsStateArray< _elementType >::operator[] ( index_type index)
inlinevirtual

Overloaded [] operator. Returns data at index (of type mtsGenericObject). Currently used for data collection (mtsCollectorState).

Implements mtsStateArrayBase.

◆ operator[]() [2/2]

template<class _elementType>
const mtsGenericObject & mtsStateArray< _elementType >::operator[] ( index_type index) const
inlinevirtual

Overloaded subscript operator.

Implements mtsStateArrayBase.

◆ Set()

template<class _elementType>
bool mtsStateArray< _elementType >::Set ( index_type index,
const mtsGenericObject & data )
virtual

Set data in array.

Implements mtsStateArrayBase.

◆ SetDataSize()

template<class _elementType>
bool mtsStateArray< _elementType >::SetDataSize ( const size_t size)
inlinevirtual

Implements mtsStateArrayBase.

Member Data Documentation

◆ Data

template<class _elementType>
VectorType mtsStateArray< _elementType >::Data
protected

A vector to store the data. These element of the vector represents the cell of the state data table.


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