...

Text file src/github.com/google/flatbuffers/tests/key_field/key_field_sample_generated.h

Documentation: github.com/google/flatbuffers/tests/key_field

     1// automatically generated by the FlatBuffers compiler, do not modify
     2
     3
     4#ifndef FLATBUFFERS_GENERATED_KEYFIELDSAMPLE_KEYFIELD_SAMPLE_H_
     5#define FLATBUFFERS_GENERATED_KEYFIELDSAMPLE_KEYFIELD_SAMPLE_H_
     6
     7#include "flatbuffers/flatbuffers.h"
     8
     9// Ensure the included flatbuffers.h is the same version as when this file was
    10// generated, otherwise it may not be compatible.
    11static_assert(FLATBUFFERS_VERSION_MAJOR == 23 &&
    12              FLATBUFFERS_VERSION_MINOR == 5 &&
    13              FLATBUFFERS_VERSION_REVISION == 26,
    14             "Non-compatible flatbuffers version included");
    15
    16namespace keyfield {
    17namespace sample {
    18
    19struct Baz;
    20
    21struct Bar;
    22
    23struct Color;
    24
    25struct Apple;
    26
    27struct Fruit;
    28
    29struct Rice;
    30
    31struct Grain;
    32
    33struct FooTable;
    34struct FooTableBuilder;
    35struct FooTableT;
    36
    37bool operator==(const Baz &lhs, const Baz &rhs);
    38bool operator!=(const Baz &lhs, const Baz &rhs);
    39bool operator==(const Bar &lhs, const Bar &rhs);
    40bool operator!=(const Bar &lhs, const Bar &rhs);
    41bool operator==(const Color &lhs, const Color &rhs);
    42bool operator!=(const Color &lhs, const Color &rhs);
    43bool operator==(const Apple &lhs, const Apple &rhs);
    44bool operator!=(const Apple &lhs, const Apple &rhs);
    45bool operator==(const Fruit &lhs, const Fruit &rhs);
    46bool operator!=(const Fruit &lhs, const Fruit &rhs);
    47bool operator==(const Rice &lhs, const Rice &rhs);
    48bool operator!=(const Rice &lhs, const Rice &rhs);
    49bool operator==(const Grain &lhs, const Grain &rhs);
    50bool operator!=(const Grain &lhs, const Grain &rhs);
    51bool operator==(const FooTableT &lhs, const FooTableT &rhs);
    52bool operator!=(const FooTableT &lhs, const FooTableT &rhs);
    53
    54inline const ::flatbuffers::TypeTable *BazTypeTable();
    55
    56inline const ::flatbuffers::TypeTable *BarTypeTable();
    57
    58inline const ::flatbuffers::TypeTable *ColorTypeTable();
    59
    60inline const ::flatbuffers::TypeTable *AppleTypeTable();
    61
    62inline const ::flatbuffers::TypeTable *FruitTypeTable();
    63
    64inline const ::flatbuffers::TypeTable *RiceTypeTable();
    65
    66inline const ::flatbuffers::TypeTable *GrainTypeTable();
    67
    68inline const ::flatbuffers::TypeTable *FooTableTypeTable();
    69
    70FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) Baz FLATBUFFERS_FINAL_CLASS {
    71 private:
    72  uint8_t a_[4];
    73  uint8_t b_;
    74
    75 public:
    76  static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
    77    return BazTypeTable();
    78  }
    79  Baz()
    80      : a_(),
    81        b_(0) {
    82  }
    83  Baz(uint8_t _b)
    84      : a_(),
    85        b_(::flatbuffers::EndianScalar(_b)) {
    86  }
    87  Baz(::flatbuffers::span<const uint8_t, 4> _a, uint8_t _b)
    88      : b_(::flatbuffers::EndianScalar(_b)) {
    89    ::flatbuffers::CastToArray(a_).CopyFromSpan(_a);
    90  }
    91  const ::flatbuffers::Array<uint8_t, 4> *a() const {
    92    return &::flatbuffers::CastToArray(a_);
    93  }
    94  ::flatbuffers::Array<uint8_t, 4> *mutable_a() {
    95    return &::flatbuffers::CastToArray(a_);
    96  }
    97  bool KeyCompareLessThan(const Baz * const o) const {
    98    return KeyCompareWithValue(o->a()) < 0;
    99  }
   100  int KeyCompareWithValue(const ::flatbuffers::Array<uint8_t, 4> *_a) const {
   101    const ::flatbuffers::Array<uint8_t, 4> *curr_a = a();
   102    for (::flatbuffers::uoffset_t i = 0; i < curr_a->size(); i++) {
   103      const auto lhs = curr_a->Get(i);
   104      const auto rhs = _a->Get(i);
   105      if (lhs != rhs)
   106        return static_cast<int>(lhs > rhs) - static_cast<int>(lhs < rhs);
   107    }
   108    return 0;
   109  }
   110  uint8_t b() const {
   111    return ::flatbuffers::EndianScalar(b_);
   112  }
   113  void mutate_b(uint8_t _b) {
   114    ::flatbuffers::WriteScalar(&b_, _b);
   115  }
   116};
   117FLATBUFFERS_STRUCT_END(Baz, 5);
   118
   119inline bool operator==(const Baz &lhs, const Baz &rhs) {
   120  return
   121      (*lhs.a() == *rhs.a()) &&
   122      (lhs.b() == rhs.b());
   123}
   124
   125inline bool operator!=(const Baz &lhs, const Baz &rhs) {
   126    return !(lhs == rhs);
   127}
   128
   129
   130FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Bar FLATBUFFERS_FINAL_CLASS {
   131 private:
   132  float a_[3];
   133  uint8_t b_;
   134  int8_t padding0__;  int16_t padding1__;
   135
   136 public:
   137  static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
   138    return BarTypeTable();
   139  }
   140  Bar()
   141      : a_(),
   142        b_(0),
   143        padding0__(0),
   144        padding1__(0) {
   145    (void)padding0__;
   146    (void)padding1__;
   147  }
   148  Bar(uint8_t _b)
   149      : a_(),
   150        b_(::flatbuffers::EndianScalar(_b)),
   151        padding0__(0),
   152        padding1__(0) {
   153    (void)padding0__;
   154    (void)padding1__;
   155  }
   156  Bar(::flatbuffers::span<const float, 3> _a, uint8_t _b)
   157      : b_(::flatbuffers::EndianScalar(_b)),
   158        padding0__(0),
   159        padding1__(0) {
   160    ::flatbuffers::CastToArray(a_).CopyFromSpan(_a);
   161    (void)padding0__;
   162    (void)padding1__;
   163  }
   164  const ::flatbuffers::Array<float, 3> *a() const {
   165    return &::flatbuffers::CastToArray(a_);
   166  }
   167  ::flatbuffers::Array<float, 3> *mutable_a() {
   168    return &::flatbuffers::CastToArray(a_);
   169  }
   170  bool KeyCompareLessThan(const Bar * const o) const {
   171    return KeyCompareWithValue(o->a()) < 0;
   172  }
   173  int KeyCompareWithValue(const ::flatbuffers::Array<float, 3> *_a) const {
   174    const ::flatbuffers::Array<float, 3> *curr_a = a();
   175    for (::flatbuffers::uoffset_t i = 0; i < curr_a->size(); i++) {
   176      const auto lhs = curr_a->Get(i);
   177      const auto rhs = _a->Get(i);
   178      if (lhs != rhs)
   179        return static_cast<int>(lhs > rhs) - static_cast<int>(lhs < rhs);
   180    }
   181    return 0;
   182  }
   183  uint8_t b() const {
   184    return ::flatbuffers::EndianScalar(b_);
   185  }
   186  void mutate_b(uint8_t _b) {
   187    ::flatbuffers::WriteScalar(&b_, _b);
   188  }
   189};
   190FLATBUFFERS_STRUCT_END(Bar, 16);
   191
   192inline bool operator==(const Bar &lhs, const Bar &rhs) {
   193  return
   194      (*lhs.a() == *rhs.a()) &&
   195      (lhs.b() == rhs.b());
   196}
   197
   198inline bool operator!=(const Bar &lhs, const Bar &rhs) {
   199    return !(lhs == rhs);
   200}
   201
   202
   203FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Color FLATBUFFERS_FINAL_CLASS {
   204 private:
   205  float rgb_[3];
   206  uint8_t tag_;
   207  int8_t padding0__;  int16_t padding1__;
   208
   209 public:
   210  static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
   211    return ColorTypeTable();
   212  }
   213  Color()
   214      : rgb_(),
   215        tag_(0),
   216        padding0__(0),
   217        padding1__(0) {
   218    (void)padding0__;
   219    (void)padding1__;
   220  }
   221  Color(uint8_t _tag)
   222      : rgb_(),
   223        tag_(::flatbuffers::EndianScalar(_tag)),
   224        padding0__(0),
   225        padding1__(0) {
   226    (void)padding0__;
   227    (void)padding1__;
   228  }
   229  Color(::flatbuffers::span<const float, 3> _rgb, uint8_t _tag)
   230      : tag_(::flatbuffers::EndianScalar(_tag)),
   231        padding0__(0),
   232        padding1__(0) {
   233    ::flatbuffers::CastToArray(rgb_).CopyFromSpan(_rgb);
   234    (void)padding0__;
   235    (void)padding1__;
   236  }
   237  const ::flatbuffers::Array<float, 3> *rgb() const {
   238    return &::flatbuffers::CastToArray(rgb_);
   239  }
   240  ::flatbuffers::Array<float, 3> *mutable_rgb() {
   241    return &::flatbuffers::CastToArray(rgb_);
   242  }
   243  bool KeyCompareLessThan(const Color * const o) const {
   244    return KeyCompareWithValue(o->rgb()) < 0;
   245  }
   246  int KeyCompareWithValue(const ::flatbuffers::Array<float, 3> *_rgb) const {
   247    const ::flatbuffers::Array<float, 3> *curr_rgb = rgb();
   248    for (::flatbuffers::uoffset_t i = 0; i < curr_rgb->size(); i++) {
   249      const auto lhs = curr_rgb->Get(i);
   250      const auto rhs = _rgb->Get(i);
   251      if (lhs != rhs)
   252        return static_cast<int>(lhs > rhs) - static_cast<int>(lhs < rhs);
   253    }
   254    return 0;
   255  }
   256  uint8_t tag() const {
   257    return ::flatbuffers::EndianScalar(tag_);
   258  }
   259  void mutate_tag(uint8_t _tag) {
   260    ::flatbuffers::WriteScalar(&tag_, _tag);
   261  }
   262};
   263FLATBUFFERS_STRUCT_END(Color, 16);
   264
   265inline bool operator==(const Color &lhs, const Color &rhs) {
   266  return
   267      (*lhs.rgb() == *rhs.rgb()) &&
   268      (lhs.tag() == rhs.tag());
   269}
   270
   271inline bool operator!=(const Color &lhs, const Color &rhs) {
   272    return !(lhs == rhs);
   273}
   274
   275
   276FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Apple FLATBUFFERS_FINAL_CLASS {
   277 private:
   278  uint8_t tag_;
   279  int8_t padding0__;  int16_t padding1__;
   280  keyfield::sample::Color color_;
   281
   282 public:
   283  static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
   284    return AppleTypeTable();
   285  }
   286  Apple()
   287      : tag_(0),
   288        padding0__(0),
   289        padding1__(0),
   290        color_() {
   291    (void)padding0__;
   292    (void)padding1__;
   293  }
   294  Apple(uint8_t _tag, const keyfield::sample::Color &_color)
   295      : tag_(::flatbuffers::EndianScalar(_tag)),
   296        padding0__(0),
   297        padding1__(0),
   298        color_(_color) {
   299    (void)padding0__;
   300    (void)padding1__;
   301  }
   302  uint8_t tag() const {
   303    return ::flatbuffers::EndianScalar(tag_);
   304  }
   305  void mutate_tag(uint8_t _tag) {
   306    ::flatbuffers::WriteScalar(&tag_, _tag);
   307  }
   308  const keyfield::sample::Color &color() const {
   309    return color_;
   310  }
   311  keyfield::sample::Color &mutable_color() {
   312    return color_;
   313  }
   314  bool KeyCompareLessThan(const Apple * const o) const {
   315    return KeyCompareWithValue(o->color()) < 0;
   316  }
   317  int KeyCompareWithValue(const keyfield::sample::Color &_color) const {
   318    const auto &lhs_color = color();
   319    const auto &rhs_color = _color;
   320    const auto rhs_color_rgb = rhs_color.rgb();
   321    const auto rgb_compare_result = lhs_color.KeyCompareWithValue(rhs_color_rgb);
   322    if (rgb_compare_result != 0)
   323      return rgb_compare_result;
   324    const auto lhs_color_tag = lhs_color.tag();
   325    const auto rhs_color_tag = rhs_color.tag();
   326    if (lhs_color_tag != rhs_color_tag)
   327      return static_cast<int>(lhs_color_tag > rhs_color_tag) - static_cast<int>(lhs_color_tag < rhs_color_tag);
   328    return 0;
   329  }
   330};
   331FLATBUFFERS_STRUCT_END(Apple, 20);
   332
   333inline bool operator==(const Apple &lhs, const Apple &rhs) {
   334  return
   335      (lhs.tag() == rhs.tag()) &&
   336      (lhs.color() == rhs.color());
   337}
   338
   339inline bool operator!=(const Apple &lhs, const Apple &rhs) {
   340    return !(lhs == rhs);
   341}
   342
   343
   344FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Fruit FLATBUFFERS_FINAL_CLASS {
   345 private:
   346  keyfield::sample::Apple a_;
   347  uint8_t b_;
   348  int8_t padding0__;  int16_t padding1__;
   349
   350 public:
   351  static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
   352    return FruitTypeTable();
   353  }
   354  Fruit()
   355      : a_(),
   356        b_(0),
   357        padding0__(0),
   358        padding1__(0) {
   359    (void)padding0__;
   360    (void)padding1__;
   361  }
   362  Fruit(const keyfield::sample::Apple &_a, uint8_t _b)
   363      : a_(_a),
   364        b_(::flatbuffers::EndianScalar(_b)),
   365        padding0__(0),
   366        padding1__(0) {
   367    (void)padding0__;
   368    (void)padding1__;
   369  }
   370  const keyfield::sample::Apple &a() const {
   371    return a_;
   372  }
   373  keyfield::sample::Apple &mutable_a() {
   374    return a_;
   375  }
   376  bool KeyCompareLessThan(const Fruit * const o) const {
   377    return KeyCompareWithValue(o->a()) < 0;
   378  }
   379  int KeyCompareWithValue(const keyfield::sample::Apple &_a) const {
   380    const auto &lhs_a = a();
   381    const auto &rhs_a = _a;
   382    const auto lhs_a_tag = lhs_a.tag();
   383    const auto rhs_a_tag = rhs_a.tag();
   384    if (lhs_a_tag != rhs_a_tag)
   385      return static_cast<int>(lhs_a_tag > rhs_a_tag) - static_cast<int>(lhs_a_tag < rhs_a_tag);
   386    const auto rhs_a_color = rhs_a.color();
   387    const auto color_compare_result = lhs_a.KeyCompareWithValue(rhs_a_color);
   388    if (color_compare_result != 0)
   389      return color_compare_result;
   390    return 0;
   391  }
   392  uint8_t b() const {
   393    return ::flatbuffers::EndianScalar(b_);
   394  }
   395  void mutate_b(uint8_t _b) {
   396    ::flatbuffers::WriteScalar(&b_, _b);
   397  }
   398};
   399FLATBUFFERS_STRUCT_END(Fruit, 24);
   400
   401inline bool operator==(const Fruit &lhs, const Fruit &rhs) {
   402  return
   403      (lhs.a() == rhs.a()) &&
   404      (lhs.b() == rhs.b());
   405}
   406
   407inline bool operator!=(const Fruit &lhs, const Fruit &rhs) {
   408    return !(lhs == rhs);
   409}
   410
   411
   412FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Rice FLATBUFFERS_FINAL_CLASS {
   413 private:
   414  uint8_t origin_[3];
   415  int8_t padding0__;
   416  uint32_t quantity_;
   417
   418 public:
   419  static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
   420    return RiceTypeTable();
   421  }
   422  Rice()
   423      : origin_(),
   424        padding0__(0),
   425        quantity_(0) {
   426    (void)padding0__;
   427  }
   428  Rice(uint32_t _quantity)
   429      : origin_(),
   430        padding0__(0),
   431        quantity_(::flatbuffers::EndianScalar(_quantity)) {
   432    (void)padding0__;
   433  }
   434  Rice(::flatbuffers::span<const uint8_t, 3> _origin, uint32_t _quantity)
   435      : padding0__(0),
   436        quantity_(::flatbuffers::EndianScalar(_quantity)) {
   437    ::flatbuffers::CastToArray(origin_).CopyFromSpan(_origin);
   438    (void)padding0__;
   439  }
   440  const ::flatbuffers::Array<uint8_t, 3> *origin() const {
   441    return &::flatbuffers::CastToArray(origin_);
   442  }
   443  ::flatbuffers::Array<uint8_t, 3> *mutable_origin() {
   444    return &::flatbuffers::CastToArray(origin_);
   445  }
   446  uint32_t quantity() const {
   447    return ::flatbuffers::EndianScalar(quantity_);
   448  }
   449  void mutate_quantity(uint32_t _quantity) {
   450    ::flatbuffers::WriteScalar(&quantity_, _quantity);
   451  }
   452};
   453FLATBUFFERS_STRUCT_END(Rice, 8);
   454
   455inline bool operator==(const Rice &lhs, const Rice &rhs) {
   456  return
   457      (*lhs.origin() == *rhs.origin()) &&
   458      (lhs.quantity() == rhs.quantity());
   459}
   460
   461inline bool operator!=(const Rice &lhs, const Rice &rhs) {
   462    return !(lhs == rhs);
   463}
   464
   465
   466FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Grain FLATBUFFERS_FINAL_CLASS {
   467 private:
   468  keyfield::sample::Rice a_[3];
   469  uint8_t tag_;
   470  int8_t padding0__;  int16_t padding1__;
   471
   472 public:
   473  static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
   474    return GrainTypeTable();
   475  }
   476  Grain()
   477      : a_(),
   478        tag_(0),
   479        padding0__(0),
   480        padding1__(0) {
   481    (void)padding0__;
   482    (void)padding1__;
   483  }
   484  Grain(uint8_t _tag)
   485      : a_(),
   486        tag_(::flatbuffers::EndianScalar(_tag)),
   487        padding0__(0),
   488        padding1__(0) {
   489    (void)padding0__;
   490    (void)padding1__;
   491  }
   492  Grain(::flatbuffers::span<const keyfield::sample::Rice, 3> _a, uint8_t _tag)
   493      : tag_(::flatbuffers::EndianScalar(_tag)),
   494        padding0__(0),
   495        padding1__(0) {
   496    ::flatbuffers::CastToArray(a_).CopyFromSpan(_a);
   497    (void)padding0__;
   498    (void)padding1__;
   499  }
   500  const ::flatbuffers::Array<keyfield::sample::Rice, 3> *a() const {
   501    return &::flatbuffers::CastToArray(a_);
   502  }
   503  ::flatbuffers::Array<keyfield::sample::Rice, 3> *mutable_a() {
   504    return &::flatbuffers::CastToArray(a_);
   505  }
   506  bool KeyCompareLessThan(const Grain * const o) const {
   507    return KeyCompareWithValue(o->a()) < 0;
   508  }
   509  int KeyCompareWithValue(const ::flatbuffers::Array<keyfield::sample::Rice, 3> *_a) const {
   510    const ::flatbuffers::Array<keyfield::sample::Rice, 3> *curr_a = a();
   511    for (::flatbuffers::uoffset_t i = 0; i < curr_a->size(); i++) {
   512      const auto &lhs_a = *(curr_a->Get(i));
   513      const auto &rhs_a = *(_a->Get(i));
   514      const auto lhs_a_origin = lhs_a.origin();
   515      const auto rhs_a_origin = rhs_a.origin();
   516      for (::flatbuffers::uoffset_t i = 0; i < lhs_a_origin->size(); i++) {
   517        const auto lhs_a_origin_elem = lhs_a_origin->Get(i);
   518        const auto rhs_a_origin_elem = rhs_a_origin->Get(i);
   519        if (lhs_a_origin_elem != rhs_a_origin_elem)
   520          return static_cast<int>(lhs_a_origin_elem > rhs_a_origin_elem) - static_cast<int>(lhs_a_origin_elem < rhs_a_origin_elem);
   521      }
   522      const auto lhs_a_quantity = lhs_a.quantity();
   523      const auto rhs_a_quantity = rhs_a.quantity();
   524      if (lhs_a_quantity != rhs_a_quantity)
   525        return static_cast<int>(lhs_a_quantity > rhs_a_quantity) - static_cast<int>(lhs_a_quantity < rhs_a_quantity);
   526    }
   527    return 0;
   528  }
   529  uint8_t tag() const {
   530    return ::flatbuffers::EndianScalar(tag_);
   531  }
   532  void mutate_tag(uint8_t _tag) {
   533    ::flatbuffers::WriteScalar(&tag_, _tag);
   534  }
   535};
   536FLATBUFFERS_STRUCT_END(Grain, 28);
   537
   538inline bool operator==(const Grain &lhs, const Grain &rhs) {
   539  return
   540      (*lhs.a() == *rhs.a()) &&
   541      (lhs.tag() == rhs.tag());
   542}
   543
   544inline bool operator!=(const Grain &lhs, const Grain &rhs) {
   545    return !(lhs == rhs);
   546}
   547
   548
   549struct FooTableT : public ::flatbuffers::NativeTable {
   550  typedef FooTable TableType;
   551  int32_t a = 0;
   552  int32_t b = 0;
   553  std::string c{};
   554  std::vector<keyfield::sample::Baz> d{};
   555  std::vector<keyfield::sample::Bar> e{};
   556  std::vector<keyfield::sample::Apple> f{};
   557  std::vector<keyfield::sample::Fruit> g{};
   558  std::vector<keyfield::sample::Grain> h{};
   559};
   560
   561struct FooTable FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
   562  typedef FooTableT NativeTableType;
   563  typedef FooTableBuilder Builder;
   564  static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
   565    return FooTableTypeTable();
   566  }
   567  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
   568    VT_A = 4,
   569    VT_B = 6,
   570    VT_C = 8,
   571    VT_D = 10,
   572    VT_E = 12,
   573    VT_F = 14,
   574    VT_G = 16,
   575    VT_H = 18
   576  };
   577  int32_t a() const {
   578    return GetField<int32_t>(VT_A, 0);
   579  }
   580  bool mutate_a(int32_t _a = 0) {
   581    return SetField<int32_t>(VT_A, _a, 0);
   582  }
   583  int32_t b() const {
   584    return GetField<int32_t>(VT_B, 0);
   585  }
   586  bool mutate_b(int32_t _b = 0) {
   587    return SetField<int32_t>(VT_B, _b, 0);
   588  }
   589  const ::flatbuffers::String *c() const {
   590    return GetPointer<const ::flatbuffers::String *>(VT_C);
   591  }
   592  ::flatbuffers::String *mutable_c() {
   593    return GetPointer<::flatbuffers::String *>(VT_C);
   594  }
   595  bool KeyCompareLessThan(const FooTable * const o) const {
   596    return *c() < *o->c();
   597  }
   598  int KeyCompareWithValue(const char *_c) const {
   599    return strcmp(c()->c_str(), _c);
   600  }
   601  const ::flatbuffers::Vector<const keyfield::sample::Baz *> *d() const {
   602    return GetPointer<const ::flatbuffers::Vector<const keyfield::sample::Baz *> *>(VT_D);
   603  }
   604  ::flatbuffers::Vector<const keyfield::sample::Baz *> *mutable_d() {
   605    return GetPointer<::flatbuffers::Vector<const keyfield::sample::Baz *> *>(VT_D);
   606  }
   607  const ::flatbuffers::Vector<const keyfield::sample::Bar *> *e() const {
   608    return GetPointer<const ::flatbuffers::Vector<const keyfield::sample::Bar *> *>(VT_E);
   609  }
   610  ::flatbuffers::Vector<const keyfield::sample::Bar *> *mutable_e() {
   611    return GetPointer<::flatbuffers::Vector<const keyfield::sample::Bar *> *>(VT_E);
   612  }
   613  const ::flatbuffers::Vector<const keyfield::sample::Apple *> *f() const {
   614    return GetPointer<const ::flatbuffers::Vector<const keyfield::sample::Apple *> *>(VT_F);
   615  }
   616  ::flatbuffers::Vector<const keyfield::sample::Apple *> *mutable_f() {
   617    return GetPointer<::flatbuffers::Vector<const keyfield::sample::Apple *> *>(VT_F);
   618  }
   619  const ::flatbuffers::Vector<const keyfield::sample::Fruit *> *g() const {
   620    return GetPointer<const ::flatbuffers::Vector<const keyfield::sample::Fruit *> *>(VT_G);
   621  }
   622  ::flatbuffers::Vector<const keyfield::sample::Fruit *> *mutable_g() {
   623    return GetPointer<::flatbuffers::Vector<const keyfield::sample::Fruit *> *>(VT_G);
   624  }
   625  const ::flatbuffers::Vector<const keyfield::sample::Grain *> *h() const {
   626    return GetPointer<const ::flatbuffers::Vector<const keyfield::sample::Grain *> *>(VT_H);
   627  }
   628  ::flatbuffers::Vector<const keyfield::sample::Grain *> *mutable_h() {
   629    return GetPointer<::flatbuffers::Vector<const keyfield::sample::Grain *> *>(VT_H);
   630  }
   631  bool Verify(::flatbuffers::Verifier &verifier) const {
   632    return VerifyTableStart(verifier) &&
   633           VerifyField<int32_t>(verifier, VT_A, 4) &&
   634           VerifyField<int32_t>(verifier, VT_B, 4) &&
   635           VerifyOffsetRequired(verifier, VT_C) &&
   636           verifier.VerifyString(c()) &&
   637           VerifyOffset(verifier, VT_D) &&
   638           verifier.VerifyVector(d()) &&
   639           VerifyOffset(verifier, VT_E) &&
   640           verifier.VerifyVector(e()) &&
   641           VerifyOffset(verifier, VT_F) &&
   642           verifier.VerifyVector(f()) &&
   643           VerifyOffset(verifier, VT_G) &&
   644           verifier.VerifyVector(g()) &&
   645           VerifyOffset(verifier, VT_H) &&
   646           verifier.VerifyVector(h()) &&
   647           verifier.EndTable();
   648  }
   649  FooTableT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
   650  void UnPackTo(FooTableT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
   651  static ::flatbuffers::Offset<FooTable> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const FooTableT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
   652};
   653
   654struct FooTableBuilder {
   655  typedef FooTable Table;
   656  ::flatbuffers::FlatBufferBuilder &fbb_;
   657  ::flatbuffers::uoffset_t start_;
   658  void add_a(int32_t a) {
   659    fbb_.AddElement<int32_t>(FooTable::VT_A, a, 0);
   660  }
   661  void add_b(int32_t b) {
   662    fbb_.AddElement<int32_t>(FooTable::VT_B, b, 0);
   663  }
   664  void add_c(::flatbuffers::Offset<::flatbuffers::String> c) {
   665    fbb_.AddOffset(FooTable::VT_C, c);
   666  }
   667  void add_d(::flatbuffers::Offset<::flatbuffers::Vector<const keyfield::sample::Baz *>> d) {
   668    fbb_.AddOffset(FooTable::VT_D, d);
   669  }
   670  void add_e(::flatbuffers::Offset<::flatbuffers::Vector<const keyfield::sample::Bar *>> e) {
   671    fbb_.AddOffset(FooTable::VT_E, e);
   672  }
   673  void add_f(::flatbuffers::Offset<::flatbuffers::Vector<const keyfield::sample::Apple *>> f) {
   674    fbb_.AddOffset(FooTable::VT_F, f);
   675  }
   676  void add_g(::flatbuffers::Offset<::flatbuffers::Vector<const keyfield::sample::Fruit *>> g) {
   677    fbb_.AddOffset(FooTable::VT_G, g);
   678  }
   679  void add_h(::flatbuffers::Offset<::flatbuffers::Vector<const keyfield::sample::Grain *>> h) {
   680    fbb_.AddOffset(FooTable::VT_H, h);
   681  }
   682  explicit FooTableBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
   683        : fbb_(_fbb) {
   684    start_ = fbb_.StartTable();
   685  }
   686  ::flatbuffers::Offset<FooTable> Finish() {
   687    const auto end = fbb_.EndTable(start_);
   688    auto o = ::flatbuffers::Offset<FooTable>(end);
   689    fbb_.Required(o, FooTable::VT_C);
   690    return o;
   691  }
   692};
   693
   694inline ::flatbuffers::Offset<FooTable> CreateFooTable(
   695    ::flatbuffers::FlatBufferBuilder &_fbb,
   696    int32_t a = 0,
   697    int32_t b = 0,
   698    ::flatbuffers::Offset<::flatbuffers::String> c = 0,
   699    ::flatbuffers::Offset<::flatbuffers::Vector<const keyfield::sample::Baz *>> d = 0,
   700    ::flatbuffers::Offset<::flatbuffers::Vector<const keyfield::sample::Bar *>> e = 0,
   701    ::flatbuffers::Offset<::flatbuffers::Vector<const keyfield::sample::Apple *>> f = 0,
   702    ::flatbuffers::Offset<::flatbuffers::Vector<const keyfield::sample::Fruit *>> g = 0,
   703    ::flatbuffers::Offset<::flatbuffers::Vector<const keyfield::sample::Grain *>> h = 0) {
   704  FooTableBuilder builder_(_fbb);
   705  builder_.add_h(h);
   706  builder_.add_g(g);
   707  builder_.add_f(f);
   708  builder_.add_e(e);
   709  builder_.add_d(d);
   710  builder_.add_c(c);
   711  builder_.add_b(b);
   712  builder_.add_a(a);
   713  return builder_.Finish();
   714}
   715
   716inline ::flatbuffers::Offset<FooTable> CreateFooTableDirect(
   717    ::flatbuffers::FlatBufferBuilder &_fbb,
   718    int32_t a = 0,
   719    int32_t b = 0,
   720    const char *c = nullptr,
   721    std::vector<keyfield::sample::Baz> *d = nullptr,
   722    std::vector<keyfield::sample::Bar> *e = nullptr,
   723    std::vector<keyfield::sample::Apple> *f = nullptr,
   724    std::vector<keyfield::sample::Fruit> *g = nullptr,
   725    std::vector<keyfield::sample::Grain> *h = nullptr) {
   726  auto c__ = c ? _fbb.CreateString(c) : 0;
   727  auto d__ = d ? _fbb.CreateVectorOfSortedStructs<keyfield::sample::Baz>(d) : 0;
   728  auto e__ = e ? _fbb.CreateVectorOfSortedStructs<keyfield::sample::Bar>(e) : 0;
   729  auto f__ = f ? _fbb.CreateVectorOfSortedStructs<keyfield::sample::Apple>(f) : 0;
   730  auto g__ = g ? _fbb.CreateVectorOfSortedStructs<keyfield::sample::Fruit>(g) : 0;
   731  auto h__ = h ? _fbb.CreateVectorOfSortedStructs<keyfield::sample::Grain>(h) : 0;
   732  return keyfield::sample::CreateFooTable(
   733      _fbb,
   734      a,
   735      b,
   736      c__,
   737      d__,
   738      e__,
   739      f__,
   740      g__,
   741      h__);
   742}
   743
   744::flatbuffers::Offset<FooTable> CreateFooTable(::flatbuffers::FlatBufferBuilder &_fbb, const FooTableT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
   745
   746
   747inline bool operator==(const FooTableT &lhs, const FooTableT &rhs) {
   748  return
   749      (lhs.a == rhs.a) &&
   750      (lhs.b == rhs.b) &&
   751      (lhs.c == rhs.c) &&
   752      (lhs.d == rhs.d) &&
   753      (lhs.e == rhs.e) &&
   754      (lhs.f == rhs.f) &&
   755      (lhs.g == rhs.g) &&
   756      (lhs.h == rhs.h);
   757}
   758
   759inline bool operator!=(const FooTableT &lhs, const FooTableT &rhs) {
   760    return !(lhs == rhs);
   761}
   762
   763
   764inline FooTableT *FooTable::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
   765  auto _o = std::unique_ptr<FooTableT>(new FooTableT());
   766  UnPackTo(_o.get(), _resolver);
   767  return _o.release();
   768}
   769
   770inline void FooTable::UnPackTo(FooTableT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
   771  (void)_o;
   772  (void)_resolver;
   773  { auto _e = a(); _o->a = _e; }
   774  { auto _e = b(); _o->b = _e; }
   775  { auto _e = c(); if (_e) _o->c = _e->str(); }
   776  { auto _e = d(); if (_e) { _o->d.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->d[_i] = *_e->Get(_i); } } else { _o->d.resize(0); } }
   777  { auto _e = e(); if (_e) { _o->e.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->e[_i] = *_e->Get(_i); } } else { _o->e.resize(0); } }
   778  { auto _e = f(); if (_e) { _o->f.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->f[_i] = *_e->Get(_i); } } else { _o->f.resize(0); } }
   779  { auto _e = g(); if (_e) { _o->g.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->g[_i] = *_e->Get(_i); } } else { _o->g.resize(0); } }
   780  { auto _e = h(); if (_e) { _o->h.resize(_e->size()); for (::flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->h[_i] = *_e->Get(_i); } } else { _o->h.resize(0); } }
   781}
   782
   783inline ::flatbuffers::Offset<FooTable> FooTable::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const FooTableT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
   784  return CreateFooTable(_fbb, _o, _rehasher);
   785}
   786
   787inline ::flatbuffers::Offset<FooTable> CreateFooTable(::flatbuffers::FlatBufferBuilder &_fbb, const FooTableT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
   788  (void)_rehasher;
   789  (void)_o;
   790  struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const FooTableT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
   791  auto _a = _o->a;
   792  auto _b = _o->b;
   793  auto _c = _fbb.CreateString(_o->c);
   794  auto _d = _o->d.size() ? _fbb.CreateVectorOfStructs(_o->d) : 0;
   795  auto _e = _o->e.size() ? _fbb.CreateVectorOfStructs(_o->e) : 0;
   796  auto _f = _o->f.size() ? _fbb.CreateVectorOfStructs(_o->f) : 0;
   797  auto _g = _o->g.size() ? _fbb.CreateVectorOfStructs(_o->g) : 0;
   798  auto _h = _o->h.size() ? _fbb.CreateVectorOfStructs(_o->h) : 0;
   799  return keyfield::sample::CreateFooTable(
   800      _fbb,
   801      _a,
   802      _b,
   803      _c,
   804      _d,
   805      _e,
   806      _f,
   807      _g,
   808      _h);
   809}
   810
   811inline const ::flatbuffers::TypeTable *BazTypeTable() {
   812  static const ::flatbuffers::TypeCode type_codes[] = {
   813    { ::flatbuffers::ET_UCHAR, 1, -1 },
   814    { ::flatbuffers::ET_UCHAR, 0, -1 }
   815  };
   816  static const int16_t array_sizes[] = { 4,  };
   817  static const int64_t values[] = { 0, 4, 5 };
   818  static const char * const names[] = {
   819    "a",
   820    "b"
   821  };
   822  static const ::flatbuffers::TypeTable tt = {
   823    ::flatbuffers::ST_STRUCT, 2, type_codes, nullptr, array_sizes, values, names
   824  };
   825  return &tt;
   826}
   827
   828inline const ::flatbuffers::TypeTable *BarTypeTable() {
   829  static const ::flatbuffers::TypeCode type_codes[] = {
   830    { ::flatbuffers::ET_FLOAT, 1, -1 },
   831    { ::flatbuffers::ET_UCHAR, 0, -1 }
   832  };
   833  static const int16_t array_sizes[] = { 3,  };
   834  static const int64_t values[] = { 0, 12, 16 };
   835  static const char * const names[] = {
   836    "a",
   837    "b"
   838  };
   839  static const ::flatbuffers::TypeTable tt = {
   840    ::flatbuffers::ST_STRUCT, 2, type_codes, nullptr, array_sizes, values, names
   841  };
   842  return &tt;
   843}
   844
   845inline const ::flatbuffers::TypeTable *ColorTypeTable() {
   846  static const ::flatbuffers::TypeCode type_codes[] = {
   847    { ::flatbuffers::ET_FLOAT, 1, -1 },
   848    { ::flatbuffers::ET_UCHAR, 0, -1 }
   849  };
   850  static const int16_t array_sizes[] = { 3,  };
   851  static const int64_t values[] = { 0, 12, 16 };
   852  static const char * const names[] = {
   853    "rgb",
   854    "tag"
   855  };
   856  static const ::flatbuffers::TypeTable tt = {
   857    ::flatbuffers::ST_STRUCT, 2, type_codes, nullptr, array_sizes, values, names
   858  };
   859  return &tt;
   860}
   861
   862inline const ::flatbuffers::TypeTable *AppleTypeTable() {
   863  static const ::flatbuffers::TypeCode type_codes[] = {
   864    { ::flatbuffers::ET_UCHAR, 0, -1 },
   865    { ::flatbuffers::ET_SEQUENCE, 0, 0 }
   866  };
   867  static const ::flatbuffers::TypeFunction type_refs[] = {
   868    keyfield::sample::ColorTypeTable
   869  };
   870  static const int64_t values[] = { 0, 4, 20 };
   871  static const char * const names[] = {
   872    "tag",
   873    "color"
   874  };
   875  static const ::flatbuffers::TypeTable tt = {
   876    ::flatbuffers::ST_STRUCT, 2, type_codes, type_refs, nullptr, values, names
   877  };
   878  return &tt;
   879}
   880
   881inline const ::flatbuffers::TypeTable *FruitTypeTable() {
   882  static const ::flatbuffers::TypeCode type_codes[] = {
   883    { ::flatbuffers::ET_SEQUENCE, 0, 0 },
   884    { ::flatbuffers::ET_UCHAR, 0, -1 }
   885  };
   886  static const ::flatbuffers::TypeFunction type_refs[] = {
   887    keyfield::sample::AppleTypeTable
   888  };
   889  static const int64_t values[] = { 0, 20, 24 };
   890  static const char * const names[] = {
   891    "a",
   892    "b"
   893  };
   894  static const ::flatbuffers::TypeTable tt = {
   895    ::flatbuffers::ST_STRUCT, 2, type_codes, type_refs, nullptr, values, names
   896  };
   897  return &tt;
   898}
   899
   900inline const ::flatbuffers::TypeTable *RiceTypeTable() {
   901  static const ::flatbuffers::TypeCode type_codes[] = {
   902    { ::flatbuffers::ET_UCHAR, 1, -1 },
   903    { ::flatbuffers::ET_UINT, 0, -1 }
   904  };
   905  static const int16_t array_sizes[] = { 3,  };
   906  static const int64_t values[] = { 0, 4, 8 };
   907  static const char * const names[] = {
   908    "origin",
   909    "quantity"
   910  };
   911  static const ::flatbuffers::TypeTable tt = {
   912    ::flatbuffers::ST_STRUCT, 2, type_codes, nullptr, array_sizes, values, names
   913  };
   914  return &tt;
   915}
   916
   917inline const ::flatbuffers::TypeTable *GrainTypeTable() {
   918  static const ::flatbuffers::TypeCode type_codes[] = {
   919    { ::flatbuffers::ET_SEQUENCE, 1, 0 },
   920    { ::flatbuffers::ET_UCHAR, 0, -1 }
   921  };
   922  static const ::flatbuffers::TypeFunction type_refs[] = {
   923    keyfield::sample::RiceTypeTable
   924  };
   925  static const int16_t array_sizes[] = { 3,  };
   926  static const int64_t values[] = { 0, 24, 28 };
   927  static const char * const names[] = {
   928    "a",
   929    "tag"
   930  };
   931  static const ::flatbuffers::TypeTable tt = {
   932    ::flatbuffers::ST_STRUCT, 2, type_codes, type_refs, array_sizes, values, names
   933  };
   934  return &tt;
   935}
   936
   937inline const ::flatbuffers::TypeTable *FooTableTypeTable() {
   938  static const ::flatbuffers::TypeCode type_codes[] = {
   939    { ::flatbuffers::ET_INT, 0, -1 },
   940    { ::flatbuffers::ET_INT, 0, -1 },
   941    { ::flatbuffers::ET_STRING, 0, -1 },
   942    { ::flatbuffers::ET_SEQUENCE, 1, 0 },
   943    { ::flatbuffers::ET_SEQUENCE, 1, 1 },
   944    { ::flatbuffers::ET_SEQUENCE, 1, 2 },
   945    { ::flatbuffers::ET_SEQUENCE, 1, 3 },
   946    { ::flatbuffers::ET_SEQUENCE, 1, 4 }
   947  };
   948  static const ::flatbuffers::TypeFunction type_refs[] = {
   949    keyfield::sample::BazTypeTable,
   950    keyfield::sample::BarTypeTable,
   951    keyfield::sample::AppleTypeTable,
   952    keyfield::sample::FruitTypeTable,
   953    keyfield::sample::GrainTypeTable
   954  };
   955  static const char * const names[] = {
   956    "a",
   957    "b",
   958    "c",
   959    "d",
   960    "e",
   961    "f",
   962    "g",
   963    "h"
   964  };
   965  static const ::flatbuffers::TypeTable tt = {
   966    ::flatbuffers::ST_TABLE, 8, type_codes, type_refs, nullptr, nullptr, names
   967  };
   968  return &tt;
   969}
   970
   971inline const keyfield::sample::FooTable *GetFooTable(const void *buf) {
   972  return ::flatbuffers::GetRoot<keyfield::sample::FooTable>(buf);
   973}
   974
   975inline const keyfield::sample::FooTable *GetSizePrefixedFooTable(const void *buf) {
   976  return ::flatbuffers::GetSizePrefixedRoot<keyfield::sample::FooTable>(buf);
   977}
   978
   979inline FooTable *GetMutableFooTable(void *buf) {
   980  return ::flatbuffers::GetMutableRoot<FooTable>(buf);
   981}
   982
   983inline keyfield::sample::FooTable *GetMutableSizePrefixedFooTable(void *buf) {
   984  return ::flatbuffers::GetMutableSizePrefixedRoot<keyfield::sample::FooTable>(buf);
   985}
   986
   987inline bool VerifyFooTableBuffer(
   988    ::flatbuffers::Verifier &verifier) {
   989  return verifier.VerifyBuffer<keyfield::sample::FooTable>(nullptr);
   990}
   991
   992inline bool VerifySizePrefixedFooTableBuffer(
   993    ::flatbuffers::Verifier &verifier) {
   994  return verifier.VerifySizePrefixedBuffer<keyfield::sample::FooTable>(nullptr);
   995}
   996
   997inline void FinishFooTableBuffer(
   998    ::flatbuffers::FlatBufferBuilder &fbb,
   999    ::flatbuffers::Offset<keyfield::sample::FooTable> root) {
  1000  fbb.Finish(root);
  1001}
  1002
  1003inline void FinishSizePrefixedFooTableBuffer(
  1004    ::flatbuffers::FlatBufferBuilder &fbb,
  1005    ::flatbuffers::Offset<keyfield::sample::FooTable> root) {
  1006  fbb.FinishSizePrefixed(root);
  1007}
  1008
  1009inline std::unique_ptr<keyfield::sample::FooTableT> UnPackFooTable(
  1010    const void *buf,
  1011    const ::flatbuffers::resolver_function_t *res = nullptr) {
  1012  return std::unique_ptr<keyfield::sample::FooTableT>(GetFooTable(buf)->UnPack(res));
  1013}
  1014
  1015inline std::unique_ptr<keyfield::sample::FooTableT> UnPackSizePrefixedFooTable(
  1016    const void *buf,
  1017    const ::flatbuffers::resolver_function_t *res = nullptr) {
  1018  return std::unique_ptr<keyfield::sample::FooTableT>(GetSizePrefixedFooTable(buf)->UnPack(res));
  1019}
  1020
  1021}  // namespace sample
  1022}  // namespace keyfield
  1023
  1024#endif  // FLATBUFFERS_GENERATED_KEYFIELDSAMPLE_KEYFIELD_SAMPLE_H_

View as plain text