UNPKG

@wildboar/acse

Version:
134 lines (133 loc) 4.62 kB
/* eslint-disable */ import { ASN1TagClass as _TagClass, } from '@wildboar/asn1'; import * as $ from '@wildboar/asn1/functional'; import { _decode_ASO_qualifier, _encode_ASO_qualifier, } from '../ACSE-1/ASO-qualifier.ta.mjs'; import { _decode_ASOI_identifier, _encode_ASOI_identifier, } from '../ACSE-1/ASOI-identifier.ta.mjs'; /** * @summary ASOI_tag_Item * @description * * ### ASN.1 Definition: * * ```asn1 * ASOI-tag-Item ::= SEQUENCE { -- REMOVED_FROM_UNNESTING -- } * ``` * */ export class ASOI_tag_Item { qualifier; identifier; constructor( /** * @summary `qualifier`. * @public * @readonly */ qualifier, /** * @summary `identifier`. * @public * @readonly */ identifier) { this.qualifier = qualifier; this.identifier = identifier; } /** * @summary Restructures an object into a ASOI_tag_Item * @description * * This takes an `object` and converts it to a `ASOI_tag_Item`. * * @public * @static * @method * @param {Object} _o An object having all of the keys and values of a `ASOI_tag_Item`. * @returns {ASOI_tag_Item} */ static _from_object(_o) { return new ASOI_tag_Item(_o.qualifier, _o.identifier); } } /** * @summary The Leading Root Component Types of ASOI_tag_Item * @description * * This is an array of `ComponentSpec`s that define how to decode the leading root component type list of a SET or SEQUENCE. * * @constant */ export const _root_component_type_list_1_spec_for_ASOI_tag_Item = [ new $.ComponentSpec('qualifier', true, $.hasTag(_TagClass.context, 0)), new $.ComponentSpec('identifier', true, $.hasTag(_TagClass.context, 1)), ]; /** * @summary The Trailing Root Component Types of ASOI_tag_Item * @description * * This is an array of `ComponentSpec`s that define how to decode the trailing root component type list of a SET or SEQUENCE. * * @constant */ export const _root_component_type_list_2_spec_for_ASOI_tag_Item = []; /** * @summary The Extension Addition Component Types of ASOI_tag_Item * @description * * This is an array of `ComponentSpec`s that define how to decode the extension addition component type list of a SET or SEQUENCE. * * @constant */ export const _extension_additions_list_spec_for_ASOI_tag_Item = []; let _cached_decoder_for_ASOI_tag_Item = null; /** * @summary Decodes an ASN.1 element into a(n) ASOI_tag_Item * @function * @param {_Element} el The element being decoded. * @returns {ASOI_tag_Item} The decoded data structure. */ export function _decode_ASOI_tag_Item(el) { if (!_cached_decoder_for_ASOI_tag_Item) { _cached_decoder_for_ASOI_tag_Item = function (el) { let qualifier; let identifier; const callbacks = { qualifier: (_el) => { qualifier = $._decode_explicit(() => _decode_ASO_qualifier)(_el); }, identifier: (_el) => { identifier = $._decode_explicit(() => _decode_ASOI_identifier)(_el); }, }; $._parse_sequence(el, callbacks, _root_component_type_list_1_spec_for_ASOI_tag_Item, _extension_additions_list_spec_for_ASOI_tag_Item, _root_component_type_list_2_spec_for_ASOI_tag_Item, undefined); return new ASOI_tag_Item(qualifier, identifier); }; } return _cached_decoder_for_ASOI_tag_Item(el); } let _cached_encoder_for_ASOI_tag_Item = null; /** * @summary Encodes a(n) ASOI_tag_Item into an ASN.1 Element. * @function * @param value The element being encoded. * @param elGetter A function that can be used to get new ASN.1 elements. * @returns {_Element} The ASOI_tag_Item, encoded as an ASN.1 Element. */ export function _encode_ASOI_tag_Item(value, elGetter) { if (!_cached_encoder_for_ASOI_tag_Item) { _cached_encoder_for_ASOI_tag_Item = function (value) { return $._encodeSequence([] .concat([ /* IF_ABSENT */ value.qualifier === undefined ? undefined : $._encode_explicit(_TagClass.context, 0, () => _encode_ASO_qualifier, $.BER)(value.qualifier, $.BER), /* IF_ABSENT */ value.identifier === undefined ? undefined : $._encode_explicit(_TagClass.context, 1, () => _encode_ASOI_identifier, $.BER)(value.identifier, $.BER), ]) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_ASOI_tag_Item(value, elGetter); } /* eslint-enable */