Debian Codegraph @

Source/Control/Command/CCommand.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_COMMAND_CCOMMAND_H
22 #define KONCLUDE_CONTROL_COMMAND_CCOMMAND_H
23
24 // Libraries includes
25 #include <QString>
26
27 // Namespace includes
28 #include "CommandSettings.h"
29 #include "CCommandRecorder.h"
30 #include "CCommandRecordData.h"
31
32 // Other includes
33 #include "Concurrent/Callback/CSynchronizedCallbackListExecuter.h"
34
35 #include "Utilities/CLinker.hpp"
36
37 // Logger includes
38 #include "Logger/CLogger.h"
39
40
41 namespace Konclude {
42
43 using namespace Logger;
44 using namespace Concurrent::Callback;
45 using namespace Utilities;
46
47 namespace Control {
48
49 namespace Command {
50
51 /*!
52 *
53 * \class CCommand
54 * \author Andreas Steigmiller
55 * \version 0.1
56 * \brief TODO
57 *
58 */
59 class CCommand {
60 // public methods
61 public:
62 //! Constructor
63 CCommand(CCommand *parentSuperCommand = 0);
64
65 //! Destructor
66 virtual ~CCommand();
67
68 virtual CLinker<CCommand *> *getSubCommandLinker();
69 virtual CCommand *addSubCommand(CCommand *subCommand);
70 virtual CCommand *makeToSubCommand(CCommand *subCommand);
71 virtual CCommand *getSuperCommand();
72 virtual CCommand *setSuperCommand(CCommand *parentSuperCommand);
73
74 virtual qint64 getCommandTag() = 0;
75 virtual bool isProcessable() = 0;
76
77 virtual QString getBriefCommandDescription();
78 virtual CCommand *getNextProcessableSubCommand();
79
80 virtual CCommand *setProcessed(bool processedCommand = true);
81 virtual bool isProcessed();
82 virtual bool areAllSubCommandsProcessed();
83 virtual bool isThisCommandProcessed();
84
85 virtual CCommand *setProcessing(bool processingCommand = true);
86 virtual bool isProcessing();
87
88 virtual CCommandRecordData *getRecordData();
89 virtual CCommand *setRecordData(CCommandRecordData *takeRecordData);
90 virtual CCommand *overwriteRecordData(CCommandRecordData *takeRecordData);
91 virtual CCommand *appendRecordData(CCommandRecordData *takeRecordData);
92
93 virtual CCommandRecorder *getRecorder();
94 virtual CCommand *setRecorder(CCommandRecorder *useCommandRecorder);
95
96 virtual CCommand *deleteDependencies();
97 virtual CCommand *deleteSubCommands();
98 virtual CCommand *deleteRecordData();
99
100 virtual CCommand *addProcessedCallback(CCallbackData *callback);
101 virtual CCommand *reduceUnclosedCheckCallback();
102
103 virtual double getMaxErrorLevel();
104 virtual CCommand *reportError(double errorLevelReport);
105
106 virtual bool hasReportErrorFromSubCommands();
107 virtual CCommand *setReportErrorFromSubCommands(bool reportSubCommandErrors);
108
109 // protected methods
110 protected:
111 virtual CCommand* closedSubCommand();
112
113 // protected variables
114 protected:
115 CLinker<CCommand *> *subCommandLinker;
116 CCommand *superCommand;
117 CCommandRecordData *recordData;
118 CCommandRecorder *recorder;
119
120 QMutex closureSyncMutex;
121 QMutex errorSyncMutex;
122
123 bool processed;
124 bool processing;
125 bool closured;
126 bool reportErrorFromSubCommands;
127
128 cint64 mUnclosedCommandCount;
129
130 CSynchronizedCallbackListExecuter processedCallbackExecuter;
131
132 double errorLevel;
133
134 // private methods
135 private:
136
137 // private variables
138 private:
139
140 };
141
142 }; // end namespace Command
143
144 }; // end namespace Control
145
146 }; // end namespace Konclude
147
148 #endif // KONCLUDE_CONTROL_COMMAND_CCOMMAND_H