Itasca C++ Interface
Loading...
Searching...
No Matches
ikernel.h
Go to the documentation of this file.
1#pragma once
2#include "base/src/baseqt.h"
3#include "module/interface/ikernelbase.h"
4#include "utility/interface/iinputrecord.h"
5#include "utility/interface/itextinput.h"
6#include "security/interface/isecurity.h"
7#include "shared/interface/signal.h"
8
15namespace shared {
16 class Stream;
17}
18
19namespace security {
20 class ISC; //ISecurityCommunication;
21 struct LicenseLocation;
22}
23
24namespace itascaxd {
25 class IInputItem;
26 class IKernelBase;
27 class IRange;
28}
29
30namespace itasca {
31 class Archive2;
32 class IKernelInput;
33 class IKernelOutput;
34 class IThing;
35 class IContainer;
36
38 class IKernel {
39 public:
40 using Skip = itascaxd::IKernelBase::Skip;
41
45 using signal_type = shared::Signal<const IThing *,const IContainer *>;
46
48 shared::Signal<> abort;
52 shared::Signal<const char *, const string &, bool> pushInputItem; // type, name start
56 shared::Signal<const char *, const string &> popInputItem; // type, name
59 shared::Signal<const string &> restoreModelState; // name
61 shared::Signal<> resetModelState;
62 shared::Signal<const string &> exportResultFile; // name
63 shared::Signal<const string &> importResultFile; // name
66 shared::Signal<int32> compressingFileIndex;
69 shared::Signal<int32> compressingFileProgress; // progress
70 shared::Signal<const string &, int64, int64, int64> tagInEditor; // source, line, colStart, colEnd
71 shared::Signal<const string &> projectSysPath; // Add project path to sys.path
72
73 virtual itascaxd::IKernelBase *getIKernelBase() = 0;
79 virtual bool initialize(IKernelInput *input,IKernelOutput *output)=0;
80
82 virtual bool disconnectFromInterface()=0;
83
88 virtual bool security(security::ISC *scomm)=0;
89
92 virtual bool preCommandLineArguments(StringList * args)=0;
93
98 virtual bool commandLineArguments(const StringList &args)=0;
99 virtual std::vector<InputLine> fromCommandLineArguments(const StringList &args)=0;
100
108 virtual string processCommands(itascaxd::IInputItem *ii,const string &inputPath=string(),
109 bool recursive=false,bool suppress=false)=0;
110
121 virtual string processCommands(const std::vector<InputLine> &sl,
122 const string &inputPath=string(),bool recursive=false)=0;
123
134 virtual string processCommand(const InputLine &s,const string &inputPath=string(),
135 bool recursive=false)=0;
136
138 virtual bool getAutoTestMode() const=0;
139
142
145
147 virtual void addCommandDocumentation(const string &referencename,const StringList &list)=0;
148
150 virtual void addSphinxCommands(const StringList &)=0;
151
153 virtual void addSphinxFish(const StringList &)=0;
154
156 virtual string outputCommandsForModel() const=0;
157 virtual string outputFishForModel() const=0;
158
162 virtual int testValidCommand(const string &line, string *errorinfo=0) const=0;
163
168 virtual int testValidCommandText(const string &text, string *errorinfo=0, std::vector<int> *errorlines=0) const=0;
169
172 virtual QPair<string,string> expandCommandKeyword(const string &line,string &fileName,int cursor=-1) const=0;
175 virtual StringList getCommandInformation(const string &line,int cursor=-1,bool thinkFish=false) const=0;
176
178 virtual string getSaveFileName() const=0;
179
181 virtual bool modelChanged() const=0;
182
184 virtual bool projectChanged() const=0;
185
187 virtual void saveProject(Archive2 &a) const=0;
188 virtual bool restoreProject(Archive2 &a,uint64 label)=0;
189 virtual void remapProject(Archive2 &a)=0;
190
194 virtual bool readSaveFileInfo(shared::Stream &dev,IInputRecord::FileDataSet *set,StringList *lines) const=0;
195
203 virtual void compressFileList(const StringList &files)=0;
204 virtual void decompressFileList(const StringList &files)=0;
206 virtual bool fileIsCompressed(const string &filename) const=0;
207
208 // RESULT FILE SUPPORT
209 struct ResultsDesc {
210 string name_;
211 string command_;
212 bool state_ = false;
213 string category_;
214 };
215 virtual std::vector<ResultsDesc> getResultsState() const=0;
216 // TRUE if results files will be generated automatically during cycling.
217 virtual bool getResultsIntervalOn() const=0;
218 // non-zero if results files will be generated based on a real-time interval.
219 virtual uint64 getResultsIntervalClock() const=0;
220 // The name of the process used to determine the model time -- from the list of
221 // processes available to the current model.
222 virtual string getResultsIntervalProcess() const=0;
223 // non-zero if results files will be generated based on the number of cycles/steps.
224 virtual uint64 getResultsIntervalStep() const=0;
225 // non-zero if results files will be generated based on accumulated model time
226 // in the process returned by getResultsIntervalProcess().
227 virtual double getResultsIntervalTime() const=0;
228 // Returns the prefix used for automatically generated results files.
229 virtual string getResultsIntervalPrefix() const=0;
230 // Returns the current index used for automatically generated results files.
231 // This is appended to the prefix and incremented automatically.
232 virtual uint32 getResultsIntervalIndex() const=0;
233
237 virtual void startProcessingFile(const string &fullPathName,const string &type)=0;
238
242 virtual void stopProcessingFile(const string &fullPathName,const string &type)=0;
243
245 virtual void resetProject(bool quiet=false)=0;
246
249 virtual void cleanModel(bool all=false)=0;
250
253 virtual void calmModel()=0;
254
256 virtual void filterModel(const itascaxd::IRange &)=0;
257
259 virtual signal_type *getResetSignal() const=0;
260
262 virtual signal_type *getSaveSignal() const=0;
263
265 virtual signal_type *getRestoredSignal() const=0;
266
269 virtual void save(shared::Stream &dev,bool readOnly,bool text)=0;
270
274 virtual StringList restore(shared::Stream &dev,shared::Stream *out,Skip skip)=0;
275
276 virtual void logEvent(const string &str)=0;
277
279 virtual bool getInCycle() const=0;
280
281 virtual StringList getAllTypeKeywords() const=0;
282 };
283}
285// EoF
All default base headers if Qt is being used.
Definition basestring.h:89
std::unordered_set< FileData, FileDataHash > FileDataSet
Definition iinputrecord.h:37
This Interface provides an entry point for command processing.
Definition ikernel.h:38
virtual bool commandLineArguments(const StringList &args)=0
shared::Signal abort
Due to a QUIT or a STOP, or a catastrophic error, etc.
Definition ikernel.h:48
shared::Signal resetModelState
This SIGNAL is emitted when the model state is reset, (a NEW command, for example).
Definition ikernel.h:61
virtual string outputCommandsForModel() const =0
Output commands and FISH for inline help.
shared::Signal< const char *, const string & > popInputItem
Definition ikernel.h:56
virtual void addCommandDocumentation(const string &referencename, const StringList &list)=0
Add cmd-doc definitions from a StringList.
virtual void calmModel()=0
virtual QPair< string, string > expandCommandKeyword(const string &line, string &fileName, int cursor=-1) const =0
virtual StringList getCommandInformation(const string &line, int cursor=-1, bool thinkFish=false) const =0
virtual bool getInCycle() const =0
Get the boolean indicating cycling mode.
virtual bool readSaveFileInfo(shared::Stream &dev, IInputRecord::FileDataSet *set, StringList *lines) const =0
virtual signal_type * getRestoredSignal() const =0
Return the signal indicating that the model has been restored. i.e., it is emitted after a restore.
virtual void compressFileList(const StringList &files)=0
shared::Signal< const IThing *, const IContainer * > signal_type
Definition ikernel.h:45
virtual void addSphinxFish(const StringList &)=0
Add inline help FISH.
virtual int testValidCommandText(const string &text, string *errorinfo=0, std::vector< int > *errorlines=0) const =0
virtual bool security(security::ISC *scomm)=0
virtual bool projectChanged() const =0
Project changed state.
virtual StringList getTestDirectories() const =0
Returns all directories current part of the testing system.
virtual void filterModel(const itascaxd::IRange &)=0
Call a filter method in each module.
virtual void saveProject(Archive2 &a) const =0
Project archive.
virtual void cleanModel(bool all=false)=0
virtual bool initialize(IKernelInput *input, IKernelOutput *output)=0
virtual string getSaveFileName() const =0
Get the name of the last save file.
virtual signal_type * getSaveSignal() const =0
Return the signal indicating that the model will be saved, i.e., it is emitted before a save.
virtual string processCommand(const InputLine &s, const string &inputPath=string(), bool recursive=false)=0
virtual void addSphinxCommands(const StringList &)=0
Add inline help commands.
virtual void stopProcessingFile(const string &fullPathName, const string &type)=0
virtual string processCommands(const std::vector< InputLine > &sl, const string &inputPath=string(), bool recursive=false)=0
virtual bool getAutoTestMode() const =0
Return the test mode flag.
virtual void startProcessingFile(const string &fullPathName, const string &type)=0
virtual bool fileIsCompressed(const string &filename) const =0
Return true if the given file has been compressed.
shared::Signal< const string & > restoreModelState
Definition ikernel.h:59
virtual string processCommands(itascaxd::IInputItem *ii, const string &inputPath=string(), bool recursive=false, bool suppress=false)=0
shared::Signal< const char *, const string &, bool > pushInputItem
Definition ikernel.h:52
virtual bool modelChanged() const =0
Model changed state.
shared::Signal< int32 > compressingFileProgress
Definition ikernel.h:69
virtual signal_type * getResetSignal() const =0
Return the signal indicating that the model will be reset, i.e., it is emitted before a reset.
virtual bool disconnectFromInterface()=0
This is called to indicate that the GUI is shutting down - no calls to input or output should occurr.
virtual StringList restore(shared::Stream &dev, shared::Stream *out, Skip skip)=0
virtual bool preCommandLineArguments(StringList *args)=0
virtual void save(shared::Stream &dev, bool readOnly, bool text)=0
virtual int testValidCommand(const string &line, string *errorinfo=0) const =0
virtual IKernelOutput * getIKernelOutput()=0
Returns a pointer to a IKernelOutput object.
virtual void resetProject(bool quiet=false)=0
Clears PROJECT level memory (filter, persistant FISH, etc). Called by NEW PROJECT.
shared::Signal< int32 > compressingFileIndex
Definition ikernel.h:66
Interface describing ALL input support the kernel needs to receive from whatever interface is driving...
Definition ikernelinput.h:17
Interface describing ALL output support the kernel needs to send information to whatever interface is...
Definition ikerneloutput.h:12
Definition iinputitem.h:9
Definition ikernelbase.h:8
Definition ikernelbase.h:6
Interface to a filter, used as the main method for filtering objects.
Definition irange.h:32
namespace Itasca
Definition basememory.cpp:10
Itasca Library standard namespace, specific to 2D or 3D.
Definition icontactmodule.h:4
Definition ikernel.h:209
Provides a interface for getting text.
Definition itextinput.h:10