blob: 96e92eb3f56b1f7d2cdab82b5d4390262957224d [file] [log] [blame]
Austin Schuh2dd86a92022-09-14 21:19:23 -07001// automatically generated by the FlatBuffers compiler, do not modify
2import * as flatbuffers from 'flatbuffers';
3import { KeyValue } from '../reflection/key-value.js';
4import { Object_ } from '../reflection/object.js';
5export class RPCCall {
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 getRootAsRPCCall(bb, obj) {
16 return (obj || new RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
17 }
18 static getSizePrefixedRootAsRPCCall(bb, obj) {
19 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
20 return (obj || new RPCCall()).__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 request(obj) {
27 const offset = this.bb.__offset(this.bb_pos, 6);
28 return offset ? (obj || new Object_()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
29 }
30 response(obj) {
31 const offset = this.bb.__offset(this.bb_pos, 8);
32 return offset ? (obj || new Object_()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
33 }
34 attributes(index, obj) {
35 const offset = this.bb.__offset(this.bb_pos, 10);
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, 10);
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, 12);
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, 12);
48 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
49 }
50 static getFullyQualifiedName() {
51 return 'reflection_RPCCall';
52 }
53 static startRPCCall(builder) {
54 builder.startObject(5);
55 }
56 static addName(builder, nameOffset) {
57 builder.addFieldOffset(0, nameOffset, 0);
58 }
59 static addRequest(builder, requestOffset) {
60 builder.addFieldOffset(1, requestOffset, 0);
61 }
62 static addResponse(builder, responseOffset) {
63 builder.addFieldOffset(2, responseOffset, 0);
64 }
65 static addAttributes(builder, attributesOffset) {
66 builder.addFieldOffset(3, attributesOffset, 0);
67 }
68 static createAttributesVector(builder, data) {
69 builder.startVector(4, data.length, 4);
70 for (let i = data.length - 1; i >= 0; i--) {
71 builder.addOffset(data[i]);
72 }
73 return builder.endVector();
74 }
75 static startAttributesVector(builder, numElems) {
76 builder.startVector(4, numElems, 4);
77 }
78 static addDocumentation(builder, documentationOffset) {
79 builder.addFieldOffset(4, documentationOffset, 0);
80 }
81 static createDocumentationVector(builder, data) {
82 builder.startVector(4, data.length, 4);
83 for (let i = data.length - 1; i >= 0; i--) {
84 builder.addOffset(data[i]);
85 }
86 return builder.endVector();
87 }
88 static startDocumentationVector(builder, numElems) {
89 builder.startVector(4, numElems, 4);
90 }
91 static endRPCCall(builder) {
92 const offset = builder.endObject();
93 builder.requiredField(offset, 4); // name
94 builder.requiredField(offset, 6); // request
95 builder.requiredField(offset, 8); // response
96 return offset;
97 }
98 unpack() {
99 return new RPCCallT(this.name(), (this.request() !== null ? this.request().unpack() : null), (this.response() !== null ? this.response().unpack() : null), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()));
100 }
101 unpackTo(_o) {
102 _o.name = this.name();
103 _o.request = (this.request() !== null ? this.request().unpack() : null);
104 _o.response = (this.response() !== null ? this.response().unpack() : null);
105 _o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
106 _o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
107 }
108}
109export class RPCCallT {
110 constructor(name = null, request = null, response = null, attributes = [], documentation = []) {
111 this.name = name;
112 this.request = request;
113 this.response = response;
114 this.attributes = attributes;
115 this.documentation = documentation;
116 }
117 pack(builder) {
118 const name = (this.name !== null ? builder.createString(this.name) : 0);
119 const request = (this.request !== null ? this.request.pack(builder) : 0);
120 const response = (this.response !== null ? this.response.pack(builder) : 0);
121 const attributes = RPCCall.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
122 const documentation = RPCCall.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
123 RPCCall.startRPCCall(builder);
124 RPCCall.addName(builder, name);
125 RPCCall.addRequest(builder, request);
126 RPCCall.addResponse(builder, response);
127 RPCCall.addAttributes(builder, attributes);
128 RPCCall.addDocumentation(builder, documentation);
129 return RPCCall.endRPCCall(builder);
130 }
131}