CCash/fbe/user_model/bank_dom_models.h
2022-11-28 16:39:32 -08:00

398 lines
12 KiB
C++

//------------------------------------------------------------------------------
// Automatically generated by the Fast Binary Encoding compiler, do not modify!
// https://github.com/chronoxor/FastBinaryEncoding
// Source: user_model.fbe
// FBE version: 1.14.1.0
//------------------------------------------------------------------------------
#pragma once
#if defined(__clang__)
#pragma clang system_header
#elif defined(__GNUC__)
#pragma GCC system_header
#elif defined(_MSC_VER)
#pragma system_header
#endif
#include "fbe_models.h"
#include "bank_dom.h"
namespace FBE {
// Fast Binary Encoding ::bank_dom::Transaction field model
template <>
class FieldModel<::bank_dom::Transaction>
{
public:
FieldModel(FBEBuffer& buffer, size_t offset) noexcept;
// Get the field offset
size_t fbe_offset() const noexcept { return _offset; }
// Get the field size
size_t fbe_size() const noexcept { return 4; }
// Get the field body size
size_t fbe_body() const noexcept;
// Get the field extra size
size_t fbe_extra() const noexcept;
// Get the field type
static constexpr size_t fbe_type() noexcept { return 1; }
// Shift the current field offset
void fbe_shift(size_t size) noexcept { _offset += size; }
// Unshift the current field offset
void fbe_unshift(size_t size) noexcept { _offset -= size; }
// Check if the struct value is valid
bool verify(bool fbe_verify_type = true) const noexcept;
// Check if the struct fields are valid
bool verify_fields(size_t fbe_struct_size) const noexcept;
// Get the struct value (begin phase)
size_t get_begin() const noexcept;
// Get the struct value (end phase)
void get_end(size_t fbe_begin) const noexcept;
// Get the struct value
void get(::bank_dom::Transaction& fbe_value) const noexcept;
// Get the struct fields values
void get_fields(::bank_dom::Transaction& fbe_value, size_t fbe_struct_size) const noexcept;
// Set the struct value (begin phase)
size_t set_begin();
// Set the struct value (end phase)
void set_end(size_t fbe_begin);
// Set the struct value
void set(const ::bank_dom::Transaction& fbe_value) noexcept;
// Set the struct fields values
void set_fields(const ::bank_dom::Transaction& fbe_value) noexcept;
private:
FBEBuffer& _buffer;
size_t _offset;
public:
FieldModel<std::string> counterparty;
FieldModel<bool> receiving;
FieldModel<uint32_t> amount;
FieldModel<uint64_t> time;
};
namespace bank_dom {
// Fast Binary Encoding Transaction model
class TransactionModel : public FBE::Model
{
public:
TransactionModel() : model(this->buffer(), 4) {}
TransactionModel(const std::shared_ptr<FBEBuffer>& buffer) : FBE::Model(buffer), model(this->buffer(), 4) {}
// Get the model size
size_t fbe_size() const noexcept { return model.fbe_size() + model.fbe_extra(); }
// Get the model type
static constexpr size_t fbe_type() noexcept { return FieldModel<::bank_dom::Transaction>::fbe_type(); }
// Check if the struct value is valid
bool verify();
// Create a new model (begin phase)
size_t create_begin();
// Create a new model (end phase)
size_t create_end(size_t fbe_begin);
// Serialize the struct value
size_t serialize(const ::bank_dom::Transaction& value);
// Deserialize the struct value
size_t deserialize(::bank_dom::Transaction& value) const noexcept;
// Move to the next struct value
void next(size_t prev) noexcept { model.fbe_shift(prev); }
public:
FieldModel<::bank_dom::Transaction> model;
};
} // namespace bank_dom
// Fast Binary Encoding ::bank_dom::Logs field model
template <>
class FieldModel<::bank_dom::Logs>
{
public:
FieldModel(FBEBuffer& buffer, size_t offset) noexcept;
// Get the field offset
size_t fbe_offset() const noexcept { return _offset; }
// Get the field size
size_t fbe_size() const noexcept { return 4; }
// Get the field body size
size_t fbe_body() const noexcept;
// Get the field extra size
size_t fbe_extra() const noexcept;
// Get the field type
static constexpr size_t fbe_type() noexcept { return 2; }
// Shift the current field offset
void fbe_shift(size_t size) noexcept { _offset += size; }
// Unshift the current field offset
void fbe_unshift(size_t size) noexcept { _offset -= size; }
// Check if the struct value is valid
bool verify(bool fbe_verify_type = true) const noexcept;
// Check if the struct fields are valid
bool verify_fields(size_t fbe_struct_size) const noexcept;
// Get the struct value (begin phase)
size_t get_begin() const noexcept;
// Get the struct value (end phase)
void get_end(size_t fbe_begin) const noexcept;
// Get the struct value
void get(::bank_dom::Logs& fbe_value) const noexcept;
// Get the struct fields values
void get_fields(::bank_dom::Logs& fbe_value, size_t fbe_struct_size) const noexcept;
// Set the struct value (begin phase)
size_t set_begin();
// Set the struct value (end phase)
void set_end(size_t fbe_begin);
// Set the struct value
void set(const ::bank_dom::Logs& fbe_value) noexcept;
// Set the struct fields values
void set_fields(const ::bank_dom::Logs& fbe_value) noexcept;
private:
FBEBuffer& _buffer;
size_t _offset;
public:
FieldModelVector<::bank_dom::Transaction> data;
};
namespace bank_dom {
// Fast Binary Encoding Logs model
class LogsModel : public FBE::Model
{
public:
LogsModel() : model(this->buffer(), 4) {}
LogsModel(const std::shared_ptr<FBEBuffer>& buffer) : FBE::Model(buffer), model(this->buffer(), 4) {}
// Get the model size
size_t fbe_size() const noexcept { return model.fbe_size() + model.fbe_extra(); }
// Get the model type
static constexpr size_t fbe_type() noexcept { return FieldModel<::bank_dom::Logs>::fbe_type(); }
// Check if the struct value is valid
bool verify();
// Create a new model (begin phase)
size_t create_begin();
// Create a new model (end phase)
size_t create_end(size_t fbe_begin);
// Serialize the struct value
size_t serialize(const ::bank_dom::Logs& value);
// Deserialize the struct value
size_t deserialize(::bank_dom::Logs& value) const noexcept;
// Move to the next struct value
void next(size_t prev) noexcept { model.fbe_shift(prev); }
public:
FieldModel<::bank_dom::Logs> model;
};
} // namespace bank_dom
// Fast Binary Encoding ::bank_dom::User field model
template <>
class FieldModel<::bank_dom::User>
{
public:
FieldModel(FBEBuffer& buffer, size_t offset) noexcept;
// Get the field offset
size_t fbe_offset() const noexcept { return _offset; }
// Get the field size
size_t fbe_size() const noexcept { return 4; }
// Get the field body size
size_t fbe_body() const noexcept;
// Get the field extra size
size_t fbe_extra() const noexcept;
// Get the field type
static constexpr size_t fbe_type() noexcept { return 3; }
// Shift the current field offset
void fbe_shift(size_t size) noexcept { _offset += size; }
// Unshift the current field offset
void fbe_unshift(size_t size) noexcept { _offset -= size; }
// Check if the struct value is valid
bool verify(bool fbe_verify_type = true) const noexcept;
// Check if the struct fields are valid
bool verify_fields(size_t fbe_struct_size) const noexcept;
// Get the struct value (begin phase)
size_t get_begin() const noexcept;
// Get the struct value (end phase)
void get_end(size_t fbe_begin) const noexcept;
// Get the struct value
void get(::bank_dom::User& fbe_value) const noexcept;
// Get the struct fields values
void get_fields(::bank_dom::User& fbe_value, size_t fbe_struct_size) const noexcept;
// Set the struct value (begin phase)
size_t set_begin();
// Set the struct value (end phase)
void set_end(size_t fbe_begin);
// Set the struct value
void set(const ::bank_dom::User& fbe_value) noexcept;
// Set the struct fields values
void set_fields(const ::bank_dom::User& fbe_value) noexcept;
private:
FBEBuffer& _buffer;
size_t _offset;
public:
FieldModel<uint32_t> balance;
FieldModel<uint64_t> password;
FieldModel<std::optional<::bank_dom::Logs>> logs;
};
namespace bank_dom {
// Fast Binary Encoding User model
class UserModel : public FBE::Model
{
public:
UserModel() : model(this->buffer(), 4) {}
UserModel(const std::shared_ptr<FBEBuffer>& buffer) : FBE::Model(buffer), model(this->buffer(), 4) {}
// Get the model size
size_t fbe_size() const noexcept { return model.fbe_size() + model.fbe_extra(); }
// Get the model type
static constexpr size_t fbe_type() noexcept { return FieldModel<::bank_dom::User>::fbe_type(); }
// Check if the struct value is valid
bool verify();
// Create a new model (begin phase)
size_t create_begin();
// Create a new model (end phase)
size_t create_end(size_t fbe_begin);
// Serialize the struct value
size_t serialize(const ::bank_dom::User& value);
// Deserialize the struct value
size_t deserialize(::bank_dom::User& value) const noexcept;
// Move to the next struct value
void next(size_t prev) noexcept { model.fbe_shift(prev); }
public:
FieldModel<::bank_dom::User> model;
};
} // namespace bank_dom
// Fast Binary Encoding ::bank_dom::Global field model
template <>
class FieldModel<::bank_dom::Global>
{
public:
FieldModel(FBEBuffer& buffer, size_t offset) noexcept;
// Get the field offset
size_t fbe_offset() const noexcept { return _offset; }
// Get the field size
size_t fbe_size() const noexcept { return 4; }
// Get the field body size
size_t fbe_body() const noexcept;
// Get the field extra size
size_t fbe_extra() const noexcept;
// Get the field type
static constexpr size_t fbe_type() noexcept { return 4; }
// Shift the current field offset
void fbe_shift(size_t size) noexcept { _offset += size; }
// Unshift the current field offset
void fbe_unshift(size_t size) noexcept { _offset -= size; }
// Check if the struct value is valid
bool verify(bool fbe_verify_type = true) const noexcept;
// Check if the struct fields are valid
bool verify_fields(size_t fbe_struct_size) const noexcept;
// Get the struct value (begin phase)
size_t get_begin() const noexcept;
// Get the struct value (end phase)
void get_end(size_t fbe_begin) const noexcept;
// Get the struct value
void get(::bank_dom::Global& fbe_value) const noexcept;
// Get the struct fields values
void get_fields(::bank_dom::Global& fbe_value, size_t fbe_struct_size) const noexcept;
// Set the struct value (begin phase)
size_t set_begin();
// Set the struct value (end phase)
void set_end(size_t fbe_begin);
// Set the struct value
void set(const ::bank_dom::Global& fbe_value) noexcept;
// Set the struct fields values
void set_fields(const ::bank_dom::Global& fbe_value) noexcept;
private:
FBEBuffer& _buffer;
size_t _offset;
public:
FieldModelVector<std::string> keys;
FieldModelVector<::bank_dom::User> users;
};
namespace bank_dom {
// Fast Binary Encoding Global model
class GlobalModel : public FBE::Model
{
public:
GlobalModel() : model(this->buffer(), 4) {}
GlobalModel(const std::shared_ptr<FBEBuffer>& buffer) : FBE::Model(buffer), model(this->buffer(), 4) {}
// Get the model size
size_t fbe_size() const noexcept { return model.fbe_size() + model.fbe_extra(); }
// Get the model type
static constexpr size_t fbe_type() noexcept { return FieldModel<::bank_dom::Global>::fbe_type(); }
// Check if the struct value is valid
bool verify();
// Create a new model (begin phase)
size_t create_begin();
// Create a new model (end phase)
size_t create_end(size_t fbe_begin);
// Serialize the struct value
size_t serialize(const ::bank_dom::Global& value);
// Deserialize the struct value
size_t deserialize(::bank_dom::Global& value) const noexcept;
// Move to the next struct value
void next(size_t prev) noexcept { model.fbe_shift(prev); }
public:
FieldModel<::bank_dom::Global> model;
};
} // namespace bank_dom
} // namespace FBE