26 #ifndef _mtsStateArray_h
27 #define _mtsStateArray_h
46 template <
class _elementType>
53 typedef typename VectorType::iterator
iterator;
65 Data(size, objectExample)
75 Data.resize(size,objectExample);
95 if (typedObjectExample) {
96 this->
Data.resize(size, *typedObjectExample);
100 CMN_LOG_INIT_ERROR <<
"mtsStateArray: Create used with an object example of the wrong type, received: "
102 <<
" while expecting "
103 << value_type::ClassServices()->GetName()
113 this->
Data[indexTo] = this->
Data[indexFrom];
135 template <
class _elementType>
139 const _elementType *pdata =
dynamic_cast<const _elementType *
>(&object);
141 Data[index] = *pdata;
146 const RefType* pref =
dynamic_cast<const RefType*
>(&object);
151 CMN_LOG_RUN_ERROR <<
"mtsStateArray::Set -- type mismatch, expected " <<
typeid(_elementType).name() << std::endl;
156 template <
class _elementType>
158 _elementType* pdata =
dynamic_cast<_elementType*
>(&object);
160 *pdata = Data[index];
163 CMN_LOG_RUN_ERROR <<
"mtsStateArray::Get -- type mismatch, expected " <<
typeid(_elementType).name() << std::endl;
167 #endif // _mtsStateArray_h
VectorType::iterator iterator
Definition: mtsStateArray.h:53
value_type & Element(index_type index)
Definition: mtsStateArray.h:84
void Copy(index_type indexTo, index_type indexFrom)
Definition: mtsStateArray.h:112
#define CMN_ASSERT(expr)
Definition: cmnAssert.h:90
#define CMN_LOG_RUN_ERROR
Definition: cmnLogger.h:166
const std::string & GetName(void) const
bool SetDataSize(const size_t size)
Definition: mtsStateArray.h:72
Class register definitions and log macros.
#define CMN_LOG_INIT_ERROR
Definition: cmnLogger.h:162
Base class for data object in cisstMultiTask.
Definition: mtsGenericObject.h:56
virtual const cmnClassServicesBase * Services(void) const =0
std::vector< value_type > VectorType
Definition: mtsStateArray.h:52
virtual ~mtsStateArray()
Definition: mtsStateArray.h:69
Declaration of cmnLogger amd macros for human readable logging.
mtsGenericObject & operator[](index_type index)
Definition: mtsStateArray.h:88
Definition: mtsStateArray.h:47
_elementType value_type
Definition: mtsStateArray.h:50
mtsStateArray(const value_type &objectExample, size_type size=0)
Definition: mtsStateArray.h:63
mtsGenericTypesUnwrapImpl< T, cmnIsDerivedFromTemplated< T, mtsGenericObjectProxyBase >::IS_DERIVED >::RefType RefType
Definition: mtsGenericObjectProxy.h:714
Defines a base class the state data array.
size_t index_type
Definition: mtsStateArrayBase.h:51
mtsStateArrayBase * Create(const mtsGenericObject *objectExample, size_type size)
Definition: mtsStateArray.h:92
Definition: mtsGenericObjectProxy.h:45
VectorType Data
Definition: mtsStateArray.h:59
VectorType::const_iterator const_iterator
Definition: mtsStateArray.h:54
bool Get(index_type index, mtsGenericObject &object) const
Definition: mtsStateArray.h:157
const mtsGenericObject & operator[](index_type index) const
Definition: mtsStateArray.h:89
size_t size_type
Definition: mtsStateArrayBase.h:52
Definition: mtsStateArrayBase.h:42
bool Set(index_type index, const mtsGenericObject &object)
Definition: mtsStateArray.h:136
const cmnClassServicesBase * DataClassServices
Definition: mtsStateArrayBase.h:45
const value_type & Element(index_type index) const
Definition: mtsStateArray.h:83