-
Notifications
You must be signed in to change notification settings - Fork 1
/
if_template.hpp
63 lines (42 loc) · 1.15 KB
/
if_template.hpp
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
61
62
63
@require(interface)
#ifndef @{interface.fqn('_').upper()}_HPP
#define @{interface.fqn('_').upper()}_HPP
#include <chrono>
#include "core/dbus/traits/service.h"
@{interface.dependent_includes()}
@{interface.package().namespaces_open()}
class I@{interface.name()}
{
protected:
@for m in interface.methods:
struct @{m.name()}
{
typedef I@{interface.name()} Interface;
inline static const std::string& name()
{
static const std::string s { "@{m.name()}" }; return s;
}
inline static const std::chrono::milliseconds default_timeout()
{
return std::chrono::seconds{1};
}
typedef @{m.in_args.typedef()} ArgumentType;
typedef @{m.out_args.typedef()} ResultType;
};
@end
};
@{interface.package().namespaces_close()}
namespace core {
namespace dbus {
namespace traits {
template<>
struct Service<@{interface.package().fqn("::")}::I@{interface.name()}>
{
inline static const std::string& interface_name()
{
static const std::string s{"@{interface.fqn(".")[1:]}"};
return s;
}
};
} } }
#endif // @{interface.fqn('_').upper()}_HPP