Ensenso::NxLibCommand¶
- class Ensenso.NxLibCommand¶
This class simplifies the execution of NxLib commands.
The command name must be specified on construction. The
Parameters()
andResult()
functions provide access to the corresponding Parameters and Result nodes of the tree. TheExecute()
then writes the previously specified command name into the Command item and allows for synchronous and asynchronous command execution.Public Functions
- NxLibCommand (string commandName, string nodeName = "")¶
Constructor.
Throws NxLibException.
- Param commandName
Name of the command to execute.
- Param nodeName
Name of the execution slot the command should run in.
- NxLibItem Parameters ()¶
The command’s parameters , that will be fetched before the command executes.
- Return
NxLibItem
, where the parameters are stored.
- NxLibItem Result ()¶
The command’s results after the command finishes.
- Return
NxLibItem
, where the results are stored.
- void Execute (bool wait = true)¶
Executes the current command.
Throws NxLibException.
- Param wait
Whether to block and wait until the execution finishes.
- void Execute (out int returnCode, bool wait = true)
Executes the current command.
- Param returnCode
The return code of the operation.
- Param wait
Whether to block and wait until the execution finishes.
- void Execute (string commandName, bool wait = true)
Executes the current command.
Throws NxLibException.
- Param commandName
The command to be carried out.
- Param wait
Whether to block and wait until the execution finishes.
- void Execute (out int returnCode, string commandName, bool wait = true)
Executes the current command.
- Param returnCode
The return code of the operation.
- Param commandName
The command to be carried out.
- Param wait
Whether to block and wait until the execution finishes.
- bool Finished ()¶
Checks whether the command execution has already finished.
Throws NxLibException.
- Return
True, when NxLib is not currently executing a command, i.e. the Command node is Null. False Otherwise.
- bool Successful ()¶
Checks whether the previous command execution was successful.
Throws NxLibException.
- Return
True, when the previous NxLib command execution was successful, i.e. there is no ErrorSymbol node in the Result node. Otherwise false.
Private Functions
- void CheckReturnCode (int returnCode)¶
Checks the given
returnCode
and throws an NxLibException if its value is notNxLib.OperationSucceeded
.Throws NxLibException.
- Param returnCode
The return code , which is going to be checked for any error code value.
- bool Finished (out int returnCode)
Checks whether the command execution has already finished.
- Param returnCode
The return code of the operation.
- Return
True, when NxLib is not currently executing a command, i.e. the Command node is Null. False Otherwise.
- bool Successful (out int returnCode)
Checks whether the previous command execution was successful.
- Param returnCode
The return code of the operation.
- Return
True, when the previous NxLib command execution was successful, i.e. there is no ErrorSymbol node in the Result node. Otherwise false.
Private Members
- string CommandName¶
Name of the command to execute.
- NxLibItem CommandItem¶
The NxLibItem the command is executed on. SubItems take the parameters and will also give back the result of the command executed.
- NxLibItemToken Token¶
Is used for temporary slots to keep the
CommandItem
alive if, for example, the execution fails.