-
Notifications
You must be signed in to change notification settings - Fork 251
Expand file tree
/
Copy pathcpp_interface_header.template
More file actions
60 lines (52 loc) · 1.73 KB
/
cpp_interface_header.template
File metadata and controls
60 lines (52 loc) · 1.73 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
{% if mlComment != "" %}
{$mlComment}
{% endif %}
{$commonHeader()}
#if !defined({$interfaceCppGuardMacro})
#define {$interfaceCppGuardMacro}
#include "{$commonCppHeaderName}"
{% for iface in group.interfaces %}
{% for fn in iface.functions %}
{% for externalInterface in fn.externalInterfaces %}
{% for interfaceFile in interfacesFiles %}
{% if externalInterface == interfaceFile.interfaceName %}
#include "{$interfaceFile.interfaceCommonFileName}_interface.hpp"
{% endif %}
{% endfor -- interfacesFiles %}
{% endfor -- externalInterface %}
{% endfor -- fn %}
{% endfor -- iface %}
{$fillNamespaceBegin()}
{% for iface in group.interfaces %}
// Abstract base class for {$iface.name}
class {$iface.interfaceClassName}
{
public:
{%if count(iface.callbacksInt) > 0%}
{% for cb in iface.callbacksInt%}
typedef {$cb.interfaceTypenameName};
{% endfor %}
{%endif %}
static inline const uint32_t m_serviceId = {$iface.id};
{% for fn in iface.functions %}
static inline const uint32_t {$getClassFunctionIdName(fn)} = {$fn.id};
{% endfor -- fn %}
virtual ~{$iface.interfaceClassName}(void);
{% for fn in iface.functions if fn.isNonExternalFunction == true %}
{% if fn.mlComment %}
{$fn.mlComment}
{% endif %}
virtual {$fn.prototypeInterface} = 0;
{% endfor -- fn %}
{% for cb in iface.callbacksInt %}
static bool get_callbackAddress_{$cb.name}(uint16_t index, {$cb.name} *callback);
static bool get_callbackIdx_{$cb.name}(const {$cb.name} *callback, uint16_t &index);
{% endfor %}
private:
{% for cb in iface.callbacksInt %}
static {$cb.name} _{$cb.name}[{$count(cb.callbacks)}];
{% endfor %}
};
{% endfor -- iface %}
{$fillNamespaceEnd()}
#endif // {$interfaceCppGuardMacro}