| <%! |
| def indent(str, depth): |
| return ''.join(4*' '*depth+line for line in str.splitlines(True)) |
| %>\ |
| |
| <%def name="genHandler(sig)" buffered="True"> |
| %if ('type' in sig['sparams']) and \ |
| (sig['sparams']['type'] is not None): |
| ${sig['signal']}<${sig['sparams']['type']}>( |
| %else: |
| ${sig['signal']}( |
| %endif |
| %for spk in sig['sparams']['params']: |
| ${sig['sparams'][spk]}, |
| %endfor |
| %if ('type' in sig['hparams']) and \ |
| (sig['hparams']['type'] is not None): |
| handler::${sig['handler']}<${sig['hparams']['type']}>( |
| %else: |
| handler::${sig['handler']}( |
| %endif |
| %for i, hpk in enumerate(sig['hparams']['params']): |
| %if (i+1) != len(sig['hparams']['params']): |
| ${sig['hparams'][hpk]}, |
| %else: |
| ${sig['hparams'][hpk]} |
| %endif |
| %endfor |
| )) |
| </%def>\ |
| |
| <%def name="genSSE(event)" buffered="True"> |
| Group{ |
| %for group in event['groups']: |
| %for member in group['members']: |
| { |
| "${member['object']}", |
| {"${member['interface']}", |
| "${member['property']}"} |
| }, |
| %endfor |
| %endfor |
| }, |
| std::vector<Action>{ |
| %for a in event['action']: |
| %if len(a['parameters']) != 0: |
| make_action(action::${a['name']}( |
| %else: |
| make_action(action::${a['name']} |
| %endif |
| %for i, p in enumerate(a['parameters']): |
| %if (i+1) != len(a['parameters']): |
| ${p}, |
| %else: |
| ${p}) |
| %endif |
| %endfor |
| ), |
| %endfor |
| }, |
| TimerConf{ |
| ${event['timer']['interval']}, |
| ${event['timer']['type']} |
| }, |
| std::vector<Signal>{ |
| %for s in event['signals']: |
| Signal{ |
| %if ('match' in s) and \ |
| (s['match'] is not None): |
| match::${s['match']}( |
| %for i, mp in enumerate(s['mparams']): |
| %if (i+1) != len(s['mparams']): |
| "${mp}", |
| %else: |
| "${mp}" |
| %endif |
| %endfor |
| ), |
| %else: |
| "", |
| %endif |
| make_handler(\ |
| ${indent(genHandler(sig=s), 3)}\ |
| ) |
| }, |
| %endfor |
| } |
| </%def>\ |