forked from AIDASoft/podio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interface.jinja2
48 lines (42 loc) · 2.04 KB
/
interface.jinja2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{% macro member_getters_concept(members, get_syntax) %}
{%for member in members %}
virtual {{ member.getter_return_type() }} {{ member.getter_name(get_syntax) }}() const = 0;
{% if member.is_array %}
virtual {{ member.getter_return_type(True) }} {{ member.getter_name(get_syntax) }}(size_t i) const = 0;
{%- endif %}
{% if member.sub_members %}
{% for sub_member in member.sub_members %}
virtual {{ sub_member.getter_return_type() }} {{ sub_member.getter_name(get_sytnax) }}() const = 0;
{% endfor %}
{% endif %}
{% endfor %}
{% endmacro %}
{% macro member_getters_model(members, get_syntax) %}
{%for member in members %}
{{ member.getter_return_type() }} {{ member.getter_name(get_syntax) }}() const final { return m_value.{{ member.getter_name(get_syntax) }}(); }
{% if member.is_array %}
{{ member.getter_return_type(True) }} {{ member.getter_name(get_syntax) }}(size_t i) const final { return m_value.{{ member.getter_name(get_syntax) }}(i); }
{%- endif %}
{% if member.sub_members %}
{% for sub_member in member.sub_members %}
{{ sub_member.getter_return_type() }} {{ sub_member.getter_name(get_sytnax) }}() const final { return m_value.{{ sub_member.getter_name(get_syntax) }}(); }
{% endfor %}
{% endif %}
{% endfor %}
{% endmacro %}
{% macro member_getters(members, get_syntax) %}
{%for member in members %}
/// Access the {{ member.docstring }}
{{ member.getter_return_type() }} {{ member.getter_name(get_syntax) }}() const { return m_self->{{ member.getter_name(get_syntax) }}(); }
{% if member.is_array %}
/// Access item i of the {{ member.docstring }}
{{ member.getter_return_type(True) }} {{ member.getter_name(get_syntax) }}(size_t i) const { return m_self->{{ member.getter_name(get_syntax) }}(i); }
{%- endif %}
{% if member.sub_members %}
{% for sub_member in member.sub_members %}
/// Access the member of {{ member.docstring }}
{{ sub_member.getter_return_type() }} {{ sub_member.getter_name(get_sytnax) }}() const { return m_self->{{ sub_member.getter_name(get_syntax) }}(); }
{% endfor %}
{% endif %}
{% endfor %}
{% endmacro %}