Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame^] | 1 | // automatically generated by the FlatBuffers compiler, do not modify |
| 2 | |
| 3 | import * as flatbuffers from 'flatbuffers'; |
| 4 | |
| 5 | import { KeyValue, KeyValueT } from '../reflection/key-value.js'; |
| 6 | import { RPCCall, RPCCallT } from '../reflection/rpccall.js'; |
| 7 | |
| 8 | |
| 9 | export class Service { |
| 10 | bb: flatbuffers.ByteBuffer|null = null; |
| 11 | bb_pos = 0; |
| 12 | __init(i:number, bb:flatbuffers.ByteBuffer):Service { |
| 13 | this.bb_pos = i; |
| 14 | this.bb = bb; |
| 15 | return this; |
| 16 | } |
| 17 | |
| 18 | static getRootAsService(bb:flatbuffers.ByteBuffer, obj?:Service):Service { |
| 19 | return (obj || new Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 20 | } |
| 21 | |
| 22 | static getSizePrefixedRootAsService(bb:flatbuffers.ByteBuffer, obj?:Service):Service { |
| 23 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); |
| 24 | return (obj || new Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 25 | } |
| 26 | |
| 27 | name():string|null |
| 28 | name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null |
| 29 | name(optionalEncoding?:any):string|Uint8Array|null { |
| 30 | const offset = this.bb!.__offset(this.bb_pos, 4); |
| 31 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; |
| 32 | } |
| 33 | |
| 34 | calls(index: number, obj?:RPCCall):RPCCall|null { |
| 35 | const offset = this.bb!.__offset(this.bb_pos, 6); |
| 36 | return offset ? (obj || new RPCCall()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; |
| 37 | } |
| 38 | |
| 39 | callsLength():number { |
| 40 | const offset = this.bb!.__offset(this.bb_pos, 6); |
| 41 | return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; |
| 42 | } |
| 43 | |
| 44 | attributes(index: number, obj?:KeyValue):KeyValue|null { |
| 45 | const offset = this.bb!.__offset(this.bb_pos, 8); |
| 46 | return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null; |
| 47 | } |
| 48 | |
| 49 | attributesLength():number { |
| 50 | const offset = this.bb!.__offset(this.bb_pos, 8); |
| 51 | return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; |
| 52 | } |
| 53 | |
| 54 | documentation(index: number):string |
| 55 | documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array |
| 56 | documentation(index: number,optionalEncoding?:any):string|Uint8Array|null { |
| 57 | const offset = this.bb!.__offset(this.bb_pos, 10); |
| 58 | return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; |
| 59 | } |
| 60 | |
| 61 | documentationLength():number { |
| 62 | const offset = this.bb!.__offset(this.bb_pos, 10); |
| 63 | return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * File that this Service is declared in. |
| 68 | */ |
| 69 | declarationFile():string|null |
| 70 | declarationFile(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null |
| 71 | declarationFile(optionalEncoding?:any):string|Uint8Array|null { |
| 72 | const offset = this.bb!.__offset(this.bb_pos, 12); |
| 73 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; |
| 74 | } |
| 75 | |
| 76 | static getFullyQualifiedName():string { |
| 77 | return 'reflection_Service'; |
| 78 | } |
| 79 | |
| 80 | static startService(builder:flatbuffers.Builder) { |
| 81 | builder.startObject(5); |
| 82 | } |
| 83 | |
| 84 | static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) { |
| 85 | builder.addFieldOffset(0, nameOffset, 0); |
| 86 | } |
| 87 | |
| 88 | static addCalls(builder:flatbuffers.Builder, callsOffset:flatbuffers.Offset) { |
| 89 | builder.addFieldOffset(1, callsOffset, 0); |
| 90 | } |
| 91 | |
| 92 | static createCallsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { |
| 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 | |
| 100 | static startCallsVector(builder:flatbuffers.Builder, numElems:number) { |
| 101 | builder.startVector(4, numElems, 4); |
| 102 | } |
| 103 | |
| 104 | static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) { |
| 105 | builder.addFieldOffset(2, attributesOffset, 0); |
| 106 | } |
| 107 | |
| 108 | static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { |
| 109 | builder.startVector(4, data.length, 4); |
| 110 | for (let i = data.length - 1; i >= 0; i--) { |
| 111 | builder.addOffset(data[i]!); |
| 112 | } |
| 113 | return builder.endVector(); |
| 114 | } |
| 115 | |
| 116 | static startAttributesVector(builder:flatbuffers.Builder, numElems:number) { |
| 117 | builder.startVector(4, numElems, 4); |
| 118 | } |
| 119 | |
| 120 | static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) { |
| 121 | builder.addFieldOffset(3, documentationOffset, 0); |
| 122 | } |
| 123 | |
| 124 | static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { |
| 125 | builder.startVector(4, data.length, 4); |
| 126 | for (let i = data.length - 1; i >= 0; i--) { |
| 127 | builder.addOffset(data[i]!); |
| 128 | } |
| 129 | return builder.endVector(); |
| 130 | } |
| 131 | |
| 132 | static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) { |
| 133 | builder.startVector(4, numElems, 4); |
| 134 | } |
| 135 | |
| 136 | static addDeclarationFile(builder:flatbuffers.Builder, declarationFileOffset:flatbuffers.Offset) { |
| 137 | builder.addFieldOffset(4, declarationFileOffset, 0); |
| 138 | } |
| 139 | |
| 140 | static endService(builder:flatbuffers.Builder):flatbuffers.Offset { |
| 141 | const offset = builder.endObject(); |
| 142 | builder.requiredField(offset, 4) // name |
| 143 | return offset; |
| 144 | } |
| 145 | |
| 146 | static createService(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, callsOffset:flatbuffers.Offset, attributesOffset:flatbuffers.Offset, documentationOffset:flatbuffers.Offset, declarationFileOffset:flatbuffers.Offset):flatbuffers.Offset { |
| 147 | Service.startService(builder); |
| 148 | Service.addName(builder, nameOffset); |
| 149 | Service.addCalls(builder, callsOffset); |
| 150 | Service.addAttributes(builder, attributesOffset); |
| 151 | Service.addDocumentation(builder, documentationOffset); |
| 152 | Service.addDeclarationFile(builder, declarationFileOffset); |
| 153 | return Service.endService(builder); |
| 154 | } |
| 155 | |
| 156 | unpack(): ServiceT { |
| 157 | return new ServiceT( |
| 158 | this.name(), |
| 159 | this.bb!.createObjList(this.calls.bind(this), this.callsLength()), |
| 160 | this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()), |
| 161 | this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()), |
| 162 | this.declarationFile() |
| 163 | ); |
| 164 | } |
| 165 | |
| 166 | |
| 167 | unpackTo(_o: ServiceT): void { |
| 168 | _o.name = this.name(); |
| 169 | _o.calls = this.bb!.createObjList(this.calls.bind(this), this.callsLength()); |
| 170 | _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()); |
| 171 | _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()); |
| 172 | _o.declarationFile = this.declarationFile(); |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | export class ServiceT { |
| 177 | constructor( |
| 178 | public name: string|Uint8Array|null = null, |
| 179 | public calls: (RPCCallT)[] = [], |
| 180 | public attributes: (KeyValueT)[] = [], |
| 181 | public documentation: (string)[] = [], |
| 182 | public declarationFile: string|Uint8Array|null = null |
| 183 | ){} |
| 184 | |
| 185 | |
| 186 | pack(builder:flatbuffers.Builder): flatbuffers.Offset { |
| 187 | const name = (this.name !== null ? builder.createString(this.name!) : 0); |
| 188 | const calls = Service.createCallsVector(builder, builder.createObjectOffsetList(this.calls)); |
| 189 | const attributes = Service.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes)); |
| 190 | const documentation = Service.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation)); |
| 191 | const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile!) : 0); |
| 192 | |
| 193 | return Service.createService(builder, |
| 194 | name, |
| 195 | calls, |
| 196 | attributes, |
| 197 | documentation, |
| 198 | declarationFile |
| 199 | ); |
| 200 | } |
| 201 | } |