* Declares the privileged instance members. * @private
()
| 154 | * @private |
| 155 | */ |
| 156 | function defineInstanceMembers() { |
| 157 | /** |
| 158 | * Sets the protocol version and the encoding/decoding methods depending on the protocol version |
| 159 | * @param {Number} value |
| 160 | * @ignore |
| 161 | * @internal |
| 162 | */ |
| 163 | this.setProtocolVersion = function (value) { |
| 164 | this.protocolVersion = value; |
| 165 | //Set the collection serialization based on the protocol version |
| 166 | this.decodeCollectionLength = decodeCollectionLengthV3; |
| 167 | this.getLengthBuffer = getLengthBufferV3; |
| 168 | this.collectionLengthSize = 4; |
| 169 | if (!types.protocolVersion.uses4BytesCollectionLength(this.protocolVersion)) { |
| 170 | this.decodeCollectionLength = decodeCollectionLengthV2; |
| 171 | this.getLengthBuffer = getLengthBufferV2; |
| 172 | this.collectionLengthSize = 2; |
| 173 | } |
| 174 | }; |
| 175 | |
| 176 | const customDecoders = { |
| 177 | [customTypeNames.duration]: decodeDuration, |
| 178 | [customTypeNames.lineString]: decodeLineString, |
| 179 | [customTypeNames.point]: decodePoint, |
| 180 | [customTypeNames.polygon]: decodePolygon, |
| 181 | [customTypeNames.dateRange]: decodeDateRange |
| 182 | }; |
| 183 | |
| 184 | const customEncoders = { |
| 185 | [customTypeNames.duration]: encodeDuration, |
| 186 | [customTypeNames.lineString]: encodeLineString, |
| 187 | [customTypeNames.point]: encodePoint, |
| 188 | [customTypeNames.polygon]: encodePolygon, |
| 189 | [customTypeNames.dateRange]: encodeDateRange |
| 190 | }; |
| 191 | |
| 192 | // Decoding methods |
| 193 | this.decodeBlob = function (bytes) { |
| 194 | return this.handleBuffer(bytes); |
| 195 | }; |
| 196 | |
| 197 | /** |
| 198 | * |
| 199 | * @param {Buffer} bytes |
| 200 | * @param {OtherCustomColumnInfo | VectorColumnInfo} columnInfo |
| 201 | */ |
| 202 | this.decodeCustom = function (bytes, columnInfo) { |
| 203 | |
| 204 | // Make sure we actually have something to process in typeName before we go any further |
| 205 | if (!columnInfo) { |
| 206 | return this.handleBuffer(bytes); |
| 207 | } |
| 208 | |
| 209 | // Special handling for vector custom types (since they have args) |
| 210 | if ('customTypeName' in columnInfo && columnInfo.customTypeName === 'vector') { |
| 211 | return this.decodeVector(bytes, columnInfo); |
| 212 | } |
| 213 |
nothing calls this directly
no test coverage detected