| 1 |
// automatically generated by the FlatBuffers compiler, do not modify |
| 2 |
|
| 3 |
import * as flatbuffers from 'flatbuffers'; |
| 4 |
|
| 5 |
import { OptionalByte } from '../optional-scalars/optional-byte'; |
| 6 |
|
| 7 |
|
| 8 |
export class ScalarStuff { |
| 9 |
bb: flatbuffers.ByteBuffer|null = null; |
| 10 |
bb_pos = 0; |
| 11 |
__init(i:number, bb:flatbuffers.ByteBuffer):ScalarStuff { |
| 12 |
this.bb_pos = i; |
| 13 |
this.bb = bb; |
| 14 |
return this; |
| 15 |
} |
| 16 |
|
| 17 |
static getRootAsScalarStuff(bb:flatbuffers.ByteBuffer, obj?:ScalarStuff):ScalarStuff { |
| 18 |
return (obj || new ScalarStuff()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 19 |
} |
| 20 |
|
| 21 |
static getSizePrefixedRootAsScalarStuff(bb:flatbuffers.ByteBuffer, obj?:ScalarStuff):ScalarStuff { |
| 22 |
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); |
| 23 |
return (obj || new ScalarStuff()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 24 |
} |
| 25 |
|
| 26 |
static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean { |
| 27 |
return bb.__has_identifier('NULL'); |
| 28 |
} |
| 29 |
|
| 30 |
justI8():number { |
| 31 |
const offset = this.bb!.__offset(this.bb_pos, 4); |
| 32 |
return offset ? this.bb!.readInt8(this.bb_pos + offset) : 0; |
| 33 |
} |
| 34 |
|
| 35 |
maybeI8():number|null { |
| 36 |
const offset = this.bb!.__offset(this.bb_pos, 6); |
| 37 |
return offset ? this.bb!.readInt8(this.bb_pos + offset) : null; |
| 38 |
} |
| 39 |
|
| 40 |
defaultI8():number { |
| 41 |
const offset = this.bb!.__offset(this.bb_pos, 8); |
| 42 |
return offset ? this.bb!.readInt8(this.bb_pos + offset) : 42; |
| 43 |
} |
| 44 |
|
| 45 |
justU8():number { |
| 46 |
const offset = this.bb!.__offset(this.bb_pos, 10); |
| 47 |
return offset ? this.bb!.readUint8(this.bb_pos + offset) : 0; |
| 48 |
} |
| 49 |
|
| 50 |
maybeU8():number|null { |
| 51 |
const offset = this.bb!.__offset(this.bb_pos, 12); |
| 52 |
return offset ? this.bb!.readUint8(this.bb_pos + offset) : null; |
| 53 |
} |
| 54 |
|
| 55 |
defaultU8():number { |
| 56 |
const offset = this.bb!.__offset(this.bb_pos, 14); |
| 57 |
return offset ? this.bb!.readUint8(this.bb_pos + offset) : 42; |
| 58 |
} |
| 59 |
|
| 60 |
justI16():number { |
| 61 |
const offset = this.bb!.__offset(this.bb_pos, 16); |
| 62 |
return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0; |
| 63 |
} |
| 64 |
|
| 65 |
maybeI16():number|null { |
| 66 |
const offset = this.bb!.__offset(this.bb_pos, 18); |
| 67 |
return offset ? this.bb!.readInt16(this.bb_pos + offset) : null; |
| 68 |
} |
| 69 |
|
| 70 |
defaultI16():number { |
| 71 |
const offset = this.bb!.__offset(this.bb_pos, 20); |
| 72 |
return offset ? this.bb!.readInt16(this.bb_pos + offset) : 42; |
| 73 |
} |
| 74 |
|
| 75 |
justU16():number { |
| 76 |
const offset = this.bb!.__offset(this.bb_pos, 22); |
| 77 |
return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0; |
| 78 |
} |
| 79 |
|
| 80 |
maybeU16():number|null { |
| 81 |
const offset = this.bb!.__offset(this.bb_pos, 24); |
| 82 |
return offset ? this.bb!.readUint16(this.bb_pos + offset) : null; |
| 83 |
} |
| 84 |
|
| 85 |
defaultU16():number { |
| 86 |
const offset = this.bb!.__offset(this.bb_pos, 26); |
| 87 |
return offset ? this.bb!.readUint16(this.bb_pos + offset) : 42; |
| 88 |
} |
| 89 |
|
| 90 |
justI32():number { |
| 91 |
const offset = this.bb!.__offset(this.bb_pos, 28); |
| 92 |
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; |
| 93 |
} |
| 94 |
|
| 95 |
maybeI32():number|null { |
| 96 |
const offset = this.bb!.__offset(this.bb_pos, 30); |
| 97 |
return offset ? this.bb!.readInt32(this.bb_pos + offset) : null; |
| 98 |
} |
| 99 |
|
| 100 |
defaultI32():number { |
| 101 |
const offset = this.bb!.__offset(this.bb_pos, 32); |
| 102 |
return offset ? this.bb!.readInt32(this.bb_pos + offset) : 42; |
| 103 |
} |
| 104 |
|
| 105 |
justU32():number { |
| 106 |
const offset = this.bb!.__offset(this.bb_pos, 34); |
| 107 |
return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0; |
| 108 |
} |
| 109 |
|
| 110 |
maybeU32():number|null { |
| 111 |
const offset = this.bb!.__offset(this.bb_pos, 36); |
| 112 |
return offset ? this.bb!.readUint32(this.bb_pos + offset) : null; |
| 113 |
} |
| 114 |
|
| 115 |
defaultU32():number { |
| 116 |
const offset = this.bb!.__offset(this.bb_pos, 38); |
| 117 |
return offset ? this.bb!.readUint32(this.bb_pos + offset) : 42; |
| 118 |
} |
| 119 |
|
| 120 |
justI64():bigint { |
| 121 |
const offset = this.bb!.__offset(this.bb_pos, 40); |
| 122 |
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); |
| 123 |
} |
| 124 |
|
| 125 |
maybeI64():bigint|null { |
| 126 |
const offset = this.bb!.__offset(this.bb_pos, 42); |
| 127 |
return offset ? this.bb!.readInt64(this.bb_pos + offset) : null; |
| 128 |
} |
| 129 |
|
| 130 |
defaultI64():bigint { |
| 131 |
const offset = this.bb!.__offset(this.bb_pos, 44); |
| 132 |
return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('42'); |
| 133 |
} |
| 134 |
|
| 135 |
justU64():bigint { |
| 136 |
const offset = this.bb!.__offset(this.bb_pos, 46); |
| 137 |
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0'); |
| 138 |
} |
| 139 |
|
| 140 |
maybeU64():bigint|null { |
| 141 |
const offset = this.bb!.__offset(this.bb_pos, 48); |
| 142 |
return offset ? this.bb!.readUint64(this.bb_pos + offset) : null; |
| 143 |
} |
| 144 |
|
| 145 |
defaultU64():bigint { |
| 146 |
const offset = this.bb!.__offset(this.bb_pos, 50); |
| 147 |
return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('42'); |
| 148 |
} |
| 149 |
|
| 150 |
justF32():number { |
| 151 |
const offset = this.bb!.__offset(this.bb_pos, 52); |
| 152 |
return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0; |
| 153 |
} |
| 154 |
|
| 155 |
maybeF32():number|null { |
| 156 |
const offset = this.bb!.__offset(this.bb_pos, 54); |
| 157 |
return offset ? this.bb!.readFloat32(this.bb_pos + offset) : null; |
| 158 |
} |
| 159 |
|
| 160 |
defaultF32():number { |
| 161 |
const offset = this.bb!.__offset(this.bb_pos, 56); |
| 162 |
return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 42.0; |
| 163 |
} |
| 164 |
|
| 165 |
justF64():number { |
| 166 |
const offset = this.bb!.__offset(this.bb_pos, 58); |
| 167 |
return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0; |
| 168 |
} |
| 169 |
|
| 170 |
maybeF64():number|null { |
| 171 |
const offset = this.bb!.__offset(this.bb_pos, 60); |
| 172 |
return offset ? this.bb!.readFloat64(this.bb_pos + offset) : null; |
| 173 |
} |
| 174 |
|
| 175 |
defaultF64():number { |
| 176 |
const offset = this.bb!.__offset(this.bb_pos, 62); |
| 177 |
return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 42.0; |
| 178 |
} |
| 179 |
|
| 180 |
justBool():boolean { |
| 181 |
const offset = this.bb!.__offset(this.bb_pos, 64); |
| 182 |
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; |
| 183 |
} |
| 184 |
|
| 185 |
maybeBool():boolean|null { |
| 186 |
const offset = this.bb!.__offset(this.bb_pos, 66); |
| 187 |
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : null; |
| 188 |
} |
| 189 |
|
| 190 |
defaultBool():boolean { |
| 191 |
const offset = this.bb!.__offset(this.bb_pos, 68); |
| 192 |
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : true; |
| 193 |
} |
| 194 |
|
| 195 |
justEnum():OptionalByte { |
| 196 |
const offset = this.bb!.__offset(this.bb_pos, 70); |
| 197 |
return offset ? this.bb!.readInt8(this.bb_pos + offset) : OptionalByte.None; |
| 198 |
} |
| 199 |
|
| 200 |
maybeEnum():OptionalByte|null { |
| 201 |
const offset = this.bb!.__offset(this.bb_pos, 72); |
| 202 |
return offset ? this.bb!.readInt8(this.bb_pos + offset) : null; |
| 203 |
} |
| 204 |
|
| 205 |
defaultEnum():OptionalByte { |
| 206 |
const offset = this.bb!.__offset(this.bb_pos, 74); |
| 207 |
return offset ? this.bb!.readInt8(this.bb_pos + offset) : OptionalByte.One; |
| 208 |
} |
| 209 |
|
| 210 |
static getFullyQualifiedName():string { |
| 211 |
return 'optional_scalars.ScalarStuff'; |
| 212 |
} |
| 213 |
|
| 214 |
static startScalarStuff(builder:flatbuffers.Builder) { |
| 215 |
builder.startObject(36); |
| 216 |
} |
| 217 |
|
| 218 |
static addJustI8(builder:flatbuffers.Builder, justI8:number) { |
| 219 |
builder.addFieldInt8(0, justI8, 0); |
| 220 |
} |
| 221 |
|
| 222 |
static addMaybeI8(builder:flatbuffers.Builder, maybeI8:number) { |
| 223 |
builder.addFieldInt8(1, maybeI8, 0); |
| 224 |
} |
| 225 |
|
| 226 |
static addDefaultI8(builder:flatbuffers.Builder, defaultI8:number) { |
| 227 |
builder.addFieldInt8(2, defaultI8, 42); |
| 228 |
} |
| 229 |
|
| 230 |
static addJustU8(builder:flatbuffers.Builder, justU8:number) { |
| 231 |
builder.addFieldInt8(3, justU8, 0); |
| 232 |
} |
| 233 |
|
| 234 |
static addMaybeU8(builder:flatbuffers.Builder, maybeU8:number) { |
| 235 |
builder.addFieldInt8(4, maybeU8, 0); |
| 236 |
} |
| 237 |
|
| 238 |
static addDefaultU8(builder:flatbuffers.Builder, defaultU8:number) { |
| 239 |
builder.addFieldInt8(5, defaultU8, 42); |
| 240 |
} |
| 241 |
|
| 242 |
static addJustI16(builder:flatbuffers.Builder, justI16:number) { |
| 243 |
builder.addFieldInt16(6, justI16, 0); |
| 244 |
} |
| 245 |
|
| 246 |
static addMaybeI16(builder:flatbuffers.Builder, maybeI16:number) { |
| 247 |
builder.addFieldInt16(7, maybeI16, 0); |
| 248 |
} |
| 249 |
|
| 250 |
static addDefaultI16(builder:flatbuffers.Builder, defaultI16:number) { |
| 251 |
builder.addFieldInt16(8, defaultI16, 42); |
| 252 |
} |
| 253 |
|
| 254 |
static addJustU16(builder:flatbuffers.Builder, justU16:number) { |
| 255 |
builder.addFieldInt16(9, justU16, 0); |
| 256 |
} |
| 257 |
|
| 258 |
static addMaybeU16(builder:flatbuffers.Builder, maybeU16:number) { |
| 259 |
builder.addFieldInt16(10, maybeU16, 0); |
| 260 |
} |
| 261 |
|
| 262 |
static addDefaultU16(builder:flatbuffers.Builder, defaultU16:number) { |
| 263 |
builder.addFieldInt16(11, defaultU16, 42); |
| 264 |
} |
| 265 |
|
| 266 |
static addJustI32(builder:flatbuffers.Builder, justI32:number) { |
| 267 |
builder.addFieldInt32(12, justI32, 0); |
| 268 |
} |
| 269 |
|
| 270 |
static addMaybeI32(builder:flatbuffers.Builder, maybeI32:number) { |
| 271 |
builder.addFieldInt32(13, maybeI32, 0); |
| 272 |
} |
| 273 |
|
| 274 |
static addDefaultI32(builder:flatbuffers.Builder, defaultI32:number) { |
| 275 |
builder.addFieldInt32(14, defaultI32, 42); |
| 276 |
} |
| 277 |
|
| 278 |
static addJustU32(builder:flatbuffers.Builder, justU32:number) { |
| 279 |
builder.addFieldInt32(15, justU32, 0); |
| 280 |
} |
| 281 |
|
| 282 |
static addMaybeU32(builder:flatbuffers.Builder, maybeU32:number) { |
| 283 |
builder.addFieldInt32(16, maybeU32, 0); |
| 284 |
} |
| 285 |
|
| 286 |
static addDefaultU32(builder:flatbuffers.Builder, defaultU32:number) { |
| 287 |
builder.addFieldInt32(17, defaultU32, 42); |
| 288 |
} |
| 289 |
|
| 290 |
static addJustI64(builder:flatbuffers.Builder, justI64:bigint) { |
| 291 |
builder.addFieldInt64(18, justI64, BigInt('0')); |
| 292 |
} |
| 293 |
|
| 294 |
static addMaybeI64(builder:flatbuffers.Builder, maybeI64:bigint) { |
| 295 |
builder.addFieldInt64(19, maybeI64, BigInt(0)); |
| 296 |
} |
| 297 |
|
| 298 |
static addDefaultI64(builder:flatbuffers.Builder, defaultI64:bigint) { |
| 299 |
builder.addFieldInt64(20, defaultI64, BigInt('42')); |
| 300 |
} |
| 301 |
|
| 302 |
static addJustU64(builder:flatbuffers.Builder, justU64:bigint) { |
| 303 |
builder.addFieldInt64(21, justU64, BigInt('0')); |
| 304 |
} |
| 305 |
|
| 306 |
static addMaybeU64(builder:flatbuffers.Builder, maybeU64:bigint) { |
| 307 |
builder.addFieldInt64(22, maybeU64, BigInt(0)); |
| 308 |
} |
| 309 |
|
| 310 |
static addDefaultU64(builder:flatbuffers.Builder, defaultU64:bigint) { |
| 311 |
builder.addFieldInt64(23, defaultU64, BigInt('42')); |
| 312 |
} |
| 313 |
|
| 314 |
static addJustF32(builder:flatbuffers.Builder, justF32:number) { |
| 315 |
builder.addFieldFloat32(24, justF32, 0.0); |
| 316 |
} |
| 317 |
|
| 318 |
static addMaybeF32(builder:flatbuffers.Builder, maybeF32:number) { |
| 319 |
builder.addFieldFloat32(25, maybeF32, 0); |
| 320 |
} |
| 321 |
|
| 322 |
static addDefaultF32(builder:flatbuffers.Builder, defaultF32:number) { |
| 323 |
builder.addFieldFloat32(26, defaultF32, 42.0); |
| 324 |
} |
| 325 |
|
| 326 |
static addJustF64(builder:flatbuffers.Builder, justF64:number) { |
| 327 |
builder.addFieldFloat64(27, justF64, 0.0); |
| 328 |
} |
| 329 |
|
| 330 |
static addMaybeF64(builder:flatbuffers.Builder, maybeF64:number) { |
| 331 |
builder.addFieldFloat64(28, maybeF64, 0); |
| 332 |
} |
| 333 |
|
| 334 |
static addDefaultF64(builder:flatbuffers.Builder, defaultF64:number) { |
| 335 |
builder.addFieldFloat64(29, defaultF64, 42.0); |
| 336 |
} |
| 337 |
|
| 338 |
static addJustBool(builder:flatbuffers.Builder, justBool:boolean) { |
| 339 |
builder.addFieldInt8(30, +justBool, +false); |
| 340 |
} |
| 341 |
|
| 342 |
static addMaybeBool(builder:flatbuffers.Builder, maybeBool:boolean) { |
| 343 |
builder.addFieldInt8(31, +maybeBool, 0); |
| 344 |
} |
| 345 |
|
| 346 |
static addDefaultBool(builder:flatbuffers.Builder, defaultBool:boolean) { |
| 347 |
builder.addFieldInt8(32, +defaultBool, +true); |
| 348 |
} |
| 349 |
|
| 350 |
static addJustEnum(builder:flatbuffers.Builder, justEnum:OptionalByte) { |
| 351 |
builder.addFieldInt8(33, justEnum, OptionalByte.None); |
| 352 |
} |
| 353 |
|
| 354 |
static addMaybeEnum(builder:flatbuffers.Builder, maybeEnum:OptionalByte) { |
| 355 |
builder.addFieldInt8(34, maybeEnum, 0); |
| 356 |
} |
| 357 |
|
| 358 |
static addDefaultEnum(builder:flatbuffers.Builder, defaultEnum:OptionalByte) { |
| 359 |
builder.addFieldInt8(35, defaultEnum, OptionalByte.One); |
| 360 |
} |
| 361 |
|
| 362 |
static endScalarStuff(builder:flatbuffers.Builder):flatbuffers.Offset { |
| 363 |
const offset = builder.endObject(); |
| 364 |
return offset; |
| 365 |
} |
| 366 |
|
| 367 |
static finishScalarStuffBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) { |
| 368 |
builder.finish(offset, 'NULL'); |
| 369 |
} |
| 370 |
|
| 371 |
static finishSizePrefixedScalarStuffBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) { |
| 372 |
builder.finish(offset, 'NULL', true); |
| 373 |
} |
| 374 |
|
| 375 |
static createScalarStuff(builder:flatbuffers.Builder, justI8:number, maybeI8:number|null, defaultI8:number, justU8:number, maybeU8:number|null, defaultU8:number, justI16:number, maybeI16:number|null, defaultI16:number, justU16:number, maybeU16:number|null, defaultU16:number, justI32:number, maybeI32:number|null, defaultI32:number, justU32:number, maybeU32:number|null, defaultU32:number, justI64:bigint, maybeI64:bigint|null, defaultI64:bigint, justU64:bigint, maybeU64:bigint|null, defaultU64:bigint, justF32:number, maybeF32:number|null, defaultF32:number, justF64:number, maybeF64:number|null, defaultF64:number, justBool:boolean, maybeBool:boolean|null, defaultBool:boolean, justEnum:OptionalByte, maybeEnum:OptionalByte|null, defaultEnum:OptionalByte):flatbuffers.Offset { |
| 376 |
ScalarStuff.startScalarStuff(builder); |
| 377 |
ScalarStuff.addJustI8(builder, justI8); |
| 378 |
if (maybeI8 !== null) |
| 379 |
ScalarStuff.addMaybeI8(builder, maybeI8); |
| 380 |
ScalarStuff.addDefaultI8(builder, defaultI8); |
| 381 |
ScalarStuff.addJustU8(builder, justU8); |
| 382 |
if (maybeU8 !== null) |
| 383 |
ScalarStuff.addMaybeU8(builder, maybeU8); |
| 384 |
ScalarStuff.addDefaultU8(builder, defaultU8); |
| 385 |
ScalarStuff.addJustI16(builder, justI16); |
| 386 |
if (maybeI16 !== null) |
| 387 |
ScalarStuff.addMaybeI16(builder, maybeI16); |
| 388 |
ScalarStuff.addDefaultI16(builder, defaultI16); |
| 389 |
ScalarStuff.addJustU16(builder, justU16); |
| 390 |
if (maybeU16 !== null) |
| 391 |
ScalarStuff.addMaybeU16(builder, maybeU16); |
| 392 |
ScalarStuff.addDefaultU16(builder, defaultU16); |
| 393 |
ScalarStuff.addJustI32(builder, justI32); |
| 394 |
if (maybeI32 !== null) |
| 395 |
ScalarStuff.addMaybeI32(builder, maybeI32); |
| 396 |
ScalarStuff.addDefaultI32(builder, defaultI32); |
| 397 |
ScalarStuff.addJustU32(builder, justU32); |
| 398 |
if (maybeU32 !== null) |
| 399 |
ScalarStuff.addMaybeU32(builder, maybeU32); |
| 400 |
ScalarStuff.addDefaultU32(builder, defaultU32); |
| 401 |
ScalarStuff.addJustI64(builder, justI64); |
| 402 |
if (maybeI64 !== null) |
| 403 |
ScalarStuff.addMaybeI64(builder, maybeI64); |
| 404 |
ScalarStuff.addDefaultI64(builder, defaultI64); |
| 405 |
ScalarStuff.addJustU64(builder, justU64); |
| 406 |
if (maybeU64 !== null) |
| 407 |
ScalarStuff.addMaybeU64(builder, maybeU64); |
| 408 |
ScalarStuff.addDefaultU64(builder, defaultU64); |
| 409 |
ScalarStuff.addJustF32(builder, justF32); |
| 410 |
if (maybeF32 !== null) |
| 411 |
ScalarStuff.addMaybeF32(builder, maybeF32); |
| 412 |
ScalarStuff.addDefaultF32(builder, defaultF32); |
| 413 |
ScalarStuff.addJustF64(builder, justF64); |
| 414 |
if (maybeF64 !== null) |
| 415 |
ScalarStuff.addMaybeF64(builder, maybeF64); |
| 416 |
ScalarStuff.addDefaultF64(builder, defaultF64); |
| 417 |
ScalarStuff.addJustBool(builder, justBool); |
| 418 |
if (maybeBool !== null) |
| 419 |
ScalarStuff.addMaybeBool(builder, maybeBool); |
| 420 |
ScalarStuff.addDefaultBool(builder, defaultBool); |
| 421 |
ScalarStuff.addJustEnum(builder, justEnum); |
| 422 |
if (maybeEnum !== null) |
| 423 |
ScalarStuff.addMaybeEnum(builder, maybeEnum); |
| 424 |
ScalarStuff.addDefaultEnum(builder, defaultEnum); |
| 425 |
return ScalarStuff.endScalarStuff(builder); |
| 426 |
} |
| 427 |
} |