Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log(" CANNOT FIND ENCODE METHOD ON VARIANT !!! HELP",dataValue.toString());
}
dataValue.value.encode(stream);
}
// write statusCode
if (check_flag(encoding_mask, DataValueEncodingByte.StatusCode)) {
//ec.encodeUInt32(dataValue.statusCode.value,stream);
ec.encodeStatusCode(dataValue.statusCode,stream);
}
// write sourceTimestamp
if (check_flag(encoding_mask, DataValueEncodingByte.SourceTimestamp)) {
ec.encodeHighAccuracyDateTime(dataValue.sourceTimestamp,dataValue.sourcePicoseconds,stream);
}
// write sourcePicoseconds
if (check_flag(encoding_mask, DataValueEncodingByte.SourcePicoseconds)) {
assert(dataValue.sourcePicoseconds != null );
const sourcePicoseconds = Math.floor((dataValue.sourcePicoseconds % 100000) /10);
ec.encodeUInt16(sourcePicoseconds,stream);
}
// write serverTimestamp
if (check_flag(encoding_mask, DataValueEncodingByte.ServerTimestamp)) {
ec.encodeHighAccuracyDateTime(dataValue.serverTimestamp,dataValue.serverPicoseconds,stream);
}
// write serverPicoseconds
if (check_flag(encoding_mask, DataValueEncodingByte.ServerPicoseconds)) {
assert(dataValue.serverPicoseconds != null);
const serverPicoseconds = Math.floor((dataValue.serverPicoseconds % 100000 ) / 10) ; // we encode 10-pios
ec.encodeUInt16(serverPicoseconds,stream);
}
},
decode_debug: function(dataValue,stream,options) {
if (check_flag(encoding_mask, DataValueEncodingByte.StatusCode)) {
//ec.encodeUInt32(dataValue.statusCode.value,stream);
ec.encodeStatusCode(dataValue.statusCode,stream);
}
// write sourceTimestamp
if (check_flag(encoding_mask, DataValueEncodingByte.SourceTimestamp)) {
ec.encodeHighAccuracyDateTime(dataValue.sourceTimestamp,dataValue.sourcePicoseconds,stream);
}
// write sourcePicoseconds
if (check_flag(encoding_mask, DataValueEncodingByte.SourcePicoseconds)) {
assert(dataValue.sourcePicoseconds != null );
const sourcePicoseconds = Math.floor((dataValue.sourcePicoseconds % 100000) /10);
ec.encodeUInt16(sourcePicoseconds,stream);
}
// write serverTimestamp
if (check_flag(encoding_mask, DataValueEncodingByte.ServerTimestamp)) {
ec.encodeHighAccuracyDateTime(dataValue.serverTimestamp,dataValue.serverPicoseconds,stream);
}
// write serverPicoseconds
if (check_flag(encoding_mask, DataValueEncodingByte.ServerPicoseconds)) {
assert(dataValue.serverPicoseconds != null);
const serverPicoseconds = Math.floor((dataValue.serverPicoseconds % 100000 ) / 10) ; // we encode 10-pios
ec.encodeUInt16(serverPicoseconds,stream);
}
},
decode_debug: function(dataValue,stream,options) {
diagnosticInfo.locale = ec.decodeInt32(stream);
}
// read localized text
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.LocalizedText)) {
diagnosticInfo.localizedText = ec.decodeInt32(stream);
}
// read additional info
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.AdditionalInfo)) {
diagnosticInfo.additionalInfo = ec.decodeString(stream);
}
// read inner status code
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.InnerStatusCode)) {
diagnosticInfo.innerStatusCode = ec.decodeStatusCode(stream);
}
// read inner status code
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.InnerDiagnosticInfo)) {
const DiagnosticInfo = require("../_generated_/_auto_generated_DiagnosticInfo").DiagnosticInfo;
diagnosticInfo.innerDiagnosticInfo = new DiagnosticInfo({});
diagnosticInfo.innerDiagnosticInfo.decode(stream, options);
}
}
};
encode: function (diagnosticInfo, stream) {
const encoding_mask = getDiagnosticInfoEncodingByte(diagnosticInfo);
// write encoding byte
ec.encodeByte(encoding_mask, stream);
// write symbolic id
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.SymbolicId)) {
ec.encodeInt32(diagnosticInfo.symbolicId, stream);
}
// write namespace uri
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.NamespaceUri)) {
ec.encodeInt32(diagnosticInfo.namespaceUri, stream);
}
// write locale
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.Locale)) {
ec.encodeInt32(diagnosticInfo.locale, stream);
}
// write localized text
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.LocalizedText)) {
ec.encodeInt32(diagnosticInfo.localizedText, stream);
}
// write additional info
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.AdditionalInfo)) {
cursor_before = stream.length;
// read symbolic id
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.SymbolicId)) {
diagnosticInfo.symbolicId = ec.decodeInt32(stream);
tracer.trace("member", "symbolicId", diagnosticInfo.symbolicId, cursor_before, stream.length, "Int32");
cursor_before = stream.length;
}
// read namespace uri
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.NamespaceUri)) {
diagnosticInfo.namespaceUri = ec.decodeInt32(stream);
tracer.trace("member", "symbolicId", diagnosticInfo.namespaceUri, cursor_before, stream.length, "Int32");
cursor_before = stream.length;
}
// read locale
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.Locale)) {
diagnosticInfo.locale = ec.decodeInt32(stream);
tracer.trace("member", "locale", diagnosticInfo.locale, cursor_before, stream.length, "Int32");
cursor_before = stream.length;
}
// read localized text
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.LocalizedText)) {
diagnosticInfo.localizedText = ec.decodeInt32(stream);
tracer.trace("member", "localizedText", diagnosticInfo.localizedText, cursor_before, stream.length, "Int32");
cursor_before = stream.length;
}
// read additional info
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.AdditionalInfo)) {
diagnosticInfo.additionalInfo = ec.decodeString(stream);
tracer.trace("member", "additionalInfo", diagnosticInfo.additionalInfo, cursor_before, stream.length, "String");
cursor_before = stream.length;
}
ec.encodeInt32(diagnosticInfo.namespaceUri, stream);
}
// write locale
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.Locale)) {
ec.encodeInt32(diagnosticInfo.locale, stream);
}
// write localized text
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.LocalizedText)) {
ec.encodeInt32(diagnosticInfo.localizedText, stream);
}
// write additional info
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.AdditionalInfo)) {
ec.encodeString(diagnosticInfo.additionalInfo, stream);
}
// write inner status code
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.InnerStatusCode)) {
ec.encodeStatusCode(diagnosticInfo.innerStatusCode, stream);
}
// write innerDiagnosticInfo
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.InnerDiagnosticInfo)) {
assert(diagnosticInfo.innerDiagnosticInfo !== null && "missing innerDiagnosticInfo");
diagnosticInfo.innerDiagnosticInfo.encode(stream);
}
},
const encoding_mask = getDiagnosticInfoEncodingByte(diagnosticInfo);
// write encoding byte
ec.encodeByte(encoding_mask, stream);
// write symbolic id
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.SymbolicId)) {
ec.encodeInt32(diagnosticInfo.symbolicId, stream);
}
// write namespace uri
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.NamespaceUri)) {
ec.encodeInt32(diagnosticInfo.namespaceUri, stream);
}
// write locale
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.Locale)) {
ec.encodeInt32(diagnosticInfo.locale, stream);
}
// write localized text
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.LocalizedText)) {
ec.encodeInt32(diagnosticInfo.localizedText, stream);
}
// write additional info
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.AdditionalInfo)) {
ec.encodeString(diagnosticInfo.additionalInfo, stream);
}
// write inner status code
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.InnerStatusCode)) {
ec.encodeStatusCode(diagnosticInfo.innerStatusCode, stream);
}
// write innerDiagnosticInfo
if (check_flag(encoding_mask, DiagnosticInfo_EncodingByte.InnerDiagnosticInfo)) {
exports.decodeExpandedNodeId = function(stream) {
const encoding_byte = stream.readUInt8();
const expandedNodeId = _decodeNodeId(encoding_byte, stream);
expandedNodeId.namespaceUri = null;
expandedNodeId.serverIndex = 0;
if (check_flag(encoding_byte, EnumNodeIdEncoding.NamespaceUriFlag)) {
expandedNodeId.namespaceUri = decodeString(stream);
}
if (check_flag(encoding_byte, EnumNodeIdEncoding.ServerIndexFlag)) {
expandedNodeId.serverIndex = decodeUInt32(stream);
}
const e = expandedNodeId;
return new ExpandedNodeId(e.identifierType, e.value, e.namespace, e.namespaceUri, e.serverIndex);
};
exports.encodeExpandedNodeId = function(expandedNodeId, stream) {
assert(expandedNodeId, "encodeExpandedNodeId: must provide a valid expandedNodeId");
const encodingByte = nodeID_encodingByte(expandedNodeId);
_encodeNodeId(encodingByte, expandedNodeId, stream);
if (check_flag(encodingByte, EnumNodeIdEncoding.NamespaceUriFlag)) {
encodeString(expandedNodeId.namespaceUri, stream);
}
if (check_flag(encodingByte, EnumNodeIdEncoding.ServerIndexFlag)) {
encodeUInt32(expandedNodeId.serverIndex, stream);
}
};
exports.encodeExpandedNodeId = function(expandedNodeId, stream) {
assert(expandedNodeId, "encodeExpandedNodeId: must provide a valid expandedNodeId");
const encodingByte = nodeID_encodingByte(expandedNodeId);
_encodeNodeId(encodingByte, expandedNodeId, stream);
if (check_flag(encodingByte, EnumNodeIdEncoding.NamespaceUriFlag)) {
encodeString(expandedNodeId.namespaceUri, stream);
}
if (check_flag(encodingByte, EnumNodeIdEncoding.ServerIndexFlag)) {
encodeUInt32(expandedNodeId.serverIndex, stream);
}
};