James Kuszmaul | 8e62b02 | 2022-03-22 09:33:25 -0700 | [diff] [blame^] | 1 | // automatically generated by the FlatBuffers compiler, do not modify |
| 2 | |
| 3 | |
| 4 | #ifndef FLATBUFFERS_GENERATED_BENCH_BENCHMARKS_FLATBUFFERS_H_ |
| 5 | #define FLATBUFFERS_GENERATED_BENCH_BENCHMARKS_FLATBUFFERS_H_ |
| 6 | |
| 7 | #include "flatbuffers/flatbuffers.h" |
| 8 | |
| 9 | namespace benchmarks_flatbuffers { |
| 10 | |
| 11 | struct Foo; |
| 12 | |
| 13 | struct Bar; |
| 14 | |
| 15 | struct FooBar; |
| 16 | struct FooBarBuilder; |
| 17 | |
| 18 | struct FooBarContainer; |
| 19 | struct FooBarContainerBuilder; |
| 20 | |
| 21 | enum Enum : int16_t { |
| 22 | Enum_Apples = 0, |
| 23 | Enum_Pears = 1, |
| 24 | Enum_Bananas = 2, |
| 25 | Enum_MIN = Enum_Apples, |
| 26 | Enum_MAX = Enum_Bananas |
| 27 | }; |
| 28 | |
| 29 | inline const Enum (&EnumValuesEnum())[3] { |
| 30 | static const Enum values[] = { |
| 31 | Enum_Apples, |
| 32 | Enum_Pears, |
| 33 | Enum_Bananas |
| 34 | }; |
| 35 | return values; |
| 36 | } |
| 37 | |
| 38 | inline const char * const *EnumNamesEnum() { |
| 39 | static const char * const names[4] = { |
| 40 | "Apples", |
| 41 | "Pears", |
| 42 | "Bananas", |
| 43 | nullptr |
| 44 | }; |
| 45 | return names; |
| 46 | } |
| 47 | |
| 48 | inline const char *EnumNameEnum(Enum e) { |
| 49 | if (flatbuffers::IsOutRange(e, Enum_Apples, Enum_Bananas)) return ""; |
| 50 | const size_t index = static_cast<size_t>(e); |
| 51 | return EnumNamesEnum()[index]; |
| 52 | } |
| 53 | |
| 54 | FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Foo FLATBUFFERS_FINAL_CLASS { |
| 55 | private: |
| 56 | uint64_t id_; |
| 57 | int16_t count_; |
| 58 | int8_t prefix_; |
| 59 | int8_t padding0__; |
| 60 | uint32_t length_; |
| 61 | |
| 62 | public: |
| 63 | Foo() |
| 64 | : id_(0), |
| 65 | count_(0), |
| 66 | prefix_(0), |
| 67 | padding0__(0), |
| 68 | length_(0) { |
| 69 | (void)padding0__; |
| 70 | } |
| 71 | Foo(uint64_t _id, int16_t _count, int8_t _prefix, uint32_t _length) |
| 72 | : id_(flatbuffers::EndianScalar(_id)), |
| 73 | count_(flatbuffers::EndianScalar(_count)), |
| 74 | prefix_(flatbuffers::EndianScalar(_prefix)), |
| 75 | padding0__(0), |
| 76 | length_(flatbuffers::EndianScalar(_length)) { |
| 77 | (void)padding0__; |
| 78 | } |
| 79 | uint64_t id() const { |
| 80 | return flatbuffers::EndianScalar(id_); |
| 81 | } |
| 82 | int16_t count() const { |
| 83 | return flatbuffers::EndianScalar(count_); |
| 84 | } |
| 85 | int8_t prefix() const { |
| 86 | return flatbuffers::EndianScalar(prefix_); |
| 87 | } |
| 88 | uint32_t length() const { |
| 89 | return flatbuffers::EndianScalar(length_); |
| 90 | } |
| 91 | }; |
| 92 | FLATBUFFERS_STRUCT_END(Foo, 16); |
| 93 | |
| 94 | FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Bar FLATBUFFERS_FINAL_CLASS { |
| 95 | private: |
| 96 | benchmarks_flatbuffers::Foo parent_; |
| 97 | int32_t time_; |
| 98 | float ratio_; |
| 99 | uint16_t size_; |
| 100 | int16_t padding0__; int32_t padding1__; |
| 101 | |
| 102 | public: |
| 103 | Bar() |
| 104 | : parent_(), |
| 105 | time_(0), |
| 106 | ratio_(0), |
| 107 | size_(0), |
| 108 | padding0__(0), |
| 109 | padding1__(0) { |
| 110 | (void)padding0__; |
| 111 | (void)padding1__; |
| 112 | } |
| 113 | Bar(const benchmarks_flatbuffers::Foo &_parent, int32_t _time, float _ratio, uint16_t _size) |
| 114 | : parent_(_parent), |
| 115 | time_(flatbuffers::EndianScalar(_time)), |
| 116 | ratio_(flatbuffers::EndianScalar(_ratio)), |
| 117 | size_(flatbuffers::EndianScalar(_size)), |
| 118 | padding0__(0), |
| 119 | padding1__(0) { |
| 120 | (void)padding0__; |
| 121 | (void)padding1__; |
| 122 | } |
| 123 | const benchmarks_flatbuffers::Foo &parent() const { |
| 124 | return parent_; |
| 125 | } |
| 126 | int32_t time() const { |
| 127 | return flatbuffers::EndianScalar(time_); |
| 128 | } |
| 129 | float ratio() const { |
| 130 | return flatbuffers::EndianScalar(ratio_); |
| 131 | } |
| 132 | uint16_t size() const { |
| 133 | return flatbuffers::EndianScalar(size_); |
| 134 | } |
| 135 | }; |
| 136 | FLATBUFFERS_STRUCT_END(Bar, 32); |
| 137 | |
| 138 | struct FooBar FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { |
| 139 | typedef FooBarBuilder Builder; |
| 140 | enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { |
| 141 | VT_SIBLING = 4, |
| 142 | VT_NAME = 6, |
| 143 | VT_RATING = 8, |
| 144 | VT_POSTFIX = 10 |
| 145 | }; |
| 146 | const benchmarks_flatbuffers::Bar *sibling() const { |
| 147 | return GetStruct<const benchmarks_flatbuffers::Bar *>(VT_SIBLING); |
| 148 | } |
| 149 | const flatbuffers::String *name() const { |
| 150 | return GetPointer<const flatbuffers::String *>(VT_NAME); |
| 151 | } |
| 152 | double rating() const { |
| 153 | return GetField<double>(VT_RATING, 0.0); |
| 154 | } |
| 155 | uint8_t postfix() const { |
| 156 | return GetField<uint8_t>(VT_POSTFIX, 0); |
| 157 | } |
| 158 | bool Verify(flatbuffers::Verifier &verifier) const { |
| 159 | return VerifyTableStart(verifier) && |
| 160 | VerifyField<benchmarks_flatbuffers::Bar>(verifier, VT_SIBLING) && |
| 161 | VerifyOffset(verifier, VT_NAME) && |
| 162 | verifier.VerifyString(name()) && |
| 163 | VerifyField<double>(verifier, VT_RATING) && |
| 164 | VerifyField<uint8_t>(verifier, VT_POSTFIX) && |
| 165 | verifier.EndTable(); |
| 166 | } |
| 167 | }; |
| 168 | |
| 169 | struct FooBarBuilder { |
| 170 | typedef FooBar Table; |
| 171 | flatbuffers::FlatBufferBuilder &fbb_; |
| 172 | flatbuffers::uoffset_t start_; |
| 173 | void add_sibling(const benchmarks_flatbuffers::Bar *sibling) { |
| 174 | fbb_.AddStruct(FooBar::VT_SIBLING, sibling); |
| 175 | } |
| 176 | void add_name(flatbuffers::Offset<flatbuffers::String> name) { |
| 177 | fbb_.AddOffset(FooBar::VT_NAME, name); |
| 178 | } |
| 179 | void add_rating(double rating) { |
| 180 | fbb_.AddElement<double>(FooBar::VT_RATING, rating, 0.0); |
| 181 | } |
| 182 | void add_postfix(uint8_t postfix) { |
| 183 | fbb_.AddElement<uint8_t>(FooBar::VT_POSTFIX, postfix, 0); |
| 184 | } |
| 185 | explicit FooBarBuilder(flatbuffers::FlatBufferBuilder &_fbb) |
| 186 | : fbb_(_fbb) { |
| 187 | start_ = fbb_.StartTable(); |
| 188 | } |
| 189 | flatbuffers::Offset<FooBar> Finish() { |
| 190 | const auto end = fbb_.EndTable(start_); |
| 191 | auto o = flatbuffers::Offset<FooBar>(end); |
| 192 | return o; |
| 193 | } |
| 194 | }; |
| 195 | |
| 196 | inline flatbuffers::Offset<FooBar> CreateFooBar( |
| 197 | flatbuffers::FlatBufferBuilder &_fbb, |
| 198 | const benchmarks_flatbuffers::Bar *sibling = nullptr, |
| 199 | flatbuffers::Offset<flatbuffers::String> name = 0, |
| 200 | double rating = 0.0, |
| 201 | uint8_t postfix = 0) { |
| 202 | FooBarBuilder builder_(_fbb); |
| 203 | builder_.add_rating(rating); |
| 204 | builder_.add_name(name); |
| 205 | builder_.add_sibling(sibling); |
| 206 | builder_.add_postfix(postfix); |
| 207 | return builder_.Finish(); |
| 208 | } |
| 209 | |
| 210 | inline flatbuffers::Offset<FooBar> CreateFooBarDirect( |
| 211 | flatbuffers::FlatBufferBuilder &_fbb, |
| 212 | const benchmarks_flatbuffers::Bar *sibling = nullptr, |
| 213 | const char *name = nullptr, |
| 214 | double rating = 0.0, |
| 215 | uint8_t postfix = 0) { |
| 216 | auto name__ = name ? _fbb.CreateString(name) : 0; |
| 217 | return benchmarks_flatbuffers::CreateFooBar( |
| 218 | _fbb, |
| 219 | sibling, |
| 220 | name__, |
| 221 | rating, |
| 222 | postfix); |
| 223 | } |
| 224 | |
| 225 | struct FooBarContainer FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { |
| 226 | typedef FooBarContainerBuilder Builder; |
| 227 | enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { |
| 228 | VT_LIST = 4, |
| 229 | VT_INITIALIZED = 6, |
| 230 | VT_FRUIT = 8, |
| 231 | VT_LOCATION = 10 |
| 232 | }; |
| 233 | const flatbuffers::Vector<flatbuffers::Offset<benchmarks_flatbuffers::FooBar>> *list() const { |
| 234 | return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<benchmarks_flatbuffers::FooBar>> *>(VT_LIST); |
| 235 | } |
| 236 | bool initialized() const { |
| 237 | return GetField<uint8_t>(VT_INITIALIZED, 0) != 0; |
| 238 | } |
| 239 | benchmarks_flatbuffers::Enum fruit() const { |
| 240 | return static_cast<benchmarks_flatbuffers::Enum>(GetField<int16_t>(VT_FRUIT, 0)); |
| 241 | } |
| 242 | const flatbuffers::String *location() const { |
| 243 | return GetPointer<const flatbuffers::String *>(VT_LOCATION); |
| 244 | } |
| 245 | bool Verify(flatbuffers::Verifier &verifier) const { |
| 246 | return VerifyTableStart(verifier) && |
| 247 | VerifyOffset(verifier, VT_LIST) && |
| 248 | verifier.VerifyVector(list()) && |
| 249 | verifier.VerifyVectorOfTables(list()) && |
| 250 | VerifyField<uint8_t>(verifier, VT_INITIALIZED) && |
| 251 | VerifyField<int16_t>(verifier, VT_FRUIT) && |
| 252 | VerifyOffset(verifier, VT_LOCATION) && |
| 253 | verifier.VerifyString(location()) && |
| 254 | verifier.EndTable(); |
| 255 | } |
| 256 | }; |
| 257 | |
| 258 | struct FooBarContainerBuilder { |
| 259 | typedef FooBarContainer Table; |
| 260 | flatbuffers::FlatBufferBuilder &fbb_; |
| 261 | flatbuffers::uoffset_t start_; |
| 262 | void add_list(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<benchmarks_flatbuffers::FooBar>>> list) { |
| 263 | fbb_.AddOffset(FooBarContainer::VT_LIST, list); |
| 264 | } |
| 265 | void add_initialized(bool initialized) { |
| 266 | fbb_.AddElement<uint8_t>(FooBarContainer::VT_INITIALIZED, static_cast<uint8_t>(initialized), 0); |
| 267 | } |
| 268 | void add_fruit(benchmarks_flatbuffers::Enum fruit) { |
| 269 | fbb_.AddElement<int16_t>(FooBarContainer::VT_FRUIT, static_cast<int16_t>(fruit), 0); |
| 270 | } |
| 271 | void add_location(flatbuffers::Offset<flatbuffers::String> location) { |
| 272 | fbb_.AddOffset(FooBarContainer::VT_LOCATION, location); |
| 273 | } |
| 274 | explicit FooBarContainerBuilder(flatbuffers::FlatBufferBuilder &_fbb) |
| 275 | : fbb_(_fbb) { |
| 276 | start_ = fbb_.StartTable(); |
| 277 | } |
| 278 | flatbuffers::Offset<FooBarContainer> Finish() { |
| 279 | const auto end = fbb_.EndTable(start_); |
| 280 | auto o = flatbuffers::Offset<FooBarContainer>(end); |
| 281 | return o; |
| 282 | } |
| 283 | }; |
| 284 | |
| 285 | inline flatbuffers::Offset<FooBarContainer> CreateFooBarContainer( |
| 286 | flatbuffers::FlatBufferBuilder &_fbb, |
| 287 | flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<benchmarks_flatbuffers::FooBar>>> list = 0, |
| 288 | bool initialized = false, |
| 289 | benchmarks_flatbuffers::Enum fruit = benchmarks_flatbuffers::Enum_Apples, |
| 290 | flatbuffers::Offset<flatbuffers::String> location = 0) { |
| 291 | FooBarContainerBuilder builder_(_fbb); |
| 292 | builder_.add_location(location); |
| 293 | builder_.add_list(list); |
| 294 | builder_.add_fruit(fruit); |
| 295 | builder_.add_initialized(initialized); |
| 296 | return builder_.Finish(); |
| 297 | } |
| 298 | |
| 299 | inline flatbuffers::Offset<FooBarContainer> CreateFooBarContainerDirect( |
| 300 | flatbuffers::FlatBufferBuilder &_fbb, |
| 301 | const std::vector<flatbuffers::Offset<benchmarks_flatbuffers::FooBar>> *list = nullptr, |
| 302 | bool initialized = false, |
| 303 | benchmarks_flatbuffers::Enum fruit = benchmarks_flatbuffers::Enum_Apples, |
| 304 | const char *location = nullptr) { |
| 305 | auto list__ = list ? _fbb.CreateVector<flatbuffers::Offset<benchmarks_flatbuffers::FooBar>>(*list) : 0; |
| 306 | auto location__ = location ? _fbb.CreateString(location) : 0; |
| 307 | return benchmarks_flatbuffers::CreateFooBarContainer( |
| 308 | _fbb, |
| 309 | list__, |
| 310 | initialized, |
| 311 | fruit, |
| 312 | location__); |
| 313 | } |
| 314 | |
| 315 | inline const benchmarks_flatbuffers::FooBarContainer *GetFooBarContainer(const void *buf) { |
| 316 | return flatbuffers::GetRoot<benchmarks_flatbuffers::FooBarContainer>(buf); |
| 317 | } |
| 318 | |
| 319 | inline const benchmarks_flatbuffers::FooBarContainer *GetSizePrefixedFooBarContainer(const void *buf) { |
| 320 | return flatbuffers::GetSizePrefixedRoot<benchmarks_flatbuffers::FooBarContainer>(buf); |
| 321 | } |
| 322 | |
| 323 | inline bool VerifyFooBarContainerBuffer( |
| 324 | flatbuffers::Verifier &verifier) { |
| 325 | return verifier.VerifyBuffer<benchmarks_flatbuffers::FooBarContainer>(nullptr); |
| 326 | } |
| 327 | |
| 328 | inline bool VerifySizePrefixedFooBarContainerBuffer( |
| 329 | flatbuffers::Verifier &verifier) { |
| 330 | return verifier.VerifySizePrefixedBuffer<benchmarks_flatbuffers::FooBarContainer>(nullptr); |
| 331 | } |
| 332 | |
| 333 | inline void FinishFooBarContainerBuffer( |
| 334 | flatbuffers::FlatBufferBuilder &fbb, |
| 335 | flatbuffers::Offset<benchmarks_flatbuffers::FooBarContainer> root) { |
| 336 | fbb.Finish(root); |
| 337 | } |
| 338 | |
| 339 | inline void FinishSizePrefixedFooBarContainerBuffer( |
| 340 | flatbuffers::FlatBufferBuilder &fbb, |
| 341 | flatbuffers::Offset<benchmarks_flatbuffers::FooBarContainer> root) { |
| 342 | fbb.FinishSizePrefixed(root); |
| 343 | } |
| 344 | |
| 345 | } // namespace benchmarks_flatbuffers |
| 346 | |
| 347 | #endif // FLATBUFFERS_GENERATED_BENCH_BENCHMARKS_FLATBUFFERS_H_ |