You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
810 B
Django/Jinja
30 lines
810 B
Django/Jinja
#pragma once
|
|
|
|
#include "{{ cls.name }}.h"
|
|
#include "rpc/RpcRegistry.h"
|
|
#include "rpc/RpcValue.h"
|
|
|
|
#include <string>
|
|
#include <unordered_map>
|
|
|
|
// Skeleton-обёртка над {{ cls.name }}, реализующая IRpcObject::invoke().
|
|
class {{ cls.name }}Skeleton : public IRpcObject {
|
|
public:
|
|
explicit {{ cls.name }}Skeleton({{ cls.name }}& obj);
|
|
|
|
RpcValue invoke(const std::string& method,
|
|
const RpcArgs& args) override;
|
|
|
|
private:
|
|
using Handler = RpcValue ({{ cls.name }}Skeleton::*)(const RpcArgs&);
|
|
|
|
// Статическая таблица method-name -> member-function.
|
|
static const std::unordered_map<std::string, Handler>& handlers();
|
|
|
|
{% for m in cls.methods %}
|
|
RpcValue call_{{ m.name }}(const RpcArgs& args);
|
|
{% endfor %}
|
|
|
|
{{ cls.name }}& obj_;
|
|
};
|