1<%! 2def indent(str, depth): 3 return ''.join(4*' '*depth+line for line in str.splitlines(True)) 4%>\ 5 6<%def name="genHandler(sig)" buffered="True"> 7%if ('type' in sig['sparams']) and \ 8 (sig['sparams']['type'] is not None): 9${sig['signal']}<${sig['sparams']['type']}>( 10%else: 11${sig['signal']}( 12%endif 13%for spk in sig['sparams']['params']: 14${sig['sparams'][spk]}, 15%endfor 16%if ('type' in sig['hparams']) and \ 17 (sig['hparams']['type'] is not None): 18handler::${sig['handler']}<${sig['hparams']['type']}>( 19%else: 20handler::${sig['handler']}( 21%endif 22%for i, hpk in enumerate(sig['hparams']['params']): 23 %if (i+1) != len(sig['hparams']['params']): 24 ${sig['hparams'][hpk]}, 25 %else: 26 ${sig['hparams'][hpk]} 27 %endif 28%endfor 29)) 30</%def>\ 31 32<%def name="genSSE(event)" buffered="True"> 33Group{ 34%for group in event['groups']: 35%for member in group['members']: 36{ 37 "${member['object']}", 38 {"${member['interface']}", 39 "${member['property']}"} 40}, 41%endfor 42%endfor 43}, 44std::vector<Action>{ 45%for a in event['action']: 46%if len(a['parameters']) != 0: 47make_action(action::${a['name']}( 48%else: 49make_action(action::${a['name']} 50%endif 51%for i, p in enumerate(a['parameters']): 52%if (i+1) != len(a['parameters']): 53 ${p}, 54%else: 55 ${p}) 56%endif 57%endfor 58), 59%endfor 60}, 61Timer{ 62 ${event['timer']['interval']}, 63 ${event['timer']['type']} 64}, 65std::vector<Signal>{ 66%for s in event['signals']: 67 Signal{ 68 match::${s['match']}( 69 %for i, mp in enumerate(s['mparams']): 70 %if (i+1) != len(s['mparams']): 71 "${mp}", 72 %else: 73 "${mp}" 74 %endif 75 %endfor 76 ), 77 make_handler(\ 78 ${indent(genHandler(sig=s), 3)}\ 79 ) 80 }, 81%endfor 82} 83</%def>\ 84