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

NxLibCommand(String commandName)

Constructor.

Parameters
  • commandName: The command to be carried out when the execute method is called on this instance.

Exceptions

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.

Exceptions

~NxLibCommand()

Destructor. Calls the Finalizer.

NxLibItem Parameters()

The command’s parameters, that will be fetched before the commands executes.

Return

Ensenso::NxLibItem, where the parameters are stored.

NxLibItem Result()

The command’s results, after the command finsishes, or an error, in which case the results hold the error case.

Return

Ensenso::NxLibItem, where the results are stored.

void Execute()

Executes the current command.

Exceptions
  • Ensenso::NxLibException.:

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.

Exceptions

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.

void Execute(String commandName)

Executes a command directly.

Parameters
  • commandName: The command to be carried out.

Exceptions

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.

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.

Exceptions

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.

bool Finished()

Checks whether the command execution has already finished.

Return

true, when NxLib is not currently executing a command, i.e. the Command node is Null. False Otherwise.

Exceptions

bool Finished(int returnCode)

Checks whether the command execution has already finished.

Return

true, when NxLib is not currently executing a command, i.e. the Command node is Null. False Otherwise.

Parameters
  • returnCode: The error code of operation.

bool Successful()

Checks whether the previous command execution was successful.

Return

true, when the previous NxLib command execution was successful, i.e. there is no ErrorSymbol node in the Result node. Otherwise false.

Exceptions

bool Successful(int returnCode)

Checks whether the previous command execution was successful.

Return

true, when the previous NxLib command execution was successful, i.e. there is no ErrorSymbol node in the Result node. Otherwise false.

Parameters
  • returnCode: The error code of operation.