Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame^] | 1 | // automatically generated by the FlatBuffers compiler, do not modify |
| 2 | import * as flatbuffers from 'flatbuffers'; |
| 3 | import { KeyValue } from '../reflection/key-value.js'; |
| 4 | import { RPCCall } from '../reflection/rpccall.js'; |
| 5 | export class Service { |
| 6 | constructor() { |
| 7 | this.bb = null; |
| 8 | this.bb_pos = 0; |
| 9 | } |
| 10 | __init(i, bb) { |
| 11 | this.bb_pos = i; |
| 12 | this.bb = bb; |
| 13 | return this; |
| 14 | } |
| 15 | static getRootAsService(bb, obj) { |
| 16 | return (obj || new Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 17 | } |
| 18 | static getSizePrefixedRootAsService(bb, obj) { |
| 19 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); |
| 20 | return (obj || new Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 21 | } |
| 22 | name(optionalEncoding) { |
| 23 | const offset = this.bb.__offset(this.bb_pos, 4); |
| 24 | return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; |
| 25 | } |
| 26 | calls(index, obj) { |
| 27 | const offset = this.bb.__offset(this.bb_pos, 6); |
| 28 | return offset ? (obj || new RPCCall()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; |
| 29 | } |
| 30 | callsLength() { |
| 31 | const offset = this.bb.__offset(this.bb_pos, 6); |
| 32 | return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; |
| 33 | } |
| 34 | attributes(index, obj) { |
| 35 | const offset = this.bb.__offset(this.bb_pos, 8); |
| 36 | return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; |
| 37 | } |
| 38 | attributesLength() { |
| 39 | const offset = this.bb.__offset(this.bb_pos, 8); |
| 40 | return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; |
| 41 | } |
| 42 | documentation(index, optionalEncoding) { |
| 43 | const offset = this.bb.__offset(this.bb_pos, 10); |
| 44 | return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; |
| 45 | } |
| 46 | documentationLength() { |
| 47 | const offset = this.bb.__offset(this.bb_pos, 10); |
| 48 | return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; |
| 49 | } |
| 50 | declarationFile(optionalEncoding) { |
| 51 | const offset = this.bb.__offset(this.bb_pos, 12); |
| 52 | return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; |
| 53 | } |
| 54 | static getFullyQualifiedName() { |
| 55 | return 'reflection_Service'; |
| 56 | } |
| 57 | static startService(builder) { |
| 58 | builder.startObject(5); |
| 59 | } |
| 60 | static addName(builder, nameOffset) { |
| 61 | builder.addFieldOffset(0, nameOffset, 0); |
| 62 | } |
| 63 | static addCalls(builder, callsOffset) { |
| 64 | builder.addFieldOffset(1, callsOffset, 0); |
| 65 | } |
| 66 | static createCallsVector(builder, data) { |
| 67 | builder.startVector(4, data.length, 4); |
| 68 | for (let i = data.length - 1; i >= 0; i--) { |
| 69 | builder.addOffset(data[i]); |
| 70 | } |
| 71 | return builder.endVector(); |
| 72 | } |
| 73 | static startCallsVector(builder, numElems) { |
| 74 | builder.startVector(4, numElems, 4); |
| 75 | } |
| 76 | static addAttributes(builder, attributesOffset) { |
| 77 | builder.addFieldOffset(2, attributesOffset, 0); |
| 78 | } |
| 79 | static createAttributesVector(builder, data) { |
| 80 | builder.startVector(4, data.length, 4); |
| 81 | for (let i = data.length - 1; i >= 0; i--) { |
| 82 | builder.addOffset(data[i]); |
| 83 | } |
| 84 | return builder.endVector(); |
| 85 | } |
| 86 | static startAttributesVector(builder, numElems) { |
| 87 | builder.startVector(4, numElems, 4); |
| 88 | } |
| 89 | static addDocumentation(builder, documentationOffset) { |
| 90 | builder.addFieldOffset(3, documentationOffset, 0); |
| 91 | } |
| 92 | static createDocumentationVector(builder, data) { |
| 93 | builder.startVector(4, data.length, 4); |
| 94 | for (let i = data.length - 1; i >= 0; i--) { |
| 95 | builder.addOffset(data[i]); |
| 96 | } |
| 97 | return builder.endVector(); |
| 98 | } |
| 99 | static startDocumentationVector(builder, numElems) { |
| 100 | builder.startVector(4, numElems, 4); |
| 101 | } |
| 102 | static addDeclarationFile(builder, declarationFileOffset) { |
| 103 | builder.addFieldOffset(4, declarationFileOffset, 0); |
| 104 | } |
| 105 | static endService(builder) { |
| 106 | const offset = builder.endObject(); |
| 107 | builder.requiredField(offset, 4); // name |
| 108 | return offset; |
| 109 | } |
| 110 | static createService(builder, nameOffset, callsOffset, attributesOffset, documentationOffset, declarationFileOffset) { |
| 111 | Service.startService(builder); |
| 112 | Service.addName(builder, nameOffset); |
| 113 | Service.addCalls(builder, callsOffset); |
| 114 | Service.addAttributes(builder, attributesOffset); |
| 115 | Service.addDocumentation(builder, documentationOffset); |
| 116 | Service.addDeclarationFile(builder, declarationFileOffset); |
| 117 | return Service.endService(builder); |
| 118 | } |
| 119 | unpack() { |
| 120 | return new ServiceT(this.name(), this.bb.createObjList(this.calls.bind(this), this.callsLength()), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()), this.declarationFile()); |
| 121 | } |
| 122 | unpackTo(_o) { |
| 123 | _o.name = this.name(); |
| 124 | _o.calls = this.bb.createObjList(this.calls.bind(this), this.callsLength()); |
| 125 | _o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength()); |
| 126 | _o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()); |
| 127 | _o.declarationFile = this.declarationFile(); |
| 128 | } |
| 129 | } |
| 130 | export class ServiceT { |
| 131 | constructor(name = null, calls = [], attributes = [], documentation = [], declarationFile = null) { |
| 132 | this.name = name; |
| 133 | this.calls = calls; |
| 134 | this.attributes = attributes; |
| 135 | this.documentation = documentation; |
| 136 | this.declarationFile = declarationFile; |
| 137 | } |
| 138 | pack(builder) { |
| 139 | const name = (this.name !== null ? builder.createString(this.name) : 0); |
| 140 | const calls = Service.createCallsVector(builder, builder.createObjectOffsetList(this.calls)); |
| 141 | const attributes = Service.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes)); |
| 142 | const documentation = Service.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation)); |
| 143 | const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile) : 0); |
| 144 | return Service.createService(builder, name, calls, attributes, documentation, declarationFile); |
| 145 | } |
| 146 | } |