Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space IceMaster and version 3.7.1

...

In addition to the synchronous proxy method, slice2matlab generates the following asynchronous proxy method:

Code Block
languagematlab
titleMATLAB
classdef EmployeesPrx < Ice.ObjectPrx
    methods
        function result = getName(obj, number, varargin)  % Synchronous method
            ...
        end
        function future = getNameAsync(obj, number, varargin) % Asynchronous method
            ...
        end
    end
    ...
end

...

Here's an example that calls getNameAsync:

Code Block
languagematlab
titleMATLAB
e = ...; % Get EmployeesPrx proxy
future = e.getNameAsync(99);

% Continue to do other things here...

name = f.fetchOutputs();

...

The generated code looks like this:

Code Block
languagematlab
titleMATLAB
classdef ExamplePrx < Ice.ObjectPrx
    methods
        function future = opAsync(obj, inp1, inp2, varargin)
            ...
        end
        ...
    end
    ...
end

Now let's call fetchOutputs to demonstrate how to retrieve the results when the invocation completes:

Code Block
languagematlab
titleMATLAB
e = ...; % Get EmployeesPrx proxy
future = e.opAsync(5, 'demo');
...
[r, outp1, outp2] = future.fetchOutputs();

...

The Future object that is returned by asynchronous proxy methods has an API that resembles MATLAB's parallel.Future class:

Code Block
languagematlab
titleMATLAB
classdef Future < ...
    methods
        function ok = wait(obj)
        function varargout = fetchOutputs(obj)
        function cancel(obj)
    end
    properties(SetAccess=private) % Read only properties
        ID
        NumOutputArguments
        Operation
        Read
        State
    end
end

...