Itasca C++ Interface
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
itasca::IKernel Class Referenceabstract

This Interface provides an entry point for command processing. More...

#include <ikernel.h>

Classes

struct  ResultsDesc
 

Public Types

using Skip = itascaxd::IKernelBase::Skip
 
using signal_type = shared::Signal<const IThing *,const IContainer *>
 

Public Member Functions

virtual itascaxd::IKernelBasegetIKernelBase ()=0
 
virtual bool initialize (IKernelInput *input, IKernelOutput *output)=0
 
virtual bool disconnectFromInterface ()=0
 This is called to indicate that the GUI is shutting down - no calls to input or output should occurr.
 
virtual bool security (security::ISC *scomm)=0
 
virtual bool preCommandLineArguments (StringList *args)=0
 
virtual bool commandLineArguments (const StringList &args)=0
 
virtual std::vector< InputLinefromCommandLineArguments (const StringList &args)=0
 
virtual string processCommands (itascaxd::IInputItem *ii, const string &inputPath=string(), bool recursive=false, bool suppress=false)=0
 
virtual string processCommands (const std::vector< InputLine > &sl, const string &inputPath=string(), bool recursive=false)=0
 
virtual string processCommand (const InputLine &s, const string &inputPath=string(), bool recursive=false)=0
 
virtual bool getAutoTestMode () const =0
 Return the test mode flag.
 
virtual StringList getTestDirectories () const =0
 Returns all directories current part of the testing system.
 
virtual IKernelOutputgetIKernelOutput ()=0
 Returns a pointer to a IKernelOutput object.
 
virtual void addCommandDocumentation (const string &referencename, const StringList &list)=0
 Add cmd-doc definitions from a StringList.
 
virtual void addSphinxCommands (const StringList &)=0
 Add inline help commands.
 
virtual void addSphinxFish (const StringList &)=0
 Add inline help FISH.
 
virtual string outputCommandsForModel () const =0
 Output commands and FISH for inline help.
 
virtual string outputFishForModel () const =0
 
virtual int testValidCommand (const string &line, string *errorinfo=0) const =0
 
virtual int testValidCommandText (const string &text, string *errorinfo=0, std::vector< int > *errorlines=0) const =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 string getSaveFileName () const =0
 Get the name of the last save file.
 
virtual bool modelChanged () const =0
 Model changed state.
 
virtual bool projectChanged () const =0
 Project changed state.
 
virtual void saveProject (Archive2 &a) const =0
 Project archive.
 
virtual bool restoreProject (Archive2 &a, uint64 label)=0
 
virtual void remapProject (Archive2 &a)=0
 
virtual bool readSaveFileInfo (shared::Stream &dev, IInputRecord::FileDataSet *set, StringList *lines) const =0
 
virtual void compressFileList (const StringList &files)=0
 
virtual void decompressFileList (const StringList &files)=0
 
virtual bool fileIsCompressed (const string &filename) const =0
 Return true if the given file has been compressed.
 
virtual std::vector< ResultsDescgetResultsState () const =0
 
virtual bool getResultsIntervalOn () const =0
 
virtual uint64 getResultsIntervalClock () const =0
 
virtual string getResultsIntervalProcess () const =0
 
virtual uint64 getResultsIntervalStep () const =0
 
virtual double getResultsIntervalTime () const =0
 
virtual string getResultsIntervalPrefix () const =0
 
virtual uint32 getResultsIntervalIndex () const =0
 
virtual void startProcessingFile (const string &fullPathName, const string &type)=0
 
virtual void stopProcessingFile (const string &fullPathName, const string &type)=0
 
virtual void resetProject (bool quiet=false)=0
 Clears PROJECT level memory (filter, persistant FISH, etc). Called by NEW PROJECT.
 
virtual void cleanModel (bool all=false)=0
 
virtual void calmModel ()=0
 
virtual void filterModel (const itascaxd::IRange &)=0
 Call a filter method in each module.
 
virtual signal_typegetResetSignal () const =0
 Return the signal indicating that the model will be reset, i.e., it is emitted before a reset.
 
virtual signal_typegetSaveSignal () const =0
 Return the signal indicating that the model will be saved, i.e., it is emitted before a save.
 
virtual signal_typegetRestoredSignal () const =0
 Return the signal indicating that the model has been restored. i.e., it is emitted after a restore.
 
virtual void save (shared::Stream &dev, bool readOnly, bool text)=0
 
virtual StringList restore (shared::Stream &dev, shared::Stream *out, Skip skip)=0
 
virtual void logEvent (const string &str)=0
 
virtual bool getInCycle () const =0
 Get the boolean indicating cycling mode.
 
virtual StringList getAllTypeKeywords () const =0
 

Public Attributes

shared::Signal abort
 Due to a QUIT or a STOP, or a catastrophic error, etc.
 
shared::Signal< const char *, const string &, bool > pushInputItem
 
shared::Signal< const char *, const string & > popInputItem
 
shared::Signal< const string & > restoreModelState
 
shared::Signal resetModelState
 This SIGNAL is emitted when the model state is reset, (a NEW command, for example).
 
shared::Signal< const string & > exportResultFile
 
shared::Signal< const string & > importResultFile
 
shared::Signal< int32 > compressingFileIndex
 
shared::Signal< int32 > compressingFileProgress
 
shared::Signal< const string &, int64, int64, int64 > tagInEditor
 
shared::Signal< const string & > projectSysPath
 

Detailed Description

This Interface provides an entry point for command processing.

Member Typedef Documentation

◆ signal_type

using itasca::IKernel::signal_type = shared::Signal<const IThing *,const IContainer *>

Defines the Signal2<> type used for signaling to FISH that the model will be reset. It will be given with null arguments and all FISH pointers will be cleared. Needs to be hooked up
via the registerSignalOnThingDelete methed.

Member Function Documentation

◆ calmModel()

virtual void itasca::IKernel::calmModel ( )
pure virtual

Call a calm method defined in each module. This "calms" the model in a pre-defined and module specific way. For mechanical rigid bodies, all dofs of velocity are set to 0.

◆ cleanModel()

virtual void itasca::IKernel::cleanModel ( bool all = false)
pure virtual

Asks the model the "clean" itself - doing whatever calculations are necessary to make itself valid for cycling after whatever changes were made.

◆ commandLineArguments()

virtual bool itasca::IKernel::commandLineArguments ( const StringList & args)
pure virtual

This processes a list of command line arguments. args may have been edited by the GUI. args does NOT include the traditional first argument, the command that started the process. Returns TRUE if the program should shut down. Should be called after initialize and security.

◆ compressFileList()

virtual void itasca::IKernel::compressFileList ( const StringList & files)
pure virtual

Compress a list of save files. Two different SIGNALS are emitted during compression of a list of files. compressingFileIndex(int) gives the index of the file which is currently being processed, this is an integer between 0 and files.size()-1. compressingFileProgress(int) give the progress of the file which is currently being compressed, this is an integer between 0 and

  1. Throws an exception if there is an error.

◆ expandCommandKeyword()

virtual QPair< string, string > itasca::IKernel::expandCommandKeyword ( const string & line,
string & fileName,
int cursor = -1 ) const
pure virtual

Given a line of proposed input to the command processor, return the full expanded command and first keyword from the first two tokens. Will return null in either if there is no match, or if there is no valid keyword or token.

◆ getCommandInformation()

virtual StringList itasca::IKernel::getCommandInformation ( const string & line,
int cursor = -1,
bool thinkFish = false ) const
pure virtual

Given a line of proposed input to the command processor, returns information regarding the signature of the most recent command/FISH function referenced.

◆ initialize()

virtual bool itasca::IKernel::initialize ( IKernelInput * input,
IKernelOutput * output )
pure virtual

This must be called before the kernel object (or the code in general) can be used. its and iti are the main text communication channels. comm is used for supplementary things - like getKey(), information(), etc. poll is called during all lengthy computations to give a single-threaded GUI the chance to respond to user input.

◆ preCommandLineArguments()

virtual bool itasca::IKernel::preCommandLineArguments ( StringList * args)
pure virtual

Process command line arguments prior to restoring projects Neccesary to assing memory in fortran codes

◆ processCommand()

virtual string itasca::IKernel::processCommand ( const InputLine & s,
const string & inputPath = string(),
bool recursive = false )
pure virtual

Send contents of s as a command.
Command processing is done immediately, unless called recursively because commands are already being processed. In this case the commands are added to the lowest item on the stack and will therefore be processed after the stack is done and has exhausted prior commands. Returns the error message if an error resulted, or string() if none occurred. source and line indicate the source of the commands in sl, and the line number of the first line in sl from the original source. inputPath indicates the absolute pathname of the source file name. Will catch and handle exceptions thrown during command processing.

◆ processCommands() [1/2]

virtual string itasca::IKernel::processCommands ( const std::vector< InputLine > & sl,
const string & inputPath = string(),
bool recursive = false )
pure virtual

Send contents of sl as commands.
Command processing is done immediately, unless called recursively because commands are already being processed. In this case the commands are added to the lowest item on the stack and will therefore be processed after the stack is done and has exhausted prior commands. Returns the error message if an error resulted, or string() if none occurred. source and line indicate the source of the commands in sl, and the line number of the first line in sl from the original source. inputPath indicates the absolute pathname of the source file name. Will catch and handle exceptions thrown during command processing.

◆ processCommands() [2/2]

virtual string itasca::IKernel::processCommands ( itascaxd::IInputItem * ii,
const string & inputPath = string(),
bool recursive = false,
bool suppress = false )
pure virtual

Send contents of ii as commands, takes ownership of ii. Returns the error message if an error resulted, or string() if none occurred. Command processing is done immediately, unless called recursively because commands are already being processed. In this case the commands are added to the lowest item on the stack and will therefore be processed after the stack is done and has exhausted prior commands. Will catch and handle exceptions thrown during command processing.

◆ readSaveFileInfo()

virtual bool itasca::IKernel::readSaveFileInfo ( shared::Stream & dev,
IInputRecord::FileDataSet * set,
StringList * lines ) const
pure virtual

Checks the input stream input, which is assumed to be the start of a valid save file. It checks for the existence of an ASCII format save file header, and returns FALSE if one is not found. If one is found, it returns the contents of the header in header.

◆ restore()

virtual StringList itasca::IKernel::restore ( shared::Stream & dev,
shared::Stream * out,
Skip skip )
pure virtual

Restores file from filename name. Clears current model and opens data stream. This also loads the header (calls restoreHeader) and checks for save file validity. This function also calls remap() and clears containers of index arrays.

◆ save()

virtual void itasca::IKernel::save ( shared::Stream & dev,
bool readOnly,
bool text )
pure virtual

Saves to filename name. Checks for file space and opens data stream. Assigns indices to containers.

◆ security()

virtual bool itasca::IKernel::security ( security::ISC * scomm)
pure virtual

This function should be called after initialize but before processing commands. It checks the current security setting. Returns TRUE if program should shut down. Note - might want to modify argument in some encrypted way to verify call made correctly.

◆ startProcessingFile()

virtual void itasca::IKernel::startProcessingFile ( const string & fullPathName,
const string & type )
pure virtual

This SIGNAL Indicates that a file is being processed by the kernel.

  • fullPathName indicates the full file and path name begin processed.
  • type indicates the type of file being processed. At present this will be "Grid", indicating an import grid file.

◆ stopProcessingFile()

virtual void itasca::IKernel::stopProcessingFile ( const string & fullPathName,
const string & type )
pure virtual

This SIGNAL Indicates that a file has finished being processed by the kernel, after a call to startProcessingFile().

  • fullPathName indicates the full file and path name begin processed.
  • type indicates the type of file that was processed. At present this will be "Grid", indicating an import grid file.

◆ testValidCommand()

virtual int itasca::IKernel::testValidCommand ( const string & line,
string * errorinfo = 0 ) const
pure virtual

Tests line as a line from a data file for validity, using internal doc data. Returns -1 if OK, otherwise returns the number of the first bad token in line. errorinfo may be filled with a specific error message.

◆ testValidCommandText()

virtual int itasca::IKernel::testValidCommandText ( const string & text,
string * errorinfo = 0,
std::vector< int > * errorlines = 0 ) const
pure virtual

Tests the context of text as multiple lines of text, separated by '
'. Returns the number of errors encountered (0 if none). errorinfo may be filled with a specific error message. errorlines is filled with the character positions where errors were found in each line of text, -1 indicating no error. (??)

Member Data Documentation

◆ compressingFileIndex

shared::Signal<int32> itasca::IKernel::compressingFileIndex

This SIGNAL indicates which file is being compressed during a call to compressFileList. The value is an integer between 0 and files.size()-1.

◆ compressingFileProgress

shared::Signal<int32> itasca::IKernel::compressingFileProgress

This SIGNAL indicates the compression progressof the file presently being compressed during a call to compressFileList. The value is an integer between 0 and 100.

◆ popInputItem

shared::Signal<const char *, const string &> itasca::IKernel::popInputItem

This SIGNAL is emitted when an inputitem is popped off the input stack.

  • type indicates the type of the new input. Possible values include "keyboard", "Stringlist", and "file".
  • name is an identifying name of the input source.

◆ pushInputItem

shared::Signal<const char *, const string &, bool> itasca::IKernel::pushInputItem
  • type indicates the type of the new input. Possible values include "keyboard", "Stringlist", and "file".
  • name is an identifying name of the input source.
  • start indicates this is the start of a new call tree.

◆ restoreModelState

shared::Signal<const string &> itasca::IKernel::restoreModelState

This SIGNAL is emiited when a model is restored from a saved state.

  • name is the absolute path and file name of the save file created or overwritten.

The documentation for this class was generated from the following file: