@wildboar/rose
Version:
Remote Operation Service Element PDUs in TypeScript
138 lines (137 loc) • 5.18 kB
JavaScript
/* eslint-disable */
import { ASN1TagClass as _TagClass, } from '@wildboar/asn1';
import * as $ from '@wildboar/asn1/functional';
import { _enum_for_CancelProblem, _decode_CancelProblem, _encode_CancelProblem, } from '../Remote-Operations-Useful-Definitions/CancelProblem.ta.mjs';
import { _decode_InvokeId, _encode_InvokeId, } from '../Remote-Operations-Generic-ROS-PDUs/InvokeId.ta.mjs';
/**
* @summary cancelFailed_ParameterType
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* cancelFailed-ParameterType ::= SEQUENCE { -- REMOVED_FROM_UNNESTING -- }
* ```
*
*/
export class cancelFailed_ParameterType {
problem;
operation;
constructor(
/**
* @summary `problem`.
* @public
* @readonly
*/
problem,
/**
* @summary `operation`.
* @public
* @readonly
*/
operation) {
this.problem = problem;
this.operation = operation;
}
/**
* @summary Restructures an object into a cancelFailed_ParameterType
* @description
*
* This takes an `object` and converts it to a `cancelFailed_ParameterType`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `cancelFailed_ParameterType`.
* @returns {cancelFailed_ParameterType}
*/
static _from_object(_o) {
return new cancelFailed_ParameterType(_o.problem, _o.operation);
}
/**
* @summary The enum used as the type of the component `problem`
* @public
* @static
*/
static _enum_for_problem = _enum_for_CancelProblem;
}
/**
* @summary The Leading Root Component Types of cancelFailed_ParameterType
* @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_cancelFailed_ParameterType = [
new $.ComponentSpec('problem', false, $.hasTag(_TagClass.context, 0)),
new $.ComponentSpec('operation', false, $.hasTag(_TagClass.context, 1)),
];
/**
* @summary The Trailing Root Component Types of cancelFailed_ParameterType
* @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_cancelFailed_ParameterType = [];
/**
* @summary The Extension Addition Component Types of cancelFailed_ParameterType
* @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_cancelFailed_ParameterType = [];
let _cached_decoder_for_cancelFailed_ParameterType = null;
/**
* @summary Decodes an ASN.1 element into a(n) cancelFailed_ParameterType
* @function
* @param {_Element} el The element being decoded.
* @returns {cancelFailed_ParameterType} The decoded data structure.
*/
export function _decode_cancelFailed_ParameterType(el) {
if (!_cached_decoder_for_cancelFailed_ParameterType) {
_cached_decoder_for_cancelFailed_ParameterType = function (el) {
/* START_OF_SET_COMPONENT_DECLARATIONS */
let problem;
let operation;
/* END_OF_SET_COMPONENT_DECLARATIONS */
const callbacks = {
problem: (_el) => {
problem = $._decode_implicit(() => _decode_CancelProblem)(_el);
},
operation: (_el) => {
operation = $._decode_explicit(() => _decode_InvokeId)(_el);
},
};
$._parse_set(el, callbacks, _root_component_type_list_1_spec_for_cancelFailed_ParameterType, _extension_additions_list_spec_for_cancelFailed_ParameterType, _root_component_type_list_2_spec_for_cancelFailed_ParameterType, undefined);
return new cancelFailed_ParameterType /* SET_CONSTRUCTOR_CALL */(problem, operation);
};
}
return _cached_decoder_for_cancelFailed_ParameterType(el);
}
let _cached_encoder_for_cancelFailed_ParameterType = null;
/**
* @summary Encodes a(n) cancelFailed_ParameterType 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 cancelFailed_ParameterType, encoded as an ASN.1 Element.
*/
export function _encode_cancelFailed_ParameterType(value, elGetter) {
if (!_cached_encoder_for_cancelFailed_ParameterType) {
_cached_encoder_for_cancelFailed_ParameterType = function (value) {
return $._encodeSet([]
.concat([
/* REQUIRED */ $._encode_implicit(_TagClass.context, 0, () => _encode_CancelProblem, $.BER)(value.problem, $.BER),
/* REQUIRED */ $._encode_explicit(_TagClass.context, 1, () => _encode_InvokeId, $.BER)(value.operation, $.BER),
])
.filter((c) => !!c), $.BER);
};
}
return _cached_encoder_for_cancelFailed_ParameterType(value, elGetter);
}
/* eslint-enable */