IGLib  1.7.2
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Lib.InterfaceInterpreterBase Class Reference

Base class for interfaces with interpreters. More...

+ Inheritance diagram for IG.Lib.InterfaceInterpreterBase:
+ Collaboration diagram for IG.Lib.InterfaceInterpreterBase:

Public Member Functions

 InterfaceInterpreterBase ()
 
 InterfaceInterpreterBase (string commandFileName)
 
 InterfaceInterpreterBase (string workingDirctory, string commandFileName)
 Constructor. More...
 
 InterfaceInterpreterBase (string commandDirectory, string startDirectory, string commandFileName)
 Constructor. More...
 
virtual void ResetCommands ()
 
virtual void Append (string str)
 Appends a literal string to the contents of the command file plus a newline character. More...
 
virtual void AppendLine (string str)
 Appends a literal string to the contents of the command file. More...
 
virtual void AppendLine ()
 
virtual void AppendIndent ()
 Appends indentation to the contents of the command file. More...
 
virtual void AppendComment (string str, bool withNewlines)
 Appends a vomment to the contents of the command file. More...
 
virtual void StartCodeBlock ()
 Starts a new code block in the interpreter command file contents. More...
 
virtual void EndCodeBlock ()
 Ends a code block in the interpreter command file contents. More...
 
virtual void StartCommand (string commandName)
 Starts a new command in the interpreter command file contents. More...
 
virtual void EndCommand ()
 Ends (finalizes) a command in the interpreter command file contents. More...
 
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). More...
 
virtual void AppendValue (int value)
 Appends an integer value to the interpreter command file contents. More...
 
virtual void AppendValue (double value)
 Appends a double value to the interpreter command file contents. More...
 
virtual void AppendValue (bool value)
 Appends a boolean value to the interpreter command file contents. More...
 
virtual void AppendValue (string value)
 Appends a string value to the interpreter command file contents. More...
 
virtual void AppendValue (IVector value)
 Appends a vector value to the interpreter command file contents. More...
 
virtual void AppendValue (IMatrix value)
 Appends a matrix value to the interpreter command file contents. More...
 
virtual void AppendCommandArgumentVariableReference (string variableName)
 Appends a variable reference to the current argument block. More...
 
virtual void AppendCommandArgument (int value)
 Appends an integer argument to the command argument block of the interpreter command file. More...
 
virtual void AppendCommandArgument (double value)
 Appends a double argument to the command argument block of the interpreter command file. More...
 
virtual void AppendCommandArgument (bool value)
 Appends a boolean argument to the command argument block of the interpreter command file. More...
 
virtual void AppendCommandArgument (string value)
 Appends a string argument to the command argument block of the interpreter command file. More...
 
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. More...
 
virtual void AppendCommandArgument (IVector value)
 Appends a vector argument to the command argument block of the interpreter command file. More...
 
virtual void AppendCommandArgument (IMatrix value)
 Appends a matrix argument to the command argument block of the interpreter command file. More...
 
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. More...
 
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. More...
 
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. More...
 

Protected Member Functions

virtual void AppendCommandVariableReference (string variableName)
 Appends a variable reference to the contents of the interpreter command file. More...
 
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. More...
 
virtual void RunCommandFile ()
 Runs the interpreter command file. More...
 

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. More...
 
virtual StringBuilder CommandBuilder [get, protected set]
 Command builder. More...
 
virtual string CommandFileString [get]
 Gets current state of commands as stirng. More...
 
virtual string InterpreterCommand [get, protected 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. More...
 
virtual string CommandDirectory [get, protected set]
 Gets or sets the directory where command file will be located. More...
 
virtual string DefaultCommandFileName [get]
 Gets the default command file name for the current interpreter. More...
 
virtual string CommandFileName [get, protected set]
 Gets or sets the command file name where interpreter commands will be written. More...
 
virtual string CommandFilePath [get]
 Gets path to command file. More...
 
virtual string StartingDirectory [get, protected set]
 Gets or sets the command that invokes the interpreter. More...
 
virtual string CommandIntroduction [get, protected set]
 String that introduces a new command (and is written before the command name in the command file). Usually a newline. More...
 
virtual string CommandArgumentBlockBegin [get, protected set]
 String that begins command arguments block. More...
 
virtual string CommandArgumentBlockEnd [get, protected set]
 String that ends command argument block. More...
 
virtual string CommandArgumentSeparator [get, protected set]
 String that begins command arguments block. More...
 
virtual bool CommandArgumentsInNewLines [get, set]
 Whether command arguments are listed in separate lines or not. More...
 
virtual int CommandArgumentCount [get, protected set]
 The number of current argument. More...
 
virtual bool IsWithinArgumentBlock [get, protected set]
 The number of current argument. More...
 
virtual string CodeBlockBegin [get, protected set]
 String that begins a code block in interpreted files. More...
 
virtual string CodeBlockEnd [get, protected set]
 String that ends a code block in interpreted files. More...
 
virtual string VariableReferenceBegin [get, protected set]
 String that begins a code block in interpreted files. More...
 
virtual string VariableReferenceEnd [get, protected set]
 String that ends a code block in interpreted files. More...
 
virtual string IndentationString [get, set]
 String used for indentation of code. More...
 
virtual int IndentationLevel [get, protected set]
 Indentation level - how many indentation strings are added before each new row. More...
 
virtual string CommentBegin [get, protected set]
 String that begins a comment. More...
 
virtual string CommentEnd [get, protected set]
 String that ends a comment. More...
 
- Properties inherited from IG.Lib.ILockable
object Lock [get]
 

Private Attributes

object _mainLock = new object()
 
StringBuilder _commandBuilder = new StringBuilder()
 
string _interpreterCommand
 
string _commandDirectory
 
string _startingDirectory
 
string _commandFileName
 
string _commandIndroduction = Environment.NewLine
 
string _commandArgumentBlockBegin = " ( " + Environment.NewLine + " "
 
string _commandArgumentBlockEnd = " ) " + Environment.NewLine
 
string _commandArgumentSeparator = ", "
 
bool _commandArgumentsInNewLines = true
 
int _commandArgumentCount = 0
 
bool _isWithinArgumentBlock = false
 
string _codeBlockBegin = Environment.NewLine + "{" + Environment.NewLine
 
string _codeBlockEnd = Environment.NewLine + "}" + Environment.NewLine
 
string _variableReferenceBegin = "$"
 
string _variableReferenceEnd = ""
 
string _indentationString = " "
 
int _indentationLevel = 0
 
string _commentBegin = "/* "
 
string _commentEnd = " */ "
 

Detailed Description

Base class for interfaces with interpreters.

$A Igor Jul09;

Constructor & Destructor Documentation

IG.Lib.InterfaceInterpreterBase.InterfaceInterpreterBase ( )
inline
IG.Lib.InterfaceInterpreterBase.InterfaceInterpreterBase ( string  commandFileName)
inline
IG.Lib.InterfaceInterpreterBase.InterfaceInterpreterBase ( string  workingDirctory,
string  commandFileName 
)
inline

Constructor.

Parameters
workingDirctoryDirectory whre command file is written to and working directory for interpreter's application. Relative or absolute path.
commandFileNameName 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.

Parameters
commandDirectoryDirectory whre command file is written to. Relative or absolute path.
startDirectoryDirectory in which interpreter application is started. Relative or absolute path.
commandFileNameName of the command file to which commands are written and which is interpreted by the interpreter.

Member Function Documentation

virtual void IG.Lib.InterfaceInterpreterBase.ResetCommands ( )
inlinevirtual
virtual void IG.Lib.InterfaceInterpreterBase.Append ( string  str)
inlinevirtual

Appends a literal string to the contents of the command file plus a newline character.

Parameters
strString to be appended.
virtual void IG.Lib.InterfaceInterpreterBase.AppendLine ( string  str)
inlinevirtual

Appends a literal string to the contents of the command file.

Parameters
strString to be appended.
virtual void IG.Lib.InterfaceInterpreterBase.AppendLine ( )
inlinevirtual
virtual void IG.Lib.InterfaceInterpreterBase.AppendIndent ( )
inlinevirtual

Appends indentation to the contents of the command file.

virtual void IG.Lib.InterfaceInterpreterBase.AppendComment ( string  str,
bool  withNewlines 
)
inlinevirtual

Appends a vomment to the contents of the command file.

Parameters
strComment text.
withNewlinesWhether comment is appended in a separate line.
virtual void IG.Lib.InterfaceInterpreterBase.StartCodeBlock ( )
inlinevirtual

Starts a new code block in the interpreter command file contents.

virtual void IG.Lib.InterfaceInterpreterBase.EndCodeBlock ( )
inlinevirtual

Ends a code block in the interpreter command file contents.

virtual void IG.Lib.InterfaceInterpreterBase.StartCommand ( string  commandName)
inlinevirtual

Starts a new command in the interpreter command file contents.

Parameters
commandNameName of the command.
virtual void IG.Lib.InterfaceInterpreterBase.EndCommand ( )
inlinevirtual

Ends (finalizes) a command in the interpreter command file contents.

virtual void IG.Lib.InterfaceInterpreterBase.AppendCommandArgumentSeparatorIfNecessary ( )
inlinevirtual

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)
inlinevirtual

Appends an integer value to the interpreter command file contents.

Parameters
valueValue to be appended.
virtual void IG.Lib.InterfaceInterpreterBase.AppendValue ( double  value)
inlinevirtual

Appends a double value to the interpreter command file contents.

Parameters
valueValue to be appended.
virtual void IG.Lib.InterfaceInterpreterBase.AppendValue ( bool  value)
inlinevirtual

Appends a boolean value to the interpreter command file contents.

Parameters
valueValue to be appended.

Reimplemented in IG.Lib.InterfaceInverse.

virtual void IG.Lib.InterfaceInterpreterBase.AppendValue ( string  value)
inlinevirtual

Appends a string value to the interpreter command file contents.

Parameters
valueValue to be appended.

Reimplemented in IG.Lib.InterfaceInverse.

virtual void IG.Lib.InterfaceInterpreterBase.AppendValue ( IVector  value)
inlinevirtual

Appends a vector value to the interpreter command file contents.

Parameters
valueValue to be appended.

Reimplemented in IG.Lib.InterfaceInverse.

virtual void IG.Lib.InterfaceInterpreterBase.AppendValue ( IMatrix  value)
inlinevirtual

Appends a matrix value to the interpreter command file contents.

Parameters
valueValue to be appended.

Reimplemented in IG.Lib.InterfaceInverse.

virtual void IG.Lib.InterfaceInterpreterBase.AppendCommandVariableReference ( string  variableName)
inlineprotectedvirtual

Appends a variable reference to the contents of the interpreter command file.

Parameters
variableNameName of the variable whose reference is appended.
virtual void IG.Lib.InterfaceInterpreterBase.AppendCommandArgumentVariableReference ( string  variableName)
inlinevirtual

Appends a variable reference to the current argument block.

Parameters
variableNameName of the variable whose reference is appended.
virtual void IG.Lib.InterfaceInterpreterBase.AppendCommandArgument ( int  value)
inlinevirtual

Appends an integer argument to the command argument block of the interpreter command file.

Parameters
valueValue of the argument that is appended.
virtual void IG.Lib.InterfaceInterpreterBase.AppendCommandArgument ( double  value)
inlinevirtual

Appends a double argument to the command argument block of the interpreter command file.

Parameters
valueValue of the argument that is appended.
virtual void IG.Lib.InterfaceInterpreterBase.AppendCommandArgument ( bool  value)
inlinevirtual

Appends a boolean argument to the command argument block of the interpreter command file.

Parameters
valueValue of the argument that is appended.
virtual void IG.Lib.InterfaceInterpreterBase.AppendCommandArgument ( string  value)
inlinevirtual

Appends a string argument to the command argument block of the interpreter command file.

Parameters
valueValue of the argument that is appended.
virtual void IG.Lib.InterfaceInterpreterBase.AppendCommandArgumentPlain ( string  value)
inlinevirtual

Appends a plain string argument (without decoration such as double quotes) to the command argument block of the interpreter command file.

Parameters
valueValue of the argument that is appended.
virtual void IG.Lib.InterfaceInterpreterBase.AppendCommandArgument ( IVector  value)
inlinevirtual

Appends a vector argument to the command argument block of the interpreter command file.

Parameters
valueValue of the argument that is appended.
virtual void IG.Lib.InterfaceInterpreterBase.AppendCommandArgument ( IMatrix  value)
inlinevirtual

Appends a matrix argument to the command argument block of the interpreter command file.

Parameters
valueValue of the argument that is appended.
virtual void IG.Lib.InterfaceInterpreterBase.WriteCommandFile ( bool  appendContents)
inlineprotectedvirtual

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.

Parameters
appendContentsWhether file contents are appended.
virtual void IG.Lib.InterfaceInterpreterBase.WriteCommandFile ( )
inlinevirtual

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 ( )
inlinevirtual

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 ( )
inlineprotectedvirtual

Runs the interpreter command file.

virtual void IG.Lib.InterfaceInterpreterBase.WriteAndRunCommandFile ( )
inlinevirtual

Writes interpreter command file and runs it. After this method is called, ResetCommands() should be called if the object will be further used.

Member Data Documentation

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 = " ( " + Environment.NewLine + " "
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 + "{" + Environment.NewLine
private
string IG.Lib.InterfaceInterpreterBase._codeBlockEnd = Environment.NewLine + "}" + 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

Property Documentation

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.

virtual StringBuilder IG.Lib.InterfaceInterpreterBase.CommandBuilder
getprotected set

Command builder.

virtual string IG.Lib.InterfaceInterpreterBase.CommandFileString
get

Gets current state of commands as stirng.

virtual string IG.Lib.InterfaceInterpreterBase.InterpreterCommand
getprotected 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
getprotected 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
getprotected 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
getprotected set

Gets or sets the command that invokes the interpreter.

virtual string IG.Lib.InterfaceInterpreterBase.CommandIntroduction
getprotected 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
getprotected set

String that begins command arguments block.

virtual string IG.Lib.InterfaceInterpreterBase.CommandArgumentBlockEnd
getprotected set

String that ends command argument block.

virtual string IG.Lib.InterfaceInterpreterBase.CommandArgumentSeparator
getprotected set

String that begins command arguments block.

virtual bool IG.Lib.InterfaceInterpreterBase.CommandArgumentsInNewLines
getset

Whether command arguments are listed in separate lines or not.

virtual int IG.Lib.InterfaceInterpreterBase.CommandArgumentCount
getprotected set

The number of current argument.

virtual bool IG.Lib.InterfaceInterpreterBase.IsWithinArgumentBlock
getprotected set

The number of current argument.

virtual string IG.Lib.InterfaceInterpreterBase.CodeBlockBegin
getprotected set

String that begins a code block in interpreted files.

virtual string IG.Lib.InterfaceInterpreterBase.CodeBlockEnd
getprotected set

String that ends a code block in interpreted files.

virtual string IG.Lib.InterfaceInterpreterBase.VariableReferenceBegin
getprotected set

String that begins a code block in interpreted files.

virtual string IG.Lib.InterfaceInterpreterBase.VariableReferenceEnd
getprotected set

String that ends a code block in interpreted files.

virtual string IG.Lib.InterfaceInterpreterBase.IndentationString
getset

String used for indentation of code.

virtual int IG.Lib.InterfaceInterpreterBase.IndentationLevel
getprotected set

Indentation level - how many indentation strings are added before each new row.

virtual string IG.Lib.InterfaceInterpreterBase.CommentBegin
getprotected set

String that begins a comment.

virtual string IG.Lib.InterfaceInterpreterBase.CommentEnd
getprotected set

String that ends a comment.


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