##// END OF EJS Templates
Adds test cases...
Adds test cases + Fixes DataSourceItem's == operator

File last commit:

r1022:c90f619c0c69
r1081:54cb33e3c81c
Show More
AmdaResultParserHelper.h
107 lines | 3.5 KiB | text/x-c | CLexer
/ plugins / amda / include / AmdaResultParserHelper.h
Alexandre Leroux
Parser refactoring (1)...
r985 #ifndef SCIQLOP_AMDARESULTPARSERHELPER_H
#define SCIQLOP_AMDARESULTPARSERHELPER_H
Alexandre Leroux
Parser refactoring (3)...
r987 #include "AmdaResultParserDefs.h"
Alexandre Leroux
Parser refactoring (1)...
r985 #include <QtCore/QLoggingCategory>
#include <QtCore/QString>
#include <memory>
class IDataSeries;
Q_DECLARE_LOGGING_CATEGORY(LOG_AmdaResultParserHelper)
/**
* Helper used to interpret the data of an AMDA result file and generate the corresponding data
* series.
*
* It proposes methods allowing to read line by line an AMDA file and to extract the properties
* (from the header) and the values corresponding to the data series
*
* @sa DataSeries
*/
struct IAmdaResultParserHelper {
virtual ~IAmdaResultParserHelper() noexcept = default;
/// Verifies that the extracted properties are well formed and possibly applies other treatments
/// on them
/// @return true if the properties are well formed, false otherwise
virtual bool checkProperties() = 0;
/// Creates the data series from the properties and values extracted from the AMDA file.
/// @warning as the data are moved in the data series, the helper shouldn't be used after
/// calling this method
/// @return the data series created
virtual std::shared_ptr<IDataSeries> createSeries() = 0;
/// Reads a line from the AMDA file to extract a property that will be used to generate the data
/// series
/// @param line tahe line to interpret
virtual void readPropertyLine(const QString &line) = 0;
/// Reads a line from the AMDA file to extract a value that will be set in the data series
/// @param line the line to interpret
virtual void readResultLine(const QString &line) = 0;
};
Alexandre Leroux
Parser refactoring (2)...
r986 /**
* Implementation of @sa IAmdaResultParserHelper for scalars
*/
class ScalarParserHelper : public IAmdaResultParserHelper {
public:
bool checkProperties() override;
std::shared_ptr<IDataSeries> createSeries() override;
void readPropertyLine(const QString &line) override;
void readResultLine(const QString &line) override;
Alexandre Leroux
Parser refactoring (3)...
r987
private:
Alexandre Leroux
Parser refactoring (4)...
r988 /// @return the reading order of the "value" columns for a result line of the AMDA file
std::vector<int> valuesIndexes() const;
Alexandre Leroux
Parser refactoring (3)...
r987 Properties m_Properties{};
Alexandre Leroux
Parser refactoring (4)...
r988 std::vector<double> m_XAxisData{};
std::vector<double> m_ValuesData{};
Alexandre Leroux
Parser refactoring (2)...
r986 };
Alexandre Leroux
Spectrograms implementation (1)...
r990 /**
* Implementation of @sa IAmdaResultParserHelper for spectrograms
*/
class SpectrogramParserHelper : public IAmdaResultParserHelper {
public:
bool checkProperties() override;
std::shared_ptr<IDataSeries> createSeries() override;
void readPropertyLine(const QString &line) override;
void readResultLine(const QString &line) override;
Alexandre Leroux
Spectrograms implementation (3)...
r992
private:
Alexandre Leroux
Handles data holes in AMDA parser
r1022 void handleDataHoles();
Alexandre Leroux
Spectrograms implementation (3)...
r992 Properties m_Properties{};
Alexandre Leroux
Spectrograms implementation (5)...
r994 std::vector<double> m_XAxisData{};
Alexandre Leroux
Spectrograms implementation (4)...
r993 std::vector<double> m_YAxisData{};
Alexandre Leroux
Spectrograms implementation (5)...
r994 std::vector<double> m_ValuesData{};
std::vector<int> m_ValuesIndexes{};
double m_FillValue{std::numeric_limits<double>::quiet_NaN()};
Alexandre Leroux
Spectrograms implementation (1)...
r990 };
Alexandre Leroux
Parser refactoring (2)...
r986 /**
* Implementation of @sa IAmdaResultParserHelper for vectors
*/
class VectorParserHelper : public IAmdaResultParserHelper {
public:
bool checkProperties() override;
std::shared_ptr<IDataSeries> createSeries() override;
void readPropertyLine(const QString &line) override;
void readResultLine(const QString &line) override;
Alexandre Leroux
Parser refactoring (3)...
r987
private:
Alexandre Leroux
Parser refactoring (4)...
r988 /// @return the reading order of the "value" columns for a result line of the AMDA file
std::vector<int> valuesIndexes() const;
Alexandre Leroux
Parser refactoring (3)...
r987 Properties m_Properties{};
Alexandre Leroux
Parser refactoring (4)...
r988 std::vector<double> m_XAxisData{};
std::vector<double> m_ValuesData{};
Alexandre Leroux
Parser refactoring (2)...
r986 };
Alexandre Leroux
Parser refactoring (1)...
r985 #endif // SCIQLOP_AMDARESULTPARSERHELPER_H