Itasca C++ Interface
ikernel.h
Go to the documentation of this file.
1 #pragma once
2 #include "base/src/baseqt.h"
3 #include "utility/interface/iinputrecord.h"
4 #include "utility/interface/itextinput.h"
5 #include "security/interface/isecurity.h"
6 #include "shared/interface/signal.h"
7 
14 namespace shared {
15  class Stream;
16 }
17 
18 namespace security {
19  class ISC; //ISecurityCommunication;
20  struct LicenseLocation;
21 }
22 
23 namespace itascaxd {
24  class IInputItem;
25  class IKernelBase;
26  class IRange;
27 }
28 
29 namespace itasca {
30  class Archive2;
31  class IKernelInput;
32  class IKernelOutput;
33  class IThing;
34  class IContainer;
35  class IParse;
36 
38  class IKernel {
39  public:
43  using signal_type = shared::Signal<const IThing *,const IContainer *>;
44 
46  shared::Signal<> abort;
50  shared::Signal<const char *, const QString &, bool> pushInputItem; // type, name start
54  shared::Signal<const char *, const QString &> popInputItem; // type, name
56  shared::Signal<> restoreModelStateStart;
58  shared::Signal<const QString &> restoreModelStateEnd;
61  shared::Signal<const QString &> restoreModelState; // name
63  shared::Signal<> resetModelState;
64  shared::Signal<const QString &> exportResultFile; // name
65  shared::Signal<const QString &> importResultFile; // name
68  shared::Signal<int32> compressingFileIndex;
71  shared::Signal<int32> compressingFileProgress; // progress
72  shared::Signal<const QString &, int64, int64, int64> tagInEditor; // source, line, colStart, colEnd
73  shared::Signal<const QString &> projectSysPath; // Add project path to sys.path
74 
75 
76  virtual itascaxd::IKernelBase *getIKernelBase() = 0;
82  virtual bool initialize(IKernelInput *input,IKernelOutput *output)=0;
83 
85  virtual bool disconnectFromInterface()=0;
86 
91  virtual bool security(security::ISC *scomm)=0;
92 
95  virtual bool preCommandLineArguments(QStringList * args)=0;
96 
101  virtual bool commandLineArguments(const QStringList &args)=0;
102  virtual QList<InputLine> fromCommandLineArguments(const QStringList &args)=0;
103 
111  virtual QString processCommands(itascaxd::IInputItem *ii,const QString &inputPath=QString(),
112  bool recursive=false,bool suppress=false)=0;
113 
124  virtual QString processCommands(const QList<InputLine> &sl,
125  const QString &inputPath=QString(),bool recursive=false)=0;
126 
137  virtual QString processCommand(const InputLine &s,const QString &inputPath=QString(),
138  bool recursive=false)=0;
139 
141  virtual bool getAutoTestMode() const=0;
142 
144  virtual StringList getTestDirectories() const=0;
145 
148 
150  virtual void addCommandDocumentation(const QString &referencename,const QStringList &list)=0;
151 
153  virtual void addSphinxCommands(const QStringList &)=0;
154 
156  virtual void addSphinxFish(const QStringList &)=0;
157 
159  virtual QString outputCommandsForModel() const=0;
160  virtual QString outputFishForModel() const=0;
161 
165  virtual int testValidCommand(const QString &line, QString *errorinfo=0) const=0;
166 
171  virtual int testValidCommandText(const QString &text, QString *errorinfo=0, QList<int> *errorlines=0) const=0;
172 
175  virtual QPair<QString,QString> expandCommandKeyword(const QString &line,QString &fileName,int cursor=-1) const=0;
178  virtual QStringList getCommandInformation(const QString &line,int cursor=-1,bool thinkFish=false) const=0;
179 
181  virtual QString getSaveFileName() const=0;
182 
184  virtual bool modelChanged() const=0;
185 
187  virtual bool projectChanged() const=0;
188 
190  virtual void saveProject(Archive2 &a) const=0;
191  virtual bool restoreProject(Archive2 &a,uint64 label)=0;
192  virtual void remapProject(Archive2 &a)=0;
193 
195  virtual IParse * createStackAndParse(const QString &) = 0;
196 
200  virtual bool readSaveFileInfo(shared::Stream &dev,IInputRecord::FileDataSet *set,StringList *lines) const=0;
201 
209  virtual void compressFileList(const QStringList &files)=0;
210  virtual void decompressFileList(const QStringList &files)=0;
212  virtual bool fileIsCompressed(const QString &filename) const=0;
213 
214  // RESULT FILE SUPPORT
215  struct ResultsDesc {
216  QString name_;
217  QString command_;
218  bool state_ = false;
219  QString category_;
220  };
221  virtual std::vector<ResultsDesc> getResultsState() const=0;
222  // TRUE if results files will be generated automatically during cycling.
223  virtual bool getResultsIntervalOn() const=0;
224  // non-zero if results files will be generated based on a real-time interval.
225  virtual uint64 getResultsIntervalClock() const=0;
226  // The name of the process used to determine the model time -- from the list of
227  // processes available to the current model.
228  virtual QString getResultsIntervalProcess() const=0;
229  // non-zero if results files will be generated based on the number of cycles/steps.
230  virtual uint64 getResultsIntervalStep() const=0;
231  // non-zero if results files will be generated based on accumulated model time
232  // in the process returned by getResultsIntervalProcess().
233  virtual double getResultsIntervalTime() const=0;
234  // Returns the prefix used for automatically generated results files.
235  virtual QString getResultsIntervalPrefix() const=0;
236  // Returns the current index used for automatically generated results files.
237  // This is appended to the prefix and incremented automatically.
238  virtual uint32 getResultsIntervalIndex() const=0;
239 
243  virtual void startProcessingFile(const QString &fullPathName,const QString &type)=0;
244 
248  virtual void stopProcessingFile(const QString &fullPathName,const QString &type)=0;
249 
252  //virtual void resetModel(bool quiet=false)=0;
253 
255  virtual void resetProject(bool quiet=false)=0;
256 
259  virtual void cleanModel(bool all=false)=0;
260 
263  virtual void calmModel()=0;
264 
266  virtual void filterModel(const itascaxd::IRange &)=0;
267 
269  virtual signal_type *getResetSignal() const=0;
270 
272  virtual signal_type *getSaveSignal() const=0;
273 
275  virtual signal_type *getRestoredSignal() const=0;
276 
279  virtual void save(shared::Stream &dev,bool readOnly,bool text)=0;
280 
284  virtual StringList restore(shared::Stream &dev,shared::Stream *out=nullptr)=0;
285 
286  virtual void logEvent(const QString &str)=0;
287 
289  virtual bool getInCycle() const=0;
290 
291  virtual QStringList getAllTypeKeywords() const=0;
292 
294  virtual StateInfoOutput getModelStateInformation() const=0;
295 
297  virtual StateInfoOutput getProgramStateInformation() const=0;
298  };
299 }
301 // EoF
All default base headers if Qt is being used.
Definition: idef.h:50
Definition: basestring.h:77
std::unordered_set< FileData, FileDataHash > FileDataSet
Definition: iinputrecord.h:37
This Interface provides an entry point for command processing.
Definition: ikernel.h:38
shared::Signal< const QString & > restoreModelStateEnd
This SIGNAL is emitted when a model restore is finished, regardless of hidden state.
Definition: ikernel.h:58
virtual QStringList getCommandInformation(const QString &line, int cursor=-1, bool thinkFish=false) const =0
shared::Signal abort
Due to a QUIT or a STOP, or a catastrophic error, etc.
Definition: ikernel.h:46
shared::Signal resetModelState
This SIGNAL is emitted when the model state is reset, (a NEW command, for example).
Definition: ikernel.h:63
virtual StateInfoOutput getProgramStateInformation() const =0
Get the program state information.
virtual QPair< QString, QString > expandCommandKeyword(const QString &line, QString &fileName, int cursor=-1) const =0
virtual void calmModel()=0
virtual QString outputCommandsForModel() const =0
Output commands and FISH for inline help.
shared::Signal< const char *, const QString & > popInputItem
Definition: ikernel.h:54
virtual bool getInCycle() const =0
Get the boolean indicating cycling mode.
virtual QString processCommands(itascaxd::IInputItem *ii, const QString &inputPath=QString(), bool recursive=false, bool suppress=false)=0
virtual void addSphinxCommands(const QStringList &)=0
Add inline help commands.
virtual QString processCommands(const QList< InputLine > &sl, const QString &inputPath=QString(), bool recursive=false)=0
virtual bool fileIsCompressed(const QString &filename) const =0
Return true if the given file has been compressed.
virtual bool readSaveFileInfo(shared::Stream &dev, IInputRecord::FileDataSet *set, StringList *lines) const =0
virtual void startProcessingFile(const QString &fullPathName, const QString &type)=0
virtual signal_type * getSaveSignal() const =0
Return the signal indicating that the model will be saved, i.e., it is emitted before a save.
shared::Signal< const IThing *, const IContainer * > signal_type
Definition: ikernel.h:43
virtual bool security(security::ISC *scomm)=0
shared::Signal< const char *, const QString &, bool > pushInputItem
Definition: ikernel.h:50
virtual StringList restore(shared::Stream &dev, shared::Stream *out=nullptr)=0
virtual IParse * createStackAndParse(const QString &)=0
Create a Parse object and stack from terminal. Needs to be destroyed.
virtual bool projectChanged() const =0
Project changed state.
virtual QString processCommand(const InputLine &s, const QString &inputPath=QString(), bool recursive=false)=0
virtual StringList getTestDirectories() const =0
Returns all directories current part of the testing system.
virtual void addCommandDocumentation(const QString &referencename, const QStringList &list)=0
Add cmd-doc definitions from a StringList.
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
shared::Signal restoreModelStateStart
This SIGNAL is emitted when a model restore is started.
Definition: ikernel.h:56
virtual int testValidCommandText(const QString &text, QString *errorinfo=0, QList< int > *errorlines=0) const =0
shared::Signal< const QString & > restoreModelState
Definition: ikernel.h:61
virtual bool preCommandLineArguments(QStringList *args)=0
virtual IKernelOutput * getIKernelOutput()=0
Returns a pointer to a IKernelOutput object.
virtual StateInfoOutput getModelStateInformation() const =0
Get the model state information.
virtual bool getAutoTestMode() const =0
Return the test mode flag.
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 QString getSaveFileName() const =0
Get the name of the last save file.
virtual void stopProcessingFile(const QString &fullPathName, const QString &type)=0
virtual void compressFileList(const QStringList &files)=0
virtual int testValidCommand(const QString &line, QString *errorinfo=0) const =0
virtual bool modelChanged() const =0
Model changed state.
virtual void addSphinxFish(const QStringList &)=0
Add inline help FISH.
virtual bool commandLineArguments(const QStringList &args)=0
shared::Signal< int32 > compressingFileProgress
Definition: ikernel.h:71
virtual bool disconnectFromInterface()=0
This is called to indicate that the GUI is shutting down - no calls to input or output should occurr.
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 void save(shared::Stream &dev, bool readOnly, bool text)=0
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:68
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
Interface to the main command processing class.
Definition: iparse.h:50
Definition: iinputitem.h:9
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:215
Provides a interface for getting text.
Definition: itextinput.h:10