39 lines
1.2 KiB
Django/Jinja
39 lines
1.2 KiB
Django/Jinja
// Generated File -- DO NOT MODIFY.
|
|
#pragma once
|
|
|
|
#include <glacier/status/error_or.h>
|
|
#include <mammoth/proc/thread.h>
|
|
#include <ztypes.h>
|
|
|
|
#include "{{file}}.h"
|
|
#include "{{file}}.client.h"
|
|
|
|
{% for interface in interfaces %}
|
|
|
|
class {{interface.name}}ServerBase {
|
|
public:
|
|
{{interface.name}}ServerBase(z_cap_t {{interface.name}}_cap) : endpoint_({{interface.name}}_cap) {}
|
|
{{interface.name}}ServerBase(const {{interface.name}}ServerBase&) = delete;
|
|
{{interface.name}}ServerBase({{interface.name}}ServerBase&&) = delete;
|
|
|
|
glcr::ErrorOr<{{interface.name}}Client> CreateClient();
|
|
|
|
[[nodiscard]] Thread RunServer();
|
|
|
|
{% for method in interface.methods %}
|
|
[[nodiscard]] virtual glcr::ErrorCode Handle{{method.name}}(const {{method.request}}&, {{method.response}}&) = 0;
|
|
{% endfor %}
|
|
|
|
private:
|
|
z_cap_t endpoint_;
|
|
|
|
friend void {{interface.name}}ServerBaseThreadBootstrap(void*);
|
|
void ServerThread();
|
|
|
|
[[nodiscard]] glcr::ErrorCode HandleRequest(const glcr::ByteBuffer& request, const glcr::CapBuffer& req_caps,
|
|
glcr::ByteBuffer& response, uint64_t& resp_length,
|
|
glcr::CapBuffer& resp_caps);
|
|
};
|
|
|
|
{% endfor %}
|