SeqEventManager

class SeqEventManager (
size_t N
T...
) {}

Examples

1 scope(failure) {writefln("Unittest failure :%s(%s)", __FILE__, __LINE__); stdout.flush();}
2 scope(success) {writefln("Unittest success :%s(%s)", __FILE__, __LINE__); stdout.flush();}
3 
4 auto event = new SeqEventManager!(3, bool);
5 
6 size_t cnt;
7 size_t[3] ns;
8 event[0].strongConnect(delegate(b){
9     assert(b);
10     ns[0] = cnt;
11     ++cnt;
12 });
13 
14 event[1].strongConnect(delegate(b){
15     assert(b);
16     ns[1] = cnt;
17     ++cnt;
18 });
19 
20 event[2].strongConnect(delegate(b){
21     assert(b);
22     ns[2] = cnt;
23     ++cnt;
24 });
25 
26 event.emit(true);
27 assert(cnt == 3);
28 assert(ns[] == [0, 1, 2]);

Meta