Debian Codegraph @

Source/Test/Evaluation/CReasonerExecutableEvaluationProvider.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_CREASONEREXECUTABLEEVALUATIONPROVIDER_H
22 #define KONCLUDE_TEST_EVALUATION_CREASONEREXECUTABLEEVALUATIONPROVIDER_H
23
24 // Libraries includes
25 #include <QProcess>
26 #include <QString>
27 #include <QStringList>
28 #include <QDir>
29 #include <QObject>
30
31 // Namespace includes
32 #include "CReasonerEvaluationTerminationResult.h"
33 #include "CReasonerEvaluationProvider.h"
34 #include "CReasonerMemoryUsageCheckingThread.h"
35
36 #include "Test/Evaluation/Events/CReasonerEvaluationReasonerStartEvent.h"
37 #include "Test/Evaluation/Events/CReasonerEvaluationReasonerRestartEvent.h"
38 #include "Test/Evaluation/Events/CReasonerEvaluationReasonerStopEvent.h"
39
40 // Other includes
41 #include "Config/CConfigDataReader.h"
42
43 #include "Concurrent/Callback/CBlockingCallbackData.h"
44
45 // Logger includes
46 #include "Logger/CLogger.h"
47
48
49
50 namespace Konclude {
51
52 using namespace Config;
53 using namespace Concurrent::Callback;
54
55 namespace Test {
56
57 namespace Evaluation {
58
59 using namespace Events;
60
61
62 /*!
63 *
64 * \class CReasonerExecutableEvaluationProvider
65 * \author Andreas Steigmiller
66 * \version 0.1
67 * \brief TODO
68 *
69 */
70 class CReasonerExecutableEvaluationProvider : public CIntervalThread, public CLogIdentifier, public CReasonerEvaluationProvider {
71 Q_OBJECT
72
73 // public methods
74 public:
75 //! Constructor
76 CReasonerExecutableEvaluationProvider();
77
78 //! Destructor
79 virtual ~CReasonerExecutableEvaluationProvider();
80
81
82 virtual bool restartReasoner();
83 virtual bool createReasoner(CConfiguration *config);
84 virtual CReasonerEvaluationTerminationResult* destroyReasoner();
85
86 virtual QString getReasonerAddressString();
87
88 // protected methods
89 protected:
90 bool assistTermination(Q_PID processID);
91
92 virtual bool processTimer(qint64 timerID);
93 void startReasonerThreaded();
94 void terminateReasonerThreaded();
95 bool restartReasonerThreaded();
96
97 bool processCustomsEvents(QEvent::Type type, CCustomEvent* event);
98
99 void startReasoner();
100 void terminateReasoner();
101
102 public slots:
103 void processError(QProcess::ProcessError error);
104 void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
105
106
107
108 // protected variables
109 protected:
110 CConfiguration* mConfig;
111
112 QString mReasonerName;
113 QString mReasonerBinaryFile;
114 QString mReasonerBinaryArguments;
115 cint64 mReasonerPort;
116
117 QProcess* mProcess;
118 bool mProcessError;
119 bool mProcessFinished;
120
121 cint64 mKillTimeout;
122 QString mKillScriptString;
123 QString mKillScriptArgumentsString;
124
125 cint64 mRestartSleepTime;
126 cint64 mTerminationSleepTime;
127
128
129 CReasonerMemoryUsageCheckingThread* mMemoryCheckingThread;
130
131
132 QString mReasonerStdOutText;
133 QString mReasonerStdErrText;
134 QString mReasonerErrorString;
135 bool mReasonerForcedTermination = false;
136 cint64 mMaxMemoryUsage = 0;
137 bool mReasonerFinishedInTime = true;
138 bool mCheckingMemoryUsage = false;
139
140
141 // private methods
142 private:
143
144 // private variables
145 private:
146
147 };
148
149 }; // end namespace Evaluation
150
151 }; // end namespace Test
152
153 }; // end namespace Konclude
154
155 #endif // KONCLUDE_TEST_EVALUATION_CREASONEREXECUTABLEEVALUATIONPROVIDER_H