53 lines
1.2 KiB
Plaintext
53 lines
1.2 KiB
Plaintext
// Copyright 2021 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.
|
|
|
|
|
|
// trying to represent a typical mix of datatypes:
|
|
// 1 array of 3 elements, each element: 1 string, 3 nested objects, 9 scalars
|
|
// root element has the array, additional string and an enum
|
|
|
|
namespace benchmarks_flatbuffers;
|
|
|
|
enum Enum : short { Apples, Pears, Bananas}
|
|
|
|
struct Foo {
|
|
id:ulong;
|
|
count:short;
|
|
prefix:byte;
|
|
length:uint;
|
|
}
|
|
|
|
struct Bar {
|
|
parent:Foo;
|
|
time:int;
|
|
ratio:float;
|
|
size:ushort;
|
|
}
|
|
|
|
table FooBar {
|
|
sibling:Bar;
|
|
name:string;
|
|
rating:double;
|
|
postfix:ubyte;
|
|
}
|
|
|
|
table FooBarContainer {
|
|
list:[FooBar]; // 3 copies of the above
|
|
initialized:bool;
|
|
fruit:Enum;
|
|
location:string;
|
|
}
|
|
|
|
root_type FooBarContainer;
|