code:
// automatically generated by the FlatBuffers compiler, do not modify

#ifndef FLATBUFFERS_GENERATED_FILEMANAGER_MIRA_PLUGINS_FILEMANAGER_H_
#define FLATBUFFERS_GENERATED_FILEMANAGER_MIRA_PLUGINS_FILEMANAGER_H_

#include "flatbuffers/flatbuffers.h"

namespace Mira {
namespace Plugins {
namespace FileManager {

struct EchoRequest;

struct OpenRequest;

struct CloseRequest;

struct SeekRequest;

struct ReadRequest;

struct ReadResponse;

struct WriteRequest;

struct Dent;

struct GetDentsRequest;

struct GetDentsResponse;

struct Timespec;

struct StatRequest;

struct StatResponse;

struct MkdirRequest;

struct RmdirRequest;

struct UnlinkRequest;

struct DecryptSelfRequest;

struct DecryptSelfResponse;

FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Timespec FLATBUFFERS_FINAL_CLASS {
 private:
  int64_t tv_sec_;
  int32_t tv_nsec_;
  int32_t padding0__;

 public:
  Timespec() {
    memset(this, 0, sizeof(Timespec));
  }
  Timespec(int64_t _tv_sec, int32_t _tv_nsec)
      : tv_sec_(flatbuffers::EndianScalar(_tv_sec)),
        tv_nsec_(flatbuffers::EndianScalar(_tv_nsec)),
        padding0__(0) {
    (void)padding0__;
  }
  int64_t tv_sec() const {
    return flatbuffers::EndianScalar(tv_sec_);
  }
  int32_t tv_nsec() const {
    return flatbuffers::EndianScalar(tv_nsec_);
  }
};
FLATBUFFERS_STRUCT_END(Timespec, 16);

struct EchoRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    VT_MESSAGE = 4
  };
  const flatbuffers::String *message() const {
    return GetPointer<const flatbuffers::String *>(VT_MESSAGE);
  }
  bool Verify(flatbuffers::Verifier &verifier) const {
    return VerifyTableStart(verifier) &&
           VerifyOffset(verifier, VT_MESSAGE) &&
           verifier.VerifyString(message()) &&
           verifier.EndTable();
  }
};

struct EchoRequestBuilder {
  flatbuffers::FlatBufferBuilder &fbb_;
  flatbuffers::uoffset_t start_;
  void add_message(flatbuffers::Offset<flatbuffers::String> message) {
    fbb_.AddOffset(EchoRequest::VT_MESSAGE, message);
  }
  explicit EchoRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
  EchoRequestBuilder &operator=(const EchoRequestBuilder &);
  flatbuffers::Offset<EchoRequest> Finish() {
    const auto end = fbb_.EndTable(start_);
    auto o = flatbuffers::Offset<EchoRequest>(end);
    return o;
  }
};

inline flatbuffers::Offset<EchoRequest> CreateEchoRequest(
    flatbuffers::FlatBufferBuilder &_fbb,
    flatbuffers::Offset<flatbuffers::String> message = 0) {
  EchoRequestBuilder builder_(_fbb);
  builder_.add_message(message);
  return builder_.Finish();
}

inline flatbuffers::Offset<EchoRequest> CreateEchoRequestDirect(
    flatbuffers::FlatBufferBuilder &_fbb,
    const char *message = nullptr) {
  auto message__ = message ? _fbb.CreateString(message) : 0;
  return Mira::Plugins::FileManager::CreateEchoRequest(
      _fbb,
      message__);
}

struct OpenRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    VT_FLAGS = 4,
    VT_MODE = 6,
    VT_PATH = 8
  };
  int32_t flags() const {
    return GetField<int32_t>(VT_FLAGS, 0);
  }
  int32_t mode() const {
    return GetField<int32_t>(VT_MODE, 0);
  }
  const flatbuffers::String *path() const {
    return GetPointer<const flatbuffers::String *>(VT_PATH);
  }
  bool Verify(flatbuffers::Verifier &verifier) const {
    return VerifyTableStart(verifier) &&
           VerifyField<int32_t>(verifier, VT_FLAGS) &&
           VerifyField<int32_t>(verifier, VT_MODE) &&
           VerifyOffset(verifier, VT_PATH) &&
           verifier.VerifyString(path()) &&
           verifier.EndTable();
  }
};

struct OpenRequestBuilder {
  flatbuffers::FlatBufferBuilder &fbb_;
  flatbuffers::uoffset_t start_;
  void add_flags(int32_t flags) {
    fbb_.AddElement<int32_t>(OpenRequest::VT_FLAGS, flags, 0);
  }
  void add_mode(int32_t mode) {
    fbb_.AddElement<int32_t>(OpenRequest::VT_MODE, mode, 0);
  }
  void add_path(flatbuffers::Offset<flatbuffers::String> path) {
    fbb_.AddOffset(OpenRequest::VT_PATH, path);
  }
  explicit OpenRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
  OpenRequestBuilder &operator=(const OpenRequestBuilder &);
  flatbuffers::Offset<OpenRequest> Finish() {
    const auto end = fbb_.EndTable(start_);
    auto o = flatbuffers::Offset<OpenRequest>(end);
    return o;
  }
};

inline flatbuffers::Offset<OpenRequest> CreateOpenRequest(
    flatbuffers::FlatBufferBuilder &_fbb,
    int32_t flags = 0,
    int32_t mode = 0,
    flatbuffers::Offset<flatbuffers::String> path = 0) {
  OpenRequestBuilder builder_(_fbb);
  builder_.add_path(path);
  builder_.add_mode(mode);
  builder_.add_flags(flags);
  return builder_.Finish();
}

inline flatbuffers::Offset<OpenRequest> CreateOpenRequestDirect(
    flatbuffers::FlatBufferBuilder &_fbb,
    int32_t flags = 0,
    int32_t mode = 0,
    const char *path = nullptr) {
  auto path__ = path ? _fbb.CreateString(path) : 0;
  return Mira::Plugins::FileManager::CreateOpenRequest(
      _fbb,
      flags,
      mode,
      path__);
}

struct CloseRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    VT_HANDLE = 4
  };
  int32_t handle() const {
    return GetField<int32_t>(VT_HANDLE, 0);
  }
  bool Verify(flatbuffers::Verifier &verifier) const {
    return VerifyTableStart(verifier) &&
           VerifyField<int32_t>(verifier, VT_HANDLE) &&
           verifier.EndTable();
  }
};

struct CloseRequestBuilder {
  flatbuffers::FlatBufferBuilder &fbb_;
  flatbuffers::uoffset_t start_;
  void add_handle(int32_t handle) {
    fbb_.AddElement<int32_t>(CloseRequest::VT_HANDLE, handle, 0);
  }
  explicit CloseRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
  CloseRequestBuilder &operator=(const CloseRequestBuilder &);
  flatbuffers::Offset<CloseRequest> Finish() {
    const auto end = fbb_.EndTable(start_);
    auto o = flatbuffers::Offset<CloseRequest>(end);
    return o;
  }
};

inline flatbuffers::Offset<CloseRequest> CreateCloseRequest(
    flatbuffers::FlatBufferBuilder &_fbb,
    int32_t handle = 0) {
  CloseRequestBuilder builder_(_fbb);
  builder_.add_handle(handle);
  return builder_.Finish();
}

struct SeekRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    VT_HANDLE = 4,
    VT_OFFSET = 6
  };
  int32_t handle() const {
    return GetField<int32_t>(VT_HANDLE, 0);
  }
  int64_t offset() const {
    return GetField<int64_t>(VT_OFFSET, 0);
  }
  bool Verify(flatbuffers::Verifier &verifier) const {
    return VerifyTableStart(verifier) &&
           VerifyField<int32_t>(verifier, VT_HANDLE) &&
           VerifyField<int64_t>(verifier, VT_OFFSET) &&
           verifier.EndTable();
  }
};

struct SeekRequestBuilder {
  flatbuffers::FlatBufferBuilder &fbb_;
  flatbuffers::uoffset_t start_;
  void add_handle(int32_t handle) {
    fbb_.AddElement<int32_t>(SeekRequest::VT_HANDLE, handle, 0);
  }
  void add_offset(int64_t offset) {
    fbb_.AddElement<int64_t>(SeekRequest::VT_OFFSET, offset, 0);
  }
  explicit SeekRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
  SeekRequestBuilder &operator=(const SeekRequestBuilder &);
  flatbuffers::Offset<SeekRequest> Finish() {
    const auto end = fbb_.EndTable(start_);
    auto o = flatbuffers::Offset<SeekRequest>(end);
    return o;
  }
};

inline flatbuffers::Offset<SeekRequest> CreateSeekRequest(
    flatbuffers::FlatBufferBuilder &_fbb,
    int32_t handle = 0,
    int64_t offset = 0) {
  SeekRequestBuilder builder_(_fbb);
  builder_.add_offset(offset);
  builder_.add_handle(handle);
  return builder_.Finish();
}

struct ReadRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    VT_HANDLE = 4,
    VT_SIZE = 6
  };
  int32_t handle() const {
    return GetField<int32_t>(VT_HANDLE, 0);
  }
  uint64_t size() const {
    return GetField<uint64_t>(VT_SIZE, 0);
  }
  bool Verify(flatbuffers::Verifier &verifier) const {
    return VerifyTableStart(verifier) &&
           VerifyField<int32_t>(verifier, VT_HANDLE) &&
           VerifyField<uint64_t>(verifier, VT_SIZE) &&
           verifier.EndTable();
  }
};

struct ReadRequestBuilder {
  flatbuffers::FlatBufferBuilder &fbb_;
  flatbuffers::uoffset_t start_;
  void add_handle(int32_t handle) {
    fbb_.AddElement<int32_t>(ReadRequest::VT_HANDLE, handle, 0);
  }
  void add_size(uint64_t size) {
    fbb_.AddElement<uint64_t>(ReadRequest::VT_SIZE, size, 0);
  }
  explicit ReadRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
  ReadRequestBuilder &operator=(const ReadRequestBuilder &);
  flatbuffers::Offset<ReadRequest> Finish() {
    const auto end = fbb_.EndTable(start_);
    auto o = flatbuffers::Offset<ReadRequest>(end);
    return o;
  }
};

inline flatbuffers::Offset<ReadRequest> CreateReadRequest(
    flatbuffers::FlatBufferBuilder &_fbb,
    int32_t handle = 0,
    uint64_t size = 0) {
  ReadRequestBuilder builder_(_fbb);
  builder_.add_size(size);
  builder_.add_handle(handle);
  return builder_.Finish();
}

struct ReadResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    VT_DATA = 4
  };
  const flatbuffers::Vector<uint8_t> *data() const {
    return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_DATA);
  }
  bool Verify(flatbuffers::Verifier &verifier) const {
    return VerifyTableStart(verifier) &&
           VerifyOffset(verifier, VT_DATA) &&
           verifier.VerifyVector(data()) &&
           verifier.EndTable();
  }
};

struct ReadResponseBuilder {
  flatbuffers::FlatBufferBuilder &fbb_;
  flatbuffers::uoffset_t start_;
  void add_data(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> data) {
    fbb_.AddOffset(ReadResponse::VT_DATA, data);
  }
  explicit ReadResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
  ReadResponseBuilder &operator=(const ReadResponseBuilder &);
  flatbuffers::Offset<ReadResponse> Finish() {
    const auto end = fbb_.EndTable(start_);
    auto o = flatbuffers::Offset<ReadResponse>(end);
    return o;
  }
};

inline flatbuffers::Offset<ReadResponse> CreateReadResponse(
    flatbuffers::FlatBufferBuilder &_fbb,
    flatbuffers::Offset<flatbuffers::Vector<uint8_t>> data = 0) {
  ReadResponseBuilder builder_(_fbb);
  builder_.add_data(data);
  return builder_.Finish();
}

inline flatbuffers::Offset<ReadResponse> CreateReadResponseDirect(
    flatbuffers::FlatBufferBuilder &_fbb,
    const std::vector<uint8_t> *data = nullptr) {
  auto data__ = data ? _fbb.CreateVector<uint8_t>(*data) : 0;
  return Mira::Plugins::FileManager::CreateReadResponse(
      _fbb,
      data__);
}

struct WriteRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    VT_HANDLE = 4,
    VT_DATA = 6
  };
  int32_t handle() const {
    return GetField<int32_t>(VT_HANDLE, 0);
  }
  const flatbuffers::Vector<uint8_t> *data() const {
    return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_DATA);
  }
  bool Verify(flatbuffers::Verifier &verifier) const {
    return VerifyTableStart(verifier) &&
           VerifyField<int32_t>(verifier, VT_HANDLE) &&
           VerifyOffset(verifier, VT_DATA) &&
           verifier.VerifyVector(data()) &&
           verifier.EndTable();
  }
};

struct WriteRequestBuilder {
  flatbuffers::FlatBufferBuilder &fbb_;
  flatbuffers::uoffset_t start_;
  void add_handle(int32_t handle) {
    fbb_.AddElement<int32_t>(WriteRequest::VT_HANDLE, handle, 0);
  }
  void add_data(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> data) {
    fbb_.AddOffset(WriteRequest::VT_DATA, data);
  }
  explicit WriteRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
  WriteRequestBuilder &operator=(const WriteRequestBuilder &);
  flatbuffers::Offset<WriteRequest> Finish() {
    const auto end = fbb_.EndTable(start_);
    auto o = flatbuffers::Offset<WriteRequest>(end);
    return o;
  }
};

inline flatbuffers::Offset<WriteRequest> CreateWriteRequest(
    flatbuffers::FlatBufferBuilder &_fbb,
    int32_t handle = 0,
    flatbuffers::Offset<flatbuffers::Vector<uint8_t>> data = 0) {
  WriteRequestBuilder builder_(_fbb);
  builder_.add_data(data);
  builder_.add_handle(handle);
  return builder_.Finish();
}

inline flatbuffers::Offset<WriteRequest> CreateWriteRequestDirect(
    flatbuffers::FlatBufferBuilder &_fbb,
    int32_t handle = 0,
    const std::vector<uint8_t> *data = nullptr) {
  auto data__ = data ? _fbb.CreateVector<uint8_t>(*data) : 0;
  return Mira::Plugins::FileManager::CreateWriteRequest(
      _fbb,
      handle,
      data__);
}

struct Dent FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    VT_FILENO = 4,
    VT_RECLEN = 6,
    VT_TYPE = 8,
    VT_NAME = 10
  };
  uint32_t fileno() const {
    return GetField<uint32_t>(VT_FILENO, 0);
  }
  uint32_t recLen() const {
    return GetField<uint32_t>(VT_RECLEN, 0);
  }
  uint32_t type() const {
    return GetField<uint32_t>(VT_TYPE, 0);
  }
  const flatbuffers::String *name() const {
    return GetPointer<const flatbuffers::String *>(VT_NAME);
  }
  bool Verify(flatbuffers::Verifier &verifier) const {
    return VerifyTableStart(verifier) &&
           VerifyField<uint32_t>(verifier, VT_FILENO) &&
           VerifyField<uint32_t>(verifier, VT_RECLEN) &&
           VerifyField<uint32_t>(verifier, VT_TYPE) &&
           VerifyOffset(verifier, VT_NAME) &&
           verifier.VerifyString(name()) &&
           verifier.EndTable();
  }
};

struct DentBuilder {
  flatbuffers::FlatBufferBuilder &fbb_;
  flatbuffers::uoffset_t start_;
  void add_fileno(uint32_t fileno) {
    fbb_.AddElement<uint32_t>(Dent::VT_FILENO, fileno, 0);
  }
  void add_recLen(uint32_t recLen) {
    fbb_.AddElement<uint32_t>(Dent::VT_RECLEN, recLen, 0);
  }
  void add_type(uint32_t type) {
    fbb_.AddElement<uint32_t>(Dent::VT_TYPE, type, 0);
  }
  void add_name(flatbuffers::Offset<flatbuffers::String> name) {
    fbb_.AddOffset(Dent::VT_NAME, name);
  }
  explicit DentBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
  DentBuilder &operator=(const DentBuilder &);
  flatbuffers::Offset<Dent> Finish() {
    const auto end = fbb_.EndTable(start_);
    auto o = flatbuffers::Offset<Dent>(end);
    return o;
  }
};

inline flatbuffers::Offset<Dent> CreateDent(
    flatbuffers::FlatBufferBuilder &_fbb,
    uint32_t fileno = 0,
    uint32_t recLen = 0,
    uint32_t type = 0,
    flatbuffers::Offset<flatbuffers::String> name = 0) {
  DentBuilder builder_(_fbb);
  builder_.add_name(name);
  builder_.add_type(type);
  builder_.add_recLen(recLen);
  builder_.add_fileno(fileno);
  return builder_.Finish();
}

inline flatbuffers::Offset<Dent> CreateDentDirect(
    flatbuffers::FlatBufferBuilder &_fbb,
    uint32_t fileno = 0,
    uint32_t recLen = 0,
    uint32_t type = 0,
    const char *name = nullptr) {
  auto name__ = name ? _fbb.CreateString(name) : 0;
  return Mira::Plugins::FileManager::CreateDent(
      _fbb,
      fileno,
      recLen,
      type,
      name__);
}

struct GetDentsRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    VT_PATH = 4
  };
  const flatbuffers::String *path() const {
    return GetPointer<const flatbuffers::String *>(VT_PATH);
  }
  bool Verify(flatbuffers::Verifier &verifier) const {
    return VerifyTableStart(verifier) &&
           VerifyOffset(verifier, VT_PATH) &&
           verifier.VerifyString(path()) &&
           verifier.EndTable();
  }
};

struct GetDentsRequestBuilder {
  flatbuffers::FlatBufferBuilder &fbb_;
  flatbuffers::uoffset_t start_;
  void add_path(flatbuffers::Offset<flatbuffers::String> path) {
    fbb_.AddOffset(GetDentsRequest::VT_PATH, path);
  }
  explicit GetDentsRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
  GetDentsRequestBuilder &operator=(const GetDentsRequestBuilder &);
  flatbuffers::Offset<GetDentsRequest> Finish() {
    const auto end = fbb_.EndTable(start_);
    auto o = flatbuffers::Offset<GetDentsRequest>(end);
    return o;
  }
};

inline flatbuffers::Offset<GetDentsRequest> CreateGetDentsRequest(
    flatbuffers::FlatBufferBuilder &_fbb,
    flatbuffers::Offset<flatbuffers::String> path = 0) {
  GetDentsRequestBuilder builder_(_fbb);
  builder_.add_path(path);
  return builder_.Finish();
}

inline flatbuffers::Offset<GetDentsRequest> CreateGetDentsRequestDirect(
    flatbuffers::FlatBufferBuilder &_fbb,
    const char *path = nullptr) {
  auto path__ = path ? _fbb.CreateString(path) : 0;
  return Mira::Plugins::FileManager::CreateGetDentsRequest(
      _fbb,
      path__);
}

struct GetDentsResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    VT_DENTS = 4
  };
  const flatbuffers::Vector<flatbuffers::Offset<Dent>> *dents() const {
    return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<Dent>> *>(VT_DENTS);
  }
  bool Verify(flatbuffers::Verifier &verifier) const {
    return VerifyTableStart(verifier) &&
           VerifyOffset(verifier, VT_DENTS) &&
           verifier.VerifyVector(dents()) &&
           verifier.VerifyVectorOfTables(dents()) &&
           verifier.EndTable();
  }
};

struct GetDentsResponseBuilder {
  flatbuffers::FlatBufferBuilder &fbb_;
  flatbuffers::uoffset_t start_;
  void add_dents(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Dent>>> dents) {
    fbb_.AddOffset(GetDentsResponse::VT_DENTS, dents);
  }
  explicit GetDentsResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
  GetDentsResponseBuilder &operator=(const GetDentsResponseBuilder &);
  flatbuffers::Offset<GetDentsResponse> Finish() {
    const auto end = fbb_.EndTable(start_);
    auto o = flatbuffers::Offset<GetDentsResponse>(end);
    return o;
  }
};

inline flatbuffers::Offset<GetDentsResponse> CreateGetDentsResponse(
    flatbuffers::FlatBufferBuilder &_fbb,
    flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Dent>>> dents = 0) {
  GetDentsResponseBuilder builder_(_fbb);
  builder_.add_dents(dents);
  return builder_.Finish();
}

inline flatbuffers::Offset<GetDentsResponse> CreateGetDentsResponseDirect(
    flatbuffers::FlatBufferBuilder &_fbb,
    const std::vector<flatbuffers::Offset<Dent>> *dents = nullptr) {
  auto dents__ = dents ? _fbb.CreateVector<flatbuffers::Offset<Dent>>(*dents) : 0;
  return Mira::Plugins::FileManager::CreateGetDentsResponse(
      _fbb,
      dents__);
}

struct StatRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    VT_HANDLE = 4,
    VT_PATH = 6
  };
  int32_t handle() const {
    return GetField<int32_t>(VT_HANDLE, 0);
  }
  const flatbuffers::String *path() const {
    return GetPointer<const flatbuffers::String *>(VT_PATH);
  }
  bool Verify(flatbuffers::Verifier &verifier) const {
    return VerifyTableStart(verifier) &&
           VerifyField<int32_t>(verifier, VT_HANDLE) &&
           VerifyOffset(verifier, VT_PATH) &&
           verifier.VerifyString(path()) &&
           verifier.EndTable();
  }
};

struct StatRequestBuilder {
  flatbuffers::FlatBufferBuilder &fbb_;
  flatbuffers::uoffset_t start_;
  void add_handle(int32_t handle) {
    fbb_.AddElement<int32_t>(StatRequest::VT_HANDLE, handle, 0);
  }
  void add_path(flatbuffers::Offset<flatbuffers::String> path) {
    fbb_.AddOffset(StatRequest::VT_PATH, path);
  }
  explicit StatRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
  StatRequestBuilder &operator=(const StatRequestBuilder &);
  flatbuffers::Offset<StatRequest> Finish() {
    const auto end = fbb_.EndTable(start_);
    auto o = flatbuffers::Offset<StatRequest>(end);
    return o;
  }
};

inline flatbuffers::Offset<StatRequest> CreateStatRequest(
    flatbuffers::FlatBufferBuilder &_fbb,
    int32_t handle = 0,
    flatbuffers::Offset<flatbuffers::String> path = 0) {
  StatRequestBuilder builder_(_fbb);
  builder_.add_path(path);
  builder_.add_handle(handle);
  return builder_.Finish();
}

inline flatbuffers::Offset<StatRequest> CreateStatRequestDirect(
    flatbuffers::FlatBufferBuilder &_fbb,
    int32_t handle = 0,
    const char *path = nullptr) {
  auto path__ = path ? _fbb.CreateString(path) : 0;
  return Mira::Plugins::FileManager::CreateStatRequest(
      _fbb,
      handle,
      path__);
}

struct StatResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    VT_ST_DEV = 4,
    VT_ST_INO = 6,
    VT_ST_MODE = 8,
    VT_ST_NLINK = 10,
    VT_ST_UID = 12,
    VT_ST_GID = 14,
    VT_ST_RDEV = 16,
    VT_ST_ATIM = 18,
    VT_ST_MTIM = 20,
    VT_ST_CTIM = 22,
    VT_ST_SIZE = 24,
    VT_ST_BLOCKS = 26,
    VT_ST_BLKSIZE = 28,
    VT_ST_FLAGS = 30,
    VT_ST_GEN = 32,
    VT_ST_LSPARE = 34,
    VT_ST_BIRTHTIM = 36
  };
  uint32_t st_dev() const {
    return GetField<uint32_t>(VT_ST_DEV, 0);
  }
  uint32_t st_ino() const {
    return GetField<uint32_t>(VT_ST_INO, 0);
  }
  uint32_t st_mode() const {
    return GetField<uint32_t>(VT_ST_MODE, 0);
  }
  uint32_t st_nlink() const {
    return GetField<uint32_t>(VT_ST_NLINK, 0);
  }
  uint32_t st_uid() const {
    return GetField<uint32_t>(VT_ST_UID, 0);
  }
  uint32_t st_gid() const {
    return GetField<uint32_t>(VT_ST_GID, 0);
  }
  uint32_t st_rdev() const {
    return GetField<uint32_t>(VT_ST_RDEV, 0);
  }
  const Timespec *st_atim() const {
    return GetStruct<const Timespec *>(VT_ST_ATIM);
  }
  const Timespec *st_mtim() const {
    return GetStruct<const Timespec *>(VT_ST_MTIM);
  }
  const Timespec *st_ctim() const {
    return GetStruct<const Timespec *>(VT_ST_CTIM);
  }
  int64_t st_size() const {
    return GetField<int64_t>(VT_ST_SIZE, 0);
  }
  int64_t st_blocks() const {
    return GetField<int64_t>(VT_ST_BLOCKS, 0);
  }
  uint32_t st_blksize() const {
    return GetField<uint32_t>(VT_ST_BLKSIZE, 0);
  }
  uint32_t st_flags() const {
    return GetField<uint32_t>(VT_ST_FLAGS, 0);
  }
  uint32_t st_gen() const {
    return GetField<uint32_t>(VT_ST_GEN, 0);
  }
  int32_t st_lspare() const {
    return GetField<int32_t>(VT_ST_LSPARE, 0);
  }
  const Timespec *st_birthtim() const {
    return GetStruct<const Timespec *>(VT_ST_BIRTHTIM);
  }
  bool Verify(flatbuffers::Verifier &verifier) const {
    return VerifyTableStart(verifier) &&
           VerifyField<uint32_t>(verifier, VT_ST_DEV) &&
           VerifyField<uint32_t>(verifier, VT_ST_INO) &&
           VerifyField<uint32_t>(verifier, VT_ST_MODE) &&
           VerifyField<uint32_t>(verifier, VT_ST_NLINK) &&
           VerifyField<uint32_t>(verifier, VT_ST_UID) &&
           VerifyField<uint32_t>(verifier, VT_ST_GID) &&
           VerifyField<uint32_t>(verifier, VT_ST_RDEV) &&
           VerifyField<Timespec>(verifier, VT_ST_ATIM) &&
           VerifyField<Timespec>(verifier, VT_ST_MTIM) &&
           VerifyField<Timespec>(verifier, VT_ST_CTIM) &&
           VerifyField<int64_t>(verifier, VT_ST_SIZE) &&
           VerifyField<int64_t>(verifier, VT_ST_BLOCKS) &&
           VerifyField<uint32_t>(verifier, VT_ST_BLKSIZE) &&
           VerifyField<uint32_t>(verifier, VT_ST_FLAGS) &&
           VerifyField<uint32_t>(verifier, VT_ST_GEN) &&
           VerifyField<int32_t>(verifier, VT_ST_LSPARE) &&
           VerifyField<Timespec>(verifier, VT_ST_BIRTHTIM) &&
           verifier.EndTable();
  }
};

struct StatResponseBuilder {
  flatbuffers::FlatBufferBuilder &fbb_;
  flatbuffers::uoffset_t start_;
  void add_st_dev(uint32_t st_dev) {
    fbb_.AddElement<uint32_t>(StatResponse::VT_ST_DEV, st_dev, 0);
  }
  void add_st_ino(uint32_t st_ino) {
    fbb_.AddElement<uint32_t>(StatResponse::VT_ST_INO, st_ino, 0);
  }
  void add_st_mode(uint32_t st_mode) {
    fbb_.AddElement<uint32_t>(StatResponse::VT_ST_MODE, st_mode, 0);
  }
  void add_st_nlink(uint32_t st_nlink) {
    fbb_.AddElement<uint32_t>(StatResponse::VT_ST_NLINK, st_nlink, 0);
  }
  void add_st_uid(uint32_t st_uid) {
    fbb_.AddElement<uint32_t>(StatResponse::VT_ST_UID, st_uid, 0);
  }
  void add_st_gid(uint32_t st_gid) {
    fbb_.AddElement<uint32_t>(StatResponse::VT_ST_GID, st_gid, 0);
  }
  void add_st_rdev(uint32_t st_rdev) {
    fbb_.AddElement<uint32_t>(StatResponse::VT_ST_RDEV, st_rdev, 0);
  }
  void add_st_atim(const Timespec *st_atim) {
    fbb_.AddStruct(StatResponse::VT_ST_ATIM, st_atim);
  }
  void add_st_mtim(const Timespec *st_mtim) {
    fbb_.AddStruct(StatResponse::VT_ST_MTIM, st_mtim);
  }
  void add_st_ctim(const Timespec *st_ctim) {
    fbb_.AddStruct(StatResponse::VT_ST_CTIM, st_ctim);
  }
  void add_st_size(int64_t st_size) {
    fbb_.AddElement<int64_t>(StatResponse::VT_ST_SIZE, st_size, 0);
  }
  void add_st_blocks(int64_t st_blocks) {
    fbb_.AddElement<int64_t>(StatResponse::VT_ST_BLOCKS, st_blocks, 0);
  }
  void add_st_blksize(uint32_t st_blksize) {
    fbb_.AddElement<uint32_t>(StatResponse::VT_ST_BLKSIZE, st_blksize, 0);
  }
  void add_st_flags(uint32_t st_flags) {
    fbb_.AddElement<uint32_t>(StatResponse::VT_ST_FLAGS, st_flags, 0);
  }
  void add_st_gen(uint32_t st_gen) {
    fbb_.AddElement<uint32_t>(StatResponse::VT_ST_GEN, st_gen, 0);
  }
  void add_st_lspare(int32_t st_lspare) {
    fbb_.AddElement<int32_t>(StatResponse::VT_ST_LSPARE, st_lspare, 0);
  }
  void add_st_birthtim(const Timespec *st_birthtim) {
    fbb_.AddStruct(StatResponse::VT_ST_BIRTHTIM, st_birthtim);
  }
  explicit StatResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
  StatResponseBuilder &operator=(const StatResponseBuilder &);
  flatbuffers::Offset<StatResponse> Finish() {
    const auto end = fbb_.EndTable(start_);
    auto o = flatbuffers::Offset<StatResponse>(end);
    return o;
  }
};

inline flatbuffers::Offset<StatResponse> CreateStatResponse(
    flatbuffers::FlatBufferBuilder &_fbb,
    uint32_t st_dev = 0,
    uint32_t st_ino = 0,
    uint32_t st_mode = 0,
    uint32_t st_nlink = 0,
    uint32_t st_uid = 0,
    uint32_t st_gid = 0,
    uint32_t st_rdev = 0,
    const Timespec *st_atim = 0,
    const Timespec *st_mtim = 0,
    const Timespec *st_ctim = 0,
    int64_t st_size = 0,
    int64_t st_blocks = 0,
    uint32_t st_blksize = 0,
    uint32_t st_flags = 0,
    uint32_t st_gen = 0,
    int32_t st_lspare = 0,
    const Timespec *st_birthtim = 0) {
  StatResponseBuilder builder_(_fbb);
  builder_.add_st_blocks(st_blocks);
  builder_.add_st_size(st_size);
  builder_.add_st_birthtim(st_birthtim);
  builder_.add_st_lspare(st_lspare);
  builder_.add_st_gen(st_gen);
  builder_.add_st_flags(st_flags);
  builder_.add_st_blksize(st_blksize);
  builder_.add_st_ctim(st_ctim);
  builder_.add_st_mtim(st_mtim);
  builder_.add_st_atim(st_atim);
  builder_.add_st_rdev(st_rdev);
  builder_.add_st_gid(st_gid);
  builder_.add_st_uid(st_uid);
  builder_.add_st_nlink(st_nlink);
  builder_.add_st_mode(st_mode);
  builder_.add_st_ino(st_ino);
  builder_.add_st_dev(st_dev);
  return builder_.Finish();
}

struct MkdirRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    VT_MODE = 4,
    VT_PATH = 6
  };
  int32_t mode() const {
    return GetField<int32_t>(VT_MODE, 0);
  }
  const flatbuffers::String *path() const {
    return GetPointer<const flatbuffers::String *>(VT_PATH);
  }
  bool Verify(flatbuffers::Verifier &verifier) const {
    return VerifyTableStart(verifier) &&
           VerifyField<int32_t>(verifier, VT_MODE) &&
           VerifyOffset(verifier, VT_PATH) &&
           verifier.VerifyString(path()) &&
           verifier.EndTable();
  }
};

struct MkdirRequestBuilder {
  flatbuffers::FlatBufferBuilder &fbb_;
  flatbuffers::uoffset_t start_;
  void add_mode(int32_t mode) {
    fbb_.AddElement<int32_t>(MkdirRequest::VT_MODE, mode, 0);
  }
  void add_path(flatbuffers::Offset<flatbuffers::String> path) {
    fbb_.AddOffset(MkdirRequest::VT_PATH, path);
  }
  explicit MkdirRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
  MkdirRequestBuilder &operator=(const MkdirRequestBuilder &);
  flatbuffers::Offset<MkdirRequest> Finish() {
    const auto end = fbb_.EndTable(start_);
    auto o = flatbuffers::Offset<MkdirRequest>(end);
    return o;
  }
};

inline flatbuffers::Offset<MkdirRequest> CreateMkdirRequest(
    flatbuffers::FlatBufferBuilder &_fbb,
    int32_t mode = 0,
    flatbuffers::Offset<flatbuffers::String> path = 0) {
  MkdirRequestBuilder builder_(_fbb);
  builder_.add_path(path);
  builder_.add_mode(mode);
  return builder_.Finish();
}

inline flatbuffers::Offset<MkdirRequest> CreateMkdirRequestDirect(
    flatbuffers::FlatBufferBuilder &_fbb,
    int32_t mode = 0,
    const char *path = nullptr) {
  auto path__ = path ? _fbb.CreateString(path) : 0;
  return Mira::Plugins::FileManager::CreateMkdirRequest(
      _fbb,
      mode,
      path__);
}

struct RmdirRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    VT_PATH = 4
  };
  const flatbuffers::String *path() const {
    return GetPointer<const flatbuffers::String *>(VT_PATH);
  }
  bool Verify(flatbuffers::Verifier &verifier) const {
    return VerifyTableStart(verifier) &&
           VerifyOffset(verifier, VT_PATH) &&
           verifier.VerifyString(path()) &&
           verifier.EndTable();
  }
};

struct RmdirRequestBuilder {
  flatbuffers::FlatBufferBuilder &fbb_;
  flatbuffers::uoffset_t start_;
  void add_path(flatbuffers::Offset<flatbuffers::String> path) {
    fbb_.AddOffset(RmdirRequest::VT_PATH, path);
  }
  explicit RmdirRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
  RmdirRequestBuilder &operator=(const RmdirRequestBuilder &);
  flatbuffers::Offset<RmdirRequest> Finish() {
    const auto end = fbb_.EndTable(start_);
    auto o = flatbuffers::Offset<RmdirRequest>(end);
    return o;
  }
};

inline flatbuffers::Offset<RmdirRequest> CreateRmdirRequest(
    flatbuffers::FlatBufferBuilder &_fbb,
    flatbuffers::Offset<flatbuffers::String> path = 0) {
  RmdirRequestBuilder builder_(_fbb);
  builder_.add_path(path);
  return builder_.Finish();
}

inline flatbuffers::Offset<RmdirRequest> CreateRmdirRequestDirect(
    flatbuffers::FlatBufferBuilder &_fbb,
    const char *path = nullptr) {
  auto path__ = path ? _fbb.CreateString(path) : 0;
  return Mira::Plugins::FileManager::CreateRmdirRequest(
      _fbb,
      path__);
}

struct UnlinkRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    VT_PATH = 4
  };
  const flatbuffers::String *path() const {
    return GetPointer<const flatbuffers::String *>(VT_PATH);
  }
  bool Verify(flatbuffers::Verifier &verifier) const {
    return VerifyTableStart(verifier) &&
           VerifyOffset(verifier, VT_PATH) &&
           verifier.VerifyString(path()) &&
           verifier.EndTable();
  }
};

struct UnlinkRequestBuilder {
  flatbuffers::FlatBufferBuilder &fbb_;
  flatbuffers::uoffset_t start_;
  void add_path(flatbuffers::Offset<flatbuffers::String> path) {
    fbb_.AddOffset(UnlinkRequest::VT_PATH, path);
  }
  explicit UnlinkRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
  UnlinkRequestBuilder &operator=(const UnlinkRequestBuilder &);
  flatbuffers::Offset<UnlinkRequest> Finish() {
    const auto end = fbb_.EndTable(start_);
    auto o = flatbuffers::Offset<UnlinkRequest>(end);
    return o;
  }
};

inline flatbuffers::Offset<UnlinkRequest> CreateUnlinkRequest(
    flatbuffers::FlatBufferBuilder &_fbb,
    flatbuffers::Offset<flatbuffers::String> path = 0) {
  UnlinkRequestBuilder builder_(_fbb);
  builder_.add_path(path);
  return builder_.Finish();
}

inline flatbuffers::Offset<UnlinkRequest> CreateUnlinkRequestDirect(
    flatbuffers::FlatBufferBuilder &_fbb,
    const char *path = nullptr) {
  auto path__ = path ? _fbb.CreateString(path) : 0;
  return Mira::Plugins::FileManager::CreateUnlinkRequest(
      _fbb,
      path__);
}

struct DecryptSelfRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    VT_PATH = 4
  };
  const flatbuffers::String *path() const {
    return GetPointer<const flatbuffers::String *>(VT_PATH);
  }
  bool Verify(flatbuffers::Verifier &verifier) const {
    return VerifyTableStart(verifier) &&
           VerifyOffset(verifier, VT_PATH) &&
           verifier.VerifyString(path()) &&
           verifier.EndTable();
  }
};

struct DecryptSelfRequestBuilder {
  flatbuffers::FlatBufferBuilder &fbb_;
  flatbuffers::uoffset_t start_;
  void add_path(flatbuffers::Offset<flatbuffers::String> path) {
    fbb_.AddOffset(DecryptSelfRequest::VT_PATH, path);
  }
  explicit DecryptSelfRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
  DecryptSelfRequestBuilder &operator=(const DecryptSelfRequestBuilder &);
  flatbuffers::Offset<DecryptSelfRequest> Finish() {
    const auto end = fbb_.EndTable(start_);
    auto o = flatbuffers::Offset<DecryptSelfRequest>(end);
    return o;
  }
};

inline flatbuffers::Offset<DecryptSelfRequest> CreateDecryptSelfRequest(
    flatbuffers::FlatBufferBuilder &_fbb,
    flatbuffers::Offset<flatbuffers::String> path = 0) {
  DecryptSelfRequestBuilder builder_(_fbb);
  builder_.add_path(path);
  return builder_.Finish();
}

inline flatbuffers::Offset<DecryptSelfRequest> CreateDecryptSelfRequestDirect(
    flatbuffers::FlatBufferBuilder &_fbb,
    const char *path = nullptr) {
  auto path__ = path ? _fbb.CreateString(path) : 0;
  return Mira::Plugins::FileManager::CreateDecryptSelfRequest(
      _fbb,
      path__);
}

struct DecryptSelfResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    VT_DATA = 4
  };
  const flatbuffers::Vector<uint8_t> *data() const {
    return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_DATA);
  }
  bool Verify(flatbuffers::Verifier &verifier) const {
    return VerifyTableStart(verifier) &&
           VerifyOffset(verifier, VT_DATA) &&
           verifier.VerifyVector(data()) &&
           verifier.EndTable();
  }
};

struct DecryptSelfResponseBuilder {
  flatbuffers::FlatBufferBuilder &fbb_;
  flatbuffers::uoffset_t start_;
  void add_data(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> data) {
    fbb_.AddOffset(DecryptSelfResponse::VT_DATA, data);
  }
  explicit DecryptSelfResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
  DecryptSelfResponseBuilder &operator=(const DecryptSelfResponseBuilder &);
  flatbuffers::Offset<DecryptSelfResponse> Finish() {
    const auto end = fbb_.EndTable(start_);
    auto o = flatbuffers::Offset<DecryptSelfResponse>(end);
    return o;
  }
};

inline flatbuffers::Offset<DecryptSelfResponse> CreateDecryptSelfResponse(
    flatbuffers::FlatBufferBuilder &_fbb,
    flatbuffers::Offset<flatbuffers::Vector<uint8_t>> data = 0) {
  DecryptSelfResponseBuilder builder_(_fbb);
  builder_.add_data(data);
  return builder_.Finish();
}

inline flatbuffers::Offset<DecryptSelfResponse> CreateDecryptSelfResponseDirect(
    flatbuffers::FlatBufferBuilder &_fbb,
    const std::vector<uint8_t> *data = nullptr) {
  auto data__ = data ? _fbb.CreateVector<uint8_t>(*data) : 0;
  return Mira::Plugins::FileManager::CreateDecryptSelfResponse(
      _fbb,
      data__);
}

}  // namespace FileManager
}  // namespace Plugins
}  // namespace Mira

#endif  // FLATBUFFERS_GENERATED_FILEMANAGER_MIRA_PLUGINS_FILEMANAGER_H_


code:
// RPC IDL File

namespace Mira.Rpc;

enum RpcMagics : uint32
{
    Version1 = 2,
    Version2 = 0x22222222
}

enum RpcCategory : uint32
{
    NONE = 0,
    SYSTEM = 1,
    LOG = 2,
    DEBUG = 3,
    FILE = 4,
    COMMAND = 5,
}

table RpcHeader
{
    // Header magic (default: 0xDEADBEEF)
    magic:uint32;

    // Mira category
    category:RpcCategory;

    // Message type
    type:uint32;

    // User specified information (not checked by rpc)
    aux:uint32;

    // Error/result
    error:int64;

    // Internal message data
    data:[ubyte];
}

root_type RpcHeader;

repo_name: veiledmerc/mira

license: mit


code:
// automatically generated by the FlatBuffers compiler, do not modify

#ifndef FLATBUFFERS_GENERATED_RPC_MIRA_RPC_H_
#define FLATBUFFERS_GENERATED_RPC_MIRA_RPC_H_

#include "flatbuffers/flatbuffers.h"

namespace Mira {
namespace Rpc {

struct RpcHeader;

enum RpcMagics {
  RpcMagics_Version1 = 2,
  RpcMagics_Version2 = 572662306,
  RpcMagics_MIN = RpcMagics_Version1,
  RpcMagics_MAX = RpcMagics_Version2
};

inline const RpcMagics (&EnumValuesRpcMagics())[2] {
  static const RpcMagics values[] = {
    RpcMagics_Version1,
    RpcMagics_Version2
  };
  return values;
}

inline const char *EnumNameRpcMagics(RpcMagics e) {
  switch (e) {
    case RpcMagics_Version1: return "Version1";
    case RpcMagics_Version2: return "Version2";
    default: return "";
  }
}

enum RpcCategory {
  RpcCategory_NONE = 0,
  RpcCategory_SYSTEM = 1,
  RpcCategory_LOG = 2,
  RpcCategory_DEBUG = 3,
  RpcCategory_FILE = 4,
  RpcCategory_COMMAND = 5,
  RpcCategory_MIN = RpcCategory_NONE,
  RpcCategory_MAX = RpcCategory_COMMAND
};

inline const RpcCategory (&EnumValuesRpcCategory())[6] {
  static const RpcCategory values[] = {
    RpcCategory_NONE,
    RpcCategory_SYSTEM,
    RpcCategory_LOG,
    RpcCategory_DEBUG,
    RpcCategory_FILE,
    RpcCategory_COMMAND
  };
  return values;
}

inline const char * const *EnumNamesRpcCategory() {
  static const char * const names[] = {
    "NONE",
    "SYSTEM",
    "LOG",
    "DEBUG",
    "FILE",
    "COMMAND",
    nullptr
  };
  return names;
}

inline const char *EnumNameRpcCategory(RpcCategory e) {
  if (e < RpcCategory_NONE || e > RpcCategory_COMMAND) return "";
  const size_t index = static_cast<int>(e);
  return EnumNamesRpcCategory()[index];
}

struct RpcHeader FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    VT_MAGIC = 4,
    VT_CATEGORY = 6,
    VT_TYPE = 8,
    VT_AUX = 10,
    VT_ERROR = 12,
    VT_DATA = 14
  };
  uint32_t magic() const {
    return GetField<uint32_t>(VT_MAGIC, 0);
  }
  RpcCategory category() const {
    return static_cast<RpcCategory>(GetField<uint32_t>(VT_CATEGORY, 0));
  }
  uint32_t type() const {
    return GetField<uint32_t>(VT_TYPE, 0);
  }
  uint32_t aux() const {
    return GetField<uint32_t>(VT_AUX, 0);
  }
  int64_t error() const {
    return GetField<int64_t>(VT_ERROR, 0);
  }
  const flatbuffers::Vector<uint8_t> *data() const {
    return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_DATA);
  }
  bool Verify(flatbuffers::Verifier &verifier) const {
    return VerifyTableStart(verifier) &&
           VerifyField<uint32_t>(verifier, VT_MAGIC) &&
           VerifyField<uint32_t>(verifier, VT_CATEGORY) &&
           VerifyField<uint32_t>(verifier, VT_TYPE) &&
           VerifyField<uint32_t>(verifier, VT_AUX) &&
           VerifyField<int64_t>(verifier, VT_ERROR) &&
           VerifyOffset(verifier, VT_DATA) &&
           verifier.VerifyVector(data()) &&
           verifier.EndTable();
  }
};

struct RpcHeaderBuilder {
  flatbuffers::FlatBufferBuilder &fbb_;
  flatbuffers::uoffset_t start_;
  void add_magic(uint32_t magic) {
    fbb_.AddElement<uint32_t>(RpcHeader::VT_MAGIC, magic, 0);
  }
  void add_category(RpcCategory category) {
    fbb_.AddElement<uint32_t>(RpcHeader::VT_CATEGORY, static_cast<uint32_t>(category), 0);
  }
  void add_type(uint32_t type) {
    fbb_.AddElement<uint32_t>(RpcHeader::VT_TYPE, type, 0);
  }
  void add_aux(uint32_t aux) {
    fbb_.AddElement<uint32_t>(RpcHeader::VT_AUX, aux, 0);
  }
  void add_error(int64_t error) {
    fbb_.AddElement<int64_t>(RpcHeader::VT_ERROR, error, 0);
  }
  void add_data(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> data) {
    fbb_.AddOffset(RpcHeader::VT_DATA, data);
  }
  explicit RpcHeaderBuilder(flatbuffers::FlatBufferBuilder &_fbb)
        : fbb_(_fbb) {
    start_ = fbb_.StartTable();
  }
  RpcHeaderBuilder &operator=(const RpcHeaderBuilder &);
  flatbuffers::Offset<RpcHeader> Finish() {
    const auto end = fbb_.EndTable(start_);
    auto o = flatbuffers::Offset<RpcHeader>(end);
    return o;
  }
};

inline flatbuffers::Offset<RpcHeader> CreateRpcHeader(
    flatbuffers::FlatBufferBuilder &_fbb,
    uint32_t magic = 0,
    RpcCategory category = RpcCategory_NONE,
    uint32_t type = 0,
    uint32_t aux = 0,
    int64_t error = 0,
    flatbuffers::Offset<flatbuffers::Vector<uint8_t>> data = 0) {
  RpcHeaderBuilder builder_(_fbb);
  builder_.add_error(error);
  builder_.add_data(data);
  builder_.add_aux(aux);
  builder_.add_type(type);
  builder_.add_category(category);
  builder_.add_magic(magic);
  return builder_.Finish();
}

inline flatbuffers::Offset<RpcHeader> CreateRpcHeaderDirect(
    flatbuffers::FlatBufferBuilder &_fbb,
    uint32_t magic = 0,
    RpcCategory category = RpcCategory_NONE,
    uint32_t type = 0,
    uint32_t aux = 0,
    int64_t error = 0,
    const std::vector<uint8_t> *data = nullptr) {
  auto data__ = data ? _fbb.CreateVector<uint8_t>(*data) : 0;
  return Mira::Rpc::CreateRpcHeader(
      _fbb,
      magic,
      category,
      type,
      aux,
      error,
      data__);
}

inline const Mira::Rpc::RpcHeader *GetRpcHeader(const void *buf) {
  return flatbuffers::GetRoot<Mira::Rpc::RpcHeader>(buf);
}

inline const Mira::Rpc::RpcHeader *GetSizePrefixedRpcHeader(const void *buf) {
  return flatbuffers::GetSizePrefixedRoot<Mira::Rpc::RpcHeader>(buf);
}

inline bool VerifyRpcHeaderBuffer(
    flatbuffers::Verifier &verifier) {
  return verifier.VerifyBuffer<Mira::Rpc::RpcHeader>(nullptr);
}

inline bool VerifySizePrefixedRpcHeaderBuffer(
    flatbuffers::Verifier &verifier) {
  return verifier.VerifySizePrefixedBuffer<Mira::Rpc::RpcHeader>(nullptr);
}

inline void FinishRpcHeaderBuffer(
    flatbuffers::FlatBufferBuilder &fbb,
    flatbuffers::Offset<Mira::Rpc::RpcHeader> root) {
  fbb.Finish(root);
}

inline void FinishSizePrefixedRpcHeaderBuffer(
    flatbuffers::FlatBufferBuilder &fbb,
    flatbuffers::Offset<Mira::Rpc::RpcHeader> root) {
  fbb.FinishSizePrefixed(root);
}

}  // namespace Rpc
}  // namespace Mira

#endif  // FLATBUFFERS_GENERATED_RPC_MIRA_RPC_H_


code:
#pragma once
#include <cstdint>

extern "C"
{
    #define COMM_LEN 19 + 13
    #define NAME_LEN 19 + 17
    #define _MAX_PATH 1024

    typedef enum SceAuthenticationId_t : uint64_t
    {
        SceVdecProxy = 0x3800000000000003ULL,
        SceVencProxy = 0x3800000000000004ULL,
        Orbis_audiod = 0x3800000000000005ULL,
        Coredump = 0x3800000000000006ULL,
        SceSysCore = 0x3800000000000007ULL,
        Orbis_setip = 0x3800000000000008ULL,
        GnmCompositor = 0x3800000000000009ULL,
        SceShellUI = 0x380000000000000fULL, // NPXS20001
        SceShellCore = 0x3800000000000010ULL,
        NPXS20103 = 0x3800000000000011ULL,
        NPXS21000 = 0x3800000000000012ULL,
        // TODO: Fill in the rest
        Decid = 0x3800000000010003,
    } SceAuthenticationId;

    typedef enum SceCapabilities_t : uint64_t
    {
        Max = 0xFFFFFFFFFFFFFFFFULL,
    } SceCapabilites;

    // "safe" way in order to modify kernel ucred externally
    typedef struct _MiraThreadCredentials {
        typedef enum class _MiraThreadCredentialsPrison : uint32_t
        {
            // Non-root prison
            Default,

            // Switch prison to root vnode
            Root,

            // Total options count
            COUNT
        } MiraThreadCredentialsPrison;

        typedef enum class _State : uint32_t
        {
            Get,
            Set,
            COUNT
        } GSState;

        // Is this a get or set operation
        GSState State;

        // Process ID to modify
        int32_t ProcessId;

        // Threaad ID to modify, or -1 for (all threads in process, USE WITH CAUTION)
        int32_t ThreadId;

        // Everything below is Get/Set
        int32_t EffectiveUserId;
        int32_t RealUserId;
        int32_t SavedUserId;
        int32_t NumGroups;
        int32_t RealGroupId;
        int32_t SavedGroupId;
        MiraThreadCredentialsPrison Prison;
        SceAuthenticationId SceAuthId;
        SceCapabilites Capabilities[4];
        uint64_t Attributes[4];
    } MiraThreadCredentials;

    typedef enum class _MiraLoadPluginType : uint8_t
    {
        // Don't try and load any plugin type
        None,

        // Load a new kernel plugin
        Kernel,

        // Load a new userland daemon plugin
        Daemon,

        // Load a new game/process trainer
        Trainer,

        // Total entry count
        COUNT
    } MiraLoadPluginType;

    // This is the requesting structure provided to the ioctl, on return a u64 as ID is returned
    typedef struct _MiraLoadPlugin
    {
        // The plugin type to load
        MiraLoadPluginType PluginType;

        // The path on filesystem of the plugin
        char PluginPath[_MAX_PATH];
    } MiraLoadPlugin;

    typedef struct _MiraUnloadPlugin
    {
        // The returned plugin id from the plugin manager
        uint64_t PluginId;
    } MiraUnloadPlugin;

    typedef enum class _MiraProcessInformationType : uint8_t
    {
        // Do nothing
        None,

        // Get process information if you know the pid
        ProcessId,

        // Get process information by name (case sensitive)
        Name,

        // Get process information by kernel address
        Address,

        // Total option count
        COUNT
    } MiraProcessInformationType;

    typedef struct _MiraProcessInformation
    {
        typedef struct _ThreadResult
        {
            int32_t ThreadId;
            int32_t ErrNo;
            int64_t RetVal;
            char Name[sizeof(((struct thread*)0)->td_name)];
        } ThreadResult;

        // Structure size
        uint32_t Size;
        int32_t ProcessId;
        int32_t OpPid;
        int32_t DebugChild;
        int32_t ExitThreads;
        int32_t SigParent;
        int32_t Signal;
        uint32_t Code;
        uint32_t Stops;
        uint32_t SType;
        char Name[sizeof(((struct proc*)0)->p_comm)];
        char ElfPath[sizeof(((struct proc*)0)->p_elfpath)];
        char RandomizedPath[sizeof(((struct proc*)0)->p_randomized_path)];
        ThreadResult Threads[];
    } MiraProcessInformation;

    typedef struct _MiraProcessList
    {
        // Structure size
        uint32_t Size;

        // Pid array
        int32_t Pids[];
    } MiraProcessList;

    typedef struct _MiraMountInSandbox
    {
        int32_t Permissions;
        char Path[_MAX_PATH];
    } MiraMountInSandbox;

};


code:
#ifndef FLATBUFFERS_BASE_H_
#define FLATBUFFERS_BASE_H_

// clang-format off

// If activate should be declared and included first.
#if defined(FLATBUFFERS_MEMORY_LEAK_TRACKING) && \
    defined(_MSC_VER) && defined(_DEBUG)
  // The _CRTDBG_MAP_ALLOC inside <crtdbg.h> will replace
  // calloc/free (etc) to its debug version using #define directives.
  #define _CRTDBG_MAP_ALLOC
  #include <stdlib.h>
  #include <crtdbg.h>
  // Replace operator new by trace-enabled version.
  #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
  #define new DEBUG_NEW
#endif

#if !defined(FLATBUFFERS_ASSERT)
#include <assert.h>
#define FLATBUFFERS_ASSERT assert
#elif defined(FLATBUFFERS_ASSERT_INCLUDE)
// Include file with forward declaration
#include FLATBUFFERS_ASSERT_INCLUDE
#endif

#ifndef ARDUINO
#include <cstdint>
#endif

#include <cstddef>
#include <cstdlib>
#include <cstring>

#if defined(ARDUINO) && !defined(ARDUINOSTL_M_H)
  #include <utility.h>
#else
  #include <utility>
#endif

#include <string>
#include <type_traits>
#include <vector>
#include <set>
#include <algorithm>
#include <iterator>
#include <memory>

#if defined(__unix__) && !defined(FLATBUFFERS_LOCALE_INDEPENDENT)
#include <unistd.h>
#endif

#ifdef _STLPORT_VERSION
  #define FLATBUFFERS_CPP98_STL
#endif
#ifndef FLATBUFFERS_CPP98_STL
  #include <functional>
#endif

#ifdef __ANDROID__
  #include <android/api-level.h>
#endif

#include "flatbuffers/stl_emulation.h"

#if defined(__ICCARM__)
#include <intrinsics.h>
#endif

// Note the __clang__ check is needed, because clang presents itself
// as an older GNUC compiler (4.2).
// Clang 3.3 and later implement all of the ISO C++ 2011 standard.
// Clang 3.4 and later implement all of the ISO C++ 2014 standard.
// http://clang.llvm.org/cxx_status.html

// Note the MSVC value '__cplusplus' may be incorrect:
// The '__cplusplus' predefined macro in the MSVC stuck at the value 199711L,
// indicating (erroneously!) that the compiler conformed to the C++98 Standard.
// This value should be correct starting from MSVC2017-15.7-Preview-3.
// The '__cplusplus' will be valid only if MSVC2017-15.7-P3 and the `/Zc:__cplusplus` switch is set.
// Workaround (for details see MSDN):
// Use the _MSC_VER and _MSVC_LANG definition instead of the __cplusplus  for compatibility.
// The _MSVC_LANG macro reports the Standard version regardless of the '/Zc:__cplusplus' switch.

#if defined(__GNUC__) && !defined(__clang__)
  #define FLATBUFFERS_GCC (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#else
  #define FLATBUFFERS_GCC 0
#endif

#if defined(__clang__)
  #define FLATBUFFERS_CLANG (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
#else
  #define FLATBUFFERS_CLANG 1
#endif

/// @cond FLATBUFFERS_INTERNAL
#if __cplusplus <= 199711L && \
    (!defined(_MSC_VER) || _MSC_VER < 1600) && \
    (!defined(__GNUC__) || \
      (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ < 40400))
  #error A C++11 compatible compiler with support for the auto typing is \
         required for FlatBuffers.
  #error __cplusplus _MSC_VER __GNUC__  __GNUC_MINOR__  __GNUC_PATCHLEVEL__
#endif

#if !defined(__clang__) && \
    defined(__GNUC__) && \
    (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ < 40600)
  // Backwards compatibility for g++ 4.4, and 4.5 which don't have the nullptr
  // and constexpr keywords. Note the __clang__ check is needed, because clang
  // presents itself as an older GNUC compiler.
  #ifndef nullptr_t
    const class nullptr_t {
    public:
      template<class T> inline operator T*() const { return 0; }
    private:
      void operator&() const;
    } nullptr = {};
  #endif
  #ifndef constexpr
    #define constexpr const
  #endif
#endif

// The wire format uses a little endian encoding (since that's efficient for
// the common platforms).
#if defined(__s390x__)
  #define FLATBUFFERS_LITTLEENDIAN 0
#endif // __s390x__
#if !defined(FLATBUFFERS_LITTLEENDIAN)
  #if defined(__GNUC__) || defined(__clang__) || defined(__ICCARM__)
    #if (defined(__BIG_ENDIAN__) || \
         (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
      #define FLATBUFFERS_LITTLEENDIAN 0
    #else
      #define FLATBUFFERS_LITTLEENDIAN 1
    #endif // __BIG_ENDIAN__
  #elif defined(_MSC_VER)
    #if defined(_M_PPC)
      #define FLATBUFFERS_LITTLEENDIAN 0
    #else
      #define FLATBUFFERS_LITTLEENDIAN 1
    #endif
  #else
    #error Unable to determine endianness, define FLATBUFFERS_LITTLEENDIAN.
  #endif
#endif // !defined(FLATBUFFERS_LITTLEENDIAN)

#define FLATBUFFERS_VERSION_MAJOR 1
#define FLATBUFFERS_VERSION_MINOR 12
#define FLATBUFFERS_VERSION_REVISION 0
#define FLATBUFFERS_STRING_EXPAND(X) #X
#define FLATBUFFERS_STRING(X) FLATBUFFERS_STRING_EXPAND(X)
namespace flatbuffers {
  // Returns version as string  "MAJOR.MINOR.REVISION".
  const char* FLATBUFFERS_VERSION();
}

#if (!defined(_MSC_VER) || _MSC_VER > 1600) && \
    (!defined(__GNUC__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 407)) || \
    defined(__clang__)
  #define FLATBUFFERS_FINAL_CLASS final
  #define FLATBUFFERS_OVERRIDE override
  #define FLATBUFFERS_VTABLE_UNDERLYING_TYPE : flatbuffers::voffset_t
#else
  #define FLATBUFFERS_FINAL_CLASS
  #define FLATBUFFERS_OVERRIDE
  #define FLATBUFFERS_VTABLE_UNDERLYING_TYPE
#endif

#if (!defined(_MSC_VER) || _MSC_VER >= 1900) && \
    (!defined(__GNUC__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)) || \
    (defined(__cpp_constexpr) && __cpp_constexpr >= 200704)
  #define FLATBUFFERS_CONSTEXPR constexpr
#else
  #define FLATBUFFERS_CONSTEXPR const
#endif

#if (defined(__cplusplus) && __cplusplus >= 201402L) || \
    (defined(__cpp_constexpr) && __cpp_constexpr >= 201304)
  #define FLATBUFFERS_CONSTEXPR_CPP14 FLATBUFFERS_CONSTEXPR
#else
  #define FLATBUFFERS_CONSTEXPR_CPP14
#endif

#if (defined(__GXX_EXPERIMENTAL_CXX0X__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)) || \
    (defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 190023026)) || \
    defined(__clang__)
  #define FLATBUFFERS_NOEXCEPT noexcept
#else
  #define FLATBUFFERS_NOEXCEPT
#endif

// NOTE: the FLATBUFFERS_DELETE_FUNC macro may change the access mode to
// private, so be sure to put it at the end or reset access mode explicitly.
#if (!defined(_MSC_VER) || _MSC_FULL_VER >= 180020827) && \
    (!defined(__GNUC__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 404)) || \
    defined(__clang__)
  #define FLATBUFFERS_DELETE_FUNC(func) func = delete;
#else
  #define FLATBUFFERS_DELETE_FUNC(func) private: func;
#endif

#ifndef FLATBUFFERS_HAS_STRING_VIEW
  // Only provide flatbuffers::string_view if __has_include can be used
  // to detect a header that provides an implementation
  #if defined(__has_include)
    // Check for std::string_view (in c++17)
    #if __has_include(<string_view>) && (__cplusplus >= 201606 || (defined(_HAS_CXX17) && _HAS_CXX17))
      #include <string_view>
      namespace flatbuffers {
        typedef std::string_view string_view;
      }
      #define FLATBUFFERS_HAS_STRING_VIEW 1
    // Check for std::experimental::string_view (in c++14, compiler-dependent)
    #elif __has_include(<experimental/string_view>) && (__cplusplus >= 201411)
      #include <experimental/string_view>
      namespace flatbuffers {
        typedef std::experimental::string_view string_view;
      }
      #define FLATBUFFERS_HAS_STRING_VIEW 1
    // Check for absl::string_view
    #elif __has_include("absl/strings/string_view.h")
      #include "absl/strings/string_view.h"
      namespace flatbuffers {
        typedef absl::string_view string_view;
      }
      #define FLATBUFFERS_HAS_STRING_VIEW 1
    #endif
  #endif // __has_include
#endif // !FLATBUFFERS_HAS_STRING_VIEW

#ifndef FLATBUFFERS_HAS_NEW_STRTOD
  // Modern (C++11) strtod and strtof functions are available for use.
  // 1) nan/inf strings as argument of strtod;
  // 2) hex-float  as argument of  strtod/strtof.
  #if (defined(_MSC_VER) && _MSC_VER >= 1900) || \
      (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) || \
      (defined(__clang__))
    #define FLATBUFFERS_HAS_NEW_STRTOD 1
  #endif
#endif // !FLATBUFFERS_HAS_NEW_STRTOD

#ifndef FLATBUFFERS_LOCALE_INDEPENDENT
  // Enable locale independent functions {strtof_l, strtod_l,strtoll_l, strtoull_l}.
  #if ((defined(_MSC_VER) && _MSC_VER >= 1800)            || \
       (defined(_XOPEN_VERSION) && (_XOPEN_VERSION>=700)) && (!defined(__ANDROID_API__) || (defined(__ANDROID_API__) && (__ANDROID_API__>=21))))
    #define FLATBUFFERS_LOCALE_INDEPENDENT 0
  #else
    #define FLATBUFFERS_LOCALE_INDEPENDENT 0
  #endif
#endif  // !FLATBUFFERS_LOCALE_INDEPENDENT

// Suppress Undefined Behavior Sanitizer (recoverable only). Usage:
// - __supress_ubsan__("undefined")
// - __supress_ubsan__("signed-integer-overflow")
#if defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >=7))
  #define __supress_ubsan__(type) __attribute__((no_sanitize(type)))
#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)
  #define __supress_ubsan__(type) __attribute__((no_sanitize_undefined))
#else
  #define __supress_ubsan__(type)
#endif

// This is constexpr function used for checking compile-time constants.
// Avoid `#pragma warning(disable: 4127) // C4127: expression is constant`.
template<typename T> FLATBUFFERS_CONSTEXPR inline bool IsConstTrue(T t) {
  return !!t;
}

// Enable C++ attribute [[]] if std:c++17 or higher.
#if ((__cplusplus >= 201703L) \
    || (defined(_MSVC_LANG) &&  (_MSVC_LANG >= 201703L)))
  // All attributes unknown to an implementation are ignored without causing an error.
  #define FLATBUFFERS_ATTRIBUTE(attr) [[attr]]

  #define FLATBUFFERS_FALLTHROUGH() [[fallthrough]]
#else
  #define FLATBUFFERS_ATTRIBUTE(attr)

  #if FLATBUFFERS_CLANG >= 30800
    #define FLATBUFFERS_FALLTHROUGH() [[clang::fallthrough]]
  #elif FLATBUFFERS_GCC >= 70300
    #define FLATBUFFERS_FALLTHROUGH() [[gnu::fallthrough]]
  #else
    #define FLATBUFFERS_FALLTHROUGH()
  #endif
#endif

/// @endcond

/// @file
namespace flatbuffers {

/// @cond FLATBUFFERS_INTERNAL
// Our default offset / size type, 32bit on purpose on 64bit systems.
// Also, using a consistent offset type maintains compatibility of serialized
// offset values between 32bit and 64bit systems.
typedef uint32_t uoffset_t;

// Signed offsets for references that can go in both directions.
typedef int32_t soffset_t;

// Offset/index used in v-tables, can be changed to uint8_t in
// format forks to save a bit of space if desired.
typedef uint16_t voffset_t;

typedef uintmax_t largest_scalar_t;

// In 32bits, this evaluates to 2GB - 1
#define FLATBUFFERS_MAX_BUFFER_SIZE ((1ULL << (sizeof(::flatbuffers::soffset_t) * 8 - 1)) - 1)

// We support aligning the contents of buffers up to this size.
#define FLATBUFFERS_MAX_ALIGNMENT 16

#if defined(_MSC_VER)
  #pragma warning(disable: 4351) // C4351: new behavior: elements of array ... will be default initialized
  #pragma warning(push)
  #pragma warning(disable: 4127) // C4127: conditional expression is constant
#endif

template<typename T> T EndianSwap(T t) {
  #if defined(_MSC_VER)
    #define FLATBUFFERS_BYTESWAP16 _byteswap_ushort
    #define FLATBUFFERS_BYTESWAP32 _byteswap_ulong
    #define FLATBUFFERS_BYTESWAP64 _byteswap_uint64
  #elif defined(__ICCARM__)
    #define FLATBUFFERS_BYTESWAP16 __REV16
    #define FLATBUFFERS_BYTESWAP32 __REV
    #define FLATBUFFERS_BYTESWAP64(x) \
       ((__REV(static_cast<uint32_t>(x >> 32U))) | (static_cast<uint64_t>(__REV(static_cast<uint32_t>(x)))) << 32U)
  #else
    #if defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ < 408 && !defined(__clang__)
      // __builtin_bswap16 was missing prior to GCC 4.8.
      #define FLATBUFFERS_BYTESWAP16(x) \
        static_cast<uint16_t>(__builtin_bswap32(static_cast<uint32_t>(x) << 16))
    #else
      #define FLATBUFFERS_BYTESWAP16 __builtin_bswap16
    #endif
    #define FLATBUFFERS_BYTESWAP32 __builtin_bswap32
    #define FLATBUFFERS_BYTESWAP64 __builtin_bswap64
  #endif
  if (sizeof(T) == 1) {   // Compile-time if-then's.
    return t;
  } else if (sizeof(T) == 2) {
    union { T t; uint16_t i; } u = { t };
    u.i = FLATBUFFERS_BYTESWAP16(u.i);
    return u.t;
  } else if (sizeof(T) == 4) {
    union { T t; uint32_t i; } u = { t };
    u.i = FLATBUFFERS_BYTESWAP32(u.i);
    return u.t;
  } else if (sizeof(T) == 8) {
    union { T t; uint64_t i; } u = { t };
    u.i = FLATBUFFERS_BYTESWAP64(u.i);
    return u.t;
  } else {
    FLATBUFFERS_ASSERT(0);
    return t;
  }
}

#if defined(_MSC_VER)
  #pragma warning(pop)
#endif

template<typename T> T EndianScalar(T t) {
  #if FLATBUFFERS_LITTLEENDIAN
    return t;
  #else
    return EndianSwap(t);
  #endif
}

template<typename T>
// UBSAN: C++ aliasing type rules, see std::bit_cast<> for details.
__supress_ubsan__("alignment")
T ReadScalar(const void *p) {
  return EndianScalar(*reinterpret_cast<const T *>(p));
}

// See https://github.com/google/flatbuffers/issues/5950

#if (FLATBUFFERS_GCC >= 100000) && (FLATBUFFERS_GCC < 110000)
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wstringop-overflow"
#endif

template<typename T>
// UBSAN: C++ aliasing type rules, see std::bit_cast<> for details.
__supress_ubsan__("alignment")
void WriteScalar(void *p, T t) {
  *reinterpret_cast<T *>(p) = EndianScalar(t);
}

template<typename T> struct Offset;
template<typename T> __supress_ubsan__("alignment") void WriteScalar(void *p, Offset<T> t) {
  *reinterpret_cast<uoffset_t *>(p) = EndianScalar(t.o);
}

#if (FLATBUFFERS_GCC >= 100000) && (FLATBUFFERS_GCC < 110000)
  #pragma GCC diagnostic pop
#endif

// Computes how many bytes you'd have to pad to be able to write an
// "scalar_size" scalar if the buffer had grown to "buf_size" (downwards in
// memory).
__supress_ubsan__("unsigned-integer-overflow")
inline size_t PaddingBytes(size_t buf_size, size_t scalar_size) {
  return ((~buf_size) + 1) & (scalar_size - 1);
}

}  // namespace flatbuffers
#endif  // FLATBUFFERS_BASE_H_


code:
/*
 * Copyright 2014 Google Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef FLATBUFFERS_CODE_GENERATORS_H_
#define FLATBUFFERS_CODE_GENERATORS_H_

#include <map>
#include <sstream>

#include "flatbuffers/idl.h"

namespace flatbuffers {

// Utility class to assist in generating code through use of text templates.
//
// Example code:
//   CodeWriter code("\t");
//   code.SetValue("NAME", "Foo");
//   code += "void {{NAME}}() { printf("%s", "{{NAME}}"); }";
//   code.SetValue("NAME", "Bar");
//   code += "void {{NAME}}() { printf("%s", "{{NAME}}"); }";
//   std::cout << code.ToString() << std::endl;
//
// Output:
//  void Foo() { printf("%s", "Foo"); }
//  void Bar() { printf("%s", "Bar"); }
class CodeWriter {
 public:
  CodeWriter(std::string pad = std::string())
      : pad_(pad), cur_ident_lvl_(0), ignore_ident_(false) {}

  // Clears the current "written" code.
  void Clear() {
    stream_.str("");
    stream_.clear();
  }

  // Associates a key with a value.  All subsequent calls to operator+=, where
  // the specified key is contained in {{ and }} delimiters will be replaced by
  // the given value.
  void SetValue(const std::string &key, const std::string &value) {
    value_map_[key] = value;
  }

  std::string GetValue(const std::string &key) const {
    const auto it = value_map_.find(key);
    return it == value_map_.end() ? "" : it->second;
  }

  // Appends the given text to the generated code as well as a newline
  // character.  Any text within {{ and }} delimiters is replaced by values
  // previously stored in the CodeWriter by calling SetValue above.  The newline
  // will be suppressed if the text ends with the \\ character.
  void operator+=(std::string text);

  // Returns the current contents of the CodeWriter as a std::string.
  std::string ToString() const { return stream_.str(); }

  // Increase ident level for writing code
  void IncrementIdentLevel() { cur_ident_lvl_++; }
  // Decrease ident level for writing code
  void DecrementIdentLevel() {
    if (cur_ident_lvl_) cur_ident_lvl_--;
  }

  void SetPadding(const std::string &padding) { pad_ = padding; }

 private:
  std::map<std::string, std::string> value_map_;
  std::stringstream stream_;
  std::string pad_;
  int cur_ident_lvl_;
  bool ignore_ident_;

  // Add ident padding (tab or space) based on ident level
  void AppendIdent(std::stringstream &stream);
};

class BaseGenerator {
 public:
  virtual bool generate() = 0;

  static std::string NamespaceDir(const Parser &parser, const std::string &path,
                                  const Namespace &ns);

  std::string GeneratedFileName(const std::string &path,
                                const std::string &file_name,
                                const IDLOptions &options) const;

 protected:
  BaseGenerator(const Parser &parser, const std::string &path,
                const std::string &file_name, std::string qualifying_start,
                std::string qualifying_separator, std::string default_extension)
      : parser_(parser),
        path_(path),
        file_name_(file_name),
        qualifying_start_(qualifying_start),
        qualifying_separator_(qualifying_separator),
        default_extension_(default_extension) {}
  virtual ~BaseGenerator() {}

  // No copy/assign.
  BaseGenerator &operator=(const BaseGenerator &);
  BaseGenerator(const BaseGenerator &);

  std::string NamespaceDir(const Namespace &ns) const;

  static const char *FlatBuffersGeneratedWarning();

  static std::string FullNamespace(const char *separator, const Namespace &ns);

  static std::string LastNamespacePart(const Namespace &ns);

  // tracks the current namespace for early exit in WrapInNameSpace
  // c++, java and csharp returns a different namespace from
  // the following default (no early exit, always fully qualify),
  // which works for js and php
  virtual const Namespace *CurrentNameSpace() const { return nullptr; }

  // Ensure that a type is prefixed with its namespace even within
  // its own namespace to avoid conflict between generated method
  // names and similarly named classes or structs
  std::string WrapInNameSpace(const Namespace *ns,
                              const std::string &name) const;

  std::string WrapInNameSpace(const Definition &def) const;

  std::string GetNameSpace(const Definition &def) const;

  const Parser &parser_;
  const std::string &path_;
  const std::string &file_name_;
  const std::string qualifying_start_;
  const std::string qualifying_separator_;
  const std::string default_extension_;
};

struct CommentConfig {
  const char *first_line;
  const char *content_line_prefix;
  const char *last_line;
};

extern void GenComment(const std::vector<std::string> &dc,
                       std::string *code_ptr, const CommentConfig *config,
                       const char *prefix = "");

class FloatConstantGenerator {
 public:
  virtual ~FloatConstantGenerator() {}
  std::string GenFloatConstant(const FieldDef &field) const;

 private:
  virtual std::string Value(double v, const std::string &src) const = 0;
  virtual std::string Inf(double v) const = 0;
  virtual std::string NaN(double v) const = 0;

  virtual std::string Value(float v, const std::string &src) const = 0;
  virtual std::string Inf(float v) const = 0;
  virtual std::string NaN(float v) const = 0;

  template<typename T>
  std::string GenFloatConstantImpl(const FieldDef &field) const;
};

class SimpleFloatConstantGenerator : public FloatConstantGenerator {
 public:
  SimpleFloatConstantGenerator(const char *nan_number,
                               const char *pos_inf_number,
                               const char *neg_inf_number);

 private:
  std::string Value(double v,
                    const std::string &src) const FLATBUFFERS_OVERRIDE;
  std::string Inf(double v) const FLATBUFFERS_OVERRIDE;
  std::string NaN(double v) const FLATBUFFERS_OVERRIDE;

  std::string Value(float v, const std::string &src) const FLATBUFFERS_OVERRIDE;
  std::string Inf(float v) const FLATBUFFERS_OVERRIDE;
  std::string NaN(float v) const FLATBUFFERS_OVERRIDE;

  const std::string nan_number_;
  const std::string pos_inf_number_;
  const std::string neg_inf_number_;
};

// C++, C#, Java like generator.
class TypedFloatConstantGenerator : public FloatConstantGenerator {
 public:
  TypedFloatConstantGenerator(const char *double_prefix,
                              const char *single_prefix, const char *nan_number,
                              const char *pos_inf_number,
                              const char *neg_inf_number = "");

 private:
  std::string Value(double v,
                    const std::string &src) const FLATBUFFERS_OVERRIDE;
  std::string Inf(double v) const FLATBUFFERS_OVERRIDE;

  std::string NaN(double v) const FLATBUFFERS_OVERRIDE;

  std::string Value(float v, const std::string &src) const FLATBUFFERS_OVERRIDE;
  std::string Inf(float v) const FLATBUFFERS_OVERRIDE;
  std::string NaN(float v) const FLATBUFFERS_OVERRIDE;

  std::string MakeNaN(const std::string &prefix) const;
  std::string MakeInf(bool neg, const std::string &prefix) const;

  const std::string double_prefix_;
  const std::string single_prefix_;
  const std::string nan_number_;
  const std::string pos_inf_number_;
  const std::string neg_inf_number_;
};

}  // namespace flatbuffers

#endif  // FLATBUFFERS_CODE_GENERATORS_H_