2023-10-24 14:54:00 -07:00
|
|
|
// Generated file - DO NOT MODIFY
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <glacier/buffer/byte_buffer.h>
|
|
|
|
#include <glacier/buffer/cap_buffer.h>
|
2023-11-10 12:26:59 -08:00
|
|
|
#include <glacier/container/vector.h>
|
2023-10-24 14:54:00 -07:00
|
|
|
#include <glacier/string/string.h>
|
|
|
|
#include <ztypes.h>
|
|
|
|
|
|
|
|
|
|
|
|
{%- for message in messages %}
|
|
|
|
class {{message.name}} {
|
|
|
|
public:
|
|
|
|
{{message.name}}() {}
|
|
|
|
// Delete copy and move until implemented.
|
|
|
|
{{message.name}}(const {{message.name}}&) = delete;
|
|
|
|
{{message.name}}({{message.name}}&&) = delete;
|
|
|
|
|
|
|
|
void ParseFromBytes(const glcr::ByteBuffer&, uint64_t offset);
|
|
|
|
void ParseFromBytes(const glcr::ByteBuffer&, uint64_t offset, const glcr::CapBuffer&);
|
2023-10-24 18:19:12 -07:00
|
|
|
uint64_t SerializeToBytes(glcr::ByteBuffer&, uint64_t offset) const;
|
|
|
|
uint64_t SerializeToBytes(glcr::ByteBuffer&, uint64_t offset, glcr::CapBuffer&) const;
|
2023-10-24 14:54:00 -07:00
|
|
|
|
|
|
|
{%- for field in message.fields %}
|
2023-11-10 12:26:59 -08:00
|
|
|
{%- if not field.repeated %}
|
2023-11-19 19:14:37 -08:00
|
|
|
const {{field.cpp_type()}}& {{field.name}}() const { return {{field.name}}_; }
|
2023-10-24 14:54:00 -07:00
|
|
|
void set_{{field.name}}(const {{field.cpp_type()}}& value) { {{field.name}}_ = value; }
|
2023-11-10 12:26:59 -08:00
|
|
|
{%- else %}
|
|
|
|
const glcr::Vector<{{field.cpp_type()}}>& {{field.name}}() const { return {{field.name}}_; }
|
|
|
|
void add_{{field.name}}(const {{field.cpp_type()}}& value) { {{field.name}}_.PushBack(value); }
|
|
|
|
{%- endif %}
|
2023-10-24 14:54:00 -07:00
|
|
|
{%- endfor %}
|
|
|
|
|
|
|
|
private:
|
|
|
|
{%- for field in message.fields %}
|
2023-11-10 12:26:59 -08:00
|
|
|
{%- if not field.repeated %}
|
2023-10-24 14:54:00 -07:00
|
|
|
{{field.cpp_type()}} {{field.name}}_;
|
2023-11-10 12:26:59 -08:00
|
|
|
{%- else %}
|
|
|
|
glcr::Vector<{{field.cpp_type()}}> {{field.name}}_;
|
|
|
|
{%- endif %}
|
2023-10-24 14:54:00 -07:00
|
|
|
{%- endfor %}
|
|
|
|
|
2023-11-10 12:51:23 -08:00
|
|
|
// Parses everything except for caps.
|
|
|
|
void ParseFromBytesInternal(const glcr::ByteBuffer&, uint64_t offset);
|
2023-10-24 14:54:00 -07:00
|
|
|
};
|
|
|
|
{%- endfor %}
|