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 { Object_, Object_T } from '../reflection/object.js'; |
| 7 | |
| 8 | |
James Kuszmaul | 3b15b0c | 2022-11-08 14:03:16 -0800 | [diff] [blame^] | 9 | export class RPCCall implements flatbuffers.IUnpackableObject<RPCCallT> { |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 10 | bb: flatbuffers.ByteBuffer|null = null; |
| 11 | bb_pos = 0; |
| 12 | __init(i:number, bb:flatbuffers.ByteBuffer):RPCCall { |
| 13 | this.bb_pos = i; |
| 14 | this.bb = bb; |
| 15 | return this; |
| 16 | } |
| 17 | |
| 18 | static getRootAsRPCCall(bb:flatbuffers.ByteBuffer, obj?:RPCCall):RPCCall { |
| 19 | return (obj || new RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 20 | } |
| 21 | |
| 22 | static getSizePrefixedRootAsRPCCall(bb:flatbuffers.ByteBuffer, obj?:RPCCall):RPCCall { |
| 23 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); |
| 24 | return (obj || new RPCCall()).__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 | request(obj?:Object_):Object_|null { |
| 35 | const offset = this.bb!.__offset(this.bb_pos, 6); |
| 36 | return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; |
| 37 | } |
| 38 | |
| 39 | response(obj?:Object_):Object_|null { |
| 40 | const offset = this.bb!.__offset(this.bb_pos, 8); |
| 41 | return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; |
| 42 | } |
| 43 | |
| 44 | attributes(index: number, obj?:KeyValue):KeyValue|null { |
| 45 | const offset = this.bb!.__offset(this.bb_pos, 10); |
| 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, 10); |
| 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, 12); |
| 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, 12); |
| 63 | return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; |
| 64 | } |
| 65 | |
| 66 | static getFullyQualifiedName():string { |
| 67 | return 'reflection_RPCCall'; |
| 68 | } |
| 69 | |
| 70 | static startRPCCall(builder:flatbuffers.Builder) { |
| 71 | builder.startObject(5); |
| 72 | } |
| 73 | |
| 74 | static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) { |
| 75 | builder.addFieldOffset(0, nameOffset, 0); |
| 76 | } |
| 77 | |
| 78 | static addRequest(builder:flatbuffers.Builder, requestOffset:flatbuffers.Offset) { |
| 79 | builder.addFieldOffset(1, requestOffset, 0); |
| 80 | } |
| 81 | |
| 82 | static addResponse(builder:flatbuffers.Builder, responseOffset:flatbuffers.Offset) { |
| 83 | builder.addFieldOffset(2, responseOffset, 0); |
| 84 | } |
| 85 | |
| 86 | static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) { |
| 87 | builder.addFieldOffset(3, attributesOffset, 0); |
| 88 | } |
| 89 | |
| 90 | static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { |
| 91 | builder.startVector(4, data.length, 4); |
| 92 | for (let i = data.length - 1; i >= 0; i--) { |
| 93 | builder.addOffset(data[i]!); |
| 94 | } |
| 95 | return builder.endVector(); |
| 96 | } |
| 97 | |
| 98 | static startAttributesVector(builder:flatbuffers.Builder, numElems:number) { |
| 99 | builder.startVector(4, numElems, 4); |
| 100 | } |
| 101 | |
| 102 | static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) { |
| 103 | builder.addFieldOffset(4, documentationOffset, 0); |
| 104 | } |
| 105 | |
| 106 | static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset { |
| 107 | builder.startVector(4, data.length, 4); |
| 108 | for (let i = data.length - 1; i >= 0; i--) { |
| 109 | builder.addOffset(data[i]!); |
| 110 | } |
| 111 | return builder.endVector(); |
| 112 | } |
| 113 | |
| 114 | static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) { |
| 115 | builder.startVector(4, numElems, 4); |
| 116 | } |
| 117 | |
| 118 | static endRPCCall(builder:flatbuffers.Builder):flatbuffers.Offset { |
| 119 | const offset = builder.endObject(); |
| 120 | builder.requiredField(offset, 4) // name |
| 121 | builder.requiredField(offset, 6) // request |
| 122 | builder.requiredField(offset, 8) // response |
| 123 | return offset; |
| 124 | } |
| 125 | |
| 126 | |
| 127 | unpack(): RPCCallT { |
| 128 | return new RPCCallT( |
| 129 | this.name(), |
| 130 | (this.request() !== null ? this.request()!.unpack() : null), |
| 131 | (this.response() !== null ? this.response()!.unpack() : null), |
James Kuszmaul | 3b15b0c | 2022-11-08 14:03:16 -0800 | [diff] [blame^] | 132 | this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength()), |
| 133 | this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength()) |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 134 | ); |
| 135 | } |
| 136 | |
| 137 | |
| 138 | unpackTo(_o: RPCCallT): void { |
| 139 | _o.name = this.name(); |
| 140 | _o.request = (this.request() !== null ? this.request()!.unpack() : null); |
| 141 | _o.response = (this.response() !== null ? this.response()!.unpack() : null); |
James Kuszmaul | 3b15b0c | 2022-11-08 14:03:16 -0800 | [diff] [blame^] | 142 | _o.attributes = this.bb!.createObjList<KeyValue, KeyValueT>(this.attributes.bind(this), this.attributesLength()); |
| 143 | _o.documentation = this.bb!.createScalarList<string>(this.documentation.bind(this), this.documentationLength()); |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 144 | } |
| 145 | } |
| 146 | |
James Kuszmaul | 3b15b0c | 2022-11-08 14:03:16 -0800 | [diff] [blame^] | 147 | export class RPCCallT implements flatbuffers.IGeneratedObject { |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 148 | constructor( |
| 149 | public name: string|Uint8Array|null = null, |
| 150 | public request: Object_T|null = null, |
| 151 | public response: Object_T|null = null, |
| 152 | public attributes: (KeyValueT)[] = [], |
| 153 | public documentation: (string)[] = [] |
| 154 | ){} |
| 155 | |
| 156 | |
| 157 | pack(builder:flatbuffers.Builder): flatbuffers.Offset { |
| 158 | const name = (this.name !== null ? builder.createString(this.name!) : 0); |
| 159 | const request = (this.request !== null ? this.request!.pack(builder) : 0); |
| 160 | const response = (this.response !== null ? this.response!.pack(builder) : 0); |
| 161 | const attributes = RPCCall.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes)); |
| 162 | const documentation = RPCCall.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation)); |
| 163 | |
| 164 | RPCCall.startRPCCall(builder); |
| 165 | RPCCall.addName(builder, name); |
| 166 | RPCCall.addRequest(builder, request); |
| 167 | RPCCall.addResponse(builder, response); |
| 168 | RPCCall.addAttributes(builder, attributes); |
| 169 | RPCCall.addDocumentation(builder, documentation); |
| 170 | |
| 171 | return RPCCall.endRPCCall(builder); |
| 172 | } |
| 173 | } |