view arrows/@asysobj/construct.m @ 0:672052bd81f8

Initial partial import.
author samer
date Wed, 19 Dec 2012 22:38:28 +0000
parents
children
line wrap: on
line source
function u=construct(s,sizes_in)
	nout=nargout(s);
	u=mkunit(s);
	h=s.h(sizes_in);

	procs = { @proc00, @proc01, @proc0n; ...
	          @proc10, @proc11, @proc11; ...
				 @procn0, @procn1, @procnn };

	u.sizes_out = s.sizefn(sizes_in);
	u.process   = procs{ n2i(nargin(s)), n2i(nargout(s)) };
	u.dispose   = @()release(h);

	function i=n2i(n), i=1+max(n,2); end
	function proc00(in), step(h); end
	function proc10(in), step(h,in); end
	function proc01(in), out=step(h); end
	function out=proc11(in), out=step(h,in); end

	function procn0(varargin), step(h,varargin{:}); end
	function out=procn1(varargin), out=step(h,varargin{:}); end
	function varargout=proc0n, [varargout{1:nout}]=step(h); end
	function varargout=proc1n(in), [varargout{1:nout}]=step(h,in); end

	function varargout=procnn(varargin), [varargout{1:nout}]=step(h,varargin{:}); end
end