Debian Codegraph @

Source/Control/Loader/CCLIBatchProcessingLoader.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_CONTROL_LOADER_CCLIBATCHPROCESSINGLOADER_H
22 #define KONCLUDE_CONTROL_LOADER_CCLIBATCHPROCESSINGLOADER_H
23
24 // Libraries includes
25 #include <QString>
26 #include <QRegExp>
27 #include <QTime>
28 #include <QDir>
29
30 // Namespace includes
31 #include "LoaderSettings.h"
32 #include "CLoader.h"
33 #include "CLoaderFactory.h"
34
35 // Other includes
36 #include "Control/Interface/OWLlink/COWLlinkProcessor.h"
37 #include "Control/Interface/OWLlink/COWLLinkRecordInterpreter.h"
38
39 #include "Control/Command/CConfigManagerReader.h"
40
41 #include "Reasoner/Query/CWriteQueryFileOWL2XMLSerializer.h"
42 #include "Reasoner/Query/CWriteQueryFileOWL2FunctionalSerializer.h"
43
44 // Logger includes
45 #include "Logger/CLogger.h"
46 #include "Logger/CLogIdentifier.h"
47 #include "Logger/COREConsolePrintLogObserver.h"
48 #include "Logger/COREFilePrintLogObserver.h"
49
50
51 #include <stdio.h>
52 #include <iostream>
53
54
55 namespace Konclude {
56
57 using namespace Logger;
58 using namespace Reasoner::Query;
59
60 namespace Control {
61
62 using namespace Interface::OWLlink;
63 using namespace Command;
64
65 namespace Loader {
66
67 /*!
68 *
69 * \class CCLIBatchProcessingLoader
70 * \author Andreas Steigmiller
71 * \version 0.1
72 * \brief TODO
73 *
74 */
75 class CCLIBatchProcessingLoader : public CLoader, public COWLlinkProcessor, public CCommandRecorder {
76 // public methods
77 public:
78 //! Constructor
79 CCLIBatchProcessingLoader();
80
81 //! Destructor
82 virtual ~CCLIBatchProcessingLoader();
83
84
85 virtual CLoader *init(CLoaderFactory *loaderFactory = 0, CConfiguration *config = 0);
86 virtual CLoader *load();
87 virtual CLoader *exit();
88
89 virtual CCommandRecorder *recordData(CCommandRecordData *recData);
90
91
92 // protected methods
93 protected:
94
95 class CCommandProcessData {
96 public:
97 CCommandProcessData(CCommand* command){
98 mCommand = command;
99 mMeasureTime = false;
100 mWriteOutput = false;
101 }
102 CCommandProcessData(CCommand* command, bool measureTime, const QString& measuredOutputString) {
103 mCommand = command;
104 mMeasureTime = measureTime;
105 mMeasuredOutputString = measuredOutputString;
106 mWriteOutput = false;
107 }
108 CCommandProcessData(CCommand* command, bool measureTime, const QString& measuredOutputString, bool writeOutput, const QString& outputFileName) {
109 mCommand = command;
110 mMeasureTime = measureTime;
111 mMeasuredOutputString = measuredOutputString;
112 mWriteOutput = writeOutput;
113 mWriteOutputFile = outputFileName;
114 }
115 public:
116 CCommand* mCommand;
117 bool mMeasureTime;
118 QString mMeasuredOutputString;
119 bool mWriteOutput;
120 QString mWriteOutputFile;
121 };
122
123 virtual COWLlinkProcessor* initializeOWLlinkContent();
124 virtual COWLlinkProcessor* concludeOWLlinkContent();
125
126 virtual CConfiguration* getConfiguration();
127
128 virtual void createTestingCommands();
129
130 void addProcessingCommand(CCommand* command);
131 void addProcessingCommand(CCommand* command, bool measureTime, const QString& measuredOutputString);
132 void addProcessingCommand(CCommand* command, bool measureTime, const QString& measuredOutputString, bool writeSatisfiabilityOutput, const QString& outputFileName);
133
134 bool hasMoreProcessingCommands();
135 void terminateProcessing();
136 void processNextCommand();
137 void finishCommandProcessing();
138 virtual void finishProcessing();
139
140 void logOutputNotice(const QString& outputString);
141 void logOutputMessage(const QString& outputString);
142 void logOutputError(const QString& errorString);
143
144 void forcedPathCreated(const QString& filePath);
145
146 virtual void writeCommandOutput(const QString& outputFileName, CCommand* processedCommand);
147
148 // protected variables
149 protected:
150 QString mIRINameString;
151 QString mRequestFileString;
152 QString mResponseFileString;
153
154 CLogIdentifier mLogIdentifier;
155
156 QList<CCommandProcessData*> mProcessCommandList;
157 CCommandProcessData* mProcessingCommandData;
158
159
160 QTime mTotalTime;
161 bool mLogTotalProcessingTime;
162 bool mCloseAfterOutput;
163 bool mOutputMeasuredTimeInSeconds;
164 bool mBlockUntilProcessed;
165 QTime mMeasurementTime;
166 QSemaphore mBlockingSemaphore;
167 COWLLinkRecordInterpreter* mOWLLinkInterpreter;
168
169 CConfiguration* mLoaderConfig;
170
171
172 // private methods
173 private:
174
175 // private variables
176 private:
177
178 };
179
180 }; // end namespace Loader
181
182 }; // end namespace Control
183
184 }; // end namespace Konclude
185
186 #endif // KONCLUDE_CONTROL_LOADER_CCLIBATCHPROCESSINGLOADER_H