view arrows/@asink/construct.m @ 2:7357e1dc2ad6

Simplified scheduler library with new schedule representation.
author samer
date Sat, 22 Dec 2012 16:17:51 +0000
parents 672052bd81f8
children ae596261e75f
line wrap: on
line source
function u=construct(s,sizes_in)
	u=mkunit(s);
	if sizes_in{1}(1)~=channels(s.sink)
		error('Number of rows in input does not match channels in sink');
	end
	snk=construct(s.sink);
	
	if isempty(s.window), 
		write=snk.writer(sizes_in{1}(2));
		u.process=@proc1;
	else 
		WIN=s.window; 
		write=snk.writer(length(WIN)); 
		u.process=@proc2;
	end

	u.sizes_out = {};
	u.dispose   = snk.dispose;
	u.starting  = snk.start;
	u.stopping  = snk.stop;

	function proc1(x), write(x); end
	function proc2(x), write(x(:,WIN)); end
end