RunFunction Method (string, XJEaseParameterCollection, XJEaseParameterCollection)

Runs an XJEase function with the specified name from the project's circuit code files. The XJEase function is run synchronously, i.e. control does not return from this method until the function has completed.

Type: Runner

Namespace: XJTAG.Integration.XJRunner

Syntax

public void RunFunction(string functionName, XJEaseParameterCollection inputArgs, XJEaseParameterCollection outputArgs)

Parameters

functionName

Type: string

The name of the XJEase test function to run.

inputArgs

Type: XJEaseParameterCollection

The XJEaseParameterCollection of input arguments for the function. An arbitrary number of IntParameter, StringParameter and XJEaseArrayParameter arguments can be added to the collection, corresponding to the parameters for the function to be run.

outputArgs

Type: XJEaseParameterCollection

The XJEaseParameterCollection of initial values for the output arguments, which can be initialised as null.

Exceptions

RuntimeException

There was an error running the XJEase code.

System.ArgumentException

The function name was an empty string.

System.ArgumentNullException

Any of the arguments were null.

System.ObjectDisposedException

The Runner has already been disposed.

Example

In this case we call RunFunction on a Runner object to run an XJEase function from the project circuit code files.

class Testing
{
    Runner runner;

    void InitialiseRunner()
    {
        /*
         * ...
         * Code to obtain Runner object from project.
         * ...
         */

        // Create the input arguments.
        var intArg = new IntParameter(1);
        var stringArg = new StringParameter("hello");
        var arrayArg = new XJEaseArrayParameter(baseType: XJEaseParameterType.Int, depth: 1) { new IntParameter(2) };

        // Add the input arguments to a collection.
        var inputArgs = new XJEaseParameterCollection();
        inputArgs.Add(intArg);
        inputArgs.Add(stringArg);
        inputArgs.Add(arrayArg);

        // Initialise the output collection.
        var outputArgs = XJEaseParameterCollection.GetOutputCollection(count: 1);

        // Run a function.
        runner.RunFunction("TestFunction", inputArgs, outputArgs);
    }
}