Itasca C++ Interface
Loading...
Searching...
No Matches
ikernel.h
Go to the documentation of this file.
1#pragma once
2
3#include "base/src/base.h"
4#include "module/interface/ikernelbase.h"
5#include "utility/interface/iinputrecord.h"
6#include "utility/interface/itextinput.h"
7
14class StateInfoOutput;
15
16namespace shared {
17 class Stream;
18}
19
20namespace security {
21 class ISC; //ISecurityCommunication;
22 struct LicenseLocation;
23}
24
25namespace itascaxd {
26 class IInputItem;
27 class IKernelBase;
28 class IRange;
29}
30
31namespace itasca {
32 class Archive2;
33 class IKernelInput;
34 class IKernelOutput;
35 class IThing;
36 class IContainer;
37 class IParse;
38
40 class IKernel {
41 public:
42 using Skip = itascaxd::IKernelBase::Skip;
43
47 using signal_type = shared::Signal<const IThing *,const IContainer *>;
48
50 shared::Signal<> abort;
54 shared::Signal<const char *, const string &, bool> pushInputItem; // type, name start
58 shared::Signal<const char *, const string &> popInputItem; // type, name
61 shared::Signal<> restoreModelStateStart;
63 shared::Signal<const string &> restoreModelStateEnd;
66 shared::Signal<const string &> restoreModelState; // name
68 shared::Signal<> resetModelState;
69 shared::Signal<const string &> exportResultFile; // name
70 shared::Signal<const string &> importResultFile; // name
73 shared::Signal<int32> compressingFileIndex;
76 shared::Signal<int32> compressingFileProgress; // progress
77 shared::Signal<const string &, int64, int64, int64> tagInEditor; // source, line, colStart, colEnd
78 shared::Signal<const string &> projectSysPath; // Add project path to sys.path\
79 // This signal is sent immediately *after* a command has been processed without error.
80 // The string is the full command string seen by
81 shared::Signal<std::vector<InputLine>> commandProcessed;
82
83 virtual itascaxd::IKernelBase *getIKernelBase() = 0;
89 virtual bool initialize(IKernelInput *input,IKernelOutput *output)=0;
90
92 virtual bool disconnectFromInterface()=0;
93
98 virtual bool security(security::ISC *scomm)=0;
99 virtual void securityCheck(security::Check check = security::Check::Normal)=0;
100
103 virtual bool preCommandLineArguments(StringList * args)=0;
104
109 virtual bool commandLineArguments(const StringList &args)=0;
110 virtual std::vector<InputLine> fromCommandLineArguments(const StringList &args)=0;
111
119 virtual string processCommands(itascaxd::IInputItem *ii,const string &inputPath=string(),
120 bool recursive=false,bool suppress=false)=0;
121
132 virtual string processCommands(const std::vector<InputLine> &sl,
133 const string &inputPath=string(),bool recursive=false)=0;
134
145 virtual string processCommand(const InputLine &s,const string &inputPath=string(),
146 bool recursive=false)=0;
147
149 virtual bool getAutoTestMode() const=0;
150
153
156
158 virtual void addCommandDocumentation(const string &referencename,const StringList &list)=0;
159
161 virtual void addSphinxCommands(const StringList &)=0;
162
164 virtual void addSphinxFish(const StringList &)=0;
165
167 virtual string outputCommandsForModel() const=0;
168 virtual string outputFishForModel() const=0;
169
173 virtual int testValidCommand(const string &line, string *errorinfo=0) const=0;
174
179 virtual int testValidCommandText(const string &text, string *errorinfo=0, std::vector<int> *errorlines=0) const=0;
180
183 virtual std::pair<string,string> expandCommandKeyword(const string &line,string &fileName,int cursor=-1) const=0;
186 virtual StringList getCommandInformation(const string &line,int cursor=-1,bool thinkFish=false) const=0;
187
189 virtual string getSaveFileName() const=0;
190
192 virtual bool modelChanged() const=0;
193
195 virtual bool projectChanged() const=0;
196
198 virtual void saveProject(Archive2 &a) const=0;
199 virtual bool restoreProject(Archive2 &a,uint64 label)=0;
200 virtual void remapProject(Archive2 &a)=0;
201
203 virtual IParse * createStackAndParse(const QString &) = 0;
204
208 virtual bool readSaveFileInfo(shared::Stream &dev,IInputRecord::FileDataSet *set,StringList *lines) const=0;
209
217 virtual void compressFileList(const StringList &files)=0;
218 virtual void decompressFileList(const StringList &files)=0;
220 virtual bool fileIsCompressed(const string &filename) const=0;
221
222 // RESULT FILE SUPPORT
223 struct ResultsDesc {
224 string name_;
225 string command_;
226 bool state_ = false;
227 string category_;
228 };
229 virtual std::vector<ResultsDesc> getResultsState() const=0;
230 // TRUE if results files will be generated automatically during cycling.
231 virtual bool getResultsIntervalOn() const=0;
232 // non-zero if results files will be generated based on a real-time interval.
233 virtual uint64 getResultsIntervalClock() const=0;
234 // The name of the process used to determine the model time -- from the list of
235 // processes available to the current model.
236 virtual string getResultsIntervalProcess() const=0;
237 // non-zero if results files will be generated based on the number of cycles/steps.
238 virtual uint64 getResultsIntervalStep() const=0;
239 // non-zero if results files will be generated based on accumulated model time
240 // in the process returned by getResultsIntervalProcess().
241 virtual double getResultsIntervalTime() const=0;
242 // Returns the prefix used for automatically generated results files.
243 virtual string getResultsIntervalPrefix() const=0;
244 // Returns the current index used for automatically generated results files.
245 // This is appended to the prefix and incremented automatically.
246 virtual uint32 getResultsIntervalIndex() const=0;
247
251 virtual void startProcessingFile(const string &fullPathName,const string &type)=0;
252
256 virtual void stopProcessingFile(const string &fullPathName,const string &type)=0;
257
259 virtual void resetProject(bool quiet=false)=0;
260
263 virtual void cleanModel(bool all=false)=0;
264
267 virtual void calmModel()=0;
268
270 virtual void filterModel(const itascaxd::IRange &)=0;
271
273 virtual signal_type *getResetSignal() const=0;
274
276 virtual signal_type *getSaveSignal() const=0;
277
279 virtual signal_type *getRestoredSignal() const=0;
280
283 virtual void save(shared::Stream &dev,bool readOnly,bool text)=0;
284
288 virtual StringList restore(shared::Stream &dev,shared::Stream *out,Skip skip)=0;
289
290 virtual void logEvent(const string &str)=0;
291
293 virtual bool getInCycle() const=0;
294
295 virtual StringList getAllTypeKeywords() const=0;
296
298 virtual StateInfoOutput getModelStateInformation() const=0;
299
301 virtual StateInfoOutput getProgramStateInformation() const=0;
302 };
303
304}
306// EoF
One stop include for all objects defined as part of base interface.
Definition basestring.h:71
std::unordered_set< FileData, FileDataHash > FileDataSet
Definition iinputrecord.h:37
This Interface provides an entry point for command processing.
Definition ikernel.h:40
shared::Signal< const string & > restoreModelStateEnd
This SIGNAL is emitted when a model restore is finished, regardless of hidden state.
Definition ikernel.h:63
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:50
shared::Signal resetModelState
This SIGNAL is emitted when the model state is reset, (a NEW command, for example).
Definition ikernel.h:68
virtual string outputCommandsForModel() const =0
Output commands and FISH for inline help.
virtual StateInfoOutput getProgramStateInformation() const =0
Get the program state information.
shared::Signal< const char *, const string & > popInputItem
Definition ikernel.h:58
virtual void addCommandDocumentation(const string &referencename, const StringList &list)=0
Add cmd-doc definitions from a StringList.
virtual void calmModel()=0
virtual std::pair< 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:47
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
shared::Signal restoreModelStateStart
Definition ikernel.h:61
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 StateInfoOutput getModelStateInformation() const =0
Get the model state information.
virtual void stopProcessingFile(const string &fullPathName, const string &type)=0
virtual IParse * createStackAndParse(const QString &)=0
Create a Parse object and stack from terminal. Needs to be destroyed.
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:66
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:54
virtual bool modelChanged() const =0
Model changed state.
shared::Signal< int32 > compressingFileProgress
Definition ikernel.h:76
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:73
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:14
Interface to the main command processing class.
Definition iparse.h:50
Definition iinputitem.h:9
Definition ikernelbase.h:9
Definition ikernelbase.h:7
Interface to a filter, used as the main method for filtering objects.
Definition irange.h:32
namespace Itasca
Definition basememory.cpp:14
Itasca Library standard namespace, specific to 2D or 3D.
Definition icontactmodule.h:6
Definition ikernel.h:223
Provides a interface for getting text.
Definition itextinput.h:12