From 17461e149cba1388f035948be9bf3ccaba4ba1d1 2017-11-16 10:22:48 From: Alexandre Leroux Date: 2017-11-16 10:22:48 Subject: [PATCH] Parser refactoring (1) Creates a helper that will be used to read the properties and values of an AMDA file, to generate the dataset. The helper is intended to replace the current implementation of the parser, to be more generic and thus manage the spectrograms more easily --- diff --git a/plugins/amda/include/AmdaResultParserHelper.h b/plugins/amda/include/AmdaResultParserHelper.h new file mode 100644 index 0000000..3113a21 --- /dev/null +++ b/plugins/amda/include/AmdaResultParserHelper.h @@ -0,0 +1,46 @@ +#ifndef SCIQLOP_AMDARESULTPARSERHELPER_H +#define SCIQLOP_AMDARESULTPARSERHELPER_H + +#include +#include + +#include + +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 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; +}; + +#endif // SCIQLOP_AMDARESULTPARSERHELPER_H