1 // automatically generated by the FlatBuffers compiler, do not modify
2
3 import FlatBuffers
4
5 public enum MyGame {
6 public enum Example {
7
8 /// Composite components of Monster color.
9 public enum Color: UInt8, Enum {
10 public typealias T = UInt8
11 public static var byteSize: Int { return MemoryLayout<UInt8>.size }
12 public var value: UInt8 { return self.rawValue }
13 case red = 1
14 /// \brief color Green
15 /// Green is bit_flag with value (1u << 1)
16 case green = 2
17 /// \brief color Blue (1u << 3)
18 case blue = 8
19
20
21 public static var max: Color { return .blue }
22 public static var min: Color { return .red }
23 }
24
25 public enum Race: Int8, Enum {
26 public typealias T = Int8
27 public static var byteSize: Int { return MemoryLayout<Int8>.size }
28 public var value: Int8 { return self.rawValue }
29 case none = -1
30 case human = 0
31 case dwarf = 1
32 case elf = 2
33
34
35 public static var max: Race { return .elf }
36 public static var min: Race { return .none }
37 }
38
39 public enum Any_: UInt8, Enum {
40 public typealias T = UInt8
41 public static var byteSize: Int { return MemoryLayout<UInt8>.size }
42 public var value: UInt8 { return self.rawValue }
43 case none = 0
44 case monster = 1
45 case testsimpletablewithenum = 2
46 case mygame_example2_monster = 3
47
48
49 public static var max: Any_ { return .mygame_example2_monster }
50 public static var min: Any_ { return .none }
51 }
52
53 public enum AnyUniqueAliases: UInt8, Enum {
54 public typealias T = UInt8
55 public static var byteSize: Int { return MemoryLayout<UInt8>.size }
56 public var value: UInt8 { return self.rawValue }
57 case none = 0
58 case m = 1
59 case ts = 2
60 case m2 = 3
61
62
63 public static var max: AnyUniqueAliases { return .m2 }
64 public static var min: AnyUniqueAliases { return .none }
65 }
66
67 public enum AnyAmbiguousAliases: UInt8, Enum {
68 public typealias T = UInt8
69 public static var byteSize: Int { return MemoryLayout<UInt8>.size }
70 public var value: UInt8 { return self.rawValue }
71 case none = 0
72 case m1 = 1
73 case m2 = 2
74 case m3 = 3
75
76
77 public static var max: AnyAmbiguousAliases { return .m3 }
78 public static var min: AnyAmbiguousAliases { return .none }
79 }
80
81 public struct Test: Readable {
82
validateVersionnull83 static func validateVersion() { FlatBuffersVersion_1_12_0() }
84 public var __buffer: ByteBuffer! { return _accessor.bb }
85
86 private var _accessor: Struct
87 public static var size = 4
88 public static var alignment = 2
89 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) }
90
91 public var a: Int16 { return _accessor.readBuffer(of: Int16.self, at: 0) }
mutatenull92 public func mutate(a: Int16) -> Bool { return _accessor.mutate(a, index: 0) }
93 public var b: Int8 { return _accessor.readBuffer(of: Int8.self, at: 2) }
mutatenull94 public func mutate(b: Int8) -> Bool { return _accessor.mutate(b, index: 2) }
95 }
96
97 public struct Vec3: Readable {
98
validateVersionnull99 static func validateVersion() { FlatBuffersVersion_1_12_0() }
100 public var __buffer: ByteBuffer! { return _accessor.bb }
101
102 private var _accessor: Struct
103 public static var size = 32
104 public static var alignment = 8
105 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) }
106
107 public var x: Float32 { return _accessor.readBuffer(of: Float32.self, at: 0) }
mutatenull108 public func mutate(x: Float32) -> Bool { return _accessor.mutate(x, index: 0) }
109 public var y: Float32 { return _accessor.readBuffer(of: Float32.self, at: 4) }
mutatenull110 public func mutate(y: Float32) -> Bool { return _accessor.mutate(y, index: 4) }
111 public var z: Float32 { return _accessor.readBuffer(of: Float32.self, at: 8) }
mutatenull112 public func mutate(z: Float32) -> Bool { return _accessor.mutate(z, index: 8) }
113 public var test1: Double { return _accessor.readBuffer(of: Double.self, at: 16) }
mutatenull114 public func mutate(test1: Double) -> Bool { return _accessor.mutate(test1, index: 16) }
115 public var test2: MyGame.Example.Color { return MyGame.Example.Color(rawValue: _accessor.readBuffer(of: UInt8.self, at: 24)) ?? .red }
116 public var test3: MyGame.Example.Test { return MyGame.Example.Test(_accessor.bb, o: _accessor.postion + 26) }
117 }
118
119 public struct Ability: Readable {
120
validateVersionnull121 static func validateVersion() { FlatBuffersVersion_1_12_0() }
122 public var __buffer: ByteBuffer! { return _accessor.bb }
123
124 private var _accessor: Struct
125 public static var size = 8
126 public static var alignment = 4
127 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) }
128
129 public var id: UInt32 { return _accessor.readBuffer(of: UInt32.self, at: 0) }
mutatenull130 public func mutate(id: UInt32) -> Bool { return _accessor.mutate(id, index: 0) }
131 public var distance: UInt32 { return _accessor.readBuffer(of: UInt32.self, at: 4) }
mutatenull132 public func mutate(distance: UInt32) -> Bool { return _accessor.mutate(distance, index: 4) }
133 }
134
createTestnull135 public static func createTest(a: Int16, b: Int8) -> UnsafeMutableRawPointer {
136 let memory = UnsafeMutableRawPointer.allocate(byteCount: Test.size, alignment: Test.alignment)
137 memory.initializeMemory(as: UInt8.self, repeating: 0, count: Test.size)
138 memory.storeBytes(of: a, toByteOffset: 0, as: Int16.self)
139 memory.storeBytes(of: b, toByteOffset: 2, as: Int8.self)
140 return memory
141 }
142
createVec3null143 public static func createVec3(x: Float32, y: Float32, z: Float32, test1: Double, test2: MyGame.Example.Color, test3a: Int16, test3b: Int8) -> UnsafeMutableRawPointer {
144 let memory = UnsafeMutableRawPointer.allocate(byteCount: Vec3.size, alignment: Vec3.alignment)
145 memory.initializeMemory(as: UInt8.self, repeating: 0, count: Vec3.size)
146 memory.storeBytes(of: x, toByteOffset: 0, as: Float32.self)
147 memory.storeBytes(of: y, toByteOffset: 4, as: Float32.self)
148 memory.storeBytes(of: z, toByteOffset: 8, as: Float32.self)
149 memory.storeBytes(of: test1, toByteOffset: 16, as: Double.self)
150 memory.storeBytes(of: test2.rawValue, toByteOffset: 24, as: UInt8.self)
151 memory.storeBytes(of: test3a, toByteOffset: 26, as: Int16.self)
152 memory.storeBytes(of: test3b, toByteOffset: 28, as: Int8.self)
153 return memory
154 }
155
createAbilitynull156 public static func createAbility(id: UInt32, distance: UInt32) -> UnsafeMutableRawPointer {
157 let memory = UnsafeMutableRawPointer.allocate(byteCount: Ability.size, alignment: Ability.alignment)
158 memory.initializeMemory(as: UInt8.self, repeating: 0, count: Ability.size)
159 memory.storeBytes(of: id, toByteOffset: 0, as: UInt32.self)
160 memory.storeBytes(of: distance, toByteOffset: 4, as: UInt32.self)
161 return memory
162 }
163
164 }
165
166 // MARK: - Example
167
168
169 public struct InParentNamespace: FlatBufferObject {
170
validateVersionnull171 static func validateVersion() { FlatBuffersVersion_1_12_0() }
172 public var __buffer: ByteBuffer! { return _accessor.bb }
173
174 private var _accessor: Table
finishnull175 public static func finish(_ fbb: FlatBufferBuilder, end: Offset<UOffset>, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
getRootAsInParentNamespacenull176 public static func getRootAsInParentNamespace(bb: ByteBuffer) -> InParentNamespace { return InParentNamespace(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
177
178 private init(_ t: Table) { _accessor = t }
179 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) }
180
startInParentNamespacenull181 public static func startInParentNamespace(_ fbb: FlatBufferBuilder) -> UOffset { fbb.startTable(with: 0) }
endInParentNamespacenull182 public static func endInParentNamespace(_ fbb: FlatBufferBuilder, start: UOffset) -> Offset<UOffset> { let end = Offset<UOffset>(offset: fbb.endTable(at: start)); return end }
createInParentNamespacenull183 public static func createInParentNamespace(_ fbb: FlatBufferBuilder) -> Offset<UOffset> {
184 let __start = InParentNamespace.startInParentNamespace(fbb)
185 return InParentNamespace.endInParentNamespace(fbb, start: __start)
186 }
187 }
188
189 public enum Example2 {
190
191 public struct Monster: FlatBufferObject {
192
validateVersionnull193 static func validateVersion() { FlatBuffersVersion_1_12_0() }
194 public var __buffer: ByteBuffer! { return _accessor.bb }
195
196 private var _accessor: Table
finishnull197 public static func finish(_ fbb: FlatBufferBuilder, end: Offset<UOffset>, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
getRootAsMonsternull198 public static func getRootAsMonster(bb: ByteBuffer) -> Monster { return Monster(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
199
200 private init(_ t: Table) { _accessor = t }
201 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) }
202
startMonsternull203 public static func startMonster(_ fbb: FlatBufferBuilder) -> UOffset { fbb.startTable(with: 0) }
endMonsternull204 public static func endMonster(_ fbb: FlatBufferBuilder, start: UOffset) -> Offset<UOffset> { let end = Offset<UOffset>(offset: fbb.endTable(at: start)); return end }
createMonsternull205 public static func createMonster(_ fbb: FlatBufferBuilder) -> Offset<UOffset> {
206 let __start = Monster.startMonster(fbb)
207 return Monster.endMonster(fbb, start: __start)
208 }
209 }
210
211 }
212
213 // MARK: - Example2
214
215
216 }
217 extension MyGame.Example {
218
219 public struct TestSimpleTableWithEnum: FlatBufferObject {
220
validateVersionnull221 static func validateVersion() { FlatBuffersVersion_1_12_0() }
222 public var __buffer: ByteBuffer! { return _accessor.bb }
223
224 private var _accessor: Table
finishnull225 public static func finish(_ fbb: FlatBufferBuilder, end: Offset<UOffset>, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
getRootAsTestSimpleTableWithEnumnull226 public static func getRootAsTestSimpleTableWithEnum(bb: ByteBuffer) -> TestSimpleTableWithEnum { return TestSimpleTableWithEnum(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
227
228 private init(_ t: Table) { _accessor = t }
229 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) }
230
231 public var color: MyGame.Example.Color { let o = _accessor.offset(4); return o == 0 ? .green : MyGame.Example.Color(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .green }
mutatenull232 public func mutate(color: MyGame.Example.Color) -> Bool {let o = _accessor.offset(4); return _accessor.mutate(color.rawValue, index: o) }
startTestSimpleTableWithEnumnull233 public static func startTestSimpleTableWithEnum(_ fbb: FlatBufferBuilder) -> UOffset { fbb.startTable(with: 1) }
addnull234 public static func add(color: MyGame.Example.Color, _ fbb: FlatBufferBuilder) { fbb.add(element: color.rawValue, def: 2, at: 0) }
endTestSimpleTableWithEnumnull235 public static func endTestSimpleTableWithEnum(_ fbb: FlatBufferBuilder, start: UOffset) -> Offset<UOffset> { let end = Offset<UOffset>(offset: fbb.endTable(at: start)); return end }
236 public static func createTestSimpleTableWithEnum(_ fbb: FlatBufferBuilder,
237 color: MyGame.Example.Color = .green) -> Offset<UOffset> {
238 let __start = TestSimpleTableWithEnum.startTestSimpleTableWithEnum(fbb)
239 TestSimpleTableWithEnum.add(color: color, fbb)
240 return TestSimpleTableWithEnum.endTestSimpleTableWithEnum(fbb, start: __start)
241 }
242 }
243
244 public struct Stat: FlatBufferObject {
245
validateVersionnull246 static func validateVersion() { FlatBuffersVersion_1_12_0() }
247 public var __buffer: ByteBuffer! { return _accessor.bb }
248
249 private var _accessor: Table
finishnull250 public static func finish(_ fbb: FlatBufferBuilder, end: Offset<UOffset>, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
getRootAsStatnull251 public static func getRootAsStat(bb: ByteBuffer) -> Stat { return Stat(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
252
253 private init(_ t: Table) { _accessor = t }
254 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) }
255
256 public var id: String? { let o = _accessor.offset(4); return o == 0 ? nil : _accessor.string(at: o) }
257 public var idSegmentArray: [UInt8]? { return _accessor.getVector(at: 4) }
258 public var val: Int64 { let o = _accessor.offset(6); return o == 0 ? 0 : _accessor.readBuffer(of: Int64.self, at: o) }
mutatenull259 public func mutate(val: Int64) -> Bool {let o = _accessor.offset(6); return _accessor.mutate(val, index: o) }
260 public var count: UInt16 { let o = _accessor.offset(8); return o == 0 ? 0 : _accessor.readBuffer(of: UInt16.self, at: o) }
mutatenull261 public func mutate(count: UInt16) -> Bool {let o = _accessor.offset(8); return _accessor.mutate(count, index: o) }
startStatnull262 public static func startStat(_ fbb: FlatBufferBuilder) -> UOffset { fbb.startTable(with: 3) }
addnull263 public static func add(id: Offset<String>, _ fbb: FlatBufferBuilder) { fbb.add(offset: id, at: 0) }
addnull264 public static func add(val: Int64, _ fbb: FlatBufferBuilder) { fbb.add(element: val, def: 0, at: 1) }
addnull265 public static func add(count: UInt16, _ fbb: FlatBufferBuilder) { fbb.add(element: count, def: 0, at: 2) }
endStatnull266 public static func endStat(_ fbb: FlatBufferBuilder, start: UOffset) -> Offset<UOffset> { let end = Offset<UOffset>(offset: fbb.endTable(at: start)); return end }
267 public static func createStat(_ fbb: FlatBufferBuilder,
268 offsetOfId id: Offset<String> = Offset(),
269 val: Int64 = 0,
270 count: UInt16 = 0) -> Offset<UOffset> {
271 let __start = Stat.startStat(fbb)
272 Stat.add(id: id, fbb)
273 Stat.add(val: val, fbb)
274 Stat.add(count: count, fbb)
275 return Stat.endStat(fbb, start: __start)
276 }
277 }
278
279 public struct Referrable: FlatBufferObject {
280
validateVersionnull281 static func validateVersion() { FlatBuffersVersion_1_12_0() }
282 public var __buffer: ByteBuffer! { return _accessor.bb }
283
284 private var _accessor: Table
finishnull285 public static func finish(_ fbb: FlatBufferBuilder, end: Offset<UOffset>, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
getRootAsReferrablenull286 public static func getRootAsReferrable(bb: ByteBuffer) -> Referrable { return Referrable(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
287
288 private init(_ t: Table) { _accessor = t }
289 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) }
290
291 public var id: UInt64 { let o = _accessor.offset(4); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
mutatenull292 public func mutate(id: UInt64) -> Bool {let o = _accessor.offset(4); return _accessor.mutate(id, index: o) }
startReferrablenull293 public static func startReferrable(_ fbb: FlatBufferBuilder) -> UOffset { fbb.startTable(with: 1) }
addnull294 public static func add(id: UInt64, _ fbb: FlatBufferBuilder) { fbb.add(element: id, def: 0, at: 0) }
endReferrablenull295 public static func endReferrable(_ fbb: FlatBufferBuilder, start: UOffset) -> Offset<UOffset> { let end = Offset<UOffset>(offset: fbb.endTable(at: start)); return end }
296 public static func createReferrable(_ fbb: FlatBufferBuilder,
297 id: UInt64 = 0) -> Offset<UOffset> {
298 let __start = Referrable.startReferrable(fbb)
299 Referrable.add(id: id, fbb)
300 return Referrable.endReferrable(fbb, start: __start)
301 }
sortVectorOfReferrablenull302 public static func sortVectorOfReferrable(offsets:[Offset<UOffset>], _ fbb: FlatBufferBuilder) -> Offset<UOffset> {
303 var off = offsets
304 off.sort { Table.compare(Table.offset(Int32($1.o), vOffset: 4, fbb: fbb.buffer), Table.offset(Int32($0.o), vOffset: 4, fbb: fbb.buffer), fbb: fbb.buffer) < 0 }
305 return fbb.createVector(ofOffsets: off)
306 }
lookupByKeynull307 fileprivate static func lookupByKey(vector: Int32, key: UInt64, fbb: ByteBuffer) -> Referrable? {
308 var span = fbb.read(def: Int32.self, position: Int(vector - 4))
309 var start: Int32 = 0
310 while span != 0 {
311 var middle = span / 2
312 let tableOffset = Table.indirect(vector + 4 * (start + middle), fbb)
313 let comp = fbb.read(def: UInt64.self, position: Int(Table.offset(Int32(fbb.capacity) - tableOffset, vOffset: 4, fbb: fbb)))
314 if comp > 0 {
315 span = middle
316 } else if comp < 0 {
317 middle += 1
318 start += middle
319 span -= middle
320 } else {
321 return Referrable(fbb, o: tableOffset)
322 }
323 }
324 return nil
325 }
326 }
327
328 /// an example documentation comment: "monster object"
329 public struct Monster: FlatBufferObject {
330
validateVersionnull331 static func validateVersion() { FlatBuffersVersion_1_12_0() }
332 public var __buffer: ByteBuffer! { return _accessor.bb }
333
334 private var _accessor: Table
finishnull335 public static func finish(_ fbb: FlatBufferBuilder, end: Offset<UOffset>, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
getRootAsMonsternull336 public static func getRootAsMonster(bb: ByteBuffer) -> Monster { return Monster(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
337
338 private init(_ t: Table) { _accessor = t }
339 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) }
340
341 public var pos: MyGame.Example.Vec3? { let o = _accessor.offset(4); return o == 0 ? nil : MyGame.Example.Vec3(_accessor.bb, o: o + _accessor.postion) }
342 public var mana: Int16 { let o = _accessor.offset(6); return o == 0 ? 150 : _accessor.readBuffer(of: Int16.self, at: o) }
mutatenull343 public func mutate(mana: Int16) -> Bool {let o = _accessor.offset(6); return _accessor.mutate(mana, index: o) }
344 public var hp: Int16 { let o = _accessor.offset(8); return o == 0 ? 100 : _accessor.readBuffer(of: Int16.self, at: o) }
mutatenull345 public func mutate(hp: Int16) -> Bool {let o = _accessor.offset(8); return _accessor.mutate(hp, index: o) }
346 public var name: String? { let o = _accessor.offset(10); return o == 0 ? nil : _accessor.string(at: o) }
347 public var nameSegmentArray: [UInt8]? { return _accessor.getVector(at: 10) }
348 public var inventoryCount: Int32 { let o = _accessor.offset(14); return o == 0 ? 0 : _accessor.vector(count: o) }
inventorynull349 public func inventory(at index: Int32) -> UInt8 { let o = _accessor.offset(14); return o == 0 ? 0 : _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1) }
350 public var inventory: [UInt8] { return _accessor.getVector(at: 14) ?? [] }
mutatenull351 public func mutate(inventory: UInt8, at index: Int32) -> Bool { let o = _accessor.offset(14); return _accessor.directMutate(inventory, index: _accessor.vector(at: o) + index * 1) }
352 public var color: MyGame.Example.Color { let o = _accessor.offset(16); return o == 0 ? .blue : MyGame.Example.Color(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .blue }
mutatenull353 public func mutate(color: MyGame.Example.Color) -> Bool {let o = _accessor.offset(16); return _accessor.mutate(color.rawValue, index: o) }
354 public var testType: MyGame.Example.Any_ { let o = _accessor.offset(18); return o == 0 ? .none : MyGame.Example.Any_(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none }
test<T: FlatBufferObject>null355 public func test<T: FlatBufferObject>(type: T.Type) -> T? { let o = _accessor.offset(20); return o == 0 ? nil : _accessor.union(o) }
356 public var test4Count: Int32 { let o = _accessor.offset(22); return o == 0 ? 0 : _accessor.vector(count: o) }
test4null357 public func test4(at index: Int32) -> MyGame.Example.Test? { let o = _accessor.offset(22); return o == 0 ? nil : MyGame.Example.Test(_accessor.bb, o: _accessor.vector(at: o) + index * 4) }
358 public var testarrayofstringCount: Int32 { let o = _accessor.offset(24); return o == 0 ? 0 : _accessor.vector(count: o) }
testarrayofstringnull359 public func testarrayofstring(at index: Int32) -> String? { let o = _accessor.offset(24); return o == 0 ? nil : _accessor.directString(at: _accessor.vector(at: o) + index * 4) }
360 /// an example documentation comment: this will end up in the generated code
361 /// multiline too
362 public var testarrayoftablesCount: Int32 { let o = _accessor.offset(26); return o == 0 ? 0 : _accessor.vector(count: o) }
testarrayoftablesnull363 public func testarrayoftables(at index: Int32) -> MyGame.Example.Monster? { let o = _accessor.offset(26); return o == 0 ? nil : MyGame.Example.Monster(_accessor.bb, o: _accessor.indirect(_accessor.vector(at: o) + index * 4)) }
testarrayoftablesBynull364 public func testarrayoftablesBy(key: String) -> MyGame.Example.Monster? { let o = _accessor.offset(26); return o == 0 ? nil : MyGame.Example.Monster.lookupByKey(vector: _accessor.vector(at: o), key: key, fbb: _accessor.bb) }
365 public var enemy: MyGame.Example.Monster? { let o = _accessor.offset(28); return o == 0 ? nil : MyGame.Example.Monster(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) }
366 public var testnestedflatbufferCount: Int32 { let o = _accessor.offset(30); return o == 0 ? 0 : _accessor.vector(count: o) }
testnestedflatbuffernull367 public func testnestedflatbuffer(at index: Int32) -> UInt8 { let o = _accessor.offset(30); return o == 0 ? 0 : _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1) }
368 public var testnestedflatbuffer: [UInt8] { return _accessor.getVector(at: 30) ?? [] }
mutatenull369 public func mutate(testnestedflatbuffer: UInt8, at index: Int32) -> Bool { let o = _accessor.offset(30); return _accessor.directMutate(testnestedflatbuffer, index: _accessor.vector(at: o) + index * 1) }
370 public var testempty: MyGame.Example.Stat? { let o = _accessor.offset(32); return o == 0 ? nil : MyGame.Example.Stat(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) }
371 public var testbool: Bool { let o = _accessor.offset(34); return o == 0 ? false : 0 != _accessor.readBuffer(of: Byte.self, at: o) }
mutatenull372 public func mutate(testbool: Byte) -> Bool {let o = _accessor.offset(34); return _accessor.mutate(testbool, index: o) }
373 public var testhashs32Fnv1: Int32 { let o = _accessor.offset(36); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) }
mutatenull374 public func mutate(testhashs32Fnv1: Int32) -> Bool {let o = _accessor.offset(36); return _accessor.mutate(testhashs32Fnv1, index: o) }
375 public var testhashu32Fnv1: UInt32 { let o = _accessor.offset(38); return o == 0 ? 0 : _accessor.readBuffer(of: UInt32.self, at: o) }
mutatenull376 public func mutate(testhashu32Fnv1: UInt32) -> Bool {let o = _accessor.offset(38); return _accessor.mutate(testhashu32Fnv1, index: o) }
377 public var testhashs64Fnv1: Int64 { let o = _accessor.offset(40); return o == 0 ? 0 : _accessor.readBuffer(of: Int64.self, at: o) }
mutatenull378 public func mutate(testhashs64Fnv1: Int64) -> Bool {let o = _accessor.offset(40); return _accessor.mutate(testhashs64Fnv1, index: o) }
379 public var testhashu64Fnv1: UInt64 { let o = _accessor.offset(42); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
mutatenull380 public func mutate(testhashu64Fnv1: UInt64) -> Bool {let o = _accessor.offset(42); return _accessor.mutate(testhashu64Fnv1, index: o) }
381 public var testhashs32Fnv1a: Int32 { let o = _accessor.offset(44); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) }
mutatenull382 public func mutate(testhashs32Fnv1a: Int32) -> Bool {let o = _accessor.offset(44); return _accessor.mutate(testhashs32Fnv1a, index: o) }
383 public var testhashu32Fnv1a: UInt32 { let o = _accessor.offset(46); return o == 0 ? 0 : _accessor.readBuffer(of: UInt32.self, at: o) }
mutatenull384 public func mutate(testhashu32Fnv1a: UInt32) -> Bool {let o = _accessor.offset(46); return _accessor.mutate(testhashu32Fnv1a, index: o) }
385 public var testhashs64Fnv1a: Int64 { let o = _accessor.offset(48); return o == 0 ? 0 : _accessor.readBuffer(of: Int64.self, at: o) }
mutatenull386 public func mutate(testhashs64Fnv1a: Int64) -> Bool {let o = _accessor.offset(48); return _accessor.mutate(testhashs64Fnv1a, index: o) }
387 public var testhashu64Fnv1a: UInt64 { let o = _accessor.offset(50); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
mutatenull388 public func mutate(testhashu64Fnv1a: UInt64) -> Bool {let o = _accessor.offset(50); return _accessor.mutate(testhashu64Fnv1a, index: o) }
389 public var testarrayofboolsCount: Int32 { let o = _accessor.offset(52); return o == 0 ? 0 : _accessor.vector(count: o) }
testarrayofboolsnull390 public func testarrayofbools(at index: Int32) -> Bool { let o = _accessor.offset(52); return o == 0 ? true : 0 != _accessor.directRead(of: Byte.self, offset: _accessor.vector(at: o) + index * 1) }
391 public var testarrayofbools: [Byte] { return _accessor.getVector(at: 52) ?? [] }
mutatenull392 public func mutate(testarrayofbools: Byte, at index: Int32) -> Bool { let o = _accessor.offset(52); return _accessor.directMutate(testarrayofbools, index: _accessor.vector(at: o) + index * 1) }
393 public var testf: Float32 { let o = _accessor.offset(54); return o == 0 ? 3.14159 : _accessor.readBuffer(of: Float32.self, at: o) }
mutatenull394 public func mutate(testf: Float32) -> Bool {let o = _accessor.offset(54); return _accessor.mutate(testf, index: o) }
395 public var testf2: Float32 { let o = _accessor.offset(56); return o == 0 ? 3.0 : _accessor.readBuffer(of: Float32.self, at: o) }
mutatenull396 public func mutate(testf2: Float32) -> Bool {let o = _accessor.offset(56); return _accessor.mutate(testf2, index: o) }
397 public var testf3: Float32 { let o = _accessor.offset(58); return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o) }
mutatenull398 public func mutate(testf3: Float32) -> Bool {let o = _accessor.offset(58); return _accessor.mutate(testf3, index: o) }
399 public var testarrayofstring2Count: Int32 { let o = _accessor.offset(60); return o == 0 ? 0 : _accessor.vector(count: o) }
testarrayofstring2null400 public func testarrayofstring2(at index: Int32) -> String? { let o = _accessor.offset(60); return o == 0 ? nil : _accessor.directString(at: _accessor.vector(at: o) + index * 4) }
401 public var testarrayofsortedstructCount: Int32 { let o = _accessor.offset(62); return o == 0 ? 0 : _accessor.vector(count: o) }
testarrayofsortedstructnull402 public func testarrayofsortedstruct(at index: Int32) -> MyGame.Example.Ability? { let o = _accessor.offset(62); return o == 0 ? nil : MyGame.Example.Ability(_accessor.bb, o: _accessor.vector(at: o) + index * 8) }
403 public var flexCount: Int32 { let o = _accessor.offset(64); return o == 0 ? 0 : _accessor.vector(count: o) }
flexnull404 public func flex(at index: Int32) -> UInt8 { let o = _accessor.offset(64); return o == 0 ? 0 : _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1) }
405 public var flex: [UInt8] { return _accessor.getVector(at: 64) ?? [] }
mutatenull406 public func mutate(flex: UInt8, at index: Int32) -> Bool { let o = _accessor.offset(64); return _accessor.directMutate(flex, index: _accessor.vector(at: o) + index * 1) }
407 public var test5Count: Int32 { let o = _accessor.offset(66); return o == 0 ? 0 : _accessor.vector(count: o) }
test5null408 public func test5(at index: Int32) -> MyGame.Example.Test? { let o = _accessor.offset(66); return o == 0 ? nil : MyGame.Example.Test(_accessor.bb, o: _accessor.vector(at: o) + index * 4) }
409 public var vectorOfLongsCount: Int32 { let o = _accessor.offset(68); return o == 0 ? 0 : _accessor.vector(count: o) }
vectorOfLongsnull410 public func vectorOfLongs(at index: Int32) -> Int64 { let o = _accessor.offset(68); return o == 0 ? 0 : _accessor.directRead(of: Int64.self, offset: _accessor.vector(at: o) + index * 8) }
411 public var vectorOfLongs: [Int64] { return _accessor.getVector(at: 68) ?? [] }
mutatenull412 public func mutate(vectorOfLongs: Int64, at index: Int32) -> Bool { let o = _accessor.offset(68); return _accessor.directMutate(vectorOfLongs, index: _accessor.vector(at: o) + index * 8) }
413 public var vectorOfDoublesCount: Int32 { let o = _accessor.offset(70); return o == 0 ? 0 : _accessor.vector(count: o) }
vectorOfDoublesnull414 public func vectorOfDoubles(at index: Int32) -> Double { let o = _accessor.offset(70); return o == 0 ? 0 : _accessor.directRead(of: Double.self, offset: _accessor.vector(at: o) + index * 8) }
415 public var vectorOfDoubles: [Double] { return _accessor.getVector(at: 70) ?? [] }
mutatenull416 public func mutate(vectorOfDoubles: Double, at index: Int32) -> Bool { let o = _accessor.offset(70); return _accessor.directMutate(vectorOfDoubles, index: _accessor.vector(at: o) + index * 8) }
417 public var parentNamespaceTest: MyGame.InParentNamespace? { let o = _accessor.offset(72); return o == 0 ? nil : MyGame.InParentNamespace(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) }
418 public var vectorOfReferrablesCount: Int32 { let o = _accessor.offset(74); return o == 0 ? 0 : _accessor.vector(count: o) }
vectorOfReferrablesnull419 public func vectorOfReferrables(at index: Int32) -> MyGame.Example.Referrable? { let o = _accessor.offset(74); return o == 0 ? nil : MyGame.Example.Referrable(_accessor.bb, o: _accessor.indirect(_accessor.vector(at: o) + index * 4)) }
vectorOfReferrablesBynull420 public func vectorOfReferrablesBy(key: UInt64) -> MyGame.Example.Referrable? { let o = _accessor.offset(74); return o == 0 ? nil : MyGame.Example.Referrable.lookupByKey(vector: _accessor.vector(at: o), key: key, fbb: _accessor.bb) }
421 public var singleWeakReference: UInt64 { let o = _accessor.offset(76); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
mutatenull422 public func mutate(singleWeakReference: UInt64) -> Bool {let o = _accessor.offset(76); return _accessor.mutate(singleWeakReference, index: o) }
423 public var vectorOfWeakReferencesCount: Int32 { let o = _accessor.offset(78); return o == 0 ? 0 : _accessor.vector(count: o) }
vectorOfWeakReferencesnull424 public func vectorOfWeakReferences(at index: Int32) -> UInt64 { let o = _accessor.offset(78); return o == 0 ? 0 : _accessor.directRead(of: UInt64.self, offset: _accessor.vector(at: o) + index * 8) }
425 public var vectorOfWeakReferences: [UInt64] { return _accessor.getVector(at: 78) ?? [] }
mutatenull426 public func mutate(vectorOfWeakReferences: UInt64, at index: Int32) -> Bool { let o = _accessor.offset(78); return _accessor.directMutate(vectorOfWeakReferences, index: _accessor.vector(at: o) + index * 8) }
427 public var vectorOfStrongReferrablesCount: Int32 { let o = _accessor.offset(80); return o == 0 ? 0 : _accessor.vector(count: o) }
vectorOfStrongReferrablesnull428 public func vectorOfStrongReferrables(at index: Int32) -> MyGame.Example.Referrable? { let o = _accessor.offset(80); return o == 0 ? nil : MyGame.Example.Referrable(_accessor.bb, o: _accessor.indirect(_accessor.vector(at: o) + index * 4)) }
vectorOfStrongReferrablesBynull429 public func vectorOfStrongReferrablesBy(key: UInt64) -> MyGame.Example.Referrable? { let o = _accessor.offset(80); return o == 0 ? nil : MyGame.Example.Referrable.lookupByKey(vector: _accessor.vector(at: o), key: key, fbb: _accessor.bb) }
430 public var coOwningReference: UInt64 { let o = _accessor.offset(82); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
mutatenull431 public func mutate(coOwningReference: UInt64) -> Bool {let o = _accessor.offset(82); return _accessor.mutate(coOwningReference, index: o) }
432 public var vectorOfCoOwningReferencesCount: Int32 { let o = _accessor.offset(84); return o == 0 ? 0 : _accessor.vector(count: o) }
vectorOfCoOwningReferencesnull433 public func vectorOfCoOwningReferences(at index: Int32) -> UInt64 { let o = _accessor.offset(84); return o == 0 ? 0 : _accessor.directRead(of: UInt64.self, offset: _accessor.vector(at: o) + index * 8) }
434 public var vectorOfCoOwningReferences: [UInt64] { return _accessor.getVector(at: 84) ?? [] }
mutatenull435 public func mutate(vectorOfCoOwningReferences: UInt64, at index: Int32) -> Bool { let o = _accessor.offset(84); return _accessor.directMutate(vectorOfCoOwningReferences, index: _accessor.vector(at: o) + index * 8) }
436 public var nonOwningReference: UInt64 { let o = _accessor.offset(86); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
mutatenull437 public func mutate(nonOwningReference: UInt64) -> Bool {let o = _accessor.offset(86); return _accessor.mutate(nonOwningReference, index: o) }
438 public var vectorOfNonOwningReferencesCount: Int32 { let o = _accessor.offset(88); return o == 0 ? 0 : _accessor.vector(count: o) }
vectorOfNonOwningReferencesnull439 public func vectorOfNonOwningReferences(at index: Int32) -> UInt64 { let o = _accessor.offset(88); return o == 0 ? 0 : _accessor.directRead(of: UInt64.self, offset: _accessor.vector(at: o) + index * 8) }
440 public var vectorOfNonOwningReferences: [UInt64] { return _accessor.getVector(at: 88) ?? [] }
mutatenull441 public func mutate(vectorOfNonOwningReferences: UInt64, at index: Int32) -> Bool { let o = _accessor.offset(88); return _accessor.directMutate(vectorOfNonOwningReferences, index: _accessor.vector(at: o) + index * 8) }
442 public var anyUniqueType: MyGame.Example.AnyUniqueAliases { let o = _accessor.offset(90); return o == 0 ? .none : MyGame.Example.AnyUniqueAliases(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none }
anyUnique<T: FlatBufferObject>null443 public func anyUnique<T: FlatBufferObject>(type: T.Type) -> T? { let o = _accessor.offset(92); return o == 0 ? nil : _accessor.union(o) }
444 public var anyAmbiguousType: MyGame.Example.AnyAmbiguousAliases { let o = _accessor.offset(94); return o == 0 ? .none : MyGame.Example.AnyAmbiguousAliases(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none }
anyAmbiguous<T: FlatBufferObject>null445 public func anyAmbiguous<T: FlatBufferObject>(type: T.Type) -> T? { let o = _accessor.offset(96); return o == 0 ? nil : _accessor.union(o) }
446 public var vectorOfEnumsCount: Int32 { let o = _accessor.offset(98); return o == 0 ? 0 : _accessor.vector(count: o) }
vectorOfEnumsnull447 public func vectorOfEnums(at index: Int32) -> MyGame.Example.Color? { let o = _accessor.offset(98); return o == 0 ? MyGame.Example.Color.red : MyGame.Example.Color(rawValue: _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1)) }
448 public var signedEnum: MyGame.Example.Race { let o = _accessor.offset(100); return o == 0 ? .none : MyGame.Example.Race(rawValue: _accessor.readBuffer(of: Int8.self, at: o)) ?? .none }
mutatenull449 public func mutate(signedEnum: MyGame.Example.Race) -> Bool {let o = _accessor.offset(100); return _accessor.mutate(signedEnum.rawValue, index: o) }
startMonsternull450 public static func startMonster(_ fbb: FlatBufferBuilder) -> UOffset { fbb.startTable(with: 49) }
addnull451 public static func add(pos: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(structOffset: 0) }
addnull452 public static func add(mana: Int16, _ fbb: FlatBufferBuilder) { fbb.add(element: mana, def: 150, at: 1) }
addnull453 public static func add(hp: Int16, _ fbb: FlatBufferBuilder) { fbb.add(element: hp, def: 100, at: 2) }
addnull454 public static func add(name: Offset<String>, _ fbb: FlatBufferBuilder) { fbb.add(offset: name, at: 3) }
addVectorOfnull455 public static func addVectorOf(inventory: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: inventory, at: 5) }
addnull456 public static func add(color: MyGame.Example.Color, _ fbb: FlatBufferBuilder) { fbb.add(element: color.rawValue, def: 8, at: 6) }
addnull457 public static func add(testType: MyGame.Example.Any_, _ fbb: FlatBufferBuilder) { fbb.add(element: testType.rawValue, def: 0, at: 7) }
addnull458 public static func add(test: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: test, at: 8) }
addVectorOfnull459 public static func addVectorOf(test4: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: test4, at: 9) }
addVectorOfnull460 public static func addVectorOf(testarrayofstring: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: testarrayofstring, at: 10) }
addVectorOfnull461 public static func addVectorOf(testarrayoftables: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: testarrayoftables, at: 11) }
addnull462 public static func add(enemy: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: enemy, at: 12) }
addVectorOfnull463 public static func addVectorOf(testnestedflatbuffer: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: testnestedflatbuffer, at: 13) }
addnull464 public static func add(testempty: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: testempty, at: 14) }
addnull465 public static func add(testbool: Bool, _ fbb: FlatBufferBuilder) { fbb.add(condition: testbool, def: false, at: 15) }
addnull466 public static func add(testhashs32Fnv1: Int32, _ fbb: FlatBufferBuilder) { fbb.add(element: testhashs32Fnv1, def: 0, at: 16) }
addnull467 public static func add(testhashu32Fnv1: UInt32, _ fbb: FlatBufferBuilder) { fbb.add(element: testhashu32Fnv1, def: 0, at: 17) }
addnull468 public static func add(testhashs64Fnv1: Int64, _ fbb: FlatBufferBuilder) { fbb.add(element: testhashs64Fnv1, def: 0, at: 18) }
addnull469 public static func add(testhashu64Fnv1: UInt64, _ fbb: FlatBufferBuilder) { fbb.add(element: testhashu64Fnv1, def: 0, at: 19) }
addnull470 public static func add(testhashs32Fnv1a: Int32, _ fbb: FlatBufferBuilder) { fbb.add(element: testhashs32Fnv1a, def: 0, at: 20) }
addnull471 public static func add(testhashu32Fnv1a: UInt32, _ fbb: FlatBufferBuilder) { fbb.add(element: testhashu32Fnv1a, def: 0, at: 21) }
addnull472 public static func add(testhashs64Fnv1a: Int64, _ fbb: FlatBufferBuilder) { fbb.add(element: testhashs64Fnv1a, def: 0, at: 22) }
addnull473 public static func add(testhashu64Fnv1a: UInt64, _ fbb: FlatBufferBuilder) { fbb.add(element: testhashu64Fnv1a, def: 0, at: 23) }
addVectorOfnull474 public static func addVectorOf(testarrayofbools: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: testarrayofbools, at: 24) }
addnull475 public static func add(testf: Float32, _ fbb: FlatBufferBuilder) { fbb.add(element: testf, def: 3.14159, at: 25) }
addnull476 public static func add(testf2: Float32, _ fbb: FlatBufferBuilder) { fbb.add(element: testf2, def: 3.0, at: 26) }
addnull477 public static func add(testf3: Float32, _ fbb: FlatBufferBuilder) { fbb.add(element: testf3, def: 0.0, at: 27) }
addVectorOfnull478 public static func addVectorOf(testarrayofstring2: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: testarrayofstring2, at: 28) }
addVectorOfnull479 public static func addVectorOf(testarrayofsortedstruct: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: testarrayofsortedstruct, at: 29) }
addVectorOfnull480 public static func addVectorOf(flex: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: flex, at: 30) }
addVectorOfnull481 public static func addVectorOf(test5: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: test5, at: 31) }
addVectorOfnull482 public static func addVectorOf(vectorOfLongs: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: vectorOfLongs, at: 32) }
addVectorOfnull483 public static func addVectorOf(vectorOfDoubles: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: vectorOfDoubles, at: 33) }
addnull484 public static func add(parentNamespaceTest: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: parentNamespaceTest, at: 34) }
addVectorOfnull485 public static func addVectorOf(vectorOfReferrables: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: vectorOfReferrables, at: 35) }
addnull486 public static func add(singleWeakReference: UInt64, _ fbb: FlatBufferBuilder) { fbb.add(element: singleWeakReference, def: 0, at: 36) }
addVectorOfnull487 public static func addVectorOf(vectorOfWeakReferences: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: vectorOfWeakReferences, at: 37) }
addVectorOfnull488 public static func addVectorOf(vectorOfStrongReferrables: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: vectorOfStrongReferrables, at: 38) }
addnull489 public static func add(coOwningReference: UInt64, _ fbb: FlatBufferBuilder) { fbb.add(element: coOwningReference, def: 0, at: 39) }
addVectorOfnull490 public static func addVectorOf(vectorOfCoOwningReferences: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: vectorOfCoOwningReferences, at: 40) }
addnull491 public static func add(nonOwningReference: UInt64, _ fbb: FlatBufferBuilder) { fbb.add(element: nonOwningReference, def: 0, at: 41) }
addVectorOfnull492 public static func addVectorOf(vectorOfNonOwningReferences: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: vectorOfNonOwningReferences, at: 42) }
addnull493 public static func add(anyUniqueType: MyGame.Example.AnyUniqueAliases, _ fbb: FlatBufferBuilder) { fbb.add(element: anyUniqueType.rawValue, def: 0, at: 43) }
addnull494 public static func add(anyUnique: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: anyUnique, at: 44) }
addnull495 public static func add(anyAmbiguousType: MyGame.Example.AnyAmbiguousAliases, _ fbb: FlatBufferBuilder) { fbb.add(element: anyAmbiguousType.rawValue, def: 0, at: 45) }
addnull496 public static func add(anyAmbiguous: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: anyAmbiguous, at: 46) }
addVectorOfnull497 public static func addVectorOf(vectorOfEnums: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: vectorOfEnums, at: 47) }
addnull498 public static func add(signedEnum: MyGame.Example.Race, _ fbb: FlatBufferBuilder) { fbb.add(element: signedEnum.rawValue, def: -1, at: 48) }
endMonsternull499 public static func endMonster(_ fbb: FlatBufferBuilder, start: UOffset) -> Offset<UOffset> { let end = Offset<UOffset>(offset: fbb.endTable(at: start)); fbb.require(table: end, fields: [10]); return end }
500 public static func createMonster(_ fbb: FlatBufferBuilder,
501 offsetOfPos pos: Offset<UOffset> = Offset(),
502 mana: Int16 = 150,
503 hp: Int16 = 100,
504 offsetOfName name: Offset<String> = Offset(),
505 vectorOfInventory inventory: Offset<UOffset> = Offset(),
506 color: MyGame.Example.Color = .blue,
507 testType: MyGame.Example.Any_ = .none,
508 offsetOfTest test: Offset<UOffset> = Offset(),
509 vectorOfTest4 test4: Offset<UOffset> = Offset(),
510 vectorOfTestarrayofstring testarrayofstring: Offset<UOffset> = Offset(),
511 vectorOfTestarrayoftables testarrayoftables: Offset<UOffset> = Offset(),
512 offsetOfEnemy enemy: Offset<UOffset> = Offset(),
513 vectorOfTestnestedflatbuffer testnestedflatbuffer: Offset<UOffset> = Offset(),
514 offsetOfTestempty testempty: Offset<UOffset> = Offset(),
515 testbool: Bool = false,
516 testhashs32Fnv1: Int32 = 0,
517 testhashu32Fnv1: UInt32 = 0,
518 testhashs64Fnv1: Int64 = 0,
519 testhashu64Fnv1: UInt64 = 0,
520 testhashs32Fnv1a: Int32 = 0,
521 testhashu32Fnv1a: UInt32 = 0,
522 testhashs64Fnv1a: Int64 = 0,
523 testhashu64Fnv1a: UInt64 = 0,
524 vectorOfTestarrayofbools testarrayofbools: Offset<UOffset> = Offset(),
525 testf: Float32 = 3.14159,
526 testf2: Float32 = 3.0,
527 testf3: Float32 = 0.0,
528 vectorOfTestarrayofstring2 testarrayofstring2: Offset<UOffset> = Offset(),
529 vectorOfTestarrayofsortedstruct testarrayofsortedstruct: Offset<UOffset> = Offset(),
530 vectorOfFlex flex: Offset<UOffset> = Offset(),
531 vectorOfTest5 test5: Offset<UOffset> = Offset(),
532 vectorOfVectorOfLongs vectorOfLongs: Offset<UOffset> = Offset(),
533 vectorOfVectorOfDoubles vectorOfDoubles: Offset<UOffset> = Offset(),
534 offsetOfParentNamespaceTest parentNamespaceTest: Offset<UOffset> = Offset(),
535 vectorOfVectorOfReferrables vectorOfReferrables: Offset<UOffset> = Offset(),
536 singleWeakReference: UInt64 = 0,
537 vectorOfVectorOfWeakReferences vectorOfWeakReferences: Offset<UOffset> = Offset(),
538 vectorOfVectorOfStrongReferrables vectorOfStrongReferrables: Offset<UOffset> = Offset(),
539 coOwningReference: UInt64 = 0,
540 vectorOfVectorOfCoOwningReferences vectorOfCoOwningReferences: Offset<UOffset> = Offset(),
541 nonOwningReference: UInt64 = 0,
542 vectorOfVectorOfNonOwningReferences vectorOfNonOwningReferences: Offset<UOffset> = Offset(),
543 anyUniqueType: MyGame.Example.AnyUniqueAliases = .none,
544 offsetOfAnyUnique anyUnique: Offset<UOffset> = Offset(),
545 anyAmbiguousType: MyGame.Example.AnyAmbiguousAliases = .none,
546 offsetOfAnyAmbiguous anyAmbiguous: Offset<UOffset> = Offset(),
547 vectorOfVectorOfEnums vectorOfEnums: Offset<UOffset> = Offset(),
548 signedEnum: MyGame.Example.Race = .none) -> Offset<UOffset> {
549 let __start = Monster.startMonster(fbb)
550 Monster.add(pos: pos, fbb)
551 Monster.add(mana: mana, fbb)
552 Monster.add(hp: hp, fbb)
553 Monster.add(name: name, fbb)
554 Monster.addVectorOf(inventory: inventory, fbb)
555 Monster.add(color: color, fbb)
556 Monster.add(testType: testType, fbb)
557 Monster.add(test: test, fbb)
558 Monster.addVectorOf(test4: test4, fbb)
559 Monster.addVectorOf(testarrayofstring: testarrayofstring, fbb)
560 Monster.addVectorOf(testarrayoftables: testarrayoftables, fbb)
561 Monster.add(enemy: enemy, fbb)
562 Monster.addVectorOf(testnestedflatbuffer: testnestedflatbuffer, fbb)
563 Monster.add(testempty: testempty, fbb)
564 Monster.add(testbool: testbool, fbb)
565 Monster.add(testhashs32Fnv1: testhashs32Fnv1, fbb)
566 Monster.add(testhashu32Fnv1: testhashu32Fnv1, fbb)
567 Monster.add(testhashs64Fnv1: testhashs64Fnv1, fbb)
568 Monster.add(testhashu64Fnv1: testhashu64Fnv1, fbb)
569 Monster.add(testhashs32Fnv1a: testhashs32Fnv1a, fbb)
570 Monster.add(testhashu32Fnv1a: testhashu32Fnv1a, fbb)
571 Monster.add(testhashs64Fnv1a: testhashs64Fnv1a, fbb)
572 Monster.add(testhashu64Fnv1a: testhashu64Fnv1a, fbb)
573 Monster.addVectorOf(testarrayofbools: testarrayofbools, fbb)
574 Monster.add(testf: testf, fbb)
575 Monster.add(testf2: testf2, fbb)
576 Monster.add(testf3: testf3, fbb)
577 Monster.addVectorOf(testarrayofstring2: testarrayofstring2, fbb)
578 Monster.addVectorOf(testarrayofsortedstruct: testarrayofsortedstruct, fbb)
579 Monster.addVectorOf(flex: flex, fbb)
580 Monster.addVectorOf(test5: test5, fbb)
581 Monster.addVectorOf(vectorOfLongs: vectorOfLongs, fbb)
582 Monster.addVectorOf(vectorOfDoubles: vectorOfDoubles, fbb)
583 Monster.add(parentNamespaceTest: parentNamespaceTest, fbb)
584 Monster.addVectorOf(vectorOfReferrables: vectorOfReferrables, fbb)
585 Monster.add(singleWeakReference: singleWeakReference, fbb)
586 Monster.addVectorOf(vectorOfWeakReferences: vectorOfWeakReferences, fbb)
587 Monster.addVectorOf(vectorOfStrongReferrables: vectorOfStrongReferrables, fbb)
588 Monster.add(coOwningReference: coOwningReference, fbb)
589 Monster.addVectorOf(vectorOfCoOwningReferences: vectorOfCoOwningReferences, fbb)
590 Monster.add(nonOwningReference: nonOwningReference, fbb)
591 Monster.addVectorOf(vectorOfNonOwningReferences: vectorOfNonOwningReferences, fbb)
592 Monster.add(anyUniqueType: anyUniqueType, fbb)
593 Monster.add(anyUnique: anyUnique, fbb)
594 Monster.add(anyAmbiguousType: anyAmbiguousType, fbb)
595 Monster.add(anyAmbiguous: anyAmbiguous, fbb)
596 Monster.addVectorOf(vectorOfEnums: vectorOfEnums, fbb)
597 Monster.add(signedEnum: signedEnum, fbb)
598 return Monster.endMonster(fbb, start: __start)
599 }
sortVectorOfMonsternull600 public static func sortVectorOfMonster(offsets:[Offset<UOffset>], _ fbb: FlatBufferBuilder) -> Offset<UOffset> {
601 var off = offsets
602 off.sort { Table.compare(Table.offset(Int32($1.o), vOffset: 10, fbb: fbb.buffer), Table.offset(Int32($0.o), vOffset: 10, fbb: fbb.buffer), fbb: fbb.buffer) < 0 }
603 return fbb.createVector(ofOffsets: off)
604 }
lookupByKeynull605 fileprivate static func lookupByKey(vector: Int32, key: String, fbb: ByteBuffer) -> Monster? {
606 let key = key.utf8.map { $0 }
607 var span = fbb.read(def: Int32.self, position: Int(vector - 4))
608 var start: Int32 = 0
609 while span != 0 {
610 var middle = span / 2
611 let tableOffset = Table.indirect(vector + 4 * (start + middle), fbb)
612 let comp = Table.compare(Table.offset(Int32(fbb.capacity) - tableOffset, vOffset: 10, fbb: fbb), key, fbb: fbb)
613 if comp > 0 {
614 span = middle
615 } else if comp < 0 {
616 middle += 1
617 start += middle
618 span -= middle
619 } else {
620 return Monster(fbb, o: tableOffset)
621 }
622 }
623 return nil
624 }
625 }
626
627 public struct TypeAliases: FlatBufferObject {
628
validateVersionnull629 static func validateVersion() { FlatBuffersVersion_1_12_0() }
630 public var __buffer: ByteBuffer! { return _accessor.bb }
631
632 private var _accessor: Table
finishnull633 public static func finish(_ fbb: FlatBufferBuilder, end: Offset<UOffset>, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
getRootAsTypeAliasesnull634 public static func getRootAsTypeAliases(bb: ByteBuffer) -> TypeAliases { return TypeAliases(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
635
636 private init(_ t: Table) { _accessor = t }
637 public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) }
638
639 public var i8: Int8 { let o = _accessor.offset(4); return o == 0 ? 0 : _accessor.readBuffer(of: Int8.self, at: o) }
mutatenull640 public func mutate(i8: Int8) -> Bool {let o = _accessor.offset(4); return _accessor.mutate(i8, index: o) }
641 public var u8: UInt8 { let o = _accessor.offset(6); return o == 0 ? 0 : _accessor.readBuffer(of: UInt8.self, at: o) }
mutatenull642 public func mutate(u8: UInt8) -> Bool {let o = _accessor.offset(6); return _accessor.mutate(u8, index: o) }
643 public var i16: Int16 { let o = _accessor.offset(8); return o == 0 ? 0 : _accessor.readBuffer(of: Int16.self, at: o) }
mutatenull644 public func mutate(i16: Int16) -> Bool {let o = _accessor.offset(8); return _accessor.mutate(i16, index: o) }
645 public var u16: UInt16 { let o = _accessor.offset(10); return o == 0 ? 0 : _accessor.readBuffer(of: UInt16.self, at: o) }
mutatenull646 public func mutate(u16: UInt16) -> Bool {let o = _accessor.offset(10); return _accessor.mutate(u16, index: o) }
647 public var i32: Int32 { let o = _accessor.offset(12); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) }
mutatenull648 public func mutate(i32: Int32) -> Bool {let o = _accessor.offset(12); return _accessor.mutate(i32, index: o) }
649 public var u32: UInt32 { let o = _accessor.offset(14); return o == 0 ? 0 : _accessor.readBuffer(of: UInt32.self, at: o) }
mutatenull650 public func mutate(u32: UInt32) -> Bool {let o = _accessor.offset(14); return _accessor.mutate(u32, index: o) }
651 public var i64: Int64 { let o = _accessor.offset(16); return o == 0 ? 0 : _accessor.readBuffer(of: Int64.self, at: o) }
mutatenull652 public func mutate(i64: Int64) -> Bool {let o = _accessor.offset(16); return _accessor.mutate(i64, index: o) }
653 public var u64: UInt64 { let o = _accessor.offset(18); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
mutatenull654 public func mutate(u64: UInt64) -> Bool {let o = _accessor.offset(18); return _accessor.mutate(u64, index: o) }
655 public var f32: Float32 { let o = _accessor.offset(20); return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o) }
mutatenull656 public func mutate(f32: Float32) -> Bool {let o = _accessor.offset(20); return _accessor.mutate(f32, index: o) }
657 public var f64: Double { let o = _accessor.offset(22); return o == 0 ? 0.0 : _accessor.readBuffer(of: Double.self, at: o) }
mutatenull658 public func mutate(f64: Double) -> Bool {let o = _accessor.offset(22); return _accessor.mutate(f64, index: o) }
659 public var v8Count: Int32 { let o = _accessor.offset(24); return o == 0 ? 0 : _accessor.vector(count: o) }
v8null660 public func v8(at index: Int32) -> Int8 { let o = _accessor.offset(24); return o == 0 ? 0 : _accessor.directRead(of: Int8.self, offset: _accessor.vector(at: o) + index * 1) }
661 public var v8: [Int8] { return _accessor.getVector(at: 24) ?? [] }
mutatenull662 public func mutate(v8: Int8, at index: Int32) -> Bool { let o = _accessor.offset(24); return _accessor.directMutate(v8, index: _accessor.vector(at: o) + index * 1) }
663 public var vf64Count: Int32 { let o = _accessor.offset(26); return o == 0 ? 0 : _accessor.vector(count: o) }
vf64null664 public func vf64(at index: Int32) -> Double { let o = _accessor.offset(26); return o == 0 ? 0 : _accessor.directRead(of: Double.self, offset: _accessor.vector(at: o) + index * 8) }
665 public var vf64: [Double] { return _accessor.getVector(at: 26) ?? [] }
mutatenull666 public func mutate(vf64: Double, at index: Int32) -> Bool { let o = _accessor.offset(26); return _accessor.directMutate(vf64, index: _accessor.vector(at: o) + index * 8) }
startTypeAliasesnull667 public static func startTypeAliases(_ fbb: FlatBufferBuilder) -> UOffset { fbb.startTable(with: 12) }
addnull668 public static func add(i8: Int8, _ fbb: FlatBufferBuilder) { fbb.add(element: i8, def: 0, at: 0) }
addnull669 public static func add(u8: UInt8, _ fbb: FlatBufferBuilder) { fbb.add(element: u8, def: 0, at: 1) }
addnull670 public static func add(i16: Int16, _ fbb: FlatBufferBuilder) { fbb.add(element: i16, def: 0, at: 2) }
addnull671 public static func add(u16: UInt16, _ fbb: FlatBufferBuilder) { fbb.add(element: u16, def: 0, at: 3) }
addnull672 public static func add(i32: Int32, _ fbb: FlatBufferBuilder) { fbb.add(element: i32, def: 0, at: 4) }
addnull673 public static func add(u32: UInt32, _ fbb: FlatBufferBuilder) { fbb.add(element: u32, def: 0, at: 5) }
addnull674 public static func add(i64: Int64, _ fbb: FlatBufferBuilder) { fbb.add(element: i64, def: 0, at: 6) }
addnull675 public static func add(u64: UInt64, _ fbb: FlatBufferBuilder) { fbb.add(element: u64, def: 0, at: 7) }
addnull676 public static func add(f32: Float32, _ fbb: FlatBufferBuilder) { fbb.add(element: f32, def: 0.0, at: 8) }
addnull677 public static func add(f64: Double, _ fbb: FlatBufferBuilder) { fbb.add(element: f64, def: 0.0, at: 9) }
addVectorOfnull678 public static func addVectorOf(v8: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: v8, at: 10) }
addVectorOfnull679 public static func addVectorOf(vf64: Offset<UOffset>, _ fbb: FlatBufferBuilder) { fbb.add(offset: vf64, at: 11) }
endTypeAliasesnull680 public static func endTypeAliases(_ fbb: FlatBufferBuilder, start: UOffset) -> Offset<UOffset> { let end = Offset<UOffset>(offset: fbb.endTable(at: start)); return end }
681 public static func createTypeAliases(_ fbb: FlatBufferBuilder,
682 i8: Int8 = 0,
683 u8: UInt8 = 0,
684 i16: Int16 = 0,
685 u16: UInt16 = 0,
686 i32: Int32 = 0,
687 u32: UInt32 = 0,
688 i64: Int64 = 0,
689 u64: UInt64 = 0,
690 f32: Float32 = 0.0,
691 f64: Double = 0.0,
692 vectorOfV8 v8: Offset<UOffset> = Offset(),
693 vectorOfVf64 vf64: Offset<UOffset> = Offset()) -> Offset<UOffset> {
694 let __start = TypeAliases.startTypeAliases(fbb)
695 TypeAliases.add(i8: i8, fbb)
696 TypeAliases.add(u8: u8, fbb)
697 TypeAliases.add(i16: i16, fbb)
698 TypeAliases.add(u16: u16, fbb)
699 TypeAliases.add(i32: i32, fbb)
700 TypeAliases.add(u32: u32, fbb)
701 TypeAliases.add(i64: i64, fbb)
702 TypeAliases.add(u64: u64, fbb)
703 TypeAliases.add(f32: f32, fbb)
704 TypeAliases.add(f64: f64, fbb)
705 TypeAliases.addVectorOf(v8: v8, fbb)
706 TypeAliases.addVectorOf(vf64: vf64, fbb)
707 return TypeAliases.endTypeAliases(fbb, start: __start)
708 }
709 }
710
711 }
712
713 // MARK: - Example
714
715
716 // MARK: - MyGame
717
718
719