comparison sinks/@sinkcat/construct.m @ 0:672052bd81f8

Initial partial import.
author samer
date Wed, 19 Dec 2012 22:38:28 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:672052bd81f8
1 function s=construct(sig)
2 sc=construct(sig.sinks{1});
3 sx=sig.sinks(2:end);
4
5 s.start = @start;
6 s.stop = @stop;
7 s.dispose = @dispose;
8 s.writer = @writer;
9
10 function start, sc.start(); end
11 function stop, sc.stop(); end
12 function dispose, sc.dispose(); end
13
14 function r=writer(n)
15 rc=sc.writer(n);
16 r = @next;
17 function rem=next(x)
18 rem=rc(x);
19 while rem>0 && ~isempty(sx) % current signal exhausted, try next
20 sc.dispose();
21 sc=construct(sx{1}); sx=sx(2:end);
22 rem=sinkwriten(sc,n,x(end-rem+1:end));
23 rc=sc.writer(n);
24 end
25 end
26 end
27 end