summaryrefslogtreecommitdiff
path: root/tmk_core/tool/mbed/mbed-sdk/workspace_tools/data/rpc/class.cpp
blob: f7831980c0caea196fa50873b23e1c35a8b613df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class Rpc{{name}} : public RPC {
public:
    Rpc{{name}}({{cons_proto}}) : RPC(name), o({{cons_call}}) {}

    {{methods}}

    virtual const struct rpc_method *get_rpc_methods() {
        static const rpc_method rpc_methods[] = {
            {{rpc_methods}},
            RPC_METHOD_SUPER(RPC)
        };
        return rpc_methods;
    }
    static struct rpc_class *get_rpc_class() {
        static const rpc_function funcs[] = {
            {"new", rpc_function_caller<const char*, {{cons_type}}, &RPC::construct<Rpc{{name}}, {{cons_type}}> >},
            RPC_METHOD_END
        };
        static rpc_class c = {"{{name}}", funcs, NULL};
        return &c;
    }
private:
    {{name}} o;
};