samer@0: function u=construct(s,sizes_in) samer@0: nout=nargout(s); samer@0: u=mkunit(s); samer@0: h=s.h(sizes_in); samer@0: samer@0: procs = { @proc00, @proc01, @proc0n; ... samer@0: @proc10, @proc11, @proc11; ... samer@0: @procn0, @procn1, @procnn }; samer@0: samer@0: u.sizes_out = s.sizefn(sizes_in); samer@0: u.process = procs{ n2i(nargin(s)), n2i(nargout(s)) }; samer@0: u.dispose = @()release(h); samer@0: samer@0: function i=n2i(n), i=1+max(n,2); end samer@0: function proc00(in), step(h); end samer@0: function proc10(in), step(h,in); end samer@0: function proc01(in), out=step(h); end samer@0: function out=proc11(in), out=step(h,in); end samer@0: samer@0: function procn0(varargin), step(h,varargin{:}); end samer@0: function out=procn1(varargin), out=step(h,varargin{:}); end samer@0: function varargout=proc0n, [varargout{1:nout}]=step(h); end samer@0: function varargout=proc1n(in), [varargout{1:nout}]=step(h,in); end samer@0: samer@0: function varargout=procnn(varargin), [varargout{1:nout}]=step(h,varargin{:}); end samer@0: end samer@0: