25#ifndef _mtsStateTable_h
26#define _mtsStateTable_h
87 void ToStreamRaw(std::ostream & outputStream,
const char delimiter =
' ',
88 bool headerOnly =
false,
const std::string & headerPrefix =
"")
const override;
168 template <
class _elementType>
174 value_ref_type * Current;
179 AccessorBase(table, id), History(*history), Current(data) {}
182 History.Element(when.
Index()).ToStream(outputStream);
186 data = History.Element(when.
Index());
187 return Table.ValidateReadIndex(when);
193 if (!
Table.ValidateReadIndex(when))
196 return &(History.Element(when.
Index()));
200 value_type* pdata =
dynamic_cast<value_type*
>(&data);
202 return Get(when, *pdata);
204 value_ref_type* pref =
dynamic_cast<value_ref_type*
>(&data);
206 return Get(when, *pref);
212 return Get(
Table.GetIndexReader(), data);
215 return Get(
Table.GetIndexReader(), data);
219 return Get(
Table.GetIndexDelayed(), data);
222 return Get(
Table.GetIndexDelayed(), data);
279 std::vector<mtsStateIndex::TimeTicksType>
Ticks;
353 return this->AutomaticAdvanceFlag;
358 this->AutomaticAdvanceFlag = automaticAdvance;
368 template <
class _elementType>
372 template <
class _elementType>
373 void AddData(_elementType & element,
const std::string & name =
"") {
379 template <
class _elementType>
393 template<
class _elementType>
412 template<
class _elementType>
414 CMN_LOG_RUN_WARNING <<
"mtsStateTable::GetAccessor is deprecated, use GetAccessorBy{Instance,Name,Id}" << std::endl;
418 CMN_LOG_RUN_WARNING <<
"mtsStateTable::GetAccessor is deprecated, use GetAccessorBy{Instance,Name,Id}" << std::endl;
422 CMN_LOG_RUN_WARNING <<
"mtsStateTable::GetAccessor is deprecated, use GetAccessorBy{Instance,Name,Id}" << std::endl;
426 CMN_LOG_RUN_WARNING <<
"mtsStateTable::GetAccessor is deprecated, use GetAccessorBy{Instance,Name,Id}" << std::endl;
464 return this->Tic.
Data;
468 return this->Toc.
Data;
472 return this->HistoryLength;
476 return this->StateVector.size();
494 void Debug(std::ostream & out,
unsigned int * listColumn,
unsigned int number)
const;
502 void CSVWrite(std::ostream & out,
bool nonZeroOnly =
false);
503 void CSVWrite(std::ostream & out,
unsigned int * listColumn,
unsigned int number,
bool nonZeroOnly =
false);
528 return object->GetName();
532template <
class _elementType>
534 return "mtsStateTable::Accessor";
537template <
class _elementType>
554template <
class _elementType>
Base class for high level objects.
Definition cmnGenericObject.h:53
Definition mtsFunctionVoid.h:36
Definition mtsFunctionWrite.h:37
Base class for data object in cisstMultiTask.
Definition mtsGenericObject.h:52
mtsGenericObject(void)
Definition mtsGenericObject.h:77
value_type Data
Definition mtsGenericObjectProxy.h:385
static bool IsEqual(const T &obj1, const mtsGenericObject &obj2)
Definition mtsGenericObjectProxy.h:689
static FinalRefType * ConditionalWrap(T &obj)
Definition mtsGenericObjectProxy.h:688
mtsGenericTypesImpl< T, cmnIsDerivedFrom< T, mtsGenericObject >::IS_DERIVED >::FinalRefType FinalRefType
Definition mtsGenericObjectProxy.h:687
mtsGenericTypesImpl< T, cmnIsDerivedFrom< T, mtsGenericObject >::IS_DERIVED >::FinalType FinalType
Definition mtsGenericObjectProxy.h:686
Definition mtsIntervalStatistics.h:45
Definition mtsStateArray.h:47
mtsStateArray(const value_type &objectExample, size_type size=0)
Definition mtsStateArray.h:62
Definition mtsStateIndex.h:50
TimeTicksType Ticks(void) const
Definition mtsStateIndex.h:98
int Index(void) const
Definition mtsStateIndex.h:93
Definition mtsStateTable.h:158
const mtsStateTable & Table
Definition mtsStateTable.h:160
AccessorBase(const mtsStateTable &table, mtsStateDataId id)
Definition mtsStateTable.h:163
virtual ~AccessorBase()
Definition mtsStateTable.h:164
mtsStateDataId Id
Definition mtsStateTable.h:161
virtual void ToStream(std::ostream &outputStream, const mtsStateIndex &when) const =0
Definition mtsStateTable.h:169
bool GetDelayed(mtsGenericObject &data) const
Definition mtsStateTable.h:221
bool GetDelayed(value_type &data) const
Definition mtsStateTable.h:218
const value_type * GetPointer(const mtsStateIndex &when) const
Definition mtsStateTable.h:192
bool GetLatest(mtsGenericObject &data) const
Definition mtsStateTable.h:214
bool Get(const mtsStateIndex &when, value_type &data) const
Definition mtsStateTable.h:185
bool Get(const mtsStateIndex &when, mtsGenericObject &data) const
Definition mtsStateTable.h:199
void SetCurrent(const value_type &data)
Definition mtsStateTable.h:224
Accessor(const mtsStateTable &table, mtsStateDataId id, const mtsStateArray< value_type > *history, value_ref_type *data)
Definition mtsStateTable.h:177
bool GetLatest(value_type &data) const
Definition mtsStateTable.h:211
void ToStream(std::ostream &outputStream, const mtsStateIndex &when) const
Definition mtsStateTable.h:181
Definition mtsStateTable.h:94
double TimeOfLastProgressEvent
Definition mtsStateTable.h:126
mtsFunctionWrite BatchReady
Definition mtsStateTable.h:131
size_t BatchCounter
Definition mtsStateTable.h:117
bool Collecting
Definition mtsStateTable.h:98
DataCollectionInfo(void)
Definition mtsStateTable.h:145
double StartTime
Definition mtsStateTable.h:103
~DataCollectionInfo()
Definition mtsStateTable.h:154
mtsFunctionVoid CollectionStarted
Definition mtsStateTable.h:135
double StopTime
Definition mtsStateTable.h:108
mtsStateTable::IndexRange BatchRange
Definition mtsStateTable.h:111
double TimeIntervalForProgressEvent
Definition mtsStateTable.h:123
size_t BatchSize
Definition mtsStateTable.h:114
mtsFunctionWrite Progress
Definition mtsStateTable.h:142
mtsFunctionWrite CollectionStopped
Definition mtsStateTable.h:139
size_t CounterForEvent
Definition mtsStateTable.h:120
Definition mtsStateTable.h:81
mtsStateIndex Last
Definition mtsStateTable.h:85
mtsStateIndex First
Definition mtsStateTable.h:84
void ToStreamRaw(std::ostream &outputStream, const char delimiter=' ', bool headerOnly=false, const std::string &headerPrefix="") const override
Definition mtsStateTable.h:67
mtsDouble Toc
Definition mtsStateTable.h:291
void Debug(std::ostream &out, unsigned int *listColumn, unsigned int number) const
mtsStateDataId PeriodId
Definition mtsStateTable.h:283
void AddData(_elementType &element, const std::string &name="")
Definition mtsStateTable.h:373
bool SetSize(const size_t size)
void AdvanceIfAutomatic(void)
mtsStateTable::AccessorBase * GetAccessorById(const size_t id) const
CISST_DEPRECATED mtsStateTable::AccessorBase * GetAccessor(const _elementType &element) const
Definition mtsStateTable.h:413
size_t GetNumberOfElements(void) const
Definition mtsStateTable.h:475
size_t IndexDelayed
Definition mtsStateTable.h:245
const std::vector< std::string > & GetDataNames(void) const
Definition mtsStateTable.h:479
mtsStateIndex GetIndexWriter(void) const
mtsStateTable::AccessorBase * GetAccessorByName(const std::string &name) const
size_t IndexReader
Definition mtsStateTable.h:242
std::vector< mtsStateIndex::TimeTicksType > Ticks
Definition mtsStateTable.h:279
bool mStarted
Definition mtsStateTable.h:233
mtsStateIndex GetIndexReader(void) const
const osaTimeServer * TimeServer
Definition mtsStateTable.h:286
mtsGenericObject * GetStateVectorElement(size_t id) const
Definition mtsStateTable.h:385
void SetAutomaticAdvance(bool automaticAdvance)
Definition mtsStateTable.h:357
const bool & AutomaticAdvance(void) const
Definition mtsStateTable.h:352
void CSVWrite(std::ostream &out, bool nonZeroOnly=false)
mtsDouble Period
Definition mtsStateTable.h:295
void CSVWrite(std::ostream &out, mtsGenericObject **listColumn, unsigned int number, bool nonZeroOnly=false)
CISST_DEPRECATED mtsStateTable::AccessorBase * GetAccessor(const char *name) const
Definition mtsStateTable.h:421
double AveragePeriod
Definition mtsStateTable.h:306
double SumOfPeriods
Definition mtsStateTable.h:303
std::vector< AccessorBase * > StateVectorAccessors
Definition mtsStateTable.h:275
void StartIfAutomatic(void)
friend class mtsCollectorBaseTest
Definition mtsStateTable.h:75
CISST_DEPRECATED mtsStateTable::AccessorBase * GetAccessor(const size_t id) const
Definition mtsStateTable.h:425
void ToStream(std::ostream &out) const override
friend class mtsTaskTest
Definition mtsStateTable.h:73
size_t SetDelay(size_t newDelay)
std::vector< mtsStateArrayBase * > StateVector
Definition mtsStateTable.h:261
double GetToc(void) const
Definition mtsStateTable.h:467
mtsStateTable::AccessorBase * GetAccessorByName(const char *name) const
friend class mtsStateTableTest
Definition mtsStateTable.h:74
size_t HistoryLength
Definition mtsStateTable.h:236
bool Started(void) const
Definition mtsStateTable.h:441
std::vector< mtsGenericObject * > StateVectorElements
Definition mtsStateTable.h:267
bool Write(mtsStateDataId id, const mtsGenericObject &obj)
mtsStateDataId TocId
Definition mtsStateTable.h:282
void DataCollectionEventTriggeringRatio(const mtsDouble &eventTriggeringRatio)
void DataCollectionStop(const mtsDouble &delay)
friend class mtsCollectorState
Definition mtsStateTable.h:71
int GetStateVectorID(const std::string &dataName) const
mtsStateDataId TicId
Definition mtsStateTable.h:282
double GetTic(void) const
Definition mtsStateTable.h:463
bool AutomaticAdvanceFlag
Definition mtsStateTable.h:258
const std::string & GetName(void) const
Definition mtsStateTable.h:508
_elementType * GetStateDataElement(mtsStateDataId id) const
Definition mtsStateTable.h:380
void CSVWrite(std::ostream &out, unsigned int *listColumn, unsigned int number, bool nonZeroOnly=false)
void GetIndexReader(mtsStateIndex &timeIndex) const
Definition mtsStateTable.h:334
void DataCollectionStart(const mtsDouble &delay)
double GetAveragePeriod(void) const
Definition mtsStateTable.h:485
std::string Name
Definition mtsStateTable.h:309
bool ValidateReadIndex(const mtsStateIndex &timeIndex) const
Definition mtsStateTable.h:347
std::vector< std::string > StateVectorDataNames
Definition mtsStateTable.h:271
CISST_DEPRECATED mtsStateTable::AccessorBase * GetAccessor(const std::string &name) const
Definition mtsStateTable.h:417
mtsStateIndex GetIndexDelayed(void) const
DataCollectionInfo DataCollection
Definition mtsStateTable.h:313
friend class mtsComponent
Definition mtsStateTable.h:72
mtsIntervalStatistics PeriodStats
Definition mtsStateTable.h:298
size_t GetHistoryLength(void) const
Definition mtsStateTable.h:471
mtsDouble Tic
Definition mtsStateTable.h:291
mtsStateTable(size_t size, const std::string &name)
size_t IndexWriter
Definition mtsStateTable.h:239
size_t Delay
Definition mtsStateTable.h:249
mtsStateDataId NewElement(const std::string &name="", _elementType *element=0)
Definition mtsStateTable.h:538
mtsStateTable::AccessorBase * GetAccessorByInstance(const _elementType &element) const
Definition mtsStateTable.h:555
Class for relative time.
Definition osaTimeServer.h:74
Class registration macros.
#define CMN_DECLARE_SERVICES_INSTANTIATION(className)
Definition cmnClassRegisterMacros.h:199
const int CMN_NO_DYNAMIC_CREATION
Definition cmnClassRegisterMacros.h:325
const int CMN_DYNAMIC_CREATION
Definition cmnClassRegisterMacros.h:328
#define CISST_EXPORT
Definition cmnExportMacros.h:50
Defines cmnGenericObject.
#define CMN_LOG_ALLOW_DEFAULT
Definition cmnLogLoD.h:76
#define CMN_LOG_RUN_WARNING
Definition cmnLogger.h:167
#define CMN_UNUSED(argument)
Definition cmnPortability.h:497
#define CISST_DEPRECATED
Definition cmnPortability.h:314
std::string mtsObjectName(const mtsComponent *object)
Definition mtsComponent.h:588
Forward declarations and #define for cisstMultiTask.
Defines the command interfaces.
Defines a function object to use a void command (mtsCommandVoid).
Defines the command interfaces.
mtsGenericObjectProxy< double > mtsDouble
Definition mtsGenericObjectProxy.h:747
Statistical analysis for periodic signals.
Defines a state data array used in a state table.
Defines a base class the state data array.
Defines an index used for mtsStateTable.
mtsStateTable::IndexRange mtsStateTableIndexRange
Definition mtsStateTable.h:521
int mtsStateDataId
Definition mtsStateTable.h:52
size_type size(void) const
Definition vctDynamicConstMatrixBase.h:228