IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.
|
Base class for interfaces with interpreters. More...
Public Member Functions | |
InterfaceInterpreterBase () | |
InterfaceInterpreterBase (string commandFileName) | |
InterfaceInterpreterBase (string workingDirctory, string commandFileName) | |
Constructor. | |
InterfaceInterpreterBase (string commandDirectory, string startDirectory, string commandFileName) | |
Constructor. | |
virtual void | ResetCommands () |
virtual void | Append (string str) |
Appends a literal string to the contents of the command file plus a newline character. | |
virtual void | AppendLine (string str) |
Appends a literal string to the contents of the command file. | |
virtual void | AppendLine () |
virtual void | AppendIndent () |
Appends indentation to the contents of the command file. | |
virtual void | AppendComment (string str, bool withNewlines) |
Appends a vomment to the contents of the command file. | |
virtual void | StartCodeBlock () |
Starts a new code block in the interpreter command file contents. | |
virtual void | EndCodeBlock () |
Ends a code block in the interpreter command file contents. | |
virtual void | StartCommand (string commandName) |
Starts a new command in the interpreter command file contents. | |
virtual void | EndCommand () |
Ends (finalizes) a command in the interpreter command file contents. | |
virtual void | AppendCommandArgumentSeparatorIfNecessary () |
Appends a command line separator to the interpreter command file contents, if necessary (i.e. if any arguments have already been written to the command file contents). | |
virtual void | AppendValue (int value) |
Appends an integer value to the interpreter command file contents. | |
virtual void | AppendValue (double value) |
Appends a double value to the interpreter command file contents. | |
virtual void | AppendValue (bool value) |
Appends a boolean value to the interpreter command file contents. | |
virtual void | AppendValue (string value) |
Appends a string value to the interpreter command file contents. | |
virtual void | AppendValue (IVector value) |
Appends a vector value to the interpreter command file contents. | |
virtual void | AppendValue (IMatrix value) |
Appends a matrix value to the interpreter command file contents. | |
virtual void | AppendCommandArgumentVariableReference (string variableName) |
Appends a variable reference to the current argument block. | |
virtual void | AppendCommandArgument (int value) |
Appends an integer argument to the command argument block of the interpreter command file. | |
virtual void | AppendCommandArgument (double value) |
Appends a double argument to the command argument block of the interpreter command file. | |
virtual void | AppendCommandArgument (bool value) |
Appends a boolean argument to the command argument block of the interpreter command file. | |
virtual void | AppendCommandArgument (string value) |
Appends a string argument to the command argument block of the interpreter command file. | |
virtual void | AppendCommandArgumentPlain (string value) |
Appends a plain string argument (without decoration such as double quotes) to the command argument block of the interpreter command file. | |
virtual void | AppendCommandArgument (IVector value) |
Appends a vector argument to the command argument block of the interpreter command file. | |
virtual void | AppendCommandArgument (IMatrix value) |
Appends a matrix argument to the command argument block of the interpreter command file. | |
virtual void | WriteCommandFile () |
Writes the current contents of the interpreter command file to the physical file. If the file exists then it is overwritten. After this method is called, ResetCommands() should be called if the object will be further used. | |
virtual void | WriteAppendToCommandFile () |
Appends the current contents of the interpreter command file to the physical file. After this method is called, ResetCommands() should be called if the object will be further used. | |
virtual void | WriteAndRunCommandFile () |
Writes interpreter command file and runs it. After this method is called, ResetCommands() should be called if the object will be further used. | |
Protected Member Functions | |
virtual void | AppendCommandVariableReference (string variableName) |
Appends a variable reference to the contents of the interpreter command file. | |
virtual void | WriteCommandFile (bool appendContents) |
Writes the current contents of the interpreter command file to the physical file. After this method is called, ResetCommands() should be called if the object will be further used. | |
virtual void | RunCommandFile () |
Runs the interpreter command file. | |
Properties | |
object | Lock [get] |
This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock. | |
virtual StringBuilder | CommandBuilder [get, set] |
Command builder. | |
virtual string | CommandFileString [get] |
Gets current state of commands as stirng. | |
virtual string | InterpreterCommand [get, set] |
Gets or sets the command that invokes the interpreter. This may be a full path to the executable, or only executable name if the executable is located in a directory included in path. | |
virtual string | CommandDirectory [get, set] |
Gets or sets the directory where command file will be located. | |
virtual string | DefaultCommandFileName [get] |
Gets the default command file name for the current interpreter. | |
virtual string | CommandFileName [get, set] |
Gets or sets the command file name where interpreter commands will be written. | |
virtual string | CommandFilePath [get] |
Gets path to command file. | |
virtual string | StartingDirectory [get, set] |
Gets or sets the command that invokes the interpreter. | |
virtual string | CommandIntroduction [get, set] |
String that introduces a new command (and is written before the command name in the command file). Usually a newline. | |
virtual string | CommandArgumentBlockBegin [get, set] |
String that begins command arguments block. | |
virtual string | CommandArgumentBlockEnd [get, set] |
String that ends command argument block. | |
virtual string | CommandArgumentSeparator [get, set] |
String that begins command arguments block. | |
virtual bool | CommandArgumentsInNewLines [get, set] |
Whether command arguments are listed in separate lines or not. | |
virtual int | CommandArgumentCount [get, set] |
The number of current argument. | |
virtual bool | IsWithinArgumentBlock [get, set] |
The number of current argument. | |
virtual string | CodeBlockBegin [get, set] |
String that begins a code block in interpreted files. | |
virtual string | CodeBlockEnd [get, set] |
String that ends a code block in interpreted files. | |
virtual string | VariableReferenceBegin [get, set] |
String that begins a code block in interpreted files. | |
virtual string | VariableReferenceEnd [get, set] |
String that ends a code block in interpreted files. | |
virtual string | IndentationString [get, set] |
String used for indentation of code. | |
virtual int | IndentationLevel [get, set] |
Indentation level - how many indentation strings are added before each new row. | |
virtual string | CommentBegin [get, set] |
String that begins a comment. | |
virtual string | CommentEnd [get, set] |
String that ends a comment. | |
Private Attributes | |
object | _mainLock = new object() |
StringBuilder | _commandBuilder = new StringBuilder() |
string | _interpreterCommand |
string | _commandDirectory |
string | _startingDirectory |
string | _commandFileName |
string | _commandIndroduction = Environment.NewLine |
string | _commandArgumentBlockBegin = " " |
string | _commandArgumentBlockEnd = " ) " + Environment.NewLine |
string | _commandArgumentSeparator = ", " |
bool | _commandArgumentsInNewLines = true |
int | _commandArgumentCount = 0 |
bool | _isWithinArgumentBlock = false |
string | _codeBlockBegin = "{" + Environment.NewLine |
string | _codeBlockEnd = "}" + Environment.NewLine |
string | _variableReferenceBegin = "$" |
string | _variableReferenceEnd = "" |
string | _indentationString = " " |
int | _indentationLevel = 0 |
string | _commentBegin = "/* " |
string | _commentEnd = " */ " |
Base class for interfaces with interpreters.
$A Igor Jul09;
IG::Lib::InterfaceInterpreterBase::InterfaceInterpreterBase | ( | ) | [inline] |
IG::Lib::InterfaceInterpreterBase::InterfaceInterpreterBase | ( | string | commandFileName | ) | [inline] |
IG::Lib::InterfaceInterpreterBase::InterfaceInterpreterBase | ( | string | workingDirctory, |
string | commandFileName | ||
) | [inline] |
Constructor.
workingDirctory | Directory whre command file is written to and working directory for interpreter's application. Relative or absolute path. |
commandFileName | Name of the command file to which commands are written and which is interpreted by the interpreter. |
IG::Lib::InterfaceInterpreterBase::InterfaceInterpreterBase | ( | string | commandDirectory, |
string | startDirectory, | ||
string | commandFileName | ||
) | [inline] |
Constructor.
commandDirectory | Directory whre command file is written to. Relative or absolute path. |
startDirectory | Directory in which interpreter application is started. Relative or absolute path. |
commandFileName | Name of the command file to which commands are written and which is interpreted by the interpreter. |
virtual void IG::Lib::InterfaceInterpreterBase::ResetCommands | ( | ) | [inline, virtual] |
virtual void IG::Lib::InterfaceInterpreterBase::Append | ( | string | str | ) | [inline, virtual] |
Appends a literal string to the contents of the command file plus a newline character.
str | String to be appended. |
virtual void IG::Lib::InterfaceInterpreterBase::AppendLine | ( | string | str | ) | [inline, virtual] |
Appends a literal string to the contents of the command file.
str | String to be appended. |
virtual void IG::Lib::InterfaceInterpreterBase::AppendLine | ( | ) | [inline, virtual] |
virtual void IG::Lib::InterfaceInterpreterBase::AppendIndent | ( | ) | [inline, virtual] |
Appends indentation to the contents of the command file.
virtual void IG::Lib::InterfaceInterpreterBase::AppendComment | ( | string | str, |
bool | withNewlines | ||
) | [inline, virtual] |
Appends a vomment to the contents of the command file.
str | Comment text. |
withNewlines | Whether comment is appended in a separate line. |
virtual void IG::Lib::InterfaceInterpreterBase::StartCodeBlock | ( | ) | [inline, virtual] |
Starts a new code block in the interpreter command file contents.
virtual void IG::Lib::InterfaceInterpreterBase::EndCodeBlock | ( | ) | [inline, virtual] |
Ends a code block in the interpreter command file contents.
virtual void IG::Lib::InterfaceInterpreterBase::StartCommand | ( | string | commandName | ) | [inline, virtual] |
Starts a new command in the interpreter command file contents.
commandName | Name of the command. |
virtual void IG::Lib::InterfaceInterpreterBase::EndCommand | ( | ) | [inline, virtual] |
Ends (finalizes) a command in the interpreter command file contents.
virtual void IG::Lib::InterfaceInterpreterBase::AppendCommandArgumentSeparatorIfNecessary | ( | ) | [inline, virtual] |
Appends a command line separator to the interpreter command file contents, if necessary (i.e. if any arguments have already been written to the command file contents).
virtual void IG::Lib::InterfaceInterpreterBase::AppendValue | ( | int | value | ) | [inline, virtual] |
Appends an integer value to the interpreter command file contents.
value | Value to be appended. |
virtual void IG::Lib::InterfaceInterpreterBase::AppendValue | ( | double | value | ) | [inline, virtual] |
Appends a double value to the interpreter command file contents.
value | Value to be appended. |
virtual void IG::Lib::InterfaceInterpreterBase::AppendValue | ( | bool | value | ) | [inline, virtual] |
Appends a boolean value to the interpreter command file contents.
value | Value to be appended. |
Reimplemented in IG::Lib::InterfaceInverse.
virtual void IG::Lib::InterfaceInterpreterBase::AppendValue | ( | string | value | ) | [inline, virtual] |
Appends a string value to the interpreter command file contents.
value | Value to be appended. |
Reimplemented in IG::Lib::InterfaceInverse.
virtual void IG::Lib::InterfaceInterpreterBase::AppendValue | ( | IVector | value | ) | [inline, virtual] |
Appends a vector value to the interpreter command file contents.
value | Value to be appended. |
Reimplemented in IG::Lib::InterfaceInverse.
virtual void IG::Lib::InterfaceInterpreterBase::AppendValue | ( | IMatrix | value | ) | [inline, virtual] |
Appends a matrix value to the interpreter command file contents.
value | Value to be appended. |
Reimplemented in IG::Lib::InterfaceInverse.
virtual void IG::Lib::InterfaceInterpreterBase::AppendCommandVariableReference | ( | string | variableName | ) | [inline, protected, virtual] |
Appends a variable reference to the contents of the interpreter command file.
value | Name of the variable whose reference is appended. |
virtual void IG::Lib::InterfaceInterpreterBase::AppendCommandArgumentVariableReference | ( | string | variableName | ) | [inline, virtual] |
Appends a variable reference to the current argument block.
value | Name of the variable whose reference is appended. |
virtual void IG::Lib::InterfaceInterpreterBase::AppendCommandArgument | ( | int | value | ) | [inline, virtual] |
Appends an integer argument to the command argument block of the interpreter command file.
value | Value of the argument that is appended. |
virtual void IG::Lib::InterfaceInterpreterBase::AppendCommandArgument | ( | double | value | ) | [inline, virtual] |
Appends a double argument to the command argument block of the interpreter command file.
value | Value of the argument that is appended. |
virtual void IG::Lib::InterfaceInterpreterBase::AppendCommandArgument | ( | bool | value | ) | [inline, virtual] |
Appends a boolean argument to the command argument block of the interpreter command file.
value | Value of the argument that is appended. |
virtual void IG::Lib::InterfaceInterpreterBase::AppendCommandArgument | ( | string | value | ) | [inline, virtual] |
Appends a string argument to the command argument block of the interpreter command file.
value | Value of the argument that is appended. |
virtual void IG::Lib::InterfaceInterpreterBase::AppendCommandArgumentPlain | ( | string | value | ) | [inline, virtual] |
Appends a plain string argument (without decoration such as double quotes) to the command argument block of the interpreter command file.
value | Value of the argument that is appended. |
virtual void IG::Lib::InterfaceInterpreterBase::AppendCommandArgument | ( | IVector | value | ) | [inline, virtual] |
Appends a vector argument to the command argument block of the interpreter command file.
value | Value of the argument that is appended. |
virtual void IG::Lib::InterfaceInterpreterBase::AppendCommandArgument | ( | IMatrix | value | ) | [inline, virtual] |
Appends a matrix argument to the command argument block of the interpreter command file.
value | Value of the argument that is appended. |
virtual void IG::Lib::InterfaceInterpreterBase::WriteCommandFile | ( | bool | appendContents | ) | [inline, protected, virtual] |
Writes the current contents of the interpreter command file to the physical file. After this method is called, ResetCommands() should be called if the object will be further used.
appendContents | Whether file contents are appended. |
virtual void IG::Lib::InterfaceInterpreterBase::WriteCommandFile | ( | ) | [inline, virtual] |
Writes the current contents of the interpreter command file to the physical file. If the file exists then it is overwritten. After this method is called, ResetCommands() should be called if the object will be further used.
virtual void IG::Lib::InterfaceInterpreterBase::WriteAppendToCommandFile | ( | ) | [inline, virtual] |
Appends the current contents of the interpreter command file to the physical file. After this method is called, ResetCommands() should be called if the object will be further used.
virtual void IG::Lib::InterfaceInterpreterBase::RunCommandFile | ( | ) | [inline, protected, virtual] |
Runs the interpreter command file.
virtual void IG::Lib::InterfaceInterpreterBase::WriteAndRunCommandFile | ( | ) | [inline, virtual] |
Writes interpreter command file and runs it. After this method is called, ResetCommands() should be called if the object will be further used.
object IG::Lib::InterfaceInterpreterBase::_mainLock = new object() [private] |
StringBuilder IG::Lib::InterfaceInterpreterBase::_commandBuilder = new StringBuilder() [private] |
string IG::Lib::InterfaceInterpreterBase::_interpreterCommand [private] |
string IG::Lib::InterfaceInterpreterBase::_commandDirectory [private] |
string IG::Lib::InterfaceInterpreterBase::_startingDirectory [private] |
string IG::Lib::InterfaceInterpreterBase::_commandFileName [private] |
string IG::Lib::InterfaceInterpreterBase::_commandIndroduction = Environment.NewLine [private] |
string IG::Lib::InterfaceInterpreterBase::_commandArgumentBlockBegin = " " [private] |
string IG::Lib::InterfaceInterpreterBase::_commandArgumentBlockEnd = " ) " + Environment.NewLine [private] |
string IG::Lib::InterfaceInterpreterBase::_commandArgumentSeparator = ", " [private] |
bool IG::Lib::InterfaceInterpreterBase::_commandArgumentsInNewLines = true [private] |
int IG::Lib::InterfaceInterpreterBase::_commandArgumentCount = 0 [private] |
bool IG::Lib::InterfaceInterpreterBase::_isWithinArgumentBlock = false [private] |
string IG::Lib::InterfaceInterpreterBase::_codeBlockBegin = "{" + Environment.NewLine [private] |
string IG::Lib::InterfaceInterpreterBase::_codeBlockEnd = "}" + Environment.NewLine [private] |
string IG::Lib::InterfaceInterpreterBase::_variableReferenceBegin = "$" [private] |
string IG::Lib::InterfaceInterpreterBase::_variableReferenceEnd = "" [private] |
string IG::Lib::InterfaceInterpreterBase::_indentationString = " " [private] |
int IG::Lib::InterfaceInterpreterBase::_indentationLevel = 0 [private] |
string IG::Lib::InterfaceInterpreterBase::_commentBegin = "/* " [private] |
string IG::Lib::InterfaceInterpreterBase::_commentEnd = " */ " [private] |
object IG::Lib::InterfaceInterpreterBase::Lock [get] |
This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock.
Implements IG::Lib::ILockable.
virtual StringBuilder IG::Lib::InterfaceInterpreterBase::CommandBuilder [get, set] |
Command builder.
virtual string IG::Lib::InterfaceInterpreterBase::CommandFileString [get] |
Gets current state of commands as stirng.
virtual string IG::Lib::InterfaceInterpreterBase::InterpreterCommand [get, set] |
Gets or sets the command that invokes the interpreter. This may be a full path to the executable, or only executable name if the executable is located in a directory included in path.
virtual string IG::Lib::InterfaceInterpreterBase::CommandDirectory [get, set] |
Gets or sets the directory where command file will be located.
virtual string IG::Lib::InterfaceInterpreterBase::DefaultCommandFileName [get] |
Gets the default command file name for the current interpreter.
virtual string IG::Lib::InterfaceInterpreterBase::CommandFileName [get, set] |
Gets or sets the command file name where interpreter commands will be written.
virtual string IG::Lib::InterfaceInterpreterBase::CommandFilePath [get] |
Gets path to command file.
virtual string IG::Lib::InterfaceInterpreterBase::StartingDirectory [get, set] |
Gets or sets the command that invokes the interpreter.
virtual string IG::Lib::InterfaceInterpreterBase::CommandIntroduction [get, set] |
String that introduces a new command (and is written before the command name in the command file). Usually a newline.
virtual string IG::Lib::InterfaceInterpreterBase::CommandArgumentBlockBegin [get, set] |
String that begins command arguments block.
virtual string IG::Lib::InterfaceInterpreterBase::CommandArgumentBlockEnd [get, set] |
String that ends command argument block.
virtual string IG::Lib::InterfaceInterpreterBase::CommandArgumentSeparator [get, set] |
String that begins command arguments block.
virtual bool IG::Lib::InterfaceInterpreterBase::CommandArgumentsInNewLines [get, set] |
Whether command arguments are listed in separate lines or not.
virtual int IG::Lib::InterfaceInterpreterBase::CommandArgumentCount [get, set] |
The number of current argument.
virtual bool IG::Lib::InterfaceInterpreterBase::IsWithinArgumentBlock [get, set] |
The number of current argument.
virtual string IG::Lib::InterfaceInterpreterBase::CodeBlockBegin [get, set] |
String that begins a code block in interpreted files.
virtual string IG::Lib::InterfaceInterpreterBase::CodeBlockEnd [get, set] |
String that ends a code block in interpreted files.
virtual string IG::Lib::InterfaceInterpreterBase::VariableReferenceBegin [get, set] |
String that begins a code block in interpreted files.
virtual string IG::Lib::InterfaceInterpreterBase::VariableReferenceEnd [get, set] |
String that ends a code block in interpreted files.
virtual string IG::Lib::InterfaceInterpreterBase::IndentationString [get, set] |
String used for indentation of code.
virtual int IG::Lib::InterfaceInterpreterBase::IndentationLevel [get, set] |
Indentation level - how many indentation strings are added before each new row.
virtual string IG::Lib::InterfaceInterpreterBase::CommentBegin [get, set] |
String that begins a comment.
virtual string IG::Lib::InterfaceInterpreterBase::CommentEnd [get, set] |
String that ends a comment.