Ensenso::NxLibCommand¶
-
class Ensenso::NxLibCommand¶
This class simplifies the execution of NxLib commands. The command name must be specified on construction. The parameters() and result() functions provide access to the corresponding Parameters and Result nodes of the tree. The execute() then writes the previously specified command name into the Command item and allows for synchronous and asynchronous command execution.
Public Functions
-
inline NxLibCommand(String commandName)¶
Constructor.
- Parameters
commandName – The command to be carried out when the execute method is called on this instance.
- Throws
Ensenso::NxLibException –
-
inline NxLibCommand(String commandName, String nodeName)¶
Constructor.
- Parameters
commandName – The command to be carried out when the execute method is called on this instance.
nodeName – The name of the execution node to be used. When not specified the command executes in a temporary node.
- Throws
Ensenso::NxLibException –
-
inline ~NxLibCommand()¶
Destructor. Calls the Finalizer.
-
inline NxLibItem Parameters()¶
The command’s parameters, that will be fetched before the commands executes.
- Returns
Ensenso::NxLibItem, where the parameters are stored.
-
inline NxLibItem Result()¶
The command’s results, after the command finsishes, or an error, in which case the results hold the error case.
- Returns
Ensenso::NxLibItem, where the results are stored.
-
inline void Execute()¶
Executes the current command.
- Throws
Ensenso::NxLibException –
-
inline void Execute(bool wait)¶
Executes the current command.
- Parameters
wait – If true, the call blocks and waits, whether the execution has been successful. If set to true, the command will throw a Ensenso::NxLibException if the execution was not successful.
- Throws
Ensenso::NxLibException – Only if wait is set to true.
-
inline void Execute(int returnCode, bool wait)¶
Executes the current command.
- Parameters
returnCode – The error code of the execution.
wait – If true, the call blocks and waits, whether the execution has been successful. If set to true, the command will throw a Ensenso::NxLibException if the execution was not successful.
-
inline void Execute(String commandName)¶
Executes a command directly.
- Parameters
commandName – The command to be carried out.
- Throws
Ensenso::NxLibException –
-
inline void Execute(int returnCode, String commandName)¶
Executes a command directly.
- Parameters
returnCode – The error code of the operation.
commandName – The command to be carried out.
-
inline void Execute(String commandName, bool wait)¶
Executes a command directly.
- Parameters
commandName – The command to be carried out.
wait – If true, the call blocks and waits, whether the execution has been successful. If set to true, the command will throw a Ensenso::NxLibException if the execution was not successful.
- Throws
Ensenso::NxLibException – Only if wait is set to true.
-
inline void Execute(int returnCode, String commandName, bool wait)¶
Executes a command directly.
- Parameters
returnCode – The error code of the operation.
commandName – The command to be carried out.
wait – If true, the call blocks and waits, till the execution finishes.
-
inline bool Finished()¶
Checks whether the command execution has already finished.
- Throws
Ensenso::NxLibException –
- Returns
true, when NxLib is not currently executing a command, i.e. the Command node is Null. False Otherwise.
-
inline bool Finished(int returnCode)¶
Checks whether the command execution has already finished.
- Parameters
returnCode – The error code of operation.
- Returns
true, when NxLib is not currently executing a command, i.e. the Command node is Null. False Otherwise.
-
inline bool Successful()¶
Checks whether the previous command execution was successful.
- Throws
Ensenso::NxLibException –
- Returns
true, when the previous NxLib command execution was successful, i.e. there is no ErrorSymbol node in the Result node. Otherwise false.
-
inline bool Successful(int returnCode)¶
Checks whether the previous command execution was successful.
- Parameters
returnCode – The error code of operation.
- Returns
true, when the previous NxLib command execution was successful, i.e. there is no ErrorSymbol node in the Result node. Otherwise false.
-
inline NxLibCommand(String commandName)¶