DataSeriesType.h
55 lines
| 1.4 KiB
| text/x-c
|
CLexer
r0 | #ifndef SCIQLOP_DATASERIESTYPE_H | |||
#define SCIQLOP_DATASERIESTYPE_H | ||||
r75 | #include <Data/MultiComponentTimeSerie.h> | |||
r68 | #include <Data/ScalarTimeSerie.h> | |||
#include <Data/SpectrogramTimeSerie.h> | ||||
#include <Data/VectorTimeSerie.h> | ||||
r0 | #include <QString> | |||
r60 | enum class DataSeriesType | |||
{ | ||||
r62 | NONE, | |||
r60 | SCALAR, | |||
VECTOR, | ||||
r75 | MULTICOMPONENT, | |||
r62 | SPECTROGRAM | |||
r60 | }; | |||
r0 | ||||
r60 | struct DataSeriesTypeUtils | |||
{ | ||||
static DataSeriesType fromString(const QString& type) | ||||
{ | ||||
if(type.toLower() == QStringLiteral("scalar")) | ||||
{ return DataSeriesType::SCALAR; } | ||||
else if(type.toLower() == QStringLiteral("spectrogram")) | ||||
{ | ||||
return DataSeriesType::SPECTROGRAM; | ||||
} | ||||
else if(type.toLower() == QStringLiteral("vector")) | ||||
{ | ||||
return DataSeriesType::VECTOR; | ||||
} | ||||
r75 | else if(type.toLower() == QStringLiteral("multicomponent")) | |||
{ | ||||
return DataSeriesType::MULTICOMPONENT; | ||||
} | ||||
r60 | else | |||
r0 | { | |||
r62 | return DataSeriesType::NONE; | |||
r0 | } | |||
r60 | } | |||
r68 | static DataSeriesType type(TimeSeries::ITimeSerie* ts) | |||
{ | ||||
if(!ts) return DataSeriesType::NONE; | ||||
if(dynamic_cast<ScalarTimeSerie*>(ts)) return DataSeriesType::SCALAR; | ||||
if(dynamic_cast<VectorTimeSerie*>(ts)) return DataSeriesType::VECTOR; | ||||
r75 | if(dynamic_cast<MultiComponentTimeSerie*>(ts)) | |||
return DataSeriesType::MULTICOMPONENT; | ||||
r68 | if(dynamic_cast<SpectrogramTimeSerie*>(ts)) | |||
return DataSeriesType::SPECTROGRAM; | ||||
return DataSeriesType::NONE; | ||||
} | ||||
r0 | }; | |||
#endif // SCIQLOP_DATASERIESTYPE_H | ||||