Debian Codegraph @

Source/Test/Evaluation/CReasonerEvaluationTableMultiFormatOutputWriter.h

raw
1 /*
2 * Copyright (C) 2013-2015, 2019 by the Konclude Developer Team.
3 *
4 * This file is part of the reasoning system Konclude.
5 * For details and support, see <http://konclude.com/>.
6 *
7 * Konclude is free software: you can redistribute it and/or modify
8 * it under the terms of version 3 of the GNU Lesser General Public
9 * License (LGPLv3) as published by the Free Software Foundation.
10 *
11 * Konclude is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU (Lesser) General Public License for more details.
15 *
16 * You should have received a copy of the GNU (Lesser) General Public
17 * License along with Konclude. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #ifndef KONCLUDE_TEST_EVALUATION_CREASONEREVALUATIONTABLEMULTIFORMATOUTPUTWRITER_H
22 #define KONCLUDE_TEST_EVALUATION_CREASONEREVALUATIONTABLEMULTIFORMATOUTPUTWRITER_H
23
24 // Libraries includes
25 #include <QMap>
26
27 // Namespace includes
28 #include "EvaluationSettings.h"
29
30
31 // Other includes
32 #include "Config/CConfiguration.h"
33
34 // Logger includes
35 #include "Logger/CLogger.h"
36
37
38
39 namespace Konclude {
40
41 using namespace Config;
42
43 namespace Test {
44
45 namespace Evaluation {
46
47
48 template<class T>
49 QString defaultConvertToStringFunction(const T& value) {
50 return QString("%1").arg(value);
51 }
52
53
54 /*!
55 *
56 * \class CReasonerEvaluationTableMultiFormatOutputWriter
57 * \author Andreas Steigmiller
58 * \version 0.1
59 * \brief TODO
60 *
61 */
62 template<class T>
63 class CReasonerEvaluationTableMultiFormatOutputWriter {
64 // public methods
65 public:
66 //! Constructor
67 CReasonerEvaluationTableMultiFormatOutputWriter();
68
69 //! Destructor
70 virtual ~CReasonerEvaluationTableMultiFormatOutputWriter();
71
72
73 QStringList writeCVSTable(const QString& baseFileName, QString (*convertStringFunction)(const T&) = &defaultConvertToStringFunction);
74 QStringList writeGNUPlotDataTable(const QString& baseFileName, QString (*convertStringFunction)(const T&) = &defaultConvertToStringFunction);
75
76
77 QStringList writeCVSTablesSorted(const QString& baseFileName, QString (*convertStringFunction)(const T&) = &defaultConvertToStringFunction);
78 QStringList writeGNUPlotDataTablesSorted(const QString& baseFileName, QString (*convertStringFunction)(const T&) = &defaultConvertToStringFunction);
79
80 QStringList writeCVSTablesSortedSplitted(cint64 splitSize, const QString& baseFileName, QString (*convertStringFunction)(const T&) = &defaultConvertToStringFunction);
81 QStringList writeGNUPlotDataTablesSortedSplitted(cint64 splitSize, const QString& baseFileName, QString (*convertStringFunction)(const T&) = &defaultConvertToStringFunction);
82
83 QStringList writeCVSTablesSeparateSorted(const QString& baseFileName, QString (*convertStringFunction)(const T&) = &defaultConvertToStringFunction);
84 QStringList writeGNUPlotDataTablesSeparateSorted(const QString& baseFileName, QString (*convertStringFunction)(const T&) = &defaultConvertToStringFunction);
85
86 CReasonerEvaluationTableMultiFormatOutputWriter<T>* buildSortedIndex();
87
88 QString getSplitIndexString(cint64 index, cint64 maxIndex);
89
90 CReasonerEvaluationTableMultiFormatOutputWriter<T>* addColumnTitles(const QStringList& titleList);
91 CReasonerEvaluationTableMultiFormatOutputWriter<T>* addNewTableRow(const QString& rowTitle, const QList<T>& rowValues);
92 CReasonerEvaluationTableMultiFormatOutputWriter<T>* addNewTableRow(const QString& rowTitle);
93 CReasonerEvaluationTableMultiFormatOutputWriter<T>* addValuesToLastTableRow(const QList<T>& rowValues);
94
95
96 // protected methods
97 protected:
98 QString getGNUPlotCompatibleTitle(const QString& string);
99
100 // protected variables
101 protected:
102 class CReasonerEvaluationTableRow {
103 public:
104 QString mTitle;
105 QList<T> mRowValueList;
106 };
107
108 QStringList mTitles;
109 QList<CReasonerEvaluationTableRow*> mRowList;
110 CReasonerEvaluationTableRow* mLastRow;
111
112 QMap<QString,CReasonerEvaluationTableRow*> mTitleColumnSortedMap;
113 QList< QMap<T,CReasonerEvaluationTableRow*>* > mColumnSortMapList;
114 bool mSortedIndexBuilded;
115
116 // private methods
117 private:
118
119 // private variables
120 private:
121
122 };
123
124
125 class CTestReasonerEvaluationTableMultiFormatOutputWriter : public CReasonerEvaluationTableMultiFormatOutputWriter<cint64> {
126 };
127
128 }; // end namespace Evaluation
129
130 }; // end namespace Test
131
132 }; // end namespace Konclude
133
134 #include "CReasonerEvaluationTableMultiFormatOutputWriter.cpp"
135
136 #endif // KONCLUDE_TEST_EVALUATION_CREASONEREVALUATIONTABLEMULTIFORMATOUTPUTWRITER_H