25#ifndef _mtsStateArray_h
26#define _mtsStateArray_h
45template <
class _elementType>
52 typedef typename VectorType::iterator
iterator;
73 if (
Data.size() > 0) {
99 if (typedObjectExample) {
100 this->Data.resize(
size, *typedObjectExample);
104 CMN_LOG_INIT_ERROR <<
"mtsStateArray: Create used with an object example of the wrong type, received: "
106 <<
" while expecting "
117 this->Data[indexTo] = this->Data[indexFrom];
139template <
class _elementType>
143 const _elementType *pdata =
dynamic_cast<const _elementType *
>(&object);
145 Data[index] = *pdata;
155 CMN_LOG_RUN_ERROR <<
"mtsStateArray::Set -- type mismatch, expected " <<
typeid(_elementType).name() << std::endl;
160template <
class _elementType>
162 _elementType* pdata =
dynamic_cast<_elementType*
>(&object);
164 *pdata =
Data[index];
167 CMN_LOG_RUN_ERROR <<
"mtsStateArray::Get -- type mismatch, expected " <<
typeid(_elementType).name() << std::endl;
const std::string & GetName(void) const
virtual const cmnClassServicesBase * Services(void) const =0
Base class for data object in cisstMultiTask.
Definition mtsGenericObject.h:52
static cmnClassServicesBase * ClassServices(void)
Definition mtsGenericObjectProxy.h:337
mtsGenericTypesUnwrapImpl< T, cmnIsDerivedFromTemplated< T, mtsGenericObjectProxyBase >::IS_DERIVED >::RefType RefType
Definition mtsGenericObjectProxy.h:731
size_t index_type
Definition mtsStateArrayBase.h:51
size_t size_type
Definition mtsStateArrayBase.h:52
mtsStateArrayBase(void)
Definition mtsStateArrayBase.h:45
const cmnClassServicesBase * DataClassServices
Definition mtsStateArrayBase.h:48
bool Set(index_type index, const mtsGenericObject &object)
Definition mtsStateArray.h:140
mtsStateArrayBase * Create(const mtsGenericObject *objectExample, size_type size)
Definition mtsStateArray.h:96
mtsGenericObject & operator[](index_type index)
Definition mtsStateArray.h:92
_elementType value_type
Definition mtsStateArray.h:49
mtsStateArray(const value_type &objectExample, size_type size=0)
Definition mtsStateArray.h:62
virtual ~mtsStateArray()
Definition mtsStateArray.h:68
bool SetDataSize(const size_t size)
Definition mtsStateArray.h:72
VectorType::const_iterator const_iterator
Definition mtsStateArray.h:53
VectorType Data
Definition mtsStateArray.h:58
const value_type & Element(index_type index) const
Definition mtsStateArray.h:87
std::vector< value_type > VectorType
Definition mtsStateArray.h:51
bool Get(index_type index, mtsGenericObject &object) const
Definition mtsStateArray.h:161
const mtsGenericObject & operator[](index_type index) const
Definition mtsStateArray.h:93
value_type & Element(index_type index)
Definition mtsStateArray.h:88
VectorType::iterator iterator
Definition mtsStateArray.h:52
void Copy(index_type indexTo, index_type indexFrom)
Definition mtsStateArray.h:116
#define CMN_ASSERT(expr)
Definition cmnAssert.h:97
Class register definitions and log macros.
Declaration of cmnLogger amd macros for human readable logging.
#define CMN_LOG_RUN_ERROR
Definition cmnLogger.h:166
#define CMN_LOG_INIT_ERROR
Definition cmnLogger.h:162
Defines a base class the state data array.
size_type size(void) const
Definition vctDynamicConstMatrixBase.h:228