// This C++ source file was generated by the TTCN-3 compiler
// of the TTCN-3 Test Executor version 11.1.0
// The generation of user and time information were disabled by the -D flag.

// Copyright (c) 2000-2025 Ericsson Telecom AB

// Do not edit this file unless you know what you are doing.

/* Including header files */

#include "LLC_Types.hh"

namespace LLC__Types {

/* Literal string constants */

const unsigned char bs_13_bits[] = { 0 },
bs_22_bits[] = { 0 },
bs_0_bits[] = { 0 },
bs_1_bits[] = { 16 },
bs_20_bits[] = { 8 },
bs_2_bits[] = { 8 },
bs_3_bits[] = { 24 },
bs_4_bits[] = { 4 },
bs_5_bits[] = { 20 },
bs_6_bits[] = { 12 },
bs_7_bits[] = { 28 },
bs_23_bits[] = { 2 },
bs_8_bits[] = { 2 },
bs_9_bits[] = { 18 },
bs_10_bits[] = { 10 },
bs_11_bits[] = { 26 },
bs_17_bits[] = { 6 },
bs_12_bits[] = { 6 },
bs_18_bits[] = { 14 },
bs_14_bits[] = { 1 },
bs_19_bits[] = { 1 },
bs_21_bits[] = { 13 },
bs_15_bits[] = { 3 },
bs_16_bits[] = { 7 };
extern const BITSTRING bs_13(1, bs_13_bits),
bs_22(4, bs_22_bits),
bs_0(5, bs_0_bits),
bs_1(5, bs_1_bits),
bs_20(4, bs_20_bits),
bs_2(5, bs_2_bits),
bs_3(5, bs_3_bits),
bs_4(5, bs_4_bits),
bs_5(5, bs_5_bits),
bs_6(5, bs_6_bits),
bs_7(5, bs_7_bits),
bs_23(4, bs_23_bits),
bs_8(5, bs_8_bits),
bs_9(5, bs_9_bits),
bs_10(5, bs_10_bits),
bs_11(5, bs_11_bits),
bs_17(4, bs_17_bits),
bs_12(5, bs_12_bits),
bs_18(4, bs_18_bits),
bs_14(1, bs_14_bits),
bs_19(4, bs_19_bits),
bs_21(4, bs_21_bits),
bs_15(3, bs_15_bits),
bs_16(3, bs_16_bits);
const unsigned char module_checksum[] = { 0x7d, 0x36, 0x04, 0xef, 0x6b, 0xd8, 0x93, 0xec, 0x46, 0xba, 0x9a, 0xa7, 0xf5, 0x1a, 0x62, 0x46 };

/* Global variable definitions */

BOOLEAN const_dec__PDU__LLC_checkFCS_defval;
const BOOLEAN& dec__PDU__LLC_checkFCS_defval = const_dec__PDU__LLC_checkFCS_defval;
const TTCN_RAWdescriptor_t Version_version__value_raw_ = {4,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       Version_version__value_xer_ = { {"version_value>\n", "version_value>\n"}, {15, 15}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t Version_version__value_descr_ = { "@LLC_Types.Version.version_value", &INTEGER_ber_, &Version_version__value_raw_, &INTEGER_text_, &Version_version__value_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Version_version__value_default_coding("RAW");
const XERdescriptor_t       Version_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t Version_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t Version_spare_descr_ = { "@LLC_Types.Version.spare", &BITSTRING_ber_, &General__Types::BIT4_raw_, NULL, &Version_spare_xer_, &BITSTRING_json_, &Version_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Version_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t Version_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for Version
const TTCN_Typedescriptor_t Version_descr_ = { "@LLC_Types.Version", NULL, &Version_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Version_default_coding("RAW");
const TTCN_RAWdescriptor_t IOV__UI_raw_ = {32,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       IOV__UI_xer_ = { {"IOV_UI>\n", "IOV_UI>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int IOV__UI_oer_ext_arr_[0] = {};
const int IOV__UI_oer_p_[0] = {};
const TTCN_OERdescriptor_t IOV__UI_oer_ = { -1, TRUE, 4, FALSE, 0, 0, IOV__UI_oer_ext_arr_, 0, IOV__UI_oer_p_};
const TTCN_Typedescriptor_t IOV__UI_descr_ = { "@LLC_Types.IOV_UI", &OCTETSTRING_ber_, &IOV__UI_raw_, &OCTETSTRING_text_, &IOV__UI_xer_, &OCTETSTRING_json_, &IOV__UI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING IOV__UI_default_coding("RAW");
const TTCN_RAWdescriptor_t IOV__I_raw_ = {32,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       IOV__I_xer_ = { {"IOV_I>\n", "IOV_I>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int IOV__I_oer_ext_arr_[0] = {};
const int IOV__I_oer_p_[0] = {};
const TTCN_OERdescriptor_t IOV__I_oer_ = { -1, TRUE, 4, FALSE, 0, 0, IOV__I_oer_ext_arr_, 0, IOV__I_oer_p_};
const TTCN_Typedescriptor_t IOV__I_descr_ = { "@LLC_Types.IOV_I", &OCTETSTRING_ber_, &IOV__I_raw_, &OCTETSTRING_text_, &IOV__I_xer_, &OCTETSTRING_json_, &IOV__I_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING IOV__I_default_coding("RAW");
const TTCN_RAWdescriptor_t T200_spare_raw_ = {4,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,4,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       T200_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t T200_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t T200_spare_descr_ = { "@LLC_Types.T200.spare", &BITSTRING_ber_, &T200_spare_raw_, NULL, &T200_spare_xer_, &BITSTRING_json_, &T200_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING T200_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t T200_t200Value_raw_ = {12,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       T200_t200Value_xer_ = { {"t200Value>\n", "t200Value>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t T200_t200Value_descr_ = { "@LLC_Types.T200.t200Value", &INTEGER_ber_, &T200_t200Value_raw_, &INTEGER_text_, &T200_t200Value_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING T200_t200Value_default_coding("RAW");
const TTCN_RAWdescriptor_t T200_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for T200
const TTCN_Typedescriptor_t T200_descr_ = { "@LLC_Types.T200", NULL, &T200_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING T200_default_coding("RAW");
const TTCN_RAWdescriptor_t N200_retransmissions_raw_ = {4,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       N200_retransmissions_xer_ = { {"retransmissions>\n", "retransmissions>\n"}, {17, 17}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t N200_retransmissions_descr_ = { "@LLC_Types.N200.retransmissions", &INTEGER_ber_, &N200_retransmissions_raw_, &INTEGER_text_, &N200_retransmissions_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING N200_retransmissions_default_coding("RAW");
const XERdescriptor_t       N200_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t N200_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t N200_spare_descr_ = { "@LLC_Types.N200.spare", &BITSTRING_ber_, &General__Types::BIT4_raw_, NULL, &N200_spare_xer_, &BITSTRING_json_, &N200_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING N200_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t N200_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for N200
const TTCN_Typedescriptor_t N200_descr_ = { "@LLC_Types.N200", NULL, &N200_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING N200_default_coding("RAW");
const TTCN_RAWdescriptor_t N201__U_spare_raw_ = {5,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,5,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       N201__U_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t N201__U_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t N201__U_spare_descr_ = { "@LLC_Types.N201_U.spare", &BITSTRING_ber_, &N201__U_spare_raw_, NULL, &N201__U_spare_xer_, &BITSTRING_json_, &N201__U_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING N201__U_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t N201__U_n201UValue_raw_ = {11,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       N201__U_n201UValue_xer_ = { {"n201UValue>\n", "n201UValue>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t N201__U_n201UValue_descr_ = { "@LLC_Types.N201_U.n201UValue", &INTEGER_ber_, &N201__U_n201UValue_raw_, &INTEGER_text_, &N201__U_n201UValue_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING N201__U_n201UValue_default_coding("RAW");
const TTCN_RAWdescriptor_t N201__U_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for N201__U
const TTCN_Typedescriptor_t N201__U_descr_ = { "@LLC_Types.N201_U", NULL, &N201__U_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING N201__U_default_coding("RAW");
const TTCN_RAWdescriptor_t N201__I_spare_raw_ = {5,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,5,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       N201__I_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t N201__I_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t N201__I_spare_descr_ = { "@LLC_Types.N201_I.spare", &BITSTRING_ber_, &N201__I_spare_raw_, NULL, &N201__I_spare_xer_, &BITSTRING_json_, &N201__I_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING N201__I_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t N201__I_n201IValue_raw_ = {11,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       N201__I_n201IValue_xer_ = { {"n201IValue>\n", "n201IValue>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t N201__I_n201IValue_descr_ = { "@LLC_Types.N201_I.n201IValue", &INTEGER_ber_, &N201__I_n201IValue_raw_, &INTEGER_text_, &N201__I_n201IValue_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING N201__I_n201IValue_default_coding("RAW");
const TTCN_RAWdescriptor_t N201__I_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for N201__I
const TTCN_Typedescriptor_t N201__I_descr_ = { "@LLC_Types.N201_I", NULL, &N201__I_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING N201__I_default_coding("RAW");
const TTCN_RAWdescriptor_t MD_spare_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       MD_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t MD_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t MD_spare_descr_ = { "@LLC_Types.MD.spare", &BITSTRING_ber_, &MD_spare_raw_, NULL, &MD_spare_xer_, &BITSTRING_json_, &MD_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING MD_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t MD_mDValue_raw_ = {15,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       MD_mDValue_xer_ = { {"mDValue>\n", "mDValue>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t MD_mDValue_descr_ = { "@LLC_Types.MD.mDValue", &INTEGER_ber_, &MD_mDValue_raw_, &INTEGER_text_, &MD_mDValue_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING MD_mDValue_default_coding("RAW");
const TTCN_RAWdescriptor_t MD_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for MD
const TTCN_Typedescriptor_t MD_descr_ = { "@LLC_Types.MD", NULL, &MD_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING MD_default_coding("RAW");
const TTCN_RAWdescriptor_t MU_spare_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       MU_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t MU_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t MU_spare_descr_ = { "@LLC_Types.MU.spare", &BITSTRING_ber_, &MU_spare_raw_, NULL, &MU_spare_xer_, &BITSTRING_json_, &MU_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING MU_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t MU_mUValue_raw_ = {15,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       MU_mUValue_xer_ = { {"mUValue>\n", "mUValue>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t MU_mUValue_descr_ = { "@LLC_Types.MU.mUValue", &INTEGER_ber_, &MU_mUValue_raw_, &INTEGER_text_, &MU_mUValue_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING MU_mUValue_default_coding("RAW");
const TTCN_RAWdescriptor_t MU_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for MU
const TTCN_Typedescriptor_t MU_descr_ = { "@LLC_Types.MU", NULL, &MU_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING MU_default_coding("RAW");
const TTCN_RAWdescriptor_t KD_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       KD_xer_ = { {"KD>\n", "KD>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t KD_descr_ = { "@LLC_Types.KD", &INTEGER_ber_, &KD_raw_, &INTEGER_text_, &KD_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING KD_default_coding("RAW");
const TTCN_RAWdescriptor_t KU_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       KU_xer_ = { {"KU>\n", "KU>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t KU_descr_ = { "@LLC_Types.KU", &INTEGER_ber_, &KU_raw_, &INTEGER_text_, &KU_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING KU_default_coding("RAW");
const XERdescriptor_t       L3param_xer_ = { {"L3param>\n", "L3param>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L3param_oer_ext_arr_[0] = {};
const int L3param_oer_p_[0] = {};
const TTCN_OERdescriptor_t L3param_oer_ = { -1, TRUE, -1, FALSE, 0, 0, L3param_oer_ext_arr_, 0, L3param_oer_p_};
const TTCN_Typedescriptor_t L3param_descr_ = { "@LLC_Types.L3param", &OCTETSTRING_ber_, &OCTETSTRING_raw_, &OCTETSTRING_text_, &L3param_xer_, &OCTETSTRING_json_, &L3param_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L3param_default_coding("RAW");
const TTCN_RAWdescriptor_t Reset__LLC_raw_ = {0,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       Reset__LLC_xer_ = { {"Reset_LLC>\n", "Reset_LLC>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int Reset__LLC_oer_ext_arr_[0] = {};
const int Reset__LLC_oer_p_[0] = {};
const TTCN_OERdescriptor_t Reset__LLC_oer_ = { -1, TRUE, 0, FALSE, 0, 0, Reset__LLC_oer_ext_arr_, 0, Reset__LLC_oer_p_};
const TTCN_Typedescriptor_t Reset__LLC_descr_ = { "@LLC_Types.Reset_LLC", &OCTETSTRING_ber_, &Reset__LLC_raw_, &OCTETSTRING_text_, &Reset__LLC_xer_, &OCTETSTRING_json_, &Reset__LLC_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Reset__LLC_default_coding("RAW");
const TTCN_RAWdescriptor_t XID__Data_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for XID__Data
const TTCN_Typedescriptor_t XID__Data_descr_ = { "@LLC_Types.XID_Data", NULL, &XID__Data_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING XID__Data_version_default_coding("RAW");
const XERdescriptor_t       XID__Data_iOV__UI_xer_ = { {"iOV_UI>\n", "iOV_UI>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int XID__Data_iOV__UI_oer_ext_arr_[0] = {};
const int XID__Data_iOV__UI_oer_p_[0] = {};
const TTCN_OERdescriptor_t XID__Data_iOV__UI_oer_ = { -1, TRUE, 4, FALSE, 0, 0, XID__Data_iOV__UI_oer_ext_arr_, 0, XID__Data_iOV__UI_oer_p_};
const TTCN_Typedescriptor_t XID__Data_iOV__UI_descr_ = { "@LLC_Types.XID_Data.iOV_UI", &OCTETSTRING_ber_, &IOV__UI_raw_, &OCTETSTRING_text_, &XID__Data_iOV__UI_xer_, &OCTETSTRING_json_, &XID__Data_iOV__UI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING XID__Data_iOV__UI_default_coding("RAW");
const XERdescriptor_t       XID__Data_iOV__I_xer_ = { {"iOV_I>\n", "iOV_I>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int XID__Data_iOV__I_oer_ext_arr_[0] = {};
const int XID__Data_iOV__I_oer_p_[0] = {};
const TTCN_OERdescriptor_t XID__Data_iOV__I_oer_ = { -1, TRUE, 4, FALSE, 0, 0, XID__Data_iOV__I_oer_ext_arr_, 0, XID__Data_iOV__I_oer_p_};
const TTCN_Typedescriptor_t XID__Data_iOV__I_descr_ = { "@LLC_Types.XID_Data.iOV_I", &OCTETSTRING_ber_, &IOV__I_raw_, &OCTETSTRING_text_, &XID__Data_iOV__I_xer_, &OCTETSTRING_json_, &XID__Data_iOV__I_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING XID__Data_iOV__I_default_coding("RAW");
UNIVERSAL_CHARSTRING XID__Data_t200_default_coding("RAW");
UNIVERSAL_CHARSTRING XID__Data_n200_default_coding("RAW");
UNIVERSAL_CHARSTRING XID__Data_n201__U_default_coding("RAW");
UNIVERSAL_CHARSTRING XID__Data_n201__I_default_coding("RAW");
UNIVERSAL_CHARSTRING XID__Data_mD_default_coding("RAW");
UNIVERSAL_CHARSTRING XID__Data_mU_default_coding("RAW");
const XERdescriptor_t       XID__Data_kD_xer_ = { {"kD>\n", "kD>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t XID__Data_kD_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t XID__Data_kD_descr_ = { "@LLC_Types.XID_Data.kD", &INTEGER_ber_, &KD_raw_, &INTEGER_text_, &XID__Data_kD_xer_, &INTEGER_json_, &XID__Data_kD_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING XID__Data_kD_default_coding("RAW");
const XERdescriptor_t       XID__Data_kU_xer_ = { {"kU>\n", "kU>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t XID__Data_kU_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t XID__Data_kU_descr_ = { "@LLC_Types.XID_Data.kU", &INTEGER_ber_, &KU_raw_, &INTEGER_text_, &XID__Data_kU_xer_, &INTEGER_json_, &XID__Data_kU_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING XID__Data_kU_default_coding("RAW");
const XERdescriptor_t       XID__Data_l3param_xer_ = { {"l3param>\n", "l3param>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int XID__Data_l3param_oer_ext_arr_[0] = {};
const int XID__Data_l3param_oer_p_[0] = {};
const TTCN_OERdescriptor_t XID__Data_l3param_oer_ = { -1, TRUE, -1, FALSE, 0, 0, XID__Data_l3param_oer_ext_arr_, 0, XID__Data_l3param_oer_p_};
const TTCN_Typedescriptor_t XID__Data_l3param_descr_ = { "@LLC_Types.XID_Data.l3param", &OCTETSTRING_ber_, &OCTETSTRING_raw_, &OCTETSTRING_text_, &XID__Data_l3param_xer_, &OCTETSTRING_json_, &XID__Data_l3param_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING XID__Data_l3param_default_coding("RAW");
const XERdescriptor_t       XID__Data_reset_xer_ = { {"reset>\n", "reset>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int XID__Data_reset_oer_ext_arr_[0] = {};
const int XID__Data_reset_oer_p_[0] = {};
const TTCN_OERdescriptor_t XID__Data_reset_oer_ = { -1, TRUE, 0, FALSE, 0, 0, XID__Data_reset_oer_ext_arr_, 0, XID__Data_reset_oer_p_};
const TTCN_Typedescriptor_t XID__Data_reset_descr_ = { "@LLC_Types.XID_Data.reset", &OCTETSTRING_ber_, &Reset__LLC_raw_, &OCTETSTRING_text_, &XID__Data_reset_xer_, &OCTETSTRING_json_, &XID__Data_reset_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING XID__Data_reset_default_coding("RAW");
UNIVERSAL_CHARSTRING XID__Data_default_coding("RAW");
const TTCN_RAWdescriptor_t XID__length_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for XID__length
const TTCN_Typedescriptor_t XID__length_descr_ = { "@LLC_Types.XID_length", NULL, &XID__length_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_RAWdescriptor_t XID__length_short__len_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       XID__length_short__len_xer_ = { {"short_len>\n", "short_len>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t XID__length_short__len_descr_ = { "@LLC_Types.XID_length.short_len", &INTEGER_ber_, &XID__length_short__len_raw_, &INTEGER_text_, &XID__length_short__len_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING XID__length_short__len_default_coding("RAW");
const TTCN_RAWdescriptor_t XID__length_long__len_raw_ = {8,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       XID__length_long__len_xer_ = { {"long_len>\n", "long_len>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t XID__length_long__len_descr_ = { "@LLC_Types.XID_length.long_len", &INTEGER_ber_, &XID__length_long__len_raw_, &INTEGER_text_, &XID__length_long__len_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING XID__length_long__len_default_coding("RAW");
UNIVERSAL_CHARSTRING XID__length_default_coding("RAW");
const TTCN_RAWdescriptor_t XID_xl_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       XID_xl_xer_ = { {"xl>\n", "xl>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t XID_xl_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t XID_xl_descr_ = { "@LLC_Types.XID.xl", &BITSTRING_ber_, &XID_xl_raw_, NULL, &XID_xl_xer_, &BITSTRING_json_, &XID_xl_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING XID_xl_default_coding("RAW");
const TTCN_RAWdescriptor_t XID_typefield_raw_ = {5,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,5,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       XID_typefield_xer_ = { {"typefield>\n", "typefield>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t XID_typefield_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t XID_typefield_descr_ = { "@LLC_Types.XID.typefield", &BITSTRING_ber_, &XID_typefield_raw_, NULL, &XID_typefield_xer_, &BITSTRING_json_, &XID_typefield_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING XID_typefield_default_coding("RAW");
const TTCN_RAWdescriptor_t XID_xID__length_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,8,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for XID_xID__length
const TTCN_Typedescriptor_t XID_xID__length_descr_ = { "@LLC_Types.XID.xID_length", NULL, &XID_xID__length_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING XID_xID__length_default_coding("RAW");
const TTCN_RAWdescriptor_t XID_xID__Data_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for XID_xID__Data
const TTCN_Typedescriptor_t XID_xID__Data_descr_ = { "@LLC_Types.XID.xID_Data", NULL, &XID_xID__Data_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING XID_xID__Data_default_coding("RAW");
const TTCN_RAWdescriptor_t XID_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for XID
const TTCN_Typedescriptor_t XID_descr_ = { "@LLC_Types.XID", NULL, &XID_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING XID_default_coding("RAW");
const TTCN_RAWdescriptor_t Control__field__UI_format_raw_ = {3,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,3,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       Control__field__UI_format_xer_ = { {"format>\n", "format>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t Control__field__UI_format_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t Control__field__UI_format_descr_ = { "@LLC_Types.Control_field_UI.format", &BITSTRING_ber_, &Control__field__UI_format_raw_, NULL, &Control__field__UI_format_xer_, &BITSTRING_json_, &Control__field__UI_format_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Control__field__UI_format_default_coding("RAW");
const TTCN_RAWdescriptor_t Control__field__UI_spare_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,2,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       Control__field__UI_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t Control__field__UI_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t Control__field__UI_spare_descr_ = { "@LLC_Types.Control_field_UI.spare", &BITSTRING_ber_, &Control__field__UI_spare_raw_, NULL, &Control__field__UI_spare_xer_, &BITSTRING_json_, &Control__field__UI_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Control__field__UI_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t Control__field__UI_nU_raw_ = {9,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       Control__field__UI_nU_xer_ = { {"nU>\n", "nU>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t Control__field__UI_nU_descr_ = { "@LLC_Types.Control_field_UI.nU", &INTEGER_ber_, &Control__field__UI_nU_raw_, &INTEGER_text_, &Control__field__UI_nU_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Control__field__UI_nU_default_coding("RAW");
const TTCN_RAWdescriptor_t Control__field__UI_e_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       Control__field__UI_e_xer_ = { {"e>\n", "e>\n"}, {3, 3}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t Control__field__UI_e_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t Control__field__UI_e_descr_ = { "@LLC_Types.Control_field_UI.e", &BITSTRING_ber_, &Control__field__UI_e_raw_, NULL, &Control__field__UI_e_xer_, &BITSTRING_json_, &Control__field__UI_e_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Control__field__UI_e_default_coding("RAW");
const TTCN_RAWdescriptor_t Control__field__UI_pM_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       Control__field__UI_pM_xer_ = { {"pM>\n", "pM>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t Control__field__UI_pM_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t Control__field__UI_pM_descr_ = { "@LLC_Types.Control_field_UI.pM", &BITSTRING_ber_, &Control__field__UI_pM_raw_, NULL, &Control__field__UI_pM_xer_, &BITSTRING_json_, &Control__field__UI_pM_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Control__field__UI_pM_default_coding("RAW");
const TTCN_RAWdescriptor_t Control__field__UI_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for Control__field__UI
const TTCN_Typedescriptor_t Control__field__UI_descr_ = { "@LLC_Types.Control_field_UI", NULL, &Control__field__UI_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Control__field__UI_default_coding("RAW");
UNIVERSAL_CHARSTRING RejectedFrameControlField__UI_control__field_default_coding("RAW");
const XERdescriptor_t       RejectedFrameControlField__UI_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int RejectedFrameControlField__UI_spare_oer_ext_arr_[0] = {};
const int RejectedFrameControlField__UI_spare_oer_p_[0] = {};
const TTCN_OERdescriptor_t RejectedFrameControlField__UI_spare_oer_ = { -1, TRUE, 4, FALSE, 0, 0, RejectedFrameControlField__UI_spare_oer_ext_arr_, 0, RejectedFrameControlField__UI_spare_oer_p_};
const TTCN_Typedescriptor_t RejectedFrameControlField__UI_spare_descr_ = { "@LLC_Types.RejectedFrameControlField_UI.spare", &OCTETSTRING_ber_, &General__Types::OCT4_raw_, &OCTETSTRING_text_, &RejectedFrameControlField__UI_spare_xer_, &OCTETSTRING_json_, &RejectedFrameControlField__UI_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RejectedFrameControlField__UI_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t RejectedFrameControlField__UI_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for RejectedFrameControlField__UI
const TTCN_Typedescriptor_t RejectedFrameControlField__UI_descr_ = { "@LLC_Types.RejectedFrameControlField_UI", NULL, &RejectedFrameControlField__UI_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RejectedFrameControlField__UI_default_coding("RAW");
const XERdescriptor_t       Control__field__U_mBits_xer_ = { {"mBits>\n", "mBits>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t Control__field__U_mBits_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t Control__field__U_mBits_descr_ = { "@LLC_Types.Control_field_U.mBits", &BITSTRING_ber_, &General__Types::BIT4_raw_, NULL, &Control__field__U_mBits_xer_, &BITSTRING_json_, &Control__field__U_mBits_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Control__field__U_mBits_default_coding("RAW");
const XERdescriptor_t       Control__field__U_pF_xer_ = { {"pF>\n", "pF>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t Control__field__U_pF_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t Control__field__U_pF_descr_ = { "@LLC_Types.Control_field_U.pF", &BITSTRING_ber_, &General__Types::BIT1_raw_, NULL, &Control__field__U_pF_xer_, &BITSTRING_json_, &Control__field__U_pF_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Control__field__U_pF_default_coding("RAW");
const XERdescriptor_t       Control__field__U_format_xer_ = { {"format>\n", "format>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t Control__field__U_format_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t Control__field__U_format_descr_ = { "@LLC_Types.Control_field_U.format", &BITSTRING_ber_, &General__Types::BIT3_raw_, NULL, &Control__field__U_format_xer_, &BITSTRING_json_, &Control__field__U_format_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Control__field__U_format_default_coding("RAW");
const TTCN_RAWdescriptor_t Control__field__U_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for Control__field__U
const TTCN_Typedescriptor_t Control__field__U_descr_ = { "@LLC_Types.Control_field_U", NULL, &Control__field__U_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Control__field__U_default_coding("RAW");
UNIVERSAL_CHARSTRING RejectedFrameControlField__U_control__field_default_coding("RAW");
const XERdescriptor_t       RejectedFrameControlField__U_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int RejectedFrameControlField__U_spare_oer_ext_arr_[0] = {};
const int RejectedFrameControlField__U_spare_oer_p_[0] = {};
const TTCN_OERdescriptor_t RejectedFrameControlField__U_spare_oer_ = { -1, TRUE, 5, FALSE, 0, 0, RejectedFrameControlField__U_spare_oer_ext_arr_, 0, RejectedFrameControlField__U_spare_oer_p_};
const TTCN_Typedescriptor_t RejectedFrameControlField__U_spare_descr_ = { "@LLC_Types.RejectedFrameControlField_U.spare", &OCTETSTRING_ber_, &General__Types::OCT5_raw_, &OCTETSTRING_text_, &RejectedFrameControlField__U_spare_xer_, &OCTETSTRING_json_, &RejectedFrameControlField__U_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RejectedFrameControlField__U_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t RejectedFrameControlField__U_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for RejectedFrameControlField__U
const TTCN_Typedescriptor_t RejectedFrameControlField__U_descr_ = { "@LLC_Types.RejectedFrameControlField_U", NULL, &RejectedFrameControlField__U_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RejectedFrameControlField__U_default_coding("RAW");
const TTCN_RAWdescriptor_t RejectedFrameControlField_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for RejectedFrameControlField
const TTCN_Typedescriptor_t RejectedFrameControlField_descr_ = { "@LLC_Types.RejectedFrameControlField", NULL, &RejectedFrameControlField_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RejectedFrameControlField_rejectedFrameControlField__UI_default_coding("RAW");
UNIVERSAL_CHARSTRING RejectedFrameControlField_rejectedFrameControlField__U_default_coding("RAW");
UNIVERSAL_CHARSTRING RejectedFrameControlField_default_coding("RAW");
const TTCN_RAWdescriptor_t UA__Information_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for UA__Information
const TTCN_Typedescriptor_t UA__Information_descr_ = { "@LLC_Types.UA_Information", NULL, &UA__Information_raw_, NULL, NULL, NULL, NULL, NULL, &XID_descr_, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING UA__Information_0_default_coding("RAW");
UNIVERSAL_CHARSTRING UA__Information_default_coding("RAW");
const TTCN_RAWdescriptor_t SABM__Information_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for SABM__Information
const TTCN_Typedescriptor_t SABM__Information_descr_ = { "@LLC_Types.SABM_Information", NULL, &SABM__Information_raw_, NULL, NULL, NULL, NULL, NULL, &XID_descr_, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING SABM__Information_0_default_coding("RAW");
UNIVERSAL_CHARSTRING SABM__Information_default_coding("RAW");
const TTCN_RAWdescriptor_t XID__Information_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for XID__Information
const TTCN_Typedescriptor_t XID__Information_descr_ = { "@LLC_Types.XID_Information", NULL, &XID__Information_raw_, NULL, NULL, NULL, NULL, NULL, &XID_descr_, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING XID__Information_0_default_coding("RAW");
UNIVERSAL_CHARSTRING XID__Information_default_coding("RAW");
const TTCN_RAWdescriptor_t DM__Information_raw_ = {0,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       DM__Information_xer_ = { {"DM_Information>\n", "DM_Information>\n"}, {16, 16}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int DM__Information_oer_ext_arr_[0] = {};
const int DM__Information_oer_p_[0] = {};
const TTCN_OERdescriptor_t DM__Information_oer_ = { -1, TRUE, 0, FALSE, 0, 0, DM__Information_oer_ext_arr_, 0, DM__Information_oer_p_};
const TTCN_Typedescriptor_t DM__Information_descr_ = { "@LLC_Types.DM_Information", &OCTETSTRING_ber_, &DM__Information_raw_, &OCTETSTRING_text_, &DM__Information_xer_, &OCTETSTRING_json_, &DM__Information_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DM__Information_default_coding("RAW");
const TTCN_RAWdescriptor_t NULL__Information_raw_ = {0,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       NULL__Information_xer_ = { {"NULL_Information>\n", "NULL_Information>\n"}, {18, 18}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int NULL__Information_oer_ext_arr_[0] = {};
const int NULL__Information_oer_p_[0] = {};
const TTCN_OERdescriptor_t NULL__Information_oer_ = { -1, TRUE, 0, FALSE, 0, 0, NULL__Information_oer_ext_arr_, 0, NULL__Information_oer_p_};
const TTCN_Typedescriptor_t NULL__Information_descr_ = { "@LLC_Types.NULL_Information", &OCTETSTRING_ber_, &NULL__Information_raw_, &OCTETSTRING_text_, &NULL__Information_xer_, &OCTETSTRING_json_, &NULL__Information_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING NULL__Information_default_coding("RAW");
const TTCN_RAWdescriptor_t DISC__Information_raw_ = {0,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       DISC__Information_xer_ = { {"DISC_Information>\n", "DISC_Information>\n"}, {18, 18}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int DISC__Information_oer_ext_arr_[0] = {};
const int DISC__Information_oer_p_[0] = {};
const TTCN_OERdescriptor_t DISC__Information_oer_ = { -1, TRUE, 0, FALSE, 0, 0, DISC__Information_oer_ext_arr_, 0, DISC__Information_oer_p_};
const TTCN_Typedescriptor_t DISC__Information_descr_ = { "@LLC_Types.DISC_Information", &OCTETSTRING_ber_, &DISC__Information_raw_, &OCTETSTRING_text_, &DISC__Information_xer_, &OCTETSTRING_json_, &DISC__Information_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DISC__Information_default_coding("RAW");
const TTCN_RAWdescriptor_t FRMR__Information_rejectedFrameControlField_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for FRMR__Information_rejectedFrameControlField
const TTCN_Typedescriptor_t FRMR__Information_rejectedFrameControlField_descr_ = { "@LLC_Types.FRMR_Information.rejectedFrameControlField", NULL, &FRMR__Information_rejectedFrameControlField_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING FRMR__Information_rejectedFrameControlField_default_coding("RAW");
const TTCN_RAWdescriptor_t FRMR__Information_spare1_raw_ = {4,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,4,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       FRMR__Information_spare1_xer_ = { {"spare1>\n", "spare1>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t FRMR__Information_spare1_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t FRMR__Information_spare1_descr_ = { "@LLC_Types.FRMR_Information.spare1", &BITSTRING_ber_, &FRMR__Information_spare1_raw_, NULL, &FRMR__Information_spare1_xer_, &BITSTRING_json_, &FRMR__Information_spare1_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING FRMR__Information_spare1_default_coding("RAW");
const TTCN_RAWdescriptor_t FRMR__Information_vS_raw_ = {9,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,9,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       FRMR__Information_vS_xer_ = { {"vS>\n", "vS>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t FRMR__Information_vS_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t FRMR__Information_vS_descr_ = { "@LLC_Types.FRMR_Information.vS", &BITSTRING_ber_, &FRMR__Information_vS_raw_, NULL, &FRMR__Information_vS_xer_, &BITSTRING_json_, &FRMR__Information_vS_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING FRMR__Information_vS_default_coding("RAW");
const TTCN_RAWdescriptor_t FRMR__Information_spare2_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       FRMR__Information_spare2_xer_ = { {"spare2>\n", "spare2>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t FRMR__Information_spare2_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t FRMR__Information_spare2_descr_ = { "@LLC_Types.FRMR_Information.spare2", &BITSTRING_ber_, &FRMR__Information_spare2_raw_, NULL, &FRMR__Information_spare2_xer_, &BITSTRING_json_, &FRMR__Information_spare2_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING FRMR__Information_spare2_default_coding("RAW");
const TTCN_RAWdescriptor_t FRMR__Information_vR_raw_ = {9,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,9,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       FRMR__Information_vR_xer_ = { {"vR>\n", "vR>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t FRMR__Information_vR_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t FRMR__Information_vR_descr_ = { "@LLC_Types.FRMR_Information.vR", &BITSTRING_ber_, &FRMR__Information_vR_raw_, NULL, &FRMR__Information_vR_xer_, &BITSTRING_json_, &FRMR__Information_vR_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING FRMR__Information_vR_default_coding("RAW");
const TTCN_RAWdescriptor_t FRMR__Information_cR_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       FRMR__Information_cR_xer_ = { {"cR>\n", "cR>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t FRMR__Information_cR_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t FRMR__Information_cR_descr_ = { "@LLC_Types.FRMR_Information.cR", &BITSTRING_ber_, &FRMR__Information_cR_raw_, NULL, &FRMR__Information_cR_xer_, &BITSTRING_json_, &FRMR__Information_cR_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING FRMR__Information_cR_default_coding("RAW");
const TTCN_RAWdescriptor_t FRMR__Information_spare3_raw_ = {4,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,4,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       FRMR__Information_spare3_xer_ = { {"spare3>\n", "spare3>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t FRMR__Information_spare3_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t FRMR__Information_spare3_descr_ = { "@LLC_Types.FRMR_Information.spare3", &BITSTRING_ber_, &FRMR__Information_spare3_raw_, NULL, &FRMR__Information_spare3_xer_, &BITSTRING_json_, &FRMR__Information_spare3_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING FRMR__Information_spare3_default_coding("RAW");
const TTCN_RAWdescriptor_t FRMR__Information_w4_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       FRMR__Information_w4_xer_ = { {"w4>\n", "w4>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t FRMR__Information_w4_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t FRMR__Information_w4_descr_ = { "@LLC_Types.FRMR_Information.w4", &BITSTRING_ber_, &FRMR__Information_w4_raw_, NULL, &FRMR__Information_w4_xer_, &BITSTRING_json_, &FRMR__Information_w4_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING FRMR__Information_w4_default_coding("RAW");
const TTCN_RAWdescriptor_t FRMR__Information_w3_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       FRMR__Information_w3_xer_ = { {"w3>\n", "w3>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t FRMR__Information_w3_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t FRMR__Information_w3_descr_ = { "@LLC_Types.FRMR_Information.w3", &BITSTRING_ber_, &FRMR__Information_w3_raw_, NULL, &FRMR__Information_w3_xer_, &BITSTRING_json_, &FRMR__Information_w3_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING FRMR__Information_w3_default_coding("RAW");
const TTCN_RAWdescriptor_t FRMR__Information_w2_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       FRMR__Information_w2_xer_ = { {"w2>\n", "w2>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t FRMR__Information_w2_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t FRMR__Information_w2_descr_ = { "@LLC_Types.FRMR_Information.w2", &BITSTRING_ber_, &FRMR__Information_w2_raw_, NULL, &FRMR__Information_w2_xer_, &BITSTRING_json_, &FRMR__Information_w2_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING FRMR__Information_w2_default_coding("RAW");
const TTCN_RAWdescriptor_t FRMR__Information_w1_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       FRMR__Information_w1_xer_ = { {"w1>\n", "w1>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t FRMR__Information_w1_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t FRMR__Information_w1_descr_ = { "@LLC_Types.FRMR_Information.w1", &BITSTRING_ber_, &FRMR__Information_w1_raw_, NULL, &FRMR__Information_w1_xer_, &BITSTRING_json_, &FRMR__Information_w1_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING FRMR__Information_w1_default_coding("RAW");
const TTCN_RAWdescriptor_t FRMR__Information_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for FRMR__Information
const TTCN_Typedescriptor_t FRMR__Information_descr_ = { "@LLC_Types.FRMR_Information", NULL, &FRMR__Information_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING FRMR__Information_default_coding("RAW");
const XERdescriptor_t       Address__field_sAPI_xer_ = { {"sAPI>\n", "sAPI>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t Address__field_sAPI_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t Address__field_sAPI_descr_ = { "@LLC_Types.Address_field.sAPI", &BITSTRING_ber_, &General__Types::BIT4_raw_, NULL, &Address__field_sAPI_xer_, &BITSTRING_json_, &Address__field_sAPI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Address__field_sAPI_default_coding("RAW");
const XERdescriptor_t       Address__field_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t Address__field_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t Address__field_spare_descr_ = { "@LLC_Types.Address_field.spare", &BITSTRING_ber_, &General__Types::BIT2_raw_, NULL, &Address__field_spare_xer_, &BITSTRING_json_, &Address__field_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Address__field_spare_default_coding("RAW");
const XERdescriptor_t       Address__field_cR_xer_ = { {"cR>\n", "cR>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t Address__field_cR_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t Address__field_cR_descr_ = { "@LLC_Types.Address_field.cR", &BITSTRING_ber_, &General__Types::BIT1_raw_, NULL, &Address__field_cR_xer_, &BITSTRING_json_, &Address__field_cR_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Address__field_cR_default_coding("RAW");
const XERdescriptor_t       Address__field_pD_xer_ = { {"pD>\n", "pD>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t Address__field_pD_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t Address__field_pD_descr_ = { "@LLC_Types.Address_field.pD", &BITSTRING_ber_, &General__Types::BIT1_raw_, NULL, &Address__field_pD_xer_, &BITSTRING_json_, &Address__field_pD_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Address__field_pD_default_coding("RAW");
const TTCN_RAWdescriptor_t Address__field_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for Address__field
const TTCN_Typedescriptor_t Address__field_descr_ = { "@LLC_Types.Address_field", NULL, &Address__field_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Address__field_default_coding("RAW");
const TTCN_RAWdescriptor_t Information__field__U_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for Information__field__U
const TTCN_Typedescriptor_t Information__field__U_descr_ = { "@LLC_Types.Information_field_U", NULL, &Information__field__U_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Information__field__U_uA_default_coding("RAW");
UNIVERSAL_CHARSTRING Information__field__U_sABM_default_coding("RAW");
UNIVERSAL_CHARSTRING Information__field__U_fRMR_default_coding("RAW");
const XERdescriptor_t       Information__field__U_dM_xer_ = { {"dM>\n", "dM>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int Information__field__U_dM_oer_ext_arr_[0] = {};
const int Information__field__U_dM_oer_p_[0] = {};
const TTCN_OERdescriptor_t Information__field__U_dM_oer_ = { -1, TRUE, 0, FALSE, 0, 0, Information__field__U_dM_oer_ext_arr_, 0, Information__field__U_dM_oer_p_};
const TTCN_Typedescriptor_t Information__field__U_dM_descr_ = { "@LLC_Types.Information_field_U.dM", &OCTETSTRING_ber_, &DM__Information_raw_, &OCTETSTRING_text_, &Information__field__U_dM_xer_, &OCTETSTRING_json_, &Information__field__U_dM_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Information__field__U_dM_default_coding("RAW");
UNIVERSAL_CHARSTRING Information__field__U_xID_default_coding("RAW");
const XERdescriptor_t       Information__field__U_nULL_xer_ = { {"nULL>\n", "nULL>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int Information__field__U_nULL_oer_ext_arr_[0] = {};
const int Information__field__U_nULL_oer_p_[0] = {};
const TTCN_OERdescriptor_t Information__field__U_nULL_oer_ = { -1, TRUE, 0, FALSE, 0, 0, Information__field__U_nULL_oer_ext_arr_, 0, Information__field__U_nULL_oer_p_};
const TTCN_Typedescriptor_t Information__field__U_nULL_descr_ = { "@LLC_Types.Information_field_U.nULL", &OCTETSTRING_ber_, &NULL__Information_raw_, &OCTETSTRING_text_, &Information__field__U_nULL_xer_, &OCTETSTRING_json_, &Information__field__U_nULL_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Information__field__U_nULL_default_coding("RAW");
const XERdescriptor_t       Information__field__U_dISC_xer_ = { {"dISC>\n", "dISC>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int Information__field__U_dISC_oer_ext_arr_[0] = {};
const int Information__field__U_dISC_oer_p_[0] = {};
const TTCN_OERdescriptor_t Information__field__U_dISC_oer_ = { -1, TRUE, 0, FALSE, 0, 0, Information__field__U_dISC_oer_ext_arr_, 0, Information__field__U_dISC_oer_p_};
const TTCN_Typedescriptor_t Information__field__U_dISC_descr_ = { "@LLC_Types.Information_field_U.dISC", &OCTETSTRING_ber_, &DISC__Information_raw_, &OCTETSTRING_text_, &Information__field__U_dISC_xer_, &OCTETSTRING_json_, &Information__field__U_dISC_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING Information__field__U_dISC_default_coding("RAW");
UNIVERSAL_CHARSTRING Information__field__U_default_coding("RAW");
UNIVERSAL_CHARSTRING PDU__LLC__UI_address__field_default_coding("RAW");
UNIVERSAL_CHARSTRING PDU__LLC__UI_control__field_default_coding("RAW");
const XERdescriptor_t       PDU__LLC__UI_information__field__UI_xer_ = { {"information_field_UI>\n", "information_field_UI>\n"}, {22, 22}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int PDU__LLC__UI_information__field__UI_oer_ext_arr_[0] = {};
const int PDU__LLC__UI_information__field__UI_oer_p_[0] = {};
const TTCN_OERdescriptor_t PDU__LLC__UI_information__field__UI_oer_ = { -1, TRUE, -1, FALSE, 0, 0, PDU__LLC__UI_information__field__UI_oer_ext_arr_, 0, PDU__LLC__UI_information__field__UI_oer_p_};
const TTCN_Typedescriptor_t PDU__LLC__UI_information__field__UI_descr_ = { "@LLC_Types.PDU_LLC_UI.information_field_UI", &OCTETSTRING_ber_, &OCTETSTRING_raw_, &OCTETSTRING_text_, &PDU__LLC__UI_information__field__UI_xer_, &OCTETSTRING_json_, &PDU__LLC__UI_information__field__UI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING PDU__LLC__UI_information__field__UI_default_coding("RAW");
const TTCN_RAWdescriptor_t PDU__LLC__UI_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for PDU__LLC__UI
const TTCN_Typedescriptor_t PDU__LLC__UI_descr_ = { "@LLC_Types.PDU_LLC_UI", NULL, &PDU__LLC__UI_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       PDU__LLC__UI_fCS_xer_ = { {"fCS>\n", "fCS>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int PDU__LLC__UI_fCS_oer_ext_arr_[0] = {};
const int PDU__LLC__UI_fCS_oer_p_[0] = {};
const TTCN_OERdescriptor_t PDU__LLC__UI_fCS_oer_ = { -1, TRUE, 3, FALSE, 0, 0, PDU__LLC__UI_fCS_oer_ext_arr_, 0, PDU__LLC__UI_fCS_oer_p_};
const TTCN_Typedescriptor_t PDU__LLC__UI_fCS_descr_ = { "@LLC_Types.PDU_LLC_UI.fCS", &OCTETSTRING_ber_, &General__Types::OCT3_raw_, &OCTETSTRING_text_, &PDU__LLC__UI_fCS_xer_, &OCTETSTRING_json_, &PDU__LLC__UI_fCS_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING PDU__LLC__UI_fCS_default_coding("RAW");
UNIVERSAL_CHARSTRING PDU__LLC__UI_default_coding("RAW");
UNIVERSAL_CHARSTRING PDU__LLC__U_address__field_default_coding("RAW");
UNIVERSAL_CHARSTRING PDU__LLC__U_control__field_default_coding("RAW");
const TTCN_RAWdescriptor_t PDU__LLC__U_information__field__U_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for PDU__LLC__U_information__field__U
const TTCN_Typedescriptor_t PDU__LLC__U_information__field__U_descr_ = { "@LLC_Types.PDU_LLC_U.information_field_U", NULL, &PDU__LLC__U_information__field__U_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING PDU__LLC__U_information__field__U_default_coding("RAW");
const TTCN_RAWdescriptor_t PDU__LLC__U_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for PDU__LLC__U
const TTCN_Typedescriptor_t PDU__LLC__U_descr_ = { "@LLC_Types.PDU_LLC_U", NULL, &PDU__LLC__U_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       PDU__LLC__U_fCS_xer_ = { {"fCS>\n", "fCS>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int PDU__LLC__U_fCS_oer_ext_arr_[0] = {};
const int PDU__LLC__U_fCS_oer_p_[0] = {};
const TTCN_OERdescriptor_t PDU__LLC__U_fCS_oer_ = { -1, TRUE, 3, FALSE, 0, 0, PDU__LLC__U_fCS_oer_ext_arr_, 0, PDU__LLC__U_fCS_oer_p_};
const TTCN_Typedescriptor_t PDU__LLC__U_fCS_descr_ = { "@LLC_Types.PDU_LLC_U.fCS", &OCTETSTRING_ber_, &General__Types::OCT3_raw_, &OCTETSTRING_text_, &PDU__LLC__U_fCS_xer_, &OCTETSTRING_json_, &PDU__LLC__U_fCS_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING PDU__LLC__U_fCS_default_coding("RAW");
UNIVERSAL_CHARSTRING PDU__LLC__U_default_coding("RAW");
const TTCN_RAWdescriptor_t PDU__LLC_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for PDU__LLC
const TTCN_Typedescriptor_t PDU__LLC_descr_ = { "@LLC_Types.PDU_LLC", NULL, &PDU__LLC_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING PDU__LLC_pDU__LLC__UI_default_coding("RAW");
UNIVERSAL_CHARSTRING PDU__LLC_pDU__LLC__U_default_coding("RAW");
UNIVERSAL_CHARSTRING PDU__LLC_default_coding("RAW");
TTCN_Module module_object("LLC_Types", __DATE__, __TIME__, module_checksum, pre_init_module, NULL, 0U, 4294967295U, 4294967295U, 4294967295U, NULL, 0LU, 0, post_init_module, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

const RuntimeVersionChecker ver_checker(  current_runtime_version.requires_major_version_11,
  current_runtime_version.requires_minor_version_1,
  current_runtime_version.requires_patch_level_0,  current_runtime_version.requires_runtime_1);

/* Member functions of C++ classes */

Version::Version()
{
}

Version::Version(const INTEGER& par_version__value,
    const BITSTRING& par_spare)
  :   field_version__value(par_version__value),
  field_spare(par_spare)
{
}

Version::Version(const Version& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.Version.");
if (other_value.version__value().is_bound()) field_version__value = other_value.version__value();
else field_version__value.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
}

void Version::clean_up()
{
field_version__value.clean_up();
field_spare.clean_up();
}

const TTCN_Typedescriptor_t* Version::get_descriptor() const { return &Version_descr_; }
Version& Version::operator=(const Version& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LLC_Types.Version.");
  if (other_value.version__value().is_bound()) field_version__value = other_value.version__value();
  else field_version__value.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
}
return *this;
}

boolean Version::operator==(const Version& other_value) const
{
return field_version__value==other_value.field_version__value
  && field_spare==other_value.field_spare;
}

boolean Version::is_bound() const
{
return (field_version__value.is_bound())
  || (field_spare.is_bound());
}
boolean Version::is_value() const
{
return field_version__value.is_value()
  && field_spare.is_value();
}
void Version::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ version_value := ");
field_version__value.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(" }");
}

void Version::set_implicit_omit()
{
if (version__value().is_bound()) version__value().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void Version::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record value of type @LLC_Types.Version has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) version__value().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "version_value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          version__value().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.Version: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LLC_Types.Version");
  }
}

void Version::encode_text(Text_Buf& text_buf) const
{
field_version__value.encode_text(text_buf);
field_spare.encode_text(text_buf);
}

void Version::decode_text(Text_Buf& text_buf)
{
field_version__value.decode_text(text_buf);
field_spare.decode_text(text_buf);
}

void Version::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void Version::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int Version::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, Version_version__value_descr_.raw->forceomit);
  decoded_field_length = field_version__value.RAW_decode(Version_version__value_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::BIT4_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(General__Types::BIT4_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Version::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 2;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(2);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, Version_version__value_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::BIT4_descr_.raw);
  encoded_length += field_version__value.RAW_encode(Version_version__value_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_spare.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct Version_template::single_value_struct {
INTEGER_template field_version__value;
BITSTRING_template field_spare;
};

void Version_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_version__value = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
}
}
}

void Version_template::copy_value(const Version& other_value)
{
single_value = new single_value_struct;
if (other_value.version__value().is_bound()) {
  single_value->field_version__value = other_value.version__value();
} else {
  single_value->field_version__value.clean_up();
}
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Version_template::copy_template(const Version_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.version__value().get_selection()) {
single_value->field_version__value = other_value.version__value();
} else {
single_value->field_version__value.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new Version_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new Version_template(*other_value.implication_.precondition);
implication_.implied_template = new Version_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.Version.");
break;
}
set_selection(other_value);
}

Version_template::Version_template()
{
}

Version_template::Version_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

Version_template::Version_template(const Version& other_value)
{
copy_value(other_value);
}

Version_template::Version_template(const OPTIONAL<Version>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const Version&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.Version from an unbound optional field.");
}
}

Version_template::Version_template(Version_template* p_precondition, Version_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

Version_template::Version_template(Dynamic_Match_Interface<Version>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<Version>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

Version_template::Version_template(const Version_template& other_value)
: Base_Template()
{
copy_template(other_value);
}

Version_template::~Version_template()
{
clean_up();
}

Version_template& Version_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

Version_template& Version_template::operator=(const Version& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

Version_template& Version_template::operator=(const OPTIONAL<Version>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const Version&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.Version.");
}
return *this;
}

Version_template& Version_template::operator=(const Version_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean Version_template::match(const Version& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.version__value().is_bound()) return FALSE;
if(!single_value->field_version__value.match(other_value.version__value(), legacy))return FALSE;
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @LLC_Types.Version.");
}
return FALSE;
}

boolean Version_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_version__value.is_bound()
 || single_value->field_spare.is_bound();
}

boolean Version_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_version__value.is_value()
 && single_value->field_spare.is_value();
}

void Version_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

Version Version_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.Version.");
Version ret_val;
if (single_value->field_version__value.is_bound()) {
ret_val.version__value() = single_value->field_version__value.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
return ret_val;
}

void Version_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH)
TTCN_error("Setting an invalid list for a template of type @LLC_Types.Version.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Version_template[list_length];
}

Version_template& Version_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH)
TTCN_error("Accessing a list element of a non-list template of type @LLC_Types.Version.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LLC_Types.Version.");
return value_list.list_value[list_index];
}

INTEGER_template& Version_template::version__value()
{
set_specific();
return single_value->field_version__value;
}

const INTEGER_template& Version_template::version__value() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field version_value of a non-specific template of type @LLC_Types.Version.");
return single_value->field_version__value;
}

BITSTRING_template& Version_template::spare()
{
set_specific();
return single_value->field_spare;
}

const BITSTRING_template& Version_template::spare() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare of a non-specific template of type @LLC_Types.Version.");
return single_value->field_spare;
}

int Version_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Version which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 2;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LLC_Types.Version containing an empty list.");
      int item_size = value_list.list_value[0].size_of();
      for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++)
      {
        if (value_list.list_value[l_idx].size_of()!=item_size)
          TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Version containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Version containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Version containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Version containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Version containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Version containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Version containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LLC_Types.Version.");
  }
  return 0;
}

void Version_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ version_value := ");
single_value->field_version__value.log();
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void Version_template::log_match(const Version& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_version__value.match(match_value.version__value(), legacy)){
TTCN_Logger::log_logmatch_info(".version_value");
single_value->field_version__value.log_match(match_value.version__value(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ version_value := ");
single_value->field_version__value.log_match(match_value.version__value(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void Version_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (version__value().is_bound()) version__value().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void Version_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_version__value.encode_text(text_buf);
single_value->field_spare.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.Version.");
}
}

void Version_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_version__value.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new Version_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @LLC_Types.Version.");
}
}

void Version_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    Version_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @LLC_Types.Version has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) version__value().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "version_value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          version__value().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.Version: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Version_template* precondition = new Version_template;
    precondition->set_param(*param.get_elem(0));
    Version_template* implied_template = new Version_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Version_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LLC_Types.Version");
  }
  is_ifpresent = param.get_ifpresent();
}

void Version_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_version__value.check_restriction(t_res, t_name ? t_name : "@LLC_Types.Version");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@LLC_Types.Version");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.Version");
}

boolean Version_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean Version_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

T200::T200()
{
}

T200::T200(const BITSTRING& par_spare,
    const INTEGER& par_t200Value)
  :   field_spare(par_spare),
  field_t200Value(par_t200Value)
{
}

T200::T200(const T200& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.T200.");
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.t200Value().is_bound()) field_t200Value = other_value.t200Value();
else field_t200Value.clean_up();
}

void T200::clean_up()
{
field_spare.clean_up();
field_t200Value.clean_up();
}

const TTCN_Typedescriptor_t* T200::get_descriptor() const { return &T200_descr_; }
T200& T200::operator=(const T200& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LLC_Types.T200.");
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.t200Value().is_bound()) field_t200Value = other_value.t200Value();
  else field_t200Value.clean_up();
}
return *this;
}

boolean T200::operator==(const T200& other_value) const
{
return field_spare==other_value.field_spare
  && field_t200Value==other_value.field_t200Value;
}

boolean T200::is_bound() const
{
return (field_spare.is_bound())
  || (field_t200Value.is_bound());
}
boolean T200::is_value() const
{
return field_spare.is_value()
  && field_t200Value.is_value();
}
void T200::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ spare := ");
field_spare.log();
TTCN_Logger::log_event_str(", t200Value := ");
field_t200Value.log();
TTCN_Logger::log_event_str(" }");
}

void T200::set_implicit_omit()
{
if (spare().is_bound()) spare().set_implicit_omit();
if (t200Value().is_bound()) t200Value().set_implicit_omit();
}

void T200::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record value of type @LLC_Types.T200 has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) t200Value().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "t200Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          t200Value().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.T200: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LLC_Types.T200");
  }
}

void T200::encode_text(Text_Buf& text_buf) const
{
field_spare.encode_text(text_buf);
field_t200Value.encode_text(text_buf);
}

void T200::decode_text(Text_Buf& text_buf)
{
field_spare.decode_text(text_buf);
field_t200Value.decode_text(text_buf);
}

void T200::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void T200::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int T200::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, T200_spare_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(T200_spare_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, T200_t200Value_descr_.raw->forceomit);
  decoded_field_length = field_t200Value.RAW_decode(T200_t200Value_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int T200::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 2;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(2);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, T200_spare_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, T200_t200Value_descr_.raw);
  encoded_length += field_spare.RAW_encode(T200_spare_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_t200Value.RAW_encode(T200_t200Value_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct T200_template::single_value_struct {
BITSTRING_template field_spare;
INTEGER_template field_t200Value;
};

void T200_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_spare = ANY_VALUE;
single_value->field_t200Value = ANY_VALUE;
}
}
}

void T200_template::copy_value(const T200& other_value)
{
single_value = new single_value_struct;
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
if (other_value.t200Value().is_bound()) {
  single_value->field_t200Value = other_value.t200Value();
} else {
  single_value->field_t200Value.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void T200_template::copy_template(const T200_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.t200Value().get_selection()) {
single_value->field_t200Value = other_value.t200Value();
} else {
single_value->field_t200Value.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new T200_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new T200_template(*other_value.implication_.precondition);
implication_.implied_template = new T200_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.T200.");
break;
}
set_selection(other_value);
}

T200_template::T200_template()
{
}

T200_template::T200_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

T200_template::T200_template(const T200& other_value)
{
copy_value(other_value);
}

T200_template::T200_template(const OPTIONAL<T200>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const T200&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.T200 from an unbound optional field.");
}
}

T200_template::T200_template(T200_template* p_precondition, T200_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

T200_template::T200_template(Dynamic_Match_Interface<T200>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<T200>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

T200_template::T200_template(const T200_template& other_value)
: Base_Template()
{
copy_template(other_value);
}

T200_template::~T200_template()
{
clean_up();
}

T200_template& T200_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

T200_template& T200_template::operator=(const T200& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

T200_template& T200_template::operator=(const OPTIONAL<T200>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const T200&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.T200.");
}
return *this;
}

T200_template& T200_template::operator=(const T200_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean T200_template::match(const T200& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
if(!other_value.t200Value().is_bound()) return FALSE;
if(!single_value->field_t200Value.match(other_value.t200Value(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @LLC_Types.T200.");
}
return FALSE;
}

boolean T200_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_spare.is_bound()
 || single_value->field_t200Value.is_bound();
}

boolean T200_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_spare.is_value()
 && single_value->field_t200Value.is_value();
}

void T200_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

T200 T200_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.T200.");
T200 ret_val;
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_t200Value.is_bound()) {
ret_val.t200Value() = single_value->field_t200Value.valueof();
}
return ret_val;
}

void T200_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH)
TTCN_error("Setting an invalid list for a template of type @LLC_Types.T200.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new T200_template[list_length];
}

T200_template& T200_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH)
TTCN_error("Accessing a list element of a non-list template of type @LLC_Types.T200.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LLC_Types.T200.");
return value_list.list_value[list_index];
}

BITSTRING_template& T200_template::spare()
{
set_specific();
return single_value->field_spare;
}

const BITSTRING_template& T200_template::spare() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare of a non-specific template of type @LLC_Types.T200.");
return single_value->field_spare;
}

INTEGER_template& T200_template::t200Value()
{
set_specific();
return single_value->field_t200Value;
}

const INTEGER_template& T200_template::t200Value() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field t200Value of a non-specific template of type @LLC_Types.T200.");
return single_value->field_t200Value;
}

int T200_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.T200 which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 2;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LLC_Types.T200 containing an empty list.");
      int item_size = value_list.list_value[0].size_of();
      for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++)
      {
        if (value_list.list_value[l_idx].size_of()!=item_size)
          TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.T200 containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.T200 containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.T200 containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.T200 containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.T200 containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.T200 containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.T200 containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LLC_Types.T200.");
  }
  return 0;
}

void T200_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(", t200Value := ");
single_value->field_t200Value.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void T200_template::log_match(const T200& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_t200Value.match(match_value.t200Value(), legacy)){
TTCN_Logger::log_logmatch_info(".t200Value");
single_value->field_t200Value.log_match(match_value.t200Value(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(", t200Value := ");
single_value->field_t200Value.log_match(match_value.t200Value(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void T200_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (spare().is_bound()) spare().set_implicit_omit();
if (t200Value().is_bound()) t200Value().set_implicit_omit();
}

void T200_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_spare.encode_text(text_buf);
single_value->field_t200Value.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.T200.");
}
}

void T200_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_spare.decode_text(text_buf);
single_value->field_t200Value.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new T200_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @LLC_Types.T200.");
}
}

void T200_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    T200_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @LLC_Types.T200 has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) t200Value().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "t200Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          t200Value().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.T200: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    T200_template* precondition = new T200_template;
    precondition->set_param(*param.get_elem(0));
    T200_template* implied_template = new T200_template;
    implied_template->set_param(*param.get_elem(1));
    *this = T200_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LLC_Types.T200");
  }
  is_ifpresent = param.get_ifpresent();
}

void T200_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@LLC_Types.T200");
single_value->field_t200Value.check_restriction(t_res, t_name ? t_name : "@LLC_Types.T200");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.T200");
}

boolean T200_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean T200_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

N200::N200()
{
}

N200::N200(const INTEGER& par_retransmissions,
    const BITSTRING& par_spare)
  :   field_retransmissions(par_retransmissions),
  field_spare(par_spare)
{
}

N200::N200(const N200& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.N200.");
if (other_value.retransmissions().is_bound()) field_retransmissions = other_value.retransmissions();
else field_retransmissions.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
}

void N200::clean_up()
{
field_retransmissions.clean_up();
field_spare.clean_up();
}

const TTCN_Typedescriptor_t* N200::get_descriptor() const { return &N200_descr_; }
N200& N200::operator=(const N200& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LLC_Types.N200.");
  if (other_value.retransmissions().is_bound()) field_retransmissions = other_value.retransmissions();
  else field_retransmissions.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
}
return *this;
}

boolean N200::operator==(const N200& other_value) const
{
return field_retransmissions==other_value.field_retransmissions
  && field_spare==other_value.field_spare;
}

boolean N200::is_bound() const
{
return (field_retransmissions.is_bound())
  || (field_spare.is_bound());
}
boolean N200::is_value() const
{
return field_retransmissions.is_value()
  && field_spare.is_value();
}
void N200::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ retransmissions := ");
field_retransmissions.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(" }");
}

void N200::set_implicit_omit()
{
if (retransmissions().is_bound()) retransmissions().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void N200::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record value of type @LLC_Types.N200 has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) retransmissions().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "retransmissions")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          retransmissions().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.N200: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LLC_Types.N200");
  }
}

void N200::encode_text(Text_Buf& text_buf) const
{
field_retransmissions.encode_text(text_buf);
field_spare.encode_text(text_buf);
}

void N200::decode_text(Text_Buf& text_buf)
{
field_retransmissions.decode_text(text_buf);
field_spare.decode_text(text_buf);
}

void N200::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void N200::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int N200::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, N200_retransmissions_descr_.raw->forceomit);
  decoded_field_length = field_retransmissions.RAW_decode(N200_retransmissions_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::BIT4_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(General__Types::BIT4_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int N200::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 2;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(2);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, N200_retransmissions_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::BIT4_descr_.raw);
  encoded_length += field_retransmissions.RAW_encode(N200_retransmissions_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_spare.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct N200_template::single_value_struct {
INTEGER_template field_retransmissions;
BITSTRING_template field_spare;
};

void N200_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_retransmissions = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
}
}
}

void N200_template::copy_value(const N200& other_value)
{
single_value = new single_value_struct;
if (other_value.retransmissions().is_bound()) {
  single_value->field_retransmissions = other_value.retransmissions();
} else {
  single_value->field_retransmissions.clean_up();
}
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void N200_template::copy_template(const N200_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.retransmissions().get_selection()) {
single_value->field_retransmissions = other_value.retransmissions();
} else {
single_value->field_retransmissions.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new N200_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new N200_template(*other_value.implication_.precondition);
implication_.implied_template = new N200_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.N200.");
break;
}
set_selection(other_value);
}

N200_template::N200_template()
{
}

N200_template::N200_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

N200_template::N200_template(const N200& other_value)
{
copy_value(other_value);
}

N200_template::N200_template(const OPTIONAL<N200>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const N200&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.N200 from an unbound optional field.");
}
}

N200_template::N200_template(N200_template* p_precondition, N200_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

N200_template::N200_template(Dynamic_Match_Interface<N200>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<N200>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

N200_template::N200_template(const N200_template& other_value)
: Base_Template()
{
copy_template(other_value);
}

N200_template::~N200_template()
{
clean_up();
}

N200_template& N200_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

N200_template& N200_template::operator=(const N200& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

N200_template& N200_template::operator=(const OPTIONAL<N200>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const N200&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.N200.");
}
return *this;
}

N200_template& N200_template::operator=(const N200_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean N200_template::match(const N200& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.retransmissions().is_bound()) return FALSE;
if(!single_value->field_retransmissions.match(other_value.retransmissions(), legacy))return FALSE;
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @LLC_Types.N200.");
}
return FALSE;
}

boolean N200_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_retransmissions.is_bound()
 || single_value->field_spare.is_bound();
}

boolean N200_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_retransmissions.is_value()
 && single_value->field_spare.is_value();
}

void N200_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

N200 N200_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.N200.");
N200 ret_val;
if (single_value->field_retransmissions.is_bound()) {
ret_val.retransmissions() = single_value->field_retransmissions.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
return ret_val;
}

void N200_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH)
TTCN_error("Setting an invalid list for a template of type @LLC_Types.N200.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new N200_template[list_length];
}

N200_template& N200_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH)
TTCN_error("Accessing a list element of a non-list template of type @LLC_Types.N200.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LLC_Types.N200.");
return value_list.list_value[list_index];
}

INTEGER_template& N200_template::retransmissions()
{
set_specific();
return single_value->field_retransmissions;
}

const INTEGER_template& N200_template::retransmissions() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field retransmissions of a non-specific template of type @LLC_Types.N200.");
return single_value->field_retransmissions;
}

BITSTRING_template& N200_template::spare()
{
set_specific();
return single_value->field_spare;
}

const BITSTRING_template& N200_template::spare() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare of a non-specific template of type @LLC_Types.N200.");
return single_value->field_spare;
}

int N200_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N200 which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 2;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LLC_Types.N200 containing an empty list.");
      int item_size = value_list.list_value[0].size_of();
      for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++)
      {
        if (value_list.list_value[l_idx].size_of()!=item_size)
          TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N200 containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N200 containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N200 containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N200 containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N200 containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N200 containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N200 containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LLC_Types.N200.");
  }
  return 0;
}

void N200_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ retransmissions := ");
single_value->field_retransmissions.log();
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void N200_template::log_match(const N200& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_retransmissions.match(match_value.retransmissions(), legacy)){
TTCN_Logger::log_logmatch_info(".retransmissions");
single_value->field_retransmissions.log_match(match_value.retransmissions(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ retransmissions := ");
single_value->field_retransmissions.log_match(match_value.retransmissions(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void N200_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (retransmissions().is_bound()) retransmissions().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void N200_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_retransmissions.encode_text(text_buf);
single_value->field_spare.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.N200.");
}
}

void N200_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_retransmissions.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new N200_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @LLC_Types.N200.");
}
}

void N200_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    N200_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @LLC_Types.N200 has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) retransmissions().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "retransmissions")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          retransmissions().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.N200: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    N200_template* precondition = new N200_template;
    precondition->set_param(*param.get_elem(0));
    N200_template* implied_template = new N200_template;
    implied_template->set_param(*param.get_elem(1));
    *this = N200_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LLC_Types.N200");
  }
  is_ifpresent = param.get_ifpresent();
}

void N200_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_retransmissions.check_restriction(t_res, t_name ? t_name : "@LLC_Types.N200");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@LLC_Types.N200");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.N200");
}

boolean N200_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean N200_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

N201__U::N201__U()
{
}

N201__U::N201__U(const BITSTRING& par_spare,
    const INTEGER& par_n201UValue)
  :   field_spare(par_spare),
  field_n201UValue(par_n201UValue)
{
}

N201__U::N201__U(const N201__U& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.N201_U.");
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.n201UValue().is_bound()) field_n201UValue = other_value.n201UValue();
else field_n201UValue.clean_up();
}

void N201__U::clean_up()
{
field_spare.clean_up();
field_n201UValue.clean_up();
}

const TTCN_Typedescriptor_t* N201__U::get_descriptor() const { return &N201__U_descr_; }
N201__U& N201__U::operator=(const N201__U& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LLC_Types.N201_U.");
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.n201UValue().is_bound()) field_n201UValue = other_value.n201UValue();
  else field_n201UValue.clean_up();
}
return *this;
}

boolean N201__U::operator==(const N201__U& other_value) const
{
return field_spare==other_value.field_spare
  && field_n201UValue==other_value.field_n201UValue;
}

boolean N201__U::is_bound() const
{
return (field_spare.is_bound())
  || (field_n201UValue.is_bound());
}
boolean N201__U::is_value() const
{
return field_spare.is_value()
  && field_n201UValue.is_value();
}
void N201__U::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ spare := ");
field_spare.log();
TTCN_Logger::log_event_str(", n201UValue := ");
field_n201UValue.log();
TTCN_Logger::log_event_str(" }");
}

void N201__U::set_implicit_omit()
{
if (spare().is_bound()) spare().set_implicit_omit();
if (n201UValue().is_bound()) n201UValue().set_implicit_omit();
}

void N201__U::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record value of type @LLC_Types.N201_U has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) n201UValue().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "n201UValue")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          n201UValue().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.N201_U: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LLC_Types.N201_U");
  }
}

void N201__U::encode_text(Text_Buf& text_buf) const
{
field_spare.encode_text(text_buf);
field_n201UValue.encode_text(text_buf);
}

void N201__U::decode_text(Text_Buf& text_buf)
{
field_spare.decode_text(text_buf);
field_n201UValue.decode_text(text_buf);
}

void N201__U::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void N201__U::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int N201__U::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, N201__U_spare_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(N201__U_spare_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, N201__U_n201UValue_descr_.raw->forceomit);
  decoded_field_length = field_n201UValue.RAW_decode(N201__U_n201UValue_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int N201__U::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 2;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(2);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, N201__U_spare_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, N201__U_n201UValue_descr_.raw);
  encoded_length += field_spare.RAW_encode(N201__U_spare_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_n201UValue.RAW_encode(N201__U_n201UValue_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct N201__U_template::single_value_struct {
BITSTRING_template field_spare;
INTEGER_template field_n201UValue;
};

void N201__U_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_spare = ANY_VALUE;
single_value->field_n201UValue = ANY_VALUE;
}
}
}

void N201__U_template::copy_value(const N201__U& other_value)
{
single_value = new single_value_struct;
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
if (other_value.n201UValue().is_bound()) {
  single_value->field_n201UValue = other_value.n201UValue();
} else {
  single_value->field_n201UValue.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void N201__U_template::copy_template(const N201__U_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.n201UValue().get_selection()) {
single_value->field_n201UValue = other_value.n201UValue();
} else {
single_value->field_n201UValue.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new N201__U_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new N201__U_template(*other_value.implication_.precondition);
implication_.implied_template = new N201__U_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.N201_U.");
break;
}
set_selection(other_value);
}

N201__U_template::N201__U_template()
{
}

N201__U_template::N201__U_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

N201__U_template::N201__U_template(const N201__U& other_value)
{
copy_value(other_value);
}

N201__U_template::N201__U_template(const OPTIONAL<N201__U>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const N201__U&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.N201_U from an unbound optional field.");
}
}

N201__U_template::N201__U_template(N201__U_template* p_precondition, N201__U_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

N201__U_template::N201__U_template(Dynamic_Match_Interface<N201__U>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<N201__U>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

N201__U_template::N201__U_template(const N201__U_template& other_value)
: Base_Template()
{
copy_template(other_value);
}

N201__U_template::~N201__U_template()
{
clean_up();
}

N201__U_template& N201__U_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

N201__U_template& N201__U_template::operator=(const N201__U& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

N201__U_template& N201__U_template::operator=(const OPTIONAL<N201__U>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const N201__U&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.N201_U.");
}
return *this;
}

N201__U_template& N201__U_template::operator=(const N201__U_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean N201__U_template::match(const N201__U& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
if(!other_value.n201UValue().is_bound()) return FALSE;
if(!single_value->field_n201UValue.match(other_value.n201UValue(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @LLC_Types.N201_U.");
}
return FALSE;
}

boolean N201__U_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_spare.is_bound()
 || single_value->field_n201UValue.is_bound();
}

boolean N201__U_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_spare.is_value()
 && single_value->field_n201UValue.is_value();
}

void N201__U_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

N201__U N201__U_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.N201_U.");
N201__U ret_val;
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_n201UValue.is_bound()) {
ret_val.n201UValue() = single_value->field_n201UValue.valueof();
}
return ret_val;
}

void N201__U_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH)
TTCN_error("Setting an invalid list for a template of type @LLC_Types.N201_U.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new N201__U_template[list_length];
}

N201__U_template& N201__U_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH)
TTCN_error("Accessing a list element of a non-list template of type @LLC_Types.N201_U.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LLC_Types.N201_U.");
return value_list.list_value[list_index];
}

BITSTRING_template& N201__U_template::spare()
{
set_specific();
return single_value->field_spare;
}

const BITSTRING_template& N201__U_template::spare() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare of a non-specific template of type @LLC_Types.N201_U.");
return single_value->field_spare;
}

INTEGER_template& N201__U_template::n201UValue()
{
set_specific();
return single_value->field_n201UValue;
}

const INTEGER_template& N201__U_template::n201UValue() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field n201UValue of a non-specific template of type @LLC_Types.N201_U.");
return single_value->field_n201UValue;
}

int N201__U_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N201_U which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 2;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LLC_Types.N201_U containing an empty list.");
      int item_size = value_list.list_value[0].size_of();
      for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++)
      {
        if (value_list.list_value[l_idx].size_of()!=item_size)
          TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N201_U containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N201_U containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N201_U containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N201_U containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N201_U containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N201_U containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N201_U containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LLC_Types.N201_U.");
  }
  return 0;
}

void N201__U_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(", n201UValue := ");
single_value->field_n201UValue.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void N201__U_template::log_match(const N201__U& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_n201UValue.match(match_value.n201UValue(), legacy)){
TTCN_Logger::log_logmatch_info(".n201UValue");
single_value->field_n201UValue.log_match(match_value.n201UValue(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(", n201UValue := ");
single_value->field_n201UValue.log_match(match_value.n201UValue(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void N201__U_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (spare().is_bound()) spare().set_implicit_omit();
if (n201UValue().is_bound()) n201UValue().set_implicit_omit();
}

void N201__U_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_spare.encode_text(text_buf);
single_value->field_n201UValue.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.N201_U.");
}
}

void N201__U_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_spare.decode_text(text_buf);
single_value->field_n201UValue.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new N201__U_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @LLC_Types.N201_U.");
}
}

void N201__U_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    N201__U_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @LLC_Types.N201_U has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) n201UValue().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "n201UValue")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          n201UValue().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.N201_U: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    N201__U_template* precondition = new N201__U_template;
    precondition->set_param(*param.get_elem(0));
    N201__U_template* implied_template = new N201__U_template;
    implied_template->set_param(*param.get_elem(1));
    *this = N201__U_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LLC_Types.N201_U");
  }
  is_ifpresent = param.get_ifpresent();
}

void N201__U_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@LLC_Types.N201_U");
single_value->field_n201UValue.check_restriction(t_res, t_name ? t_name : "@LLC_Types.N201_U");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.N201_U");
}

boolean N201__U_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean N201__U_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

N201__I::N201__I()
{
}

N201__I::N201__I(const BITSTRING& par_spare,
    const INTEGER& par_n201IValue)
  :   field_spare(par_spare),
  field_n201IValue(par_n201IValue)
{
}

N201__I::N201__I(const N201__I& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.N201_I.");
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.n201IValue().is_bound()) field_n201IValue = other_value.n201IValue();
else field_n201IValue.clean_up();
}

void N201__I::clean_up()
{
field_spare.clean_up();
field_n201IValue.clean_up();
}

const TTCN_Typedescriptor_t* N201__I::get_descriptor() const { return &N201__I_descr_; }
N201__I& N201__I::operator=(const N201__I& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LLC_Types.N201_I.");
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.n201IValue().is_bound()) field_n201IValue = other_value.n201IValue();
  else field_n201IValue.clean_up();
}
return *this;
}

boolean N201__I::operator==(const N201__I& other_value) const
{
return field_spare==other_value.field_spare
  && field_n201IValue==other_value.field_n201IValue;
}

boolean N201__I::is_bound() const
{
return (field_spare.is_bound())
  || (field_n201IValue.is_bound());
}
boolean N201__I::is_value() const
{
return field_spare.is_value()
  && field_n201IValue.is_value();
}
void N201__I::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ spare := ");
field_spare.log();
TTCN_Logger::log_event_str(", n201IValue := ");
field_n201IValue.log();
TTCN_Logger::log_event_str(" }");
}

void N201__I::set_implicit_omit()
{
if (spare().is_bound()) spare().set_implicit_omit();
if (n201IValue().is_bound()) n201IValue().set_implicit_omit();
}

void N201__I::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record value of type @LLC_Types.N201_I has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) n201IValue().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "n201IValue")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          n201IValue().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.N201_I: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LLC_Types.N201_I");
  }
}

void N201__I::encode_text(Text_Buf& text_buf) const
{
field_spare.encode_text(text_buf);
field_n201IValue.encode_text(text_buf);
}

void N201__I::decode_text(Text_Buf& text_buf)
{
field_spare.decode_text(text_buf);
field_n201IValue.decode_text(text_buf);
}

void N201__I::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void N201__I::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int N201__I::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, N201__I_spare_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(N201__I_spare_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, N201__I_n201IValue_descr_.raw->forceomit);
  decoded_field_length = field_n201IValue.RAW_decode(N201__I_n201IValue_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int N201__I::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 2;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(2);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, N201__I_spare_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, N201__I_n201IValue_descr_.raw);
  encoded_length += field_spare.RAW_encode(N201__I_spare_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_n201IValue.RAW_encode(N201__I_n201IValue_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct N201__I_template::single_value_struct {
BITSTRING_template field_spare;
INTEGER_template field_n201IValue;
};

void N201__I_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_spare = ANY_VALUE;
single_value->field_n201IValue = ANY_VALUE;
}
}
}

void N201__I_template::copy_value(const N201__I& other_value)
{
single_value = new single_value_struct;
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
if (other_value.n201IValue().is_bound()) {
  single_value->field_n201IValue = other_value.n201IValue();
} else {
  single_value->field_n201IValue.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void N201__I_template::copy_template(const N201__I_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.n201IValue().get_selection()) {
single_value->field_n201IValue = other_value.n201IValue();
} else {
single_value->field_n201IValue.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new N201__I_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new N201__I_template(*other_value.implication_.precondition);
implication_.implied_template = new N201__I_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.N201_I.");
break;
}
set_selection(other_value);
}

N201__I_template::N201__I_template()
{
}

N201__I_template::N201__I_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

N201__I_template::N201__I_template(const N201__I& other_value)
{
copy_value(other_value);
}

N201__I_template::N201__I_template(const OPTIONAL<N201__I>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const N201__I&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.N201_I from an unbound optional field.");
}
}

N201__I_template::N201__I_template(N201__I_template* p_precondition, N201__I_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

N201__I_template::N201__I_template(Dynamic_Match_Interface<N201__I>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<N201__I>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

N201__I_template::N201__I_template(const N201__I_template& other_value)
: Base_Template()
{
copy_template(other_value);
}

N201__I_template::~N201__I_template()
{
clean_up();
}

N201__I_template& N201__I_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

N201__I_template& N201__I_template::operator=(const N201__I& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

N201__I_template& N201__I_template::operator=(const OPTIONAL<N201__I>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const N201__I&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.N201_I.");
}
return *this;
}

N201__I_template& N201__I_template::operator=(const N201__I_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean N201__I_template::match(const N201__I& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
if(!other_value.n201IValue().is_bound()) return FALSE;
if(!single_value->field_n201IValue.match(other_value.n201IValue(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @LLC_Types.N201_I.");
}
return FALSE;
}

boolean N201__I_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_spare.is_bound()
 || single_value->field_n201IValue.is_bound();
}

boolean N201__I_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_spare.is_value()
 && single_value->field_n201IValue.is_value();
}

void N201__I_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

N201__I N201__I_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.N201_I.");
N201__I ret_val;
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_n201IValue.is_bound()) {
ret_val.n201IValue() = single_value->field_n201IValue.valueof();
}
return ret_val;
}

void N201__I_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH)
TTCN_error("Setting an invalid list for a template of type @LLC_Types.N201_I.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new N201__I_template[list_length];
}

N201__I_template& N201__I_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH)
TTCN_error("Accessing a list element of a non-list template of type @LLC_Types.N201_I.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LLC_Types.N201_I.");
return value_list.list_value[list_index];
}

BITSTRING_template& N201__I_template::spare()
{
set_specific();
return single_value->field_spare;
}

const BITSTRING_template& N201__I_template::spare() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare of a non-specific template of type @LLC_Types.N201_I.");
return single_value->field_spare;
}

INTEGER_template& N201__I_template::n201IValue()
{
set_specific();
return single_value->field_n201IValue;
}

const INTEGER_template& N201__I_template::n201IValue() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field n201IValue of a non-specific template of type @LLC_Types.N201_I.");
return single_value->field_n201IValue;
}

int N201__I_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N201_I which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 2;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LLC_Types.N201_I containing an empty list.");
      int item_size = value_list.list_value[0].size_of();
      for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++)
      {
        if (value_list.list_value[l_idx].size_of()!=item_size)
          TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N201_I containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N201_I containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N201_I containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N201_I containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N201_I containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N201_I containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.N201_I containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LLC_Types.N201_I.");
  }
  return 0;
}

void N201__I_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(", n201IValue := ");
single_value->field_n201IValue.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void N201__I_template::log_match(const N201__I& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_n201IValue.match(match_value.n201IValue(), legacy)){
TTCN_Logger::log_logmatch_info(".n201IValue");
single_value->field_n201IValue.log_match(match_value.n201IValue(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(", n201IValue := ");
single_value->field_n201IValue.log_match(match_value.n201IValue(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void N201__I_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (spare().is_bound()) spare().set_implicit_omit();
if (n201IValue().is_bound()) n201IValue().set_implicit_omit();
}

void N201__I_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_spare.encode_text(text_buf);
single_value->field_n201IValue.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.N201_I.");
}
}

void N201__I_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_spare.decode_text(text_buf);
single_value->field_n201IValue.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new N201__I_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @LLC_Types.N201_I.");
}
}

void N201__I_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    N201__I_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @LLC_Types.N201_I has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) n201IValue().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "n201IValue")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          n201IValue().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.N201_I: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    N201__I_template* precondition = new N201__I_template;
    precondition->set_param(*param.get_elem(0));
    N201__I_template* implied_template = new N201__I_template;
    implied_template->set_param(*param.get_elem(1));
    *this = N201__I_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LLC_Types.N201_I");
  }
  is_ifpresent = param.get_ifpresent();
}

void N201__I_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@LLC_Types.N201_I");
single_value->field_n201IValue.check_restriction(t_res, t_name ? t_name : "@LLC_Types.N201_I");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.N201_I");
}

boolean N201__I_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean N201__I_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

MD::MD()
{
}

MD::MD(const BITSTRING& par_spare,
    const INTEGER& par_mDValue)
  :   field_spare(par_spare),
  field_mDValue(par_mDValue)
{
}

MD::MD(const MD& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.MD.");
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.mDValue().is_bound()) field_mDValue = other_value.mDValue();
else field_mDValue.clean_up();
}

void MD::clean_up()
{
field_spare.clean_up();
field_mDValue.clean_up();
}

const TTCN_Typedescriptor_t* MD::get_descriptor() const { return &MD_descr_; }
MD& MD::operator=(const MD& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LLC_Types.MD.");
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.mDValue().is_bound()) field_mDValue = other_value.mDValue();
  else field_mDValue.clean_up();
}
return *this;
}

boolean MD::operator==(const MD& other_value) const
{
return field_spare==other_value.field_spare
  && field_mDValue==other_value.field_mDValue;
}

boolean MD::is_bound() const
{
return (field_spare.is_bound())
  || (field_mDValue.is_bound());
}
boolean MD::is_value() const
{
return field_spare.is_value()
  && field_mDValue.is_value();
}
void MD::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ spare := ");
field_spare.log();
TTCN_Logger::log_event_str(", mDValue := ");
field_mDValue.log();
TTCN_Logger::log_event_str(" }");
}

void MD::set_implicit_omit()
{
if (spare().is_bound()) spare().set_implicit_omit();
if (mDValue().is_bound()) mDValue().set_implicit_omit();
}

void MD::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record value of type @LLC_Types.MD has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mDValue().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mDValue")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mDValue().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.MD: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LLC_Types.MD");
  }
}

void MD::encode_text(Text_Buf& text_buf) const
{
field_spare.encode_text(text_buf);
field_mDValue.encode_text(text_buf);
}

void MD::decode_text(Text_Buf& text_buf)
{
field_spare.decode_text(text_buf);
field_mDValue.decode_text(text_buf);
}

void MD::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void MD::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int MD::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, MD_spare_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(MD_spare_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, MD_mDValue_descr_.raw->forceomit);
  decoded_field_length = field_mDValue.RAW_decode(MD_mDValue_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int MD::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 2;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(2);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, MD_spare_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, MD_mDValue_descr_.raw);
  encoded_length += field_spare.RAW_encode(MD_spare_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_mDValue.RAW_encode(MD_mDValue_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct MD_template::single_value_struct {
BITSTRING_template field_spare;
INTEGER_template field_mDValue;
};

void MD_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_spare = ANY_VALUE;
single_value->field_mDValue = ANY_VALUE;
}
}
}

void MD_template::copy_value(const MD& other_value)
{
single_value = new single_value_struct;
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
if (other_value.mDValue().is_bound()) {
  single_value->field_mDValue = other_value.mDValue();
} else {
  single_value->field_mDValue.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void MD_template::copy_template(const MD_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.mDValue().get_selection()) {
single_value->field_mDValue = other_value.mDValue();
} else {
single_value->field_mDValue.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new MD_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new MD_template(*other_value.implication_.precondition);
implication_.implied_template = new MD_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.MD.");
break;
}
set_selection(other_value);
}

MD_template::MD_template()
{
}

MD_template::MD_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

MD_template::MD_template(const MD& other_value)
{
copy_value(other_value);
}

MD_template::MD_template(const OPTIONAL<MD>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const MD&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.MD from an unbound optional field.");
}
}

MD_template::MD_template(MD_template* p_precondition, MD_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

MD_template::MD_template(Dynamic_Match_Interface<MD>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<MD>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

MD_template::MD_template(const MD_template& other_value)
: Base_Template()
{
copy_template(other_value);
}

MD_template::~MD_template()
{
clean_up();
}

MD_template& MD_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

MD_template& MD_template::operator=(const MD& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

MD_template& MD_template::operator=(const OPTIONAL<MD>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const MD&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.MD.");
}
return *this;
}

MD_template& MD_template::operator=(const MD_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean MD_template::match(const MD& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
if(!other_value.mDValue().is_bound()) return FALSE;
if(!single_value->field_mDValue.match(other_value.mDValue(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @LLC_Types.MD.");
}
return FALSE;
}

boolean MD_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_spare.is_bound()
 || single_value->field_mDValue.is_bound();
}

boolean MD_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_spare.is_value()
 && single_value->field_mDValue.is_value();
}

void MD_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

MD MD_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.MD.");
MD ret_val;
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_mDValue.is_bound()) {
ret_val.mDValue() = single_value->field_mDValue.valueof();
}
return ret_val;
}

void MD_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH)
TTCN_error("Setting an invalid list for a template of type @LLC_Types.MD.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new MD_template[list_length];
}

MD_template& MD_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH)
TTCN_error("Accessing a list element of a non-list template of type @LLC_Types.MD.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LLC_Types.MD.");
return value_list.list_value[list_index];
}

BITSTRING_template& MD_template::spare()
{
set_specific();
return single_value->field_spare;
}

const BITSTRING_template& MD_template::spare() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare of a non-specific template of type @LLC_Types.MD.");
return single_value->field_spare;
}

INTEGER_template& MD_template::mDValue()
{
set_specific();
return single_value->field_mDValue;
}

const INTEGER_template& MD_template::mDValue() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mDValue of a non-specific template of type @LLC_Types.MD.");
return single_value->field_mDValue;
}

int MD_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.MD which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 2;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LLC_Types.MD containing an empty list.");
      int item_size = value_list.list_value[0].size_of();
      for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++)
      {
        if (value_list.list_value[l_idx].size_of()!=item_size)
          TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.MD containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.MD containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.MD containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.MD containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.MD containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.MD containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.MD containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LLC_Types.MD.");
  }
  return 0;
}

void MD_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(", mDValue := ");
single_value->field_mDValue.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void MD_template::log_match(const MD& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_mDValue.match(match_value.mDValue(), legacy)){
TTCN_Logger::log_logmatch_info(".mDValue");
single_value->field_mDValue.log_match(match_value.mDValue(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(", mDValue := ");
single_value->field_mDValue.log_match(match_value.mDValue(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void MD_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (spare().is_bound()) spare().set_implicit_omit();
if (mDValue().is_bound()) mDValue().set_implicit_omit();
}

void MD_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_spare.encode_text(text_buf);
single_value->field_mDValue.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.MD.");
}
}

void MD_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_spare.decode_text(text_buf);
single_value->field_mDValue.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new MD_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @LLC_Types.MD.");
}
}

void MD_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    MD_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @LLC_Types.MD has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mDValue().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mDValue")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mDValue().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.MD: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    MD_template* precondition = new MD_template;
    precondition->set_param(*param.get_elem(0));
    MD_template* implied_template = new MD_template;
    implied_template->set_param(*param.get_elem(1));
    *this = MD_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LLC_Types.MD");
  }
  is_ifpresent = param.get_ifpresent();
}

void MD_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@LLC_Types.MD");
single_value->field_mDValue.check_restriction(t_res, t_name ? t_name : "@LLC_Types.MD");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.MD");
}

boolean MD_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean MD_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

MU::MU()
{
}

MU::MU(const BITSTRING& par_spare,
    const INTEGER& par_mUValue)
  :   field_spare(par_spare),
  field_mUValue(par_mUValue)
{
}

MU::MU(const MU& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.MU.");
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.mUValue().is_bound()) field_mUValue = other_value.mUValue();
else field_mUValue.clean_up();
}

void MU::clean_up()
{
field_spare.clean_up();
field_mUValue.clean_up();
}

const TTCN_Typedescriptor_t* MU::get_descriptor() const { return &MU_descr_; }
MU& MU::operator=(const MU& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LLC_Types.MU.");
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.mUValue().is_bound()) field_mUValue = other_value.mUValue();
  else field_mUValue.clean_up();
}
return *this;
}

boolean MU::operator==(const MU& other_value) const
{
return field_spare==other_value.field_spare
  && field_mUValue==other_value.field_mUValue;
}

boolean MU::is_bound() const
{
return (field_spare.is_bound())
  || (field_mUValue.is_bound());
}
boolean MU::is_value() const
{
return field_spare.is_value()
  && field_mUValue.is_value();
}
void MU::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ spare := ");
field_spare.log();
TTCN_Logger::log_event_str(", mUValue := ");
field_mUValue.log();
TTCN_Logger::log_event_str(" }");
}

void MU::set_implicit_omit()
{
if (spare().is_bound()) spare().set_implicit_omit();
if (mUValue().is_bound()) mUValue().set_implicit_omit();
}

void MU::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record value of type @LLC_Types.MU has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mUValue().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mUValue")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mUValue().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.MU: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LLC_Types.MU");
  }
}

void MU::encode_text(Text_Buf& text_buf) const
{
field_spare.encode_text(text_buf);
field_mUValue.encode_text(text_buf);
}

void MU::decode_text(Text_Buf& text_buf)
{
field_spare.decode_text(text_buf);
field_mUValue.decode_text(text_buf);
}

void MU::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void MU::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int MU::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, MU_spare_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(MU_spare_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, MU_mUValue_descr_.raw->forceomit);
  decoded_field_length = field_mUValue.RAW_decode(MU_mUValue_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int MU::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 2;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(2);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, MU_spare_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, MU_mUValue_descr_.raw);
  encoded_length += field_spare.RAW_encode(MU_spare_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_mUValue.RAW_encode(MU_mUValue_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct MU_template::single_value_struct {
BITSTRING_template field_spare;
INTEGER_template field_mUValue;
};

void MU_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_spare = ANY_VALUE;
single_value->field_mUValue = ANY_VALUE;
}
}
}

void MU_template::copy_value(const MU& other_value)
{
single_value = new single_value_struct;
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
if (other_value.mUValue().is_bound()) {
  single_value->field_mUValue = other_value.mUValue();
} else {
  single_value->field_mUValue.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void MU_template::copy_template(const MU_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.mUValue().get_selection()) {
single_value->field_mUValue = other_value.mUValue();
} else {
single_value->field_mUValue.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new MU_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new MU_template(*other_value.implication_.precondition);
implication_.implied_template = new MU_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.MU.");
break;
}
set_selection(other_value);
}

MU_template::MU_template()
{
}

MU_template::MU_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

MU_template::MU_template(const MU& other_value)
{
copy_value(other_value);
}

MU_template::MU_template(const OPTIONAL<MU>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const MU&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.MU from an unbound optional field.");
}
}

MU_template::MU_template(MU_template* p_precondition, MU_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

MU_template::MU_template(Dynamic_Match_Interface<MU>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<MU>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

MU_template::MU_template(const MU_template& other_value)
: Base_Template()
{
copy_template(other_value);
}

MU_template::~MU_template()
{
clean_up();
}

MU_template& MU_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

MU_template& MU_template::operator=(const MU& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

MU_template& MU_template::operator=(const OPTIONAL<MU>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const MU&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.MU.");
}
return *this;
}

MU_template& MU_template::operator=(const MU_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean MU_template::match(const MU& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
if(!other_value.mUValue().is_bound()) return FALSE;
if(!single_value->field_mUValue.match(other_value.mUValue(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @LLC_Types.MU.");
}
return FALSE;
}

boolean MU_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_spare.is_bound()
 || single_value->field_mUValue.is_bound();
}

boolean MU_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_spare.is_value()
 && single_value->field_mUValue.is_value();
}

void MU_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

MU MU_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.MU.");
MU ret_val;
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_mUValue.is_bound()) {
ret_val.mUValue() = single_value->field_mUValue.valueof();
}
return ret_val;
}

void MU_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH)
TTCN_error("Setting an invalid list for a template of type @LLC_Types.MU.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new MU_template[list_length];
}

MU_template& MU_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH)
TTCN_error("Accessing a list element of a non-list template of type @LLC_Types.MU.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LLC_Types.MU.");
return value_list.list_value[list_index];
}

BITSTRING_template& MU_template::spare()
{
set_specific();
return single_value->field_spare;
}

const BITSTRING_template& MU_template::spare() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare of a non-specific template of type @LLC_Types.MU.");
return single_value->field_spare;
}

INTEGER_template& MU_template::mUValue()
{
set_specific();
return single_value->field_mUValue;
}

const INTEGER_template& MU_template::mUValue() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mUValue of a non-specific template of type @LLC_Types.MU.");
return single_value->field_mUValue;
}

int MU_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.MU which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 2;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LLC_Types.MU containing an empty list.");
      int item_size = value_list.list_value[0].size_of();
      for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++)
      {
        if (value_list.list_value[l_idx].size_of()!=item_size)
          TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.MU containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.MU containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.MU containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.MU containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.MU containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.MU containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.MU containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LLC_Types.MU.");
  }
  return 0;
}

void MU_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(", mUValue := ");
single_value->field_mUValue.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void MU_template::log_match(const MU& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_mUValue.match(match_value.mUValue(), legacy)){
TTCN_Logger::log_logmatch_info(".mUValue");
single_value->field_mUValue.log_match(match_value.mUValue(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(", mUValue := ");
single_value->field_mUValue.log_match(match_value.mUValue(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void MU_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (spare().is_bound()) spare().set_implicit_omit();
if (mUValue().is_bound()) mUValue().set_implicit_omit();
}

void MU_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_spare.encode_text(text_buf);
single_value->field_mUValue.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.MU.");
}
}

void MU_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_spare.decode_text(text_buf);
single_value->field_mUValue.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new MU_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @LLC_Types.MU.");
}
}

void MU_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    MU_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @LLC_Types.MU has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mUValue().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mUValue")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mUValue().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.MU: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    MU_template* precondition = new MU_template;
    precondition->set_param(*param.get_elem(0));
    MU_template* implied_template = new MU_template;
    implied_template->set_param(*param.get_elem(1));
    *this = MU_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LLC_Types.MU");
  }
  is_ifpresent = param.get_ifpresent();
}

void MU_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@LLC_Types.MU");
single_value->field_mUValue.check_restriction(t_res, t_name ? t_name : "@LLC_Types.MU");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.MU");
}

boolean MU_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean MU_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

void XID__Data::copy_value(const XID__Data& other_value)
{
switch (other_value.union_selection) {
case ALT_version:
field_version = new Version(*other_value.field_version);
break;
case ALT_iOV__UI:
field_iOV__UI = new OCTETSTRING(*other_value.field_iOV__UI);
break;
case ALT_iOV__I:
field_iOV__I = new OCTETSTRING(*other_value.field_iOV__I);
break;
case ALT_t200:
field_t200 = new T200(*other_value.field_t200);
break;
case ALT_n200:
field_n200 = new N200(*other_value.field_n200);
break;
case ALT_n201__U:
field_n201__U = new N201__U(*other_value.field_n201__U);
break;
case ALT_n201__I:
field_n201__I = new N201__I(*other_value.field_n201__I);
break;
case ALT_mD:
field_mD = new MD(*other_value.field_mD);
break;
case ALT_mU:
field_mU = new MU(*other_value.field_mU);
break;
case ALT_kD:
field_kD = new INTEGER(*other_value.field_kD);
break;
case ALT_kU:
field_kU = new INTEGER(*other_value.field_kU);
break;
case ALT_l3param:
field_l3param = new OCTETSTRING(*other_value.field_l3param);
break;
case ALT_reset:
field_reset = new OCTETSTRING(*other_value.field_reset);
break;
default:
TTCN_error("Assignment of an unbound union value of type @LLC_Types.XID_Data.");
}
union_selection = other_value.union_selection;
}

XID__Data::XID__Data()
{
union_selection = UNBOUND_VALUE;
}

XID__Data::XID__Data(const XID__Data& other_value)
: Base_Type(){
copy_value(other_value);
}

XID__Data::~XID__Data()
{
clean_up();
}

XID__Data& XID__Data::operator=(const XID__Data& other_value)
{
if (this != &other_value) {
clean_up();
copy_value(other_value);
}
return *this;
}

boolean XID__Data::operator==(const XID__Data& other_value) const
{
if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @LLC_Types.XID_Data.");
if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @LLC_Types.XID_Data.");
if (union_selection != other_value.union_selection) return FALSE;
switch (union_selection) {
case ALT_version:
return *field_version == *other_value.field_version;
case ALT_iOV__UI:
return *field_iOV__UI == *other_value.field_iOV__UI;
case ALT_iOV__I:
return *field_iOV__I == *other_value.field_iOV__I;
case ALT_t200:
return *field_t200 == *other_value.field_t200;
case ALT_n200:
return *field_n200 == *other_value.field_n200;
case ALT_n201__U:
return *field_n201__U == *other_value.field_n201__U;
case ALT_n201__I:
return *field_n201__I == *other_value.field_n201__I;
case ALT_mD:
return *field_mD == *other_value.field_mD;
case ALT_mU:
return *field_mU == *other_value.field_mU;
case ALT_kD:
return *field_kD == *other_value.field_kD;
case ALT_kU:
return *field_kU == *other_value.field_kU;
case ALT_l3param:
return *field_l3param == *other_value.field_l3param;
case ALT_reset:
return *field_reset == *other_value.field_reset;
default:
return FALSE;
}
}

Version& XID__Data::version()
{
if (union_selection != ALT_version) {
clean_up();
field_version = new Version;
union_selection = ALT_version;
}
return *field_version;
}

const Version& XID__Data::version() const
{
if (union_selection != ALT_version) TTCN_error("Using non-selected field version in a value of union type @LLC_Types.XID_Data.");
return *field_version;
}

OCTETSTRING& XID__Data::iOV__UI()
{
if (union_selection != ALT_iOV__UI) {
clean_up();
field_iOV__UI = new OCTETSTRING;
union_selection = ALT_iOV__UI;
}
return *field_iOV__UI;
}

const OCTETSTRING& XID__Data::iOV__UI() const
{
if (union_selection != ALT_iOV__UI) TTCN_error("Using non-selected field iOV_UI in a value of union type @LLC_Types.XID_Data.");
return *field_iOV__UI;
}

OCTETSTRING& XID__Data::iOV__I()
{
if (union_selection != ALT_iOV__I) {
clean_up();
field_iOV__I = new OCTETSTRING;
union_selection = ALT_iOV__I;
}
return *field_iOV__I;
}

const OCTETSTRING& XID__Data::iOV__I() const
{
if (union_selection != ALT_iOV__I) TTCN_error("Using non-selected field iOV_I in a value of union type @LLC_Types.XID_Data.");
return *field_iOV__I;
}

T200& XID__Data::t200()
{
if (union_selection != ALT_t200) {
clean_up();
field_t200 = new T200;
union_selection = ALT_t200;
}
return *field_t200;
}

const T200& XID__Data::t200() const
{
if (union_selection != ALT_t200) TTCN_error("Using non-selected field t200 in a value of union type @LLC_Types.XID_Data.");
return *field_t200;
}

N200& XID__Data::n200()
{
if (union_selection != ALT_n200) {
clean_up();
field_n200 = new N200;
union_selection = ALT_n200;
}
return *field_n200;
}

const N200& XID__Data::n200() const
{
if (union_selection != ALT_n200) TTCN_error("Using non-selected field n200 in a value of union type @LLC_Types.XID_Data.");
return *field_n200;
}

N201__U& XID__Data::n201__U()
{
if (union_selection != ALT_n201__U) {
clean_up();
field_n201__U = new N201__U;
union_selection = ALT_n201__U;
}
return *field_n201__U;
}

const N201__U& XID__Data::n201__U() const
{
if (union_selection != ALT_n201__U) TTCN_error("Using non-selected field n201_U in a value of union type @LLC_Types.XID_Data.");
return *field_n201__U;
}

N201__I& XID__Data::n201__I()
{
if (union_selection != ALT_n201__I) {
clean_up();
field_n201__I = new N201__I;
union_selection = ALT_n201__I;
}
return *field_n201__I;
}

const N201__I& XID__Data::n201__I() const
{
if (union_selection != ALT_n201__I) TTCN_error("Using non-selected field n201_I in a value of union type @LLC_Types.XID_Data.");
return *field_n201__I;
}

MD& XID__Data::mD()
{
if (union_selection != ALT_mD) {
clean_up();
field_mD = new MD;
union_selection = ALT_mD;
}
return *field_mD;
}

const MD& XID__Data::mD() const
{
if (union_selection != ALT_mD) TTCN_error("Using non-selected field mD in a value of union type @LLC_Types.XID_Data.");
return *field_mD;
}

MU& XID__Data::mU()
{
if (union_selection != ALT_mU) {
clean_up();
field_mU = new MU;
union_selection = ALT_mU;
}
return *field_mU;
}

const MU& XID__Data::mU() const
{
if (union_selection != ALT_mU) TTCN_error("Using non-selected field mU in a value of union type @LLC_Types.XID_Data.");
return *field_mU;
}

INTEGER& XID__Data::kD()
{
if (union_selection != ALT_kD) {
clean_up();
field_kD = new INTEGER;
union_selection = ALT_kD;
}
return *field_kD;
}

const INTEGER& XID__Data::kD() const
{
if (union_selection != ALT_kD) TTCN_error("Using non-selected field kD in a value of union type @LLC_Types.XID_Data.");
return *field_kD;
}

INTEGER& XID__Data::kU()
{
if (union_selection != ALT_kU) {
clean_up();
field_kU = new INTEGER;
union_selection = ALT_kU;
}
return *field_kU;
}

const INTEGER& XID__Data::kU() const
{
if (union_selection != ALT_kU) TTCN_error("Using non-selected field kU in a value of union type @LLC_Types.XID_Data.");
return *field_kU;
}

OCTETSTRING& XID__Data::l3param()
{
if (union_selection != ALT_l3param) {
clean_up();
field_l3param = new OCTETSTRING;
union_selection = ALT_l3param;
}
return *field_l3param;
}

const OCTETSTRING& XID__Data::l3param() const
{
if (union_selection != ALT_l3param) TTCN_error("Using non-selected field l3param in a value of union type @LLC_Types.XID_Data.");
return *field_l3param;
}

OCTETSTRING& XID__Data::reset()
{
if (union_selection != ALT_reset) {
clean_up();
field_reset = new OCTETSTRING;
union_selection = ALT_reset;
}
return *field_reset;
}

const OCTETSTRING& XID__Data::reset() const
{
if (union_selection != ALT_reset) TTCN_error("Using non-selected field reset in a value of union type @LLC_Types.XID_Data.");
return *field_reset;
}

boolean XID__Data::ischosen(union_selection_type checked_selection) const
{
if (checked_selection == UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @LLC_Types.XID_Data.");
return union_selection == checked_selection;
}

boolean XID__Data::is_bound() const
{
  return union_selection != UNBOUND_VALUE;
}

boolean XID__Data::is_value() const
{
switch (union_selection) {
case UNBOUND_VALUE: return FALSE;
case ALT_version: return field_version->is_value();
case ALT_iOV__UI: return field_iOV__UI->is_value();
case ALT_iOV__I: return field_iOV__I->is_value();
case ALT_t200: return field_t200->is_value();
case ALT_n200: return field_n200->is_value();
case ALT_n201__U: return field_n201__U->is_value();
case ALT_n201__I: return field_n201__I->is_value();
case ALT_mD: return field_mD->is_value();
case ALT_mU: return field_mU->is_value();
case ALT_kD: return field_kD->is_value();
case ALT_kU: return field_kU->is_value();
case ALT_l3param: return field_l3param->is_value();
case ALT_reset: return field_reset->is_value();
default: TTCN_error("Invalid selection in union is_bound");}
}

void XID__Data::clean_up()
{
switch (union_selection) {
case ALT_version:
  delete field_version;
  break;
case ALT_iOV__UI:
  delete field_iOV__UI;
  break;
case ALT_iOV__I:
  delete field_iOV__I;
  break;
case ALT_t200:
  delete field_t200;
  break;
case ALT_n200:
  delete field_n200;
  break;
case ALT_n201__U:
  delete field_n201__U;
  break;
case ALT_n201__I:
  delete field_n201__I;
  break;
case ALT_mD:
  delete field_mD;
  break;
case ALT_mU:
  delete field_mU;
  break;
case ALT_kD:
  delete field_kD;
  break;
case ALT_kU:
  delete field_kU;
  break;
case ALT_l3param:
  delete field_l3param;
  break;
case ALT_reset:
  delete field_reset;
  break;
default:
  break;
}
union_selection = UNBOUND_VALUE;
}

void XID__Data::log() const
{
switch (union_selection) {
case ALT_version:
TTCN_Logger::log_event_str("{ version := ");
field_version->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_iOV__UI:
TTCN_Logger::log_event_str("{ iOV_UI := ");
field_iOV__UI->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_iOV__I:
TTCN_Logger::log_event_str("{ iOV_I := ");
field_iOV__I->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_t200:
TTCN_Logger::log_event_str("{ t200 := ");
field_t200->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_n200:
TTCN_Logger::log_event_str("{ n200 := ");
field_n200->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_n201__U:
TTCN_Logger::log_event_str("{ n201_U := ");
field_n201__U->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_n201__I:
TTCN_Logger::log_event_str("{ n201_I := ");
field_n201__I->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_mD:
TTCN_Logger::log_event_str("{ mD := ");
field_mD->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_mU:
TTCN_Logger::log_event_str("{ mU := ");
field_mU->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_kD:
TTCN_Logger::log_event_str("{ kD := ");
field_kD->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_kU:
TTCN_Logger::log_event_str("{ kU := ");
field_kU->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_l3param:
TTCN_Logger::log_event_str("{ l3param := ");
field_l3param->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_reset:
TTCN_Logger::log_event_str("{ reset := ");
field_reset->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_unbound();
}
}

void XID__Data::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "union value");
  Module_Param_Ptr m_p = &param;
  if (m_p->get_type()==Module_Param::MP_Value_List && m_p->get_size()==0) return;
  if (m_p->get_type()!=Module_Param::MP_Assignment_List) {
    param.error("union value with field name was expected");
  }
  Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1);
  char* last_name = mp_last->get_id()->get_name();
  if (!strcmp(last_name, "version")) {
    version().set_param(*mp_last);
    if (!version().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "iOV_UI")) {
    iOV__UI().set_param(*mp_last);
    if (!iOV__UI().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "iOV_I")) {
    iOV__I().set_param(*mp_last);
    if (!iOV__I().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "t200")) {
    t200().set_param(*mp_last);
    if (!t200().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "n200")) {
    n200().set_param(*mp_last);
    if (!n200().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "n201_U")) {
    n201__U().set_param(*mp_last);
    if (!n201__U().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "n201_I")) {
    n201__I().set_param(*mp_last);
    if (!n201__I().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "mD")) {
    mD().set_param(*mp_last);
    if (!mD().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "mU")) {
    mU().set_param(*mp_last);
    if (!mU().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "kD")) {
    kD().set_param(*mp_last);
    if (!kD().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "kU")) {
    kU().set_param(*mp_last);
    if (!kU().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "l3param")) {
    l3param().set_param(*mp_last);
    if (!l3param().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "reset")) {
    reset().set_param(*mp_last);
    if (!reset().is_bound()) clean_up();
    return;
  }
  mp_last->error("Field %s does not exist in type @LLC_Types.XID_Data.", last_name);
}

void XID__Data::set_implicit_omit()
{
switch (union_selection) {
case ALT_version:
field_version->set_implicit_omit(); break;
case ALT_iOV__UI:
field_iOV__UI->set_implicit_omit(); break;
case ALT_iOV__I:
field_iOV__I->set_implicit_omit(); break;
case ALT_t200:
field_t200->set_implicit_omit(); break;
case ALT_n200:
field_n200->set_implicit_omit(); break;
case ALT_n201__U:
field_n201__U->set_implicit_omit(); break;
case ALT_n201__I:
field_n201__I->set_implicit_omit(); break;
case ALT_mD:
field_mD->set_implicit_omit(); break;
case ALT_mU:
field_mU->set_implicit_omit(); break;
case ALT_kD:
field_kD->set_implicit_omit(); break;
case ALT_kU:
field_kU->set_implicit_omit(); break;
case ALT_l3param:
field_l3param->set_implicit_omit(); break;
case ALT_reset:
field_reset->set_implicit_omit(); break;
default: break;
}
}

void XID__Data::encode_text(Text_Buf& text_buf) const
{
text_buf.push_int(union_selection);
switch (union_selection) {
case ALT_version:
field_version->encode_text(text_buf);
break;
case ALT_iOV__UI:
field_iOV__UI->encode_text(text_buf);
break;
case ALT_iOV__I:
field_iOV__I->encode_text(text_buf);
break;
case ALT_t200:
field_t200->encode_text(text_buf);
break;
case ALT_n200:
field_n200->encode_text(text_buf);
break;
case ALT_n201__U:
field_n201__U->encode_text(text_buf);
break;
case ALT_n201__I:
field_n201__I->encode_text(text_buf);
break;
case ALT_mD:
field_mD->encode_text(text_buf);
break;
case ALT_mU:
field_mU->encode_text(text_buf);
break;
case ALT_kD:
field_kD->encode_text(text_buf);
break;
case ALT_kU:
field_kU->encode_text(text_buf);
break;
case ALT_l3param:
field_l3param->encode_text(text_buf);
break;
case ALT_reset:
field_reset->encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an unbound value of union type @LLC_Types.XID_Data.");
}
}

void XID__Data::decode_text(Text_Buf& text_buf)
{
switch ((union_selection_type)text_buf.pull_int().get_val()) {
case ALT_version:
version().decode_text(text_buf);
break;
case ALT_iOV__UI:
iOV__UI().decode_text(text_buf);
break;
case ALT_iOV__I:
iOV__I().decode_text(text_buf);
break;
case ALT_t200:
t200().decode_text(text_buf);
break;
case ALT_n200:
n200().decode_text(text_buf);
break;
case ALT_n201__U:
n201__U().decode_text(text_buf);
break;
case ALT_n201__I:
n201__I().decode_text(text_buf);
break;
case ALT_mD:
mD().decode_text(text_buf);
break;
case ALT_mU:
mU().decode_text(text_buf);
break;
case ALT_kD:
kD().decode_text(text_buf);
break;
case ALT_kU:
kU().decode_text(text_buf);
break;
case ALT_l3param:
l3param().decode_text(text_buf);
break;
case ALT_reset:
reset().decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for type @LLC_Types.XID_Data.");
}
}

void XID__Data::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void XID__Data::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int XID__Data::RAW_decode(
const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, 
raw_order_t top_bit_ord, boolean no_err, int sel_field, boolean, const RAW_Force_Omit* force_omit)
{
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  int decoded_length=0;
  int starting_pos=p_buf.get_pos_bit();
  if(sel_field!=-1){
    switch(sel_field){
    case 0: {
      RAW_Force_Omit field_force_omit(0, force_omit, Version_descr_.raw->forceomit);
      decoded_length = version().RAW_decode(Version_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 1: {
      RAW_Force_Omit field_force_omit(1, force_omit, IOV__UI_descr_.raw->forceomit);
      decoded_length = iOV__UI().RAW_decode(IOV__UI_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 2: {
      RAW_Force_Omit field_force_omit(2, force_omit, IOV__I_descr_.raw->forceomit);
      decoded_length = iOV__I().RAW_decode(IOV__I_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 3: {
      RAW_Force_Omit field_force_omit(3, force_omit, T200_descr_.raw->forceomit);
      decoded_length = t200().RAW_decode(T200_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 4: {
      RAW_Force_Omit field_force_omit(4, force_omit, N200_descr_.raw->forceomit);
      decoded_length = n200().RAW_decode(N200_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 5: {
      RAW_Force_Omit field_force_omit(5, force_omit, N201__U_descr_.raw->forceomit);
      decoded_length = n201__U().RAW_decode(N201__U_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 6: {
      RAW_Force_Omit field_force_omit(6, force_omit, N201__I_descr_.raw->forceomit);
      decoded_length = n201__I().RAW_decode(N201__I_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 7: {
      RAW_Force_Omit field_force_omit(7, force_omit, MD_descr_.raw->forceomit);
      decoded_length = mD().RAW_decode(MD_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 8: {
      RAW_Force_Omit field_force_omit(8, force_omit, MU_descr_.raw->forceomit);
      decoded_length = mU().RAW_decode(MU_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 9: {
      RAW_Force_Omit field_force_omit(9, force_omit, KD_descr_.raw->forceomit);
      decoded_length = kD().RAW_decode(KD_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 10: {
      RAW_Force_Omit field_force_omit(10, force_omit, KU_descr_.raw->forceomit);
      decoded_length = kU().RAW_decode(KU_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 11: {
      RAW_Force_Omit field_force_omit(11, force_omit, L3param_descr_.raw->forceomit);
      decoded_length = l3param().RAW_decode(L3param_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 12: {
      RAW_Force_Omit field_force_omit(12, force_omit, Reset__LLC_descr_.raw->forceomit);
      decoded_length = reset().RAW_decode(Reset__LLC_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    default: break;
    }
    return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
  } else {
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_0_force_omit(0, force_omit, Version_descr_.raw->forceomit);
      decoded_length = version().RAW_decode(Version_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_0_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_1_force_omit(1, force_omit, IOV__UI_descr_.raw->forceomit);
      decoded_length = iOV__UI().RAW_decode(IOV__UI_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_1_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_2_force_omit(2, force_omit, IOV__I_descr_.raw->forceomit);
      decoded_length = iOV__I().RAW_decode(IOV__I_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_2_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_3_force_omit(3, force_omit, T200_descr_.raw->forceomit);
      decoded_length = t200().RAW_decode(T200_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_3_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_4_force_omit(4, force_omit, N200_descr_.raw->forceomit);
      decoded_length = n200().RAW_decode(N200_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_4_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_5_force_omit(5, force_omit, N201__U_descr_.raw->forceomit);
      decoded_length = n201__U().RAW_decode(N201__U_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_5_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_6_force_omit(6, force_omit, N201__I_descr_.raw->forceomit);
      decoded_length = n201__I().RAW_decode(N201__I_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_6_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_7_force_omit(7, force_omit, MD_descr_.raw->forceomit);
      decoded_length = mD().RAW_decode(MD_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_7_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_8_force_omit(8, force_omit, MU_descr_.raw->forceomit);
      decoded_length = mU().RAW_decode(MU_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_8_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_9_force_omit(9, force_omit, KD_descr_.raw->forceomit);
      decoded_length = kD().RAW_decode(KD_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_9_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_10_force_omit(10, force_omit, KU_descr_.raw->forceomit);
      decoded_length = kU().RAW_decode(KU_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_10_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_11_force_omit(11, force_omit, L3param_descr_.raw->forceomit);
      decoded_length = l3param().RAW_decode(L3param_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_11_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_12_force_omit(12, force_omit, Reset__LLC_descr_.raw->forceomit);
      decoded_length = reset().RAW_decode(Reset__LLC_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_12_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
 }
 clean_up();
 return -1;
}

int XID__Data::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const
{
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 13;  myleaf.body.node.nodes = init_nodes_of_enc_tree(13);
  memset(myleaf.body.node.nodes, 0, 13 * sizeof(RAW_enc_tree *));
  switch (union_selection) {
  case ALT_version:
    myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, Version_descr_.raw);
    encoded_length = field_version->RAW_encode(Version_descr_, *myleaf.body.node.nodes[0]);
    myleaf.body.node.nodes[0]->coding_descr = &Version_descr_;
    break;
  case ALT_iOV__UI:
    myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, IOV__UI_descr_.raw);
    encoded_length = field_iOV__UI->RAW_encode(IOV__UI_descr_, *myleaf.body.node.nodes[1]);
    myleaf.body.node.nodes[1]->coding_descr = &IOV__UI_descr_;
    break;
  case ALT_iOV__I:
    myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 2, IOV__I_descr_.raw);
    encoded_length = field_iOV__I->RAW_encode(IOV__I_descr_, *myleaf.body.node.nodes[2]);
    myleaf.body.node.nodes[2]->coding_descr = &IOV__I_descr_;
    break;
  case ALT_t200:
    myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 3, T200_descr_.raw);
    encoded_length = field_t200->RAW_encode(T200_descr_, *myleaf.body.node.nodes[3]);
    myleaf.body.node.nodes[3]->coding_descr = &T200_descr_;
    break;
  case ALT_n200:
    myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 4, N200_descr_.raw);
    encoded_length = field_n200->RAW_encode(N200_descr_, *myleaf.body.node.nodes[4]);
    myleaf.body.node.nodes[4]->coding_descr = &N200_descr_;
    break;
  case ALT_n201__U:
    myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 5, N201__U_descr_.raw);
    encoded_length = field_n201__U->RAW_encode(N201__U_descr_, *myleaf.body.node.nodes[5]);
    myleaf.body.node.nodes[5]->coding_descr = &N201__U_descr_;
    break;
  case ALT_n201__I:
    myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 6, N201__I_descr_.raw);
    encoded_length = field_n201__I->RAW_encode(N201__I_descr_, *myleaf.body.node.nodes[6]);
    myleaf.body.node.nodes[6]->coding_descr = &N201__I_descr_;
    break;
  case ALT_mD:
    myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 7, MD_descr_.raw);
    encoded_length = field_mD->RAW_encode(MD_descr_, *myleaf.body.node.nodes[7]);
    myleaf.body.node.nodes[7]->coding_descr = &MD_descr_;
    break;
  case ALT_mU:
    myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 8, MU_descr_.raw);
    encoded_length = field_mU->RAW_encode(MU_descr_, *myleaf.body.node.nodes[8]);
    myleaf.body.node.nodes[8]->coding_descr = &MU_descr_;
    break;
  case ALT_kD:
    myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 9, KD_descr_.raw);
    encoded_length = field_kD->RAW_encode(KD_descr_, *myleaf.body.node.nodes[9]);
    myleaf.body.node.nodes[9]->coding_descr = &KD_descr_;
    break;
  case ALT_kU:
    myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 10, KU_descr_.raw);
    encoded_length = field_kU->RAW_encode(KU_descr_, *myleaf.body.node.nodes[10]);
    myleaf.body.node.nodes[10]->coding_descr = &KU_descr_;
    break;
  case ALT_l3param:
    myleaf.body.node.nodes[11] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 11, L3param_descr_.raw);
    encoded_length = field_l3param->RAW_encode(L3param_descr_, *myleaf.body.node.nodes[11]);
    myleaf.body.node.nodes[11]->coding_descr = &L3param_descr_;
    break;
  case ALT_reset:
    myleaf.body.node.nodes[12] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 12, Reset__LLC_descr_.raw);
    encoded_length = field_reset->RAW_encode(Reset__LLC_descr_, *myleaf.body.node.nodes[12]);
    myleaf.body.node.nodes[12]->coding_descr = &Reset__LLC_descr_;
    break;
  default:
    TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  }
  return encoded_length;
}

void XID__Data_template::copy_value(const XID__Data& other_value)
{
single_value.union_selection = other_value.get_selection();
switch (single_value.union_selection) {
case XID__Data::ALT_version:
single_value.field_version = new Version_template(other_value.version());
break;
case XID__Data::ALT_iOV__UI:
single_value.field_iOV__UI = new OCTETSTRING_template(other_value.iOV__UI());
break;
case XID__Data::ALT_iOV__I:
single_value.field_iOV__I = new OCTETSTRING_template(other_value.iOV__I());
break;
case XID__Data::ALT_t200:
single_value.field_t200 = new T200_template(other_value.t200());
break;
case XID__Data::ALT_n200:
single_value.field_n200 = new N200_template(other_value.n200());
break;
case XID__Data::ALT_n201__U:
single_value.field_n201__U = new N201__U_template(other_value.n201__U());
break;
case XID__Data::ALT_n201__I:
single_value.field_n201__I = new N201__I_template(other_value.n201__I());
break;
case XID__Data::ALT_mD:
single_value.field_mD = new MD_template(other_value.mD());
break;
case XID__Data::ALT_mU:
single_value.field_mU = new MU_template(other_value.mU());
break;
case XID__Data::ALT_kD:
single_value.field_kD = new INTEGER_template(other_value.kD());
break;
case XID__Data::ALT_kU:
single_value.field_kU = new INTEGER_template(other_value.kU());
break;
case XID__Data::ALT_l3param:
single_value.field_l3param = new OCTETSTRING_template(other_value.l3param());
break;
case XID__Data::ALT_reset:
single_value.field_reset = new OCTETSTRING_template(other_value.reset());
break;
default:
TTCN_error("Initializing a template with an unbound value of type @LLC_Types.XID_Data.");
}
set_selection(SPECIFIC_VALUE);
}

void XID__Data_template::copy_template(const XID__Data_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value.union_selection = other_value.single_value.union_selection;
switch (single_value.union_selection) {
case XID__Data::ALT_version:
single_value.field_version = new Version_template(*other_value.single_value.field_version);
break;
case XID__Data::ALT_iOV__UI:
single_value.field_iOV__UI = new OCTETSTRING_template(*other_value.single_value.field_iOV__UI);
break;
case XID__Data::ALT_iOV__I:
single_value.field_iOV__I = new OCTETSTRING_template(*other_value.single_value.field_iOV__I);
break;
case XID__Data::ALT_t200:
single_value.field_t200 = new T200_template(*other_value.single_value.field_t200);
break;
case XID__Data::ALT_n200:
single_value.field_n200 = new N200_template(*other_value.single_value.field_n200);
break;
case XID__Data::ALT_n201__U:
single_value.field_n201__U = new N201__U_template(*other_value.single_value.field_n201__U);
break;
case XID__Data::ALT_n201__I:
single_value.field_n201__I = new N201__I_template(*other_value.single_value.field_n201__I);
break;
case XID__Data::ALT_mD:
single_value.field_mD = new MD_template(*other_value.single_value.field_mD);
break;
case XID__Data::ALT_mU:
single_value.field_mU = new MU_template(*other_value.single_value.field_mU);
break;
case XID__Data::ALT_kD:
single_value.field_kD = new INTEGER_template(*other_value.single_value.field_kD);
break;
case XID__Data::ALT_kU:
single_value.field_kU = new INTEGER_template(*other_value.single_value.field_kU);
break;
case XID__Data::ALT_l3param:
single_value.field_l3param = new OCTETSTRING_template(*other_value.single_value.field_l3param);
break;
case XID__Data::ALT_reset:
single_value.field_reset = new OCTETSTRING_template(*other_value.single_value.field_reset);
break;
default:
TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @LLC_Types.XID_Data.");
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new XID__Data_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new XID__Data_template(*other_value.implication_.precondition);
implication_.implied_template = new XID__Data_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized template of union type @LLC_Types.XID_Data.");
}
set_selection(other_value);
}

XID__Data_template::XID__Data_template()
{
}

XID__Data_template::XID__Data_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

XID__Data_template::XID__Data_template(const XID__Data& other_value)
{
copy_value(other_value);
}

XID__Data_template::XID__Data_template(const OPTIONAL<XID__Data>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const XID__Data&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of union type @LLC_Types.XID_Data from an unbound optional field.");
}
}

XID__Data_template::XID__Data_template(XID__Data_template* p_precondition, XID__Data_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

XID__Data_template::XID__Data_template(Dynamic_Match_Interface<XID__Data>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<XID__Data>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

XID__Data_template::XID__Data_template(const XID__Data_template& other_value)
: Base_Template(){
copy_template(other_value);
}

XID__Data_template::~XID__Data_template()
{
clean_up();
}

void XID__Data_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case XID__Data::ALT_version:
delete single_value.field_version;
break;
case XID__Data::ALT_iOV__UI:
delete single_value.field_iOV__UI;
break;
case XID__Data::ALT_iOV__I:
delete single_value.field_iOV__I;
break;
case XID__Data::ALT_t200:
delete single_value.field_t200;
break;
case XID__Data::ALT_n200:
delete single_value.field_n200;
break;
case XID__Data::ALT_n201__U:
delete single_value.field_n201__U;
break;
case XID__Data::ALT_n201__I:
delete single_value.field_n201__I;
break;
case XID__Data::ALT_mD:
delete single_value.field_mD;
break;
case XID__Data::ALT_mU:
delete single_value.field_mU;
break;
case XID__Data::ALT_kD:
delete single_value.field_kD;
break;
case XID__Data::ALT_kU:
delete single_value.field_kU;
break;
case XID__Data::ALT_l3param:
delete single_value.field_l3param;
break;
case XID__Data::ALT_reset:
delete single_value.field_reset;
default:
break;
}
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

XID__Data_template& XID__Data_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

XID__Data_template& XID__Data_template::operator=(const XID__Data& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

XID__Data_template& XID__Data_template::operator=(const OPTIONAL<XID__Data>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const XID__Data&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of union type @LLC_Types.XID_Data.");
}
return *this;
}

XID__Data_template& XID__Data_template::operator=(const XID__Data_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean XID__Data_template::match(const XID__Data& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
{
XID__Data::union_selection_type value_selection = other_value.get_selection();
if (value_selection == XID__Data::UNBOUND_VALUE) return FALSE;
if (value_selection != single_value.union_selection) return FALSE;
switch (value_selection) {
case XID__Data::ALT_version:
return single_value.field_version->match(other_value.version(), legacy);
case XID__Data::ALT_iOV__UI:
return single_value.field_iOV__UI->match(other_value.iOV__UI(), legacy);
case XID__Data::ALT_iOV__I:
return single_value.field_iOV__I->match(other_value.iOV__I(), legacy);
case XID__Data::ALT_t200:
return single_value.field_t200->match(other_value.t200(), legacy);
case XID__Data::ALT_n200:
return single_value.field_n200->match(other_value.n200(), legacy);
case XID__Data::ALT_n201__U:
return single_value.field_n201__U->match(other_value.n201__U(), legacy);
case XID__Data::ALT_n201__I:
return single_value.field_n201__I->match(other_value.n201__I(), legacy);
case XID__Data::ALT_mD:
return single_value.field_mD->match(other_value.mD(), legacy);
case XID__Data::ALT_mU:
return single_value.field_mU->match(other_value.mU(), legacy);
case XID__Data::ALT_kD:
return single_value.field_kD->match(other_value.kD(), legacy);
case XID__Data::ALT_kU:
return single_value.field_kU->match(other_value.kU(), legacy);
case XID__Data::ALT_l3param:
return single_value.field_l3param->match(other_value.l3param(), legacy);
case XID__Data::ALT_reset:
return single_value.field_reset->match(other_value.reset(), legacy);
default:
TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @LLC_Types.XID_Data.");
}
}
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error ("Matching an uninitialized template of union type @LLC_Types.XID_Data.");
}
return FALSE;
}

boolean XID__Data_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
switch (single_value.union_selection) {
case XID__Data::ALT_version:
return single_value.field_version->is_value();
case XID__Data::ALT_iOV__UI:
return single_value.field_iOV__UI->is_value();
case XID__Data::ALT_iOV__I:
return single_value.field_iOV__I->is_value();
case XID__Data::ALT_t200:
return single_value.field_t200->is_value();
case XID__Data::ALT_n200:
return single_value.field_n200->is_value();
case XID__Data::ALT_n201__U:
return single_value.field_n201__U->is_value();
case XID__Data::ALT_n201__I:
return single_value.field_n201__I->is_value();
case XID__Data::ALT_mD:
return single_value.field_mD->is_value();
case XID__Data::ALT_mU:
return single_value.field_mU->is_value();
case XID__Data::ALT_kD:
return single_value.field_kD->is_value();
case XID__Data::ALT_kU:
return single_value.field_kU->is_value();
case XID__Data::ALT_l3param:
return single_value.field_l3param->is_value();
case XID__Data::ALT_reset:
return single_value.field_reset->is_value();
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @LLC_Types.XID_Data.");
}
}

XID__Data XID__Data_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of union type @LLC_Types.XID_Data.");
XID__Data ret_val;
switch (single_value.union_selection) {
case XID__Data::ALT_version:
ret_val.version() = single_value.field_version->valueof();
break;
case XID__Data::ALT_iOV__UI:
ret_val.iOV__UI() = single_value.field_iOV__UI->valueof();
break;
case XID__Data::ALT_iOV__I:
ret_val.iOV__I() = single_value.field_iOV__I->valueof();
break;
case XID__Data::ALT_t200:
ret_val.t200() = single_value.field_t200->valueof();
break;
case XID__Data::ALT_n200:
ret_val.n200() = single_value.field_n200->valueof();
break;
case XID__Data::ALT_n201__U:
ret_val.n201__U() = single_value.field_n201__U->valueof();
break;
case XID__Data::ALT_n201__I:
ret_val.n201__I() = single_value.field_n201__I->valueof();
break;
case XID__Data::ALT_mD:
ret_val.mD() = single_value.field_mD->valueof();
break;
case XID__Data::ALT_mU:
ret_val.mU() = single_value.field_mU->valueof();
break;
case XID__Data::ALT_kD:
ret_val.kD() = single_value.field_kD->valueof();
break;
case XID__Data::ALT_kU:
ret_val.kU() = single_value.field_kU->valueof();
break;
case XID__Data::ALT_l3param:
ret_val.l3param() = single_value.field_l3param->valueof();
break;
case XID__Data::ALT_reset:
ret_val.reset() = single_value.field_reset->valueof();
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @LLC_Types.XID_Data.");
}
return ret_val;
}

XID__Data_template& XID__Data_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Internal error: Accessing a list element of a non-list template of union type @LLC_Types.XID_Data.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @LLC_Types.XID_Data.");
return value_list.list_value[list_index];
}
void XID__Data_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error ("Internal error: Setting an invalid list for a template of union type @LLC_Types.XID_Data.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new XID__Data_template[list_length];
}

Version_template& XID__Data_template::version()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data::ALT_version) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_version = new Version_template(ANY_VALUE);
else single_value.field_version = new Version_template;
single_value.union_selection = XID__Data::ALT_version;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_version;
}

const Version_template& XID__Data_template::version() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field version in a non-specific template of union type @LLC_Types.XID_Data.");
if (single_value.union_selection != XID__Data::ALT_version) TTCN_error("Accessing non-selected field version in a template of union type @LLC_Types.XID_Data.");
return *single_value.field_version;
}

OCTETSTRING_template& XID__Data_template::iOV__UI()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data::ALT_iOV__UI) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_iOV__UI = new OCTETSTRING_template(ANY_VALUE);
else single_value.field_iOV__UI = new OCTETSTRING_template;
single_value.union_selection = XID__Data::ALT_iOV__UI;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_iOV__UI;
}

const OCTETSTRING_template& XID__Data_template::iOV__UI() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iOV_UI in a non-specific template of union type @LLC_Types.XID_Data.");
if (single_value.union_selection != XID__Data::ALT_iOV__UI) TTCN_error("Accessing non-selected field iOV_UI in a template of union type @LLC_Types.XID_Data.");
return *single_value.field_iOV__UI;
}

OCTETSTRING_template& XID__Data_template::iOV__I()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data::ALT_iOV__I) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_iOV__I = new OCTETSTRING_template(ANY_VALUE);
else single_value.field_iOV__I = new OCTETSTRING_template;
single_value.union_selection = XID__Data::ALT_iOV__I;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_iOV__I;
}

const OCTETSTRING_template& XID__Data_template::iOV__I() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iOV_I in a non-specific template of union type @LLC_Types.XID_Data.");
if (single_value.union_selection != XID__Data::ALT_iOV__I) TTCN_error("Accessing non-selected field iOV_I in a template of union type @LLC_Types.XID_Data.");
return *single_value.field_iOV__I;
}

T200_template& XID__Data_template::t200()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data::ALT_t200) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_t200 = new T200_template(ANY_VALUE);
else single_value.field_t200 = new T200_template;
single_value.union_selection = XID__Data::ALT_t200;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_t200;
}

const T200_template& XID__Data_template::t200() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field t200 in a non-specific template of union type @LLC_Types.XID_Data.");
if (single_value.union_selection != XID__Data::ALT_t200) TTCN_error("Accessing non-selected field t200 in a template of union type @LLC_Types.XID_Data.");
return *single_value.field_t200;
}

N200_template& XID__Data_template::n200()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data::ALT_n200) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_n200 = new N200_template(ANY_VALUE);
else single_value.field_n200 = new N200_template;
single_value.union_selection = XID__Data::ALT_n200;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_n200;
}

const N200_template& XID__Data_template::n200() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field n200 in a non-specific template of union type @LLC_Types.XID_Data.");
if (single_value.union_selection != XID__Data::ALT_n200) TTCN_error("Accessing non-selected field n200 in a template of union type @LLC_Types.XID_Data.");
return *single_value.field_n200;
}

N201__U_template& XID__Data_template::n201__U()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data::ALT_n201__U) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_n201__U = new N201__U_template(ANY_VALUE);
else single_value.field_n201__U = new N201__U_template;
single_value.union_selection = XID__Data::ALT_n201__U;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_n201__U;
}

const N201__U_template& XID__Data_template::n201__U() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field n201_U in a non-specific template of union type @LLC_Types.XID_Data.");
if (single_value.union_selection != XID__Data::ALT_n201__U) TTCN_error("Accessing non-selected field n201_U in a template of union type @LLC_Types.XID_Data.");
return *single_value.field_n201__U;
}

N201__I_template& XID__Data_template::n201__I()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data::ALT_n201__I) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_n201__I = new N201__I_template(ANY_VALUE);
else single_value.field_n201__I = new N201__I_template;
single_value.union_selection = XID__Data::ALT_n201__I;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_n201__I;
}

const N201__I_template& XID__Data_template::n201__I() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field n201_I in a non-specific template of union type @LLC_Types.XID_Data.");
if (single_value.union_selection != XID__Data::ALT_n201__I) TTCN_error("Accessing non-selected field n201_I in a template of union type @LLC_Types.XID_Data.");
return *single_value.field_n201__I;
}

MD_template& XID__Data_template::mD()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data::ALT_mD) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_mD = new MD_template(ANY_VALUE);
else single_value.field_mD = new MD_template;
single_value.union_selection = XID__Data::ALT_mD;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_mD;
}

const MD_template& XID__Data_template::mD() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mD in a non-specific template of union type @LLC_Types.XID_Data.");
if (single_value.union_selection != XID__Data::ALT_mD) TTCN_error("Accessing non-selected field mD in a template of union type @LLC_Types.XID_Data.");
return *single_value.field_mD;
}

MU_template& XID__Data_template::mU()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data::ALT_mU) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_mU = new MU_template(ANY_VALUE);
else single_value.field_mU = new MU_template;
single_value.union_selection = XID__Data::ALT_mU;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_mU;
}

const MU_template& XID__Data_template::mU() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mU in a non-specific template of union type @LLC_Types.XID_Data.");
if (single_value.union_selection != XID__Data::ALT_mU) TTCN_error("Accessing non-selected field mU in a template of union type @LLC_Types.XID_Data.");
return *single_value.field_mU;
}

INTEGER_template& XID__Data_template::kD()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data::ALT_kD) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_kD = new INTEGER_template(ANY_VALUE);
else single_value.field_kD = new INTEGER_template;
single_value.union_selection = XID__Data::ALT_kD;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_kD;
}

const INTEGER_template& XID__Data_template::kD() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field kD in a non-specific template of union type @LLC_Types.XID_Data.");
if (single_value.union_selection != XID__Data::ALT_kD) TTCN_error("Accessing non-selected field kD in a template of union type @LLC_Types.XID_Data.");
return *single_value.field_kD;
}

INTEGER_template& XID__Data_template::kU()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data::ALT_kU) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_kU = new INTEGER_template(ANY_VALUE);
else single_value.field_kU = new INTEGER_template;
single_value.union_selection = XID__Data::ALT_kU;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_kU;
}

const INTEGER_template& XID__Data_template::kU() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field kU in a non-specific template of union type @LLC_Types.XID_Data.");
if (single_value.union_selection != XID__Data::ALT_kU) TTCN_error("Accessing non-selected field kU in a template of union type @LLC_Types.XID_Data.");
return *single_value.field_kU;
}

OCTETSTRING_template& XID__Data_template::l3param()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data::ALT_l3param) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_l3param = new OCTETSTRING_template(ANY_VALUE);
else single_value.field_l3param = new OCTETSTRING_template;
single_value.union_selection = XID__Data::ALT_l3param;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_l3param;
}

const OCTETSTRING_template& XID__Data_template::l3param() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field l3param in a non-specific template of union type @LLC_Types.XID_Data.");
if (single_value.union_selection != XID__Data::ALT_l3param) TTCN_error("Accessing non-selected field l3param in a template of union type @LLC_Types.XID_Data.");
return *single_value.field_l3param;
}

OCTETSTRING_template& XID__Data_template::reset()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data::ALT_reset) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_reset = new OCTETSTRING_template(ANY_VALUE);
else single_value.field_reset = new OCTETSTRING_template;
single_value.union_selection = XID__Data::ALT_reset;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_reset;
}

const OCTETSTRING_template& XID__Data_template::reset() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field reset in a non-specific template of union type @LLC_Types.XID_Data.");
if (single_value.union_selection != XID__Data::ALT_reset) TTCN_error("Accessing non-selected field reset in a template of union type @LLC_Types.XID_Data.");
return *single_value.field_reset;
}

boolean XID__Data_template::ischosen(XID__Data::union_selection_type checked_selection) const
{
if (checked_selection == XID__Data::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @LLC_Types.XID_Data.");
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.union_selection == XID__Data::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @LLC_Types.XID_Data.");
return single_value.union_selection == checked_selection;
case VALUE_LIST:
{
if (value_list.n_values < 1)
TTCN_error("Internal error: Performing ischosen() operation on a template of union type @LLC_Types.XID_Data containing an empty list.");
boolean ret_val = value_list.list_value[0].ischosen(checked_selection);
for (unsigned int list_count = 1; ret_val == TRUE && list_count < value_list.n_values; list_count++) {
ret_val = value_list.list_value[list_count].ischosen(checked_selection);
}
return ret_val;
}
default:
return FALSE;
}
return FALSE;
}

void XID__Data_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case XID__Data::ALT_version:
TTCN_Logger::log_event_str("{ version := ");
single_value.field_version->log();
TTCN_Logger::log_event_str(" }");
break;
case XID__Data::ALT_iOV__UI:
TTCN_Logger::log_event_str("{ iOV_UI := ");
single_value.field_iOV__UI->log();
TTCN_Logger::log_event_str(" }");
break;
case XID__Data::ALT_iOV__I:
TTCN_Logger::log_event_str("{ iOV_I := ");
single_value.field_iOV__I->log();
TTCN_Logger::log_event_str(" }");
break;
case XID__Data::ALT_t200:
TTCN_Logger::log_event_str("{ t200 := ");
single_value.field_t200->log();
TTCN_Logger::log_event_str(" }");
break;
case XID__Data::ALT_n200:
TTCN_Logger::log_event_str("{ n200 := ");
single_value.field_n200->log();
TTCN_Logger::log_event_str(" }");
break;
case XID__Data::ALT_n201__U:
TTCN_Logger::log_event_str("{ n201_U := ");
single_value.field_n201__U->log();
TTCN_Logger::log_event_str(" }");
break;
case XID__Data::ALT_n201__I:
TTCN_Logger::log_event_str("{ n201_I := ");
single_value.field_n201__I->log();
TTCN_Logger::log_event_str(" }");
break;
case XID__Data::ALT_mD:
TTCN_Logger::log_event_str("{ mD := ");
single_value.field_mD->log();
TTCN_Logger::log_event_str(" }");
break;
case XID__Data::ALT_mU:
TTCN_Logger::log_event_str("{ mU := ");
single_value.field_mU->log();
TTCN_Logger::log_event_str(" }");
break;
case XID__Data::ALT_kD:
TTCN_Logger::log_event_str("{ kD := ");
single_value.field_kD->log();
TTCN_Logger::log_event_str(" }");
break;
case XID__Data::ALT_kU:
TTCN_Logger::log_event_str("{ kU := ");
single_value.field_kU->log();
TTCN_Logger::log_event_str(" }");
break;
case XID__Data::ALT_l3param:
TTCN_Logger::log_event_str("{ l3param := ");
single_value.field_l3param->log();
TTCN_Logger::log_event_str(" }");
break;
case XID__Data::ALT_reset:
TTCN_Logger::log_event_str("{ reset := ");
single_value.field_reset->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_str("<invalid selector>");
}
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void XID__Data_template::log_match(const XID__Data& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity() && match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
return;
}
if (template_selection == SPECIFIC_VALUE && single_value.union_selection == match_value.get_selection()) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
switch (single_value.union_selection) {
case XID__Data::ALT_version:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".version");
single_value.field_version->log_match(match_value.version(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ version := ");
single_value.field_version->log_match(match_value.version(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case XID__Data::ALT_iOV__UI:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".iOV_UI");
single_value.field_iOV__UI->log_match(match_value.iOV__UI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ iOV_UI := ");
single_value.field_iOV__UI->log_match(match_value.iOV__UI(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case XID__Data::ALT_iOV__I:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".iOV_I");
single_value.field_iOV__I->log_match(match_value.iOV__I(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ iOV_I := ");
single_value.field_iOV__I->log_match(match_value.iOV__I(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case XID__Data::ALT_t200:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".t200");
single_value.field_t200->log_match(match_value.t200(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ t200 := ");
single_value.field_t200->log_match(match_value.t200(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case XID__Data::ALT_n200:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".n200");
single_value.field_n200->log_match(match_value.n200(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ n200 := ");
single_value.field_n200->log_match(match_value.n200(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case XID__Data::ALT_n201__U:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".n201_U");
single_value.field_n201__U->log_match(match_value.n201__U(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ n201_U := ");
single_value.field_n201__U->log_match(match_value.n201__U(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case XID__Data::ALT_n201__I:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".n201_I");
single_value.field_n201__I->log_match(match_value.n201__I(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ n201_I := ");
single_value.field_n201__I->log_match(match_value.n201__I(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case XID__Data::ALT_mD:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".mD");
single_value.field_mD->log_match(match_value.mD(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ mD := ");
single_value.field_mD->log_match(match_value.mD(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case XID__Data::ALT_mU:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".mU");
single_value.field_mU->log_match(match_value.mU(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ mU := ");
single_value.field_mU->log_match(match_value.mU(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case XID__Data::ALT_kD:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".kD");
single_value.field_kD->log_match(match_value.kD(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ kD := ");
single_value.field_kD->log_match(match_value.kD(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case XID__Data::ALT_kU:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".kU");
single_value.field_kU->log_match(match_value.kU(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ kU := ");
single_value.field_kU->log_match(match_value.kU(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case XID__Data::ALT_l3param:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".l3param");
single_value.field_l3param->log_match(match_value.l3param(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ l3param := ");
single_value.field_l3param->log_match(match_value.l3param(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case XID__Data::ALT_reset:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".reset");
single_value.field_reset->log_match(match_value.reset(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ reset := ");
single_value.field_reset->log_match(match_value.reset(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
default:
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str("<invalid selector>");
}
} else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void XID__Data_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
switch (single_value.union_selection) {
case XID__Data::ALT_version:
single_value.field_version->set_implicit_omit(); break;
case XID__Data::ALT_iOV__UI:
single_value.field_iOV__UI->set_implicit_omit(); break;
case XID__Data::ALT_iOV__I:
single_value.field_iOV__I->set_implicit_omit(); break;
case XID__Data::ALT_t200:
single_value.field_t200->set_implicit_omit(); break;
case XID__Data::ALT_n200:
single_value.field_n200->set_implicit_omit(); break;
case XID__Data::ALT_n201__U:
single_value.field_n201__U->set_implicit_omit(); break;
case XID__Data::ALT_n201__I:
single_value.field_n201__I->set_implicit_omit(); break;
case XID__Data::ALT_mD:
single_value.field_mD->set_implicit_omit(); break;
case XID__Data::ALT_mU:
single_value.field_mU->set_implicit_omit(); break;
case XID__Data::ALT_kD:
single_value.field_kD->set_implicit_omit(); break;
case XID__Data::ALT_kU:
single_value.field_kU->set_implicit_omit(); break;
case XID__Data::ALT_l3param:
single_value.field_l3param->set_implicit_omit(); break;
case XID__Data::ALT_reset:
single_value.field_reset->set_implicit_omit(); break;
default: break;
}
}

void XID__Data_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
text_buf.push_int(single_value.union_selection);
switch (single_value.union_selection) {
case XID__Data::ALT_version:
single_value.field_version->encode_text(text_buf);
break;
case XID__Data::ALT_iOV__UI:
single_value.field_iOV__UI->encode_text(text_buf);
break;
case XID__Data::ALT_iOV__I:
single_value.field_iOV__I->encode_text(text_buf);
break;
case XID__Data::ALT_t200:
single_value.field_t200->encode_text(text_buf);
break;
case XID__Data::ALT_n200:
single_value.field_n200->encode_text(text_buf);
break;
case XID__Data::ALT_n201__U:
single_value.field_n201__U->encode_text(text_buf);
break;
case XID__Data::ALT_n201__I:
single_value.field_n201__I->encode_text(text_buf);
break;
case XID__Data::ALT_mD:
single_value.field_mD->encode_text(text_buf);
break;
case XID__Data::ALT_mU:
single_value.field_mU->encode_text(text_buf);
break;
case XID__Data::ALT_kD:
single_value.field_kD->encode_text(text_buf);
break;
case XID__Data::ALT_kU:
single_value.field_kU->encode_text(text_buf);
break;
case XID__Data::ALT_l3param:
single_value.field_l3param->encode_text(text_buf);
break;
case XID__Data::ALT_reset:
single_value.field_reset->encode_text(text_buf);
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @LLC_Types.XID_Data.");
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized template of type @LLC_Types.XID_Data.");
}
}

void XID__Data_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
{
single_value.union_selection = XID__Data::UNBOUND_VALUE;
XID__Data::union_selection_type new_selection = (XID__Data::union_selection_type)text_buf.pull_int().get_val();
switch (new_selection) {
case XID__Data::ALT_version:
single_value.field_version = new Version_template;
single_value.field_version->decode_text(text_buf);
break;
case XID__Data::ALT_iOV__UI:
single_value.field_iOV__UI = new OCTETSTRING_template;
single_value.field_iOV__UI->decode_text(text_buf);
break;
case XID__Data::ALT_iOV__I:
single_value.field_iOV__I = new OCTETSTRING_template;
single_value.field_iOV__I->decode_text(text_buf);
break;
case XID__Data::ALT_t200:
single_value.field_t200 = new T200_template;
single_value.field_t200->decode_text(text_buf);
break;
case XID__Data::ALT_n200:
single_value.field_n200 = new N200_template;
single_value.field_n200->decode_text(text_buf);
break;
case XID__Data::ALT_n201__U:
single_value.field_n201__U = new N201__U_template;
single_value.field_n201__U->decode_text(text_buf);
break;
case XID__Data::ALT_n201__I:
single_value.field_n201__I = new N201__I_template;
single_value.field_n201__I->decode_text(text_buf);
break;
case XID__Data::ALT_mD:
single_value.field_mD = new MD_template;
single_value.field_mD->decode_text(text_buf);
break;
case XID__Data::ALT_mU:
single_value.field_mU = new MU_template;
single_value.field_mU->decode_text(text_buf);
break;
case XID__Data::ALT_kD:
single_value.field_kD = new INTEGER_template;
single_value.field_kD->decode_text(text_buf);
break;
case XID__Data::ALT_kU:
single_value.field_kU = new INTEGER_template;
single_value.field_kU->decode_text(text_buf);
break;
case XID__Data::ALT_l3param:
single_value.field_l3param = new OCTETSTRING_template;
single_value.field_l3param->decode_text(text_buf);
break;
case XID__Data::ALT_reset:
single_value.field_reset = new OCTETSTRING_template;
single_value.field_reset->decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @LLC_Types.XID_Data.");
}
single_value.union_selection = new_selection;
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new XID__Data_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized selector was received in a template of type @LLC_Types.XID_Data.");
}
}

boolean XID__Data_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean XID__Data_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int v_idx=0; v_idx<value_list.n_values; v_idx++)
if (value_list.list_value[v_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

void XID__Data_template::set_param(Module_Param& param)
{
  if (dynamic_cast<Module_Param_Name*>(param.get_id()) != NULL &&
      param.get_id()->next_name()) {
    char* param_field = param.get_id()->get_current_name();
    if (param_field[0] >= '0' && param_field[0] <= '9') {
      param.error("Unexpected array index in module parameter, expected a valid field"
        " name for union template type `@LLC_Types.XID_Data'");
    }
    if (strcmp("version", param_field) == 0) {
      version().set_param(param);
      return;
    } else if (strcmp("iOV_UI", param_field) == 0) {
      iOV__UI().set_param(param);
      return;
    } else if (strcmp("iOV_I", param_field) == 0) {
      iOV__I().set_param(param);
      return;
    } else if (strcmp("t200", param_field) == 0) {
      t200().set_param(param);
      return;
    } else if (strcmp("n200", param_field) == 0) {
      n200().set_param(param);
      return;
    } else if (strcmp("n201_U", param_field) == 0) {
      n201__U().set_param(param);
      return;
    } else if (strcmp("n201_I", param_field) == 0) {
      n201__I().set_param(param);
      return;
    } else if (strcmp("mD", param_field) == 0) {
      mD().set_param(param);
      return;
    } else if (strcmp("mU", param_field) == 0) {
      mU().set_param(param);
      return;
    } else if (strcmp("kD", param_field) == 0) {
      kD().set_param(param);
      return;
    } else if (strcmp("kU", param_field) == 0) {
      kU().set_param(param);
      return;
    } else if (strcmp("l3param", param_field) == 0) {
      l3param().set_param(param);
      return;
    } else if (strcmp("reset", param_field) == 0) {
      reset().set_param(param);
      return;
    } else param.error("Field `%s' not found in union template type `@LLC_Types.XID_Data'", param_field);
  }
  param.basic_check(Module_Param::BC_TEMPLATE, "union template");
  Module_Param_Ptr m_p = &param;
  switch (m_p->get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    XID__Data_template new_temp;
    new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size());
    for (size_t p_i=0; p_i<m_p->get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (m_p->get_size()==0) break;
    param.type_error("union template", "@LLC_Types.XID_Data");
    break;
  case Module_Param::MP_Assignment_List: {
    Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1);
    char* last_name = mp_last->get_id()->get_name();
    if (!strcmp(last_name, "version")) {
      version().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "iOV_UI")) {
      iOV__UI().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "iOV_I")) {
      iOV__I().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "t200")) {
      t200().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "n200")) {
      n200().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "n201_U")) {
      n201__U().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "n201_I")) {
      n201__I().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "mD")) {
      mD().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "mU")) {
      mU().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "kD")) {
      kD().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "kU")) {
      kU().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "l3param")) {
      l3param().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "reset")) {
      reset().set_param(*mp_last);
      break;
    }
    mp_last->error("Field %s does not exist in type @LLC_Types.XID_Data.", last_name);
  } break;
  case Module_Param::MP_Implication_Template: {
    XID__Data_template* precondition = new XID__Data_template;
    precondition->set_param(*m_p->get_elem(0));
    XID__Data_template* implied_template = new XID__Data_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = XID__Data_template(precondition, implied_template);
  } break;
  default:
    param.type_error("union template", "@LLC_Types.XID_Data");
  }
  is_ifpresent = param.get_ifpresent();
}

void XID__Data_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
switch (single_value.union_selection) {
case XID__Data::ALT_version:
single_value.field_version->check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID_Data");
return;
case XID__Data::ALT_iOV__UI:
single_value.field_iOV__UI->check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID_Data");
return;
case XID__Data::ALT_iOV__I:
single_value.field_iOV__I->check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID_Data");
return;
case XID__Data::ALT_t200:
single_value.field_t200->check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID_Data");
return;
case XID__Data::ALT_n200:
single_value.field_n200->check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID_Data");
return;
case XID__Data::ALT_n201__U:
single_value.field_n201__U->check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID_Data");
return;
case XID__Data::ALT_n201__I:
single_value.field_n201__I->check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID_Data");
return;
case XID__Data::ALT_mD:
single_value.field_mD->check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID_Data");
return;
case XID__Data::ALT_mU:
single_value.field_mU->check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID_Data");
return;
case XID__Data::ALT_kD:
single_value.field_kD->check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID_Data");
return;
case XID__Data::ALT_kU:
single_value.field_kU->check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID_Data");
return;
case XID__Data::ALT_l3param:
single_value.field_l3param->check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID_Data");
return;
case XID__Data::ALT_reset:
single_value.field_reset->check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID_Data");
return;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @LLC_Types.XID_Data.");
}
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.XID_Data");
}

void XID__length::copy_value(const XID__length& other_value)
{
switch (other_value.union_selection) {
case ALT_short__len:
field_short__len = new INTEGER(*other_value.field_short__len);
break;
case ALT_long__len:
field_long__len = new INTEGER(*other_value.field_long__len);
break;
default:
TTCN_error("Assignment of an unbound union value of type @LLC_Types.XID_length.");
}
union_selection = other_value.union_selection;
}

XID__length::XID__length()
{
union_selection = UNBOUND_VALUE;
}

XID__length::XID__length(const XID__length& other_value)
: Base_Type(){
copy_value(other_value);
}

XID__length::~XID__length()
{
clean_up();
}

XID__length& XID__length::operator=(const XID__length& other_value)
{
if (this != &other_value) {
clean_up();
copy_value(other_value);
}
return *this;
}

boolean XID__length::operator==(const XID__length& other_value) const
{
if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @LLC_Types.XID_length.");
if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @LLC_Types.XID_length.");
if (union_selection != other_value.union_selection) return FALSE;
switch (union_selection) {
case ALT_short__len:
return *field_short__len == *other_value.field_short__len;
case ALT_long__len:
return *field_long__len == *other_value.field_long__len;
default:
return FALSE;
}
}

INTEGER& XID__length::short__len()
{
if (union_selection != ALT_short__len) {
clean_up();
field_short__len = new INTEGER;
union_selection = ALT_short__len;
}
return *field_short__len;
}

const INTEGER& XID__length::short__len() const
{
if (union_selection != ALT_short__len) TTCN_error("Using non-selected field short_len in a value of union type @LLC_Types.XID_length.");
return *field_short__len;
}

INTEGER& XID__length::long__len()
{
if (union_selection != ALT_long__len) {
clean_up();
field_long__len = new INTEGER;
union_selection = ALT_long__len;
}
return *field_long__len;
}

const INTEGER& XID__length::long__len() const
{
if (union_selection != ALT_long__len) TTCN_error("Using non-selected field long_len in a value of union type @LLC_Types.XID_length.");
return *field_long__len;
}

boolean XID__length::ischosen(union_selection_type checked_selection) const
{
if (checked_selection == UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @LLC_Types.XID_length.");
return union_selection == checked_selection;
}

boolean XID__length::is_bound() const
{
  return union_selection != UNBOUND_VALUE;
}

boolean XID__length::is_value() const
{
switch (union_selection) {
case UNBOUND_VALUE: return FALSE;
case ALT_short__len: return field_short__len->is_value();
case ALT_long__len: return field_long__len->is_value();
default: TTCN_error("Invalid selection in union is_bound");}
}

void XID__length::clean_up()
{
switch (union_selection) {
case ALT_short__len:
  delete field_short__len;
  break;
case ALT_long__len:
  delete field_long__len;
  break;
default:
  break;
}
union_selection = UNBOUND_VALUE;
}

void XID__length::log() const
{
switch (union_selection) {
case ALT_short__len:
TTCN_Logger::log_event_str("{ short_len := ");
field_short__len->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_long__len:
TTCN_Logger::log_event_str("{ long_len := ");
field_long__len->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_unbound();
}
}

void XID__length::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "union value");
  Module_Param_Ptr m_p = &param;
  if (m_p->get_type()==Module_Param::MP_Value_List && m_p->get_size()==0) return;
  if (m_p->get_type()!=Module_Param::MP_Assignment_List) {
    param.error("union value with field name was expected");
  }
  Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1);
  char* last_name = mp_last->get_id()->get_name();
  if (!strcmp(last_name, "short_len")) {
    short__len().set_param(*mp_last);
    if (!short__len().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "long_len")) {
    long__len().set_param(*mp_last);
    if (!long__len().is_bound()) clean_up();
    return;
  }
  mp_last->error("Field %s does not exist in type @LLC_Types.XID_length.", last_name);
}

void XID__length::set_implicit_omit()
{
switch (union_selection) {
case ALT_short__len:
field_short__len->set_implicit_omit(); break;
case ALT_long__len:
field_long__len->set_implicit_omit(); break;
default: break;
}
}

void XID__length::encode_text(Text_Buf& text_buf) const
{
text_buf.push_int(union_selection);
switch (union_selection) {
case ALT_short__len:
field_short__len->encode_text(text_buf);
break;
case ALT_long__len:
field_long__len->encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an unbound value of union type @LLC_Types.XID_length.");
}
}

void XID__length::decode_text(Text_Buf& text_buf)
{
switch ((union_selection_type)text_buf.pull_int().get_val()) {
case ALT_short__len:
short__len().decode_text(text_buf);
break;
case ALT_long__len:
long__len().decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for type @LLC_Types.XID_length.");
}
}

void XID__length::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void XID__length::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int XID__length::RAW_decode(
const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, 
raw_order_t top_bit_ord, boolean no_err, int sel_field, boolean, const RAW_Force_Omit* force_omit)
{
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  int decoded_length=0;
  int starting_pos=p_buf.get_pos_bit();
  if(sel_field!=-1){
    switch(sel_field){
    case 0: {
      RAW_Force_Omit field_force_omit(0, force_omit, XID__length_short__len_descr_.raw->forceomit);
      decoded_length = short__len().RAW_decode(XID__length_short__len_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 1: {
      RAW_Force_Omit field_force_omit(1, force_omit, XID__length_long__len_descr_.raw->forceomit);
      decoded_length = long__len().RAW_decode(XID__length_long__len_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    default: break;
    }
    return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
  } else {
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_0_force_omit(0, force_omit, XID__length_short__len_descr_.raw->forceomit);
      decoded_length = short__len().RAW_decode(XID__length_short__len_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_0_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_1_force_omit(1, force_omit, XID__length_long__len_descr_.raw->forceomit);
      decoded_length = long__len().RAW_decode(XID__length_long__len_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_1_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
 }
 clean_up();
 return -1;
}

int XID__length::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const
{
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 2;  myleaf.body.node.nodes = init_nodes_of_enc_tree(2);
  memset(myleaf.body.node.nodes, 0, 2 * sizeof(RAW_enc_tree *));
  switch (union_selection) {
  case ALT_short__len:
    myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, XID__length_short__len_descr_.raw);
    encoded_length = field_short__len->RAW_encode(XID__length_short__len_descr_, *myleaf.body.node.nodes[0]);
    myleaf.body.node.nodes[0]->coding_descr = &XID__length_short__len_descr_;
    break;
  case ALT_long__len:
    myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, XID__length_long__len_descr_.raw);
    encoded_length = field_long__len->RAW_encode(XID__length_long__len_descr_, *myleaf.body.node.nodes[1]);
    myleaf.body.node.nodes[1]->coding_descr = &XID__length_long__len_descr_;
    break;
  default:
    TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  }
  return encoded_length;
}

void XID__length_template::copy_value(const XID__length& other_value)
{
single_value.union_selection = other_value.get_selection();
switch (single_value.union_selection) {
case XID__length::ALT_short__len:
single_value.field_short__len = new INTEGER_template(other_value.short__len());
break;
case XID__length::ALT_long__len:
single_value.field_long__len = new INTEGER_template(other_value.long__len());
break;
default:
TTCN_error("Initializing a template with an unbound value of type @LLC_Types.XID_length.");
}
set_selection(SPECIFIC_VALUE);
}

void XID__length_template::copy_template(const XID__length_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value.union_selection = other_value.single_value.union_selection;
switch (single_value.union_selection) {
case XID__length::ALT_short__len:
single_value.field_short__len = new INTEGER_template(*other_value.single_value.field_short__len);
break;
case XID__length::ALT_long__len:
single_value.field_long__len = new INTEGER_template(*other_value.single_value.field_long__len);
break;
default:
TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @LLC_Types.XID_length.");
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new XID__length_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new XID__length_template(*other_value.implication_.precondition);
implication_.implied_template = new XID__length_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized template of union type @LLC_Types.XID_length.");
}
set_selection(other_value);
}

XID__length_template::XID__length_template()
{
}

XID__length_template::XID__length_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

XID__length_template::XID__length_template(const XID__length& other_value)
{
copy_value(other_value);
}

XID__length_template::XID__length_template(const OPTIONAL<XID__length>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const XID__length&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of union type @LLC_Types.XID_length from an unbound optional field.");
}
}

XID__length_template::XID__length_template(XID__length_template* p_precondition, XID__length_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

XID__length_template::XID__length_template(Dynamic_Match_Interface<XID__length>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<XID__length>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

XID__length_template::XID__length_template(const XID__length_template& other_value)
: Base_Template(){
copy_template(other_value);
}

XID__length_template::~XID__length_template()
{
clean_up();
}

void XID__length_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case XID__length::ALT_short__len:
delete single_value.field_short__len;
break;
case XID__length::ALT_long__len:
delete single_value.field_long__len;
default:
break;
}
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

XID__length_template& XID__length_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

XID__length_template& XID__length_template::operator=(const XID__length& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

XID__length_template& XID__length_template::operator=(const OPTIONAL<XID__length>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const XID__length&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of union type @LLC_Types.XID_length.");
}
return *this;
}

XID__length_template& XID__length_template::operator=(const XID__length_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean XID__length_template::match(const XID__length& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
{
XID__length::union_selection_type value_selection = other_value.get_selection();
if (value_selection == XID__length::UNBOUND_VALUE) return FALSE;
if (value_selection != single_value.union_selection) return FALSE;
switch (value_selection) {
case XID__length::ALT_short__len:
return single_value.field_short__len->match(other_value.short__len(), legacy);
case XID__length::ALT_long__len:
return single_value.field_long__len->match(other_value.long__len(), legacy);
default:
TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @LLC_Types.XID_length.");
}
}
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error ("Matching an uninitialized template of union type @LLC_Types.XID_length.");
}
return FALSE;
}

boolean XID__length_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
switch (single_value.union_selection) {
case XID__length::ALT_short__len:
return single_value.field_short__len->is_value();
case XID__length::ALT_long__len:
return single_value.field_long__len->is_value();
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @LLC_Types.XID_length.");
}
}

XID__length XID__length_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of union type @LLC_Types.XID_length.");
XID__length ret_val;
switch (single_value.union_selection) {
case XID__length::ALT_short__len:
ret_val.short__len() = single_value.field_short__len->valueof();
break;
case XID__length::ALT_long__len:
ret_val.long__len() = single_value.field_long__len->valueof();
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @LLC_Types.XID_length.");
}
return ret_val;
}

XID__length_template& XID__length_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Internal error: Accessing a list element of a non-list template of union type @LLC_Types.XID_length.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @LLC_Types.XID_length.");
return value_list.list_value[list_index];
}
void XID__length_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error ("Internal error: Setting an invalid list for a template of union type @LLC_Types.XID_length.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new XID__length_template[list_length];
}

INTEGER_template& XID__length_template::short__len()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__length::ALT_short__len) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_short__len = new INTEGER_template(ANY_VALUE);
else single_value.field_short__len = new INTEGER_template;
single_value.union_selection = XID__length::ALT_short__len;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_short__len;
}

const INTEGER_template& XID__length_template::short__len() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field short_len in a non-specific template of union type @LLC_Types.XID_length.");
if (single_value.union_selection != XID__length::ALT_short__len) TTCN_error("Accessing non-selected field short_len in a template of union type @LLC_Types.XID_length.");
return *single_value.field_short__len;
}

INTEGER_template& XID__length_template::long__len()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__length::ALT_long__len) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_long__len = new INTEGER_template(ANY_VALUE);
else single_value.field_long__len = new INTEGER_template;
single_value.union_selection = XID__length::ALT_long__len;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_long__len;
}

const INTEGER_template& XID__length_template::long__len() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field long_len in a non-specific template of union type @LLC_Types.XID_length.");
if (single_value.union_selection != XID__length::ALT_long__len) TTCN_error("Accessing non-selected field long_len in a template of union type @LLC_Types.XID_length.");
return *single_value.field_long__len;
}

boolean XID__length_template::ischosen(XID__length::union_selection_type checked_selection) const
{
if (checked_selection == XID__length::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @LLC_Types.XID_length.");
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.union_selection == XID__length::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @LLC_Types.XID_length.");
return single_value.union_selection == checked_selection;
case VALUE_LIST:
{
if (value_list.n_values < 1)
TTCN_error("Internal error: Performing ischosen() operation on a template of union type @LLC_Types.XID_length containing an empty list.");
boolean ret_val = value_list.list_value[0].ischosen(checked_selection);
for (unsigned int list_count = 1; ret_val == TRUE && list_count < value_list.n_values; list_count++) {
ret_val = value_list.list_value[list_count].ischosen(checked_selection);
}
return ret_val;
}
default:
return FALSE;
}
return FALSE;
}

void XID__length_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case XID__length::ALT_short__len:
TTCN_Logger::log_event_str("{ short_len := ");
single_value.field_short__len->log();
TTCN_Logger::log_event_str(" }");
break;
case XID__length::ALT_long__len:
TTCN_Logger::log_event_str("{ long_len := ");
single_value.field_long__len->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_str("<invalid selector>");
}
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void XID__length_template::log_match(const XID__length& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity() && match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
return;
}
if (template_selection == SPECIFIC_VALUE && single_value.union_selection == match_value.get_selection()) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
switch (single_value.union_selection) {
case XID__length::ALT_short__len:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".short_len");
single_value.field_short__len->log_match(match_value.short__len(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ short_len := ");
single_value.field_short__len->log_match(match_value.short__len(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case XID__length::ALT_long__len:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".long_len");
single_value.field_long__len->log_match(match_value.long__len(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ long_len := ");
single_value.field_long__len->log_match(match_value.long__len(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
default:
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str("<invalid selector>");
}
} else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void XID__length_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
switch (single_value.union_selection) {
case XID__length::ALT_short__len:
single_value.field_short__len->set_implicit_omit(); break;
case XID__length::ALT_long__len:
single_value.field_long__len->set_implicit_omit(); break;
default: break;
}
}

void XID__length_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
text_buf.push_int(single_value.union_selection);
switch (single_value.union_selection) {
case XID__length::ALT_short__len:
single_value.field_short__len->encode_text(text_buf);
break;
case XID__length::ALT_long__len:
single_value.field_long__len->encode_text(text_buf);
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @LLC_Types.XID_length.");
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized template of type @LLC_Types.XID_length.");
}
}

void XID__length_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
{
single_value.union_selection = XID__length::UNBOUND_VALUE;
XID__length::union_selection_type new_selection = (XID__length::union_selection_type)text_buf.pull_int().get_val();
switch (new_selection) {
case XID__length::ALT_short__len:
single_value.field_short__len = new INTEGER_template;
single_value.field_short__len->decode_text(text_buf);
break;
case XID__length::ALT_long__len:
single_value.field_long__len = new INTEGER_template;
single_value.field_long__len->decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @LLC_Types.XID_length.");
}
single_value.union_selection = new_selection;
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new XID__length_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized selector was received in a template of type @LLC_Types.XID_length.");
}
}

boolean XID__length_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean XID__length_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int v_idx=0; v_idx<value_list.n_values; v_idx++)
if (value_list.list_value[v_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

void XID__length_template::set_param(Module_Param& param)
{
  if (dynamic_cast<Module_Param_Name*>(param.get_id()) != NULL &&
      param.get_id()->next_name()) {
    char* param_field = param.get_id()->get_current_name();
    if (param_field[0] >= '0' && param_field[0] <= '9') {
      param.error("Unexpected array index in module parameter, expected a valid field"
        " name for union template type `@LLC_Types.XID_length'");
    }
    if (strcmp("short_len", param_field) == 0) {
      short__len().set_param(param);
      return;
    } else if (strcmp("long_len", param_field) == 0) {
      long__len().set_param(param);
      return;
    } else param.error("Field `%s' not found in union template type `@LLC_Types.XID_length'", param_field);
  }
  param.basic_check(Module_Param::BC_TEMPLATE, "union template");
  Module_Param_Ptr m_p = &param;
  switch (m_p->get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    XID__length_template new_temp;
    new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size());
    for (size_t p_i=0; p_i<m_p->get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (m_p->get_size()==0) break;
    param.type_error("union template", "@LLC_Types.XID_length");
    break;
  case Module_Param::MP_Assignment_List: {
    Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1);
    char* last_name = mp_last->get_id()->get_name();
    if (!strcmp(last_name, "short_len")) {
      short__len().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "long_len")) {
      long__len().set_param(*mp_last);
      break;
    }
    mp_last->error("Field %s does not exist in type @LLC_Types.XID_length.", last_name);
  } break;
  case Module_Param::MP_Implication_Template: {
    XID__length_template* precondition = new XID__length_template;
    precondition->set_param(*m_p->get_elem(0));
    XID__length_template* implied_template = new XID__length_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = XID__length_template(precondition, implied_template);
  } break;
  default:
    param.type_error("union template", "@LLC_Types.XID_length");
  }
  is_ifpresent = param.get_ifpresent();
}

void XID__length_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
switch (single_value.union_selection) {
case XID__length::ALT_short__len:
single_value.field_short__len->check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID_length");
return;
case XID__length::ALT_long__len:
single_value.field_long__len->check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID_length");
return;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @LLC_Types.XID_length.");
}
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.XID_length");
}

XID::XID()
{
}

XID::XID(const BITSTRING& par_xl,
    const BITSTRING& par_typefield,
    const XID__length& par_xID__length,
    const XID__Data& par_xID__Data)
  :   field_xl(par_xl),
  field_typefield(par_typefield),
  field_xID__length(par_xID__length),
  field_xID__Data(par_xID__Data)
{
}

XID::XID(const XID& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.XID.");
if (other_value.xl().is_bound()) field_xl = other_value.xl();
else field_xl.clean_up();
if (other_value.typefield().is_bound()) field_typefield = other_value.typefield();
else field_typefield.clean_up();
if (other_value.xID__length().is_bound()) field_xID__length = other_value.xID__length();
else field_xID__length.clean_up();
if (other_value.xID__Data().is_bound()) field_xID__Data = other_value.xID__Data();
else field_xID__Data.clean_up();
}

void XID::clean_up()
{
field_xl.clean_up();
field_typefield.clean_up();
field_xID__length.clean_up();
field_xID__Data.clean_up();
}

const TTCN_Typedescriptor_t* XID::get_descriptor() const { return &XID_descr_; }
XID& XID::operator=(const XID& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LLC_Types.XID.");
  if (other_value.xl().is_bound()) field_xl = other_value.xl();
  else field_xl.clean_up();
  if (other_value.typefield().is_bound()) field_typefield = other_value.typefield();
  else field_typefield.clean_up();
  if (other_value.xID__length().is_bound()) field_xID__length = other_value.xID__length();
  else field_xID__length.clean_up();
  if (other_value.xID__Data().is_bound()) field_xID__Data = other_value.xID__Data();
  else field_xID__Data.clean_up();
}
return *this;
}

boolean XID::operator==(const XID& other_value) const
{
return field_xl==other_value.field_xl
  && field_typefield==other_value.field_typefield
  && field_xID__length==other_value.field_xID__length
  && field_xID__Data==other_value.field_xID__Data;
}

boolean XID::is_bound() const
{
return (field_xl.is_bound())
  || (field_typefield.is_bound())
  || (field_xID__length.is_bound())
  || (field_xID__Data.is_bound());
}
boolean XID::is_value() const
{
return field_xl.is_value()
  && field_typefield.is_value()
  && field_xID__length.is_value()
  && field_xID__Data.is_value();
}
void XID::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ xl := ");
field_xl.log();
TTCN_Logger::log_event_str(", typefield := ");
field_typefield.log();
TTCN_Logger::log_event_str(", xID_length := ");
field_xID__length.log();
TTCN_Logger::log_event_str(", xID_Data := ");
field_xID__Data.log();
TTCN_Logger::log_event_str(" }");
}

void XID::set_implicit_omit()
{
if (xl().is_bound()) xl().set_implicit_omit();
if (typefield().is_bound()) typefield().set_implicit_omit();
if (xID__length().is_bound()) xID__length().set_implicit_omit();
if (xID__Data().is_bound()) xID__Data().set_implicit_omit();
}

void XID::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (4<param.get_size()) {
      param.error("record value of type @LLC_Types.XID has 4 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) xl().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) typefield().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) xID__length().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) xID__Data().set_param(*param.get_elem(3));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "xl")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          xl().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "typefield")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          typefield().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "xID_length")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          xID__length().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "xID_Data")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          xID__Data().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.XID: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LLC_Types.XID");
  }
}

void XID::encode_text(Text_Buf& text_buf) const
{
field_xl.encode_text(text_buf);
field_typefield.encode_text(text_buf);
field_xID__length.encode_text(text_buf);
field_xID__Data.encode_text(text_buf);
}

void XID::decode_text(Text_Buf& text_buf)
{
field_xl.decode_text(text_buf);
field_typefield.decode_text(text_buf);
field_xID__length.decode_text(text_buf);
field_xID__Data.decode_text(text_buf);
}

void XID::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void XID::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int XID::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  int selected_field = -1;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, XID_xl_descr_.raw->forceomit);
  decoded_field_length = field_xl.RAW_decode(XID_xl_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, XID_typefield_descr_.raw->forceomit);
  decoded_field_length = field_typefield.RAW_decode(XID_typefield_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_xl ==  bs_13) selected_field = 0;
  else if (field_xl ==  bs_14) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, XID_xID__length_descr_.raw->forceomit);
  decoded_field_length = field_xID__length.RAW_decode(XID_xID__length_descr_, p_buf, limit, local_top_order, no_err, selected_field, TRUE, &field_2_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  switch (field_xID__length.get_selection()) {
  case XID__length::ALT_short__len: {
    INTEGER tmp1 = field_xID__length.short__len().convert_to_Integer(XID__length_short__len_descr_);
    field_xID__length.short__len() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case XID__length::ALT_long__len: {
    INTEGER tmp2 = field_xID__length.long__len().convert_to_Integer(XID__length_long__len_descr_);
    field_xID__length.long__len() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  if (field_typefield ==  bs_0) selected_field = 0;
  else if (field_typefield ==  bs_1) selected_field = 1;
  else if (field_typefield ==  bs_2) selected_field = 2;
  else if (field_typefield ==  bs_3) selected_field = 3;
  else if (field_typefield ==  bs_4) selected_field = 4;
  else if (field_typefield ==  bs_5) selected_field = 5;
  else if (field_typefield ==  bs_6) selected_field = 6;
  else if (field_typefield ==  bs_7) selected_field = 7;
  else if (field_typefield ==  bs_8) selected_field = 8;
  else if (field_typefield ==  bs_9) selected_field = 9;
  else if (field_typefield ==  bs_10) selected_field = 10;
  else if (field_typefield ==  bs_11) selected_field = 11;
  else if (field_typefield ==  bs_12) selected_field = 12;
  else selected_field = -1;
  RAW_Force_Omit field_3_force_omit(3, force_omit, XID_xID__Data_descr_.raw->forceomit);
  decoded_field_length = field_xID__Data.RAW_decode(XID_xID__Data_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, no_err, selected_field, TRUE, &field_3_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int XID::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 4;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(4);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, XID_xl_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, XID_typefield_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, XID_xID__length_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, XID_xID__Data_descr_.raw);
  encoded_length += field_xl.RAW_encode(XID_xl_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_typefield.RAW_encode(XID_typefield_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_xID__length.RAW_encode(XID_xID__length_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_xID__Data.RAW_encode(XID_xID__Data_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_xID__length.get_selection()) {
  case XID__length::ALT_short__len:
  if (field_xl !=  bs_13) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_13.RAW_encode(XID_xl_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case XID__length::ALT_long__len:
  if (field_xl !=  bs_14) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_14.RAW_encode(XID_xl_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  default:;
  }
  switch (field_xID__Data.get_selection()) {
  case XID__Data::ALT_version:
  if (field_typefield !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_0.RAW_encode(XID_typefield_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case XID__Data::ALT_iOV__UI:
  if (field_typefield !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_1.RAW_encode(XID_typefield_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case XID__Data::ALT_iOV__I:
  if (field_typefield !=  bs_2) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_2.RAW_encode(XID_typefield_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case XID__Data::ALT_t200:
  if (field_typefield !=  bs_3) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_3.RAW_encode(XID_typefield_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case XID__Data::ALT_n200:
  if (field_typefield !=  bs_4) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_4.RAW_encode(XID_typefield_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case XID__Data::ALT_n201__U:
  if (field_typefield !=  bs_5) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_5.RAW_encode(XID_typefield_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case XID__Data::ALT_n201__I:
  if (field_typefield !=  bs_6) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_6.RAW_encode(XID_typefield_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case XID__Data::ALT_mD:
  if (field_typefield !=  bs_7) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_7.RAW_encode(XID_typefield_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case XID__Data::ALT_mU:
  if (field_typefield !=  bs_8) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_8.RAW_encode(XID_typefield_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case XID__Data::ALT_kD:
  if (field_typefield !=  bs_9) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_9.RAW_encode(XID_typefield_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case XID__Data::ALT_kU:
  if (field_typefield !=  bs_10) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_10.RAW_encode(XID_typefield_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case XID__Data::ALT_l3param:
  if (field_typefield !=  bs_11) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_11.RAW_encode(XID_typefield_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case XID__Data::ALT_reset:
  if (field_typefield !=  bs_12) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_12.RAW_encode(XID_typefield_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  default:;
  }
  return myleaf.length = encoded_length;
}

struct XID_template::single_value_struct {
BITSTRING_template field_xl;
BITSTRING_template field_typefield;
XID__length_template field_xID__length;
XID__Data_template field_xID__Data;
};

void XID_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_xl = ANY_VALUE;
single_value->field_typefield = ANY_VALUE;
single_value->field_xID__length = ANY_VALUE;
single_value->field_xID__Data = ANY_VALUE;
}
}
}

void XID_template::copy_value(const XID& other_value)
{
single_value = new single_value_struct;
if (other_value.xl().is_bound()) {
  single_value->field_xl = other_value.xl();
} else {
  single_value->field_xl.clean_up();
}
if (other_value.typefield().is_bound()) {
  single_value->field_typefield = other_value.typefield();
} else {
  single_value->field_typefield.clean_up();
}
if (other_value.xID__length().is_bound()) {
  single_value->field_xID__length = other_value.xID__length();
} else {
  single_value->field_xID__length.clean_up();
}
if (other_value.xID__Data().is_bound()) {
  single_value->field_xID__Data = other_value.xID__Data();
} else {
  single_value->field_xID__Data.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void XID_template::copy_template(const XID_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.xl().get_selection()) {
single_value->field_xl = other_value.xl();
} else {
single_value->field_xl.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.typefield().get_selection()) {
single_value->field_typefield = other_value.typefield();
} else {
single_value->field_typefield.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.xID__length().get_selection()) {
single_value->field_xID__length = other_value.xID__length();
} else {
single_value->field_xID__length.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.xID__Data().get_selection()) {
single_value->field_xID__Data = other_value.xID__Data();
} else {
single_value->field_xID__Data.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new XID_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new XID_template(*other_value.implication_.precondition);
implication_.implied_template = new XID_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.XID.");
break;
}
set_selection(other_value);
}

XID_template::XID_template()
{
}

XID_template::XID_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

XID_template::XID_template(const XID& other_value)
{
copy_value(other_value);
}

XID_template::XID_template(const OPTIONAL<XID>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const XID&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.XID from an unbound optional field.");
}
}

XID_template::XID_template(XID_template* p_precondition, XID_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

XID_template::XID_template(Dynamic_Match_Interface<XID>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<XID>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

XID_template::XID_template(const XID_template& other_value)
: Base_Template()
{
copy_template(other_value);
}

XID_template::~XID_template()
{
clean_up();
}

XID_template& XID_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

XID_template& XID_template::operator=(const XID& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

XID_template& XID_template::operator=(const OPTIONAL<XID>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const XID&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.XID.");
}
return *this;
}

XID_template& XID_template::operator=(const XID_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean XID_template::match(const XID& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.xl().is_bound()) return FALSE;
if(!single_value->field_xl.match(other_value.xl(), legacy))return FALSE;
if(!other_value.typefield().is_bound()) return FALSE;
if(!single_value->field_typefield.match(other_value.typefield(), legacy))return FALSE;
if(!other_value.xID__length().is_bound()) return FALSE;
if(!single_value->field_xID__length.match(other_value.xID__length(), legacy))return FALSE;
if(!other_value.xID__Data().is_bound()) return FALSE;
if(!single_value->field_xID__Data.match(other_value.xID__Data(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @LLC_Types.XID.");
}
return FALSE;
}

boolean XID_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_xl.is_bound()
 || single_value->field_typefield.is_bound()
 || single_value->field_xID__length.is_bound()
 || single_value->field_xID__Data.is_bound();
}

boolean XID_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_xl.is_value()
 && single_value->field_typefield.is_value()
 && single_value->field_xID__length.is_value()
 && single_value->field_xID__Data.is_value();
}

void XID_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

XID XID_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.XID.");
XID ret_val;
if (single_value->field_xl.is_bound()) {
ret_val.xl() = single_value->field_xl.valueof();
}
if (single_value->field_typefield.is_bound()) {
ret_val.typefield() = single_value->field_typefield.valueof();
}
if (single_value->field_xID__length.is_bound()) {
ret_val.xID__length() = single_value->field_xID__length.valueof();
}
if (single_value->field_xID__Data.is_bound()) {
ret_val.xID__Data() = single_value->field_xID__Data.valueof();
}
return ret_val;
}

void XID_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH)
TTCN_error("Setting an invalid list for a template of type @LLC_Types.XID.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new XID_template[list_length];
}

XID_template& XID_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH)
TTCN_error("Accessing a list element of a non-list template of type @LLC_Types.XID.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LLC_Types.XID.");
return value_list.list_value[list_index];
}

BITSTRING_template& XID_template::xl()
{
set_specific();
return single_value->field_xl;
}

const BITSTRING_template& XID_template::xl() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field xl of a non-specific template of type @LLC_Types.XID.");
return single_value->field_xl;
}

BITSTRING_template& XID_template::typefield()
{
set_specific();
return single_value->field_typefield;
}

const BITSTRING_template& XID_template::typefield() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field typefield of a non-specific template of type @LLC_Types.XID.");
return single_value->field_typefield;
}

XID__length_template& XID_template::xID__length()
{
set_specific();
return single_value->field_xID__length;
}

const XID__length_template& XID_template::xID__length() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field xID_length of a non-specific template of type @LLC_Types.XID.");
return single_value->field_xID__length;
}

XID__Data_template& XID_template::xID__Data()
{
set_specific();
return single_value->field_xID__Data;
}

const XID__Data_template& XID_template::xID__Data() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field xID_Data of a non-specific template of type @LLC_Types.XID.");
return single_value->field_xID__Data;
}

int XID_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.XID which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 4;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LLC_Types.XID containing an empty list.");
      int item_size = value_list.list_value[0].size_of();
      for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++)
      {
        if (value_list.list_value[l_idx].size_of()!=item_size)
          TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.XID containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.XID containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.XID containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.XID containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.XID containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.XID containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.XID containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LLC_Types.XID.");
  }
  return 0;
}

void XID_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ xl := ");
single_value->field_xl.log();
TTCN_Logger::log_event_str(", typefield := ");
single_value->field_typefield.log();
TTCN_Logger::log_event_str(", xID_length := ");
single_value->field_xID__length.log();
TTCN_Logger::log_event_str(", xID_Data := ");
single_value->field_xID__Data.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void XID_template::log_match(const XID& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_xl.match(match_value.xl(), legacy)){
TTCN_Logger::log_logmatch_info(".xl");
single_value->field_xl.log_match(match_value.xl(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_typefield.match(match_value.typefield(), legacy)){
TTCN_Logger::log_logmatch_info(".typefield");
single_value->field_typefield.log_match(match_value.typefield(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_xID__length.match(match_value.xID__length(), legacy)){
TTCN_Logger::log_logmatch_info(".xID_length");
single_value->field_xID__length.log_match(match_value.xID__length(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_xID__Data.match(match_value.xID__Data(), legacy)){
TTCN_Logger::log_logmatch_info(".xID_Data");
single_value->field_xID__Data.log_match(match_value.xID__Data(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ xl := ");
single_value->field_xl.log_match(match_value.xl(), legacy);
TTCN_Logger::log_event_str(", typefield := ");
single_value->field_typefield.log_match(match_value.typefield(), legacy);
TTCN_Logger::log_event_str(", xID_length := ");
single_value->field_xID__length.log_match(match_value.xID__length(), legacy);
TTCN_Logger::log_event_str(", xID_Data := ");
single_value->field_xID__Data.log_match(match_value.xID__Data(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void XID_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (xl().is_bound()) xl().set_implicit_omit();
if (typefield().is_bound()) typefield().set_implicit_omit();
if (xID__length().is_bound()) xID__length().set_implicit_omit();
if (xID__Data().is_bound()) xID__Data().set_implicit_omit();
}

void XID_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_xl.encode_text(text_buf);
single_value->field_typefield.encode_text(text_buf);
single_value->field_xID__length.encode_text(text_buf);
single_value->field_xID__Data.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.XID.");
}
}

void XID_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_xl.decode_text(text_buf);
single_value->field_typefield.decode_text(text_buf);
single_value->field_xID__length.decode_text(text_buf);
single_value->field_xID__Data.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new XID_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @LLC_Types.XID.");
}
}

void XID_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    XID_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (4<param.get_size()) {
      param.error("record template of type @LLC_Types.XID has 4 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) xl().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) typefield().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) xID__length().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) xID__Data().set_param(*param.get_elem(3));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "xl")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          xl().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "typefield")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          typefield().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "xID_length")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          xID__length().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "xID_Data")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          xID__Data().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.XID: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    XID_template* precondition = new XID_template;
    precondition->set_param(*param.get_elem(0));
    XID_template* implied_template = new XID_template;
    implied_template->set_param(*param.get_elem(1));
    *this = XID_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LLC_Types.XID");
  }
  is_ifpresent = param.get_ifpresent();
}

void XID_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_xl.check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID");
single_value->field_typefield.check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID");
single_value->field_xID__length.check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID");
single_value->field_xID__Data.check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.XID");
}

boolean XID_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean XID_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

Control__field__UI::Control__field__UI()
{
}

Control__field__UI::Control__field__UI(const BITSTRING& par_format,
    const BITSTRING& par_spare,
    const INTEGER& par_nU,
    const BITSTRING& par_e,
    const BITSTRING& par_pM)
  :   field_format(par_format),
  field_spare(par_spare),
  field_nU(par_nU),
  field_e(par_e),
  field_pM(par_pM)
{
}

Control__field__UI::Control__field__UI(const Control__field__UI& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.Control_field_UI.");
if (other_value.format().is_bound()) field_format = other_value.format();
else field_format.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.nU().is_bound()) field_nU = other_value.nU();
else field_nU.clean_up();
if (other_value.e().is_bound()) field_e = other_value.e();
else field_e.clean_up();
if (other_value.pM().is_bound()) field_pM = other_value.pM();
else field_pM.clean_up();
}

void Control__field__UI::clean_up()
{
field_format.clean_up();
field_spare.clean_up();
field_nU.clean_up();
field_e.clean_up();
field_pM.clean_up();
}

const TTCN_Typedescriptor_t* Control__field__UI::get_descriptor() const { return &Control__field__UI_descr_; }
Control__field__UI& Control__field__UI::operator=(const Control__field__UI& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LLC_Types.Control_field_UI.");
  if (other_value.format().is_bound()) field_format = other_value.format();
  else field_format.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.nU().is_bound()) field_nU = other_value.nU();
  else field_nU.clean_up();
  if (other_value.e().is_bound()) field_e = other_value.e();
  else field_e.clean_up();
  if (other_value.pM().is_bound()) field_pM = other_value.pM();
  else field_pM.clean_up();
}
return *this;
}

boolean Control__field__UI::operator==(const Control__field__UI& other_value) const
{
return field_format==other_value.field_format
  && field_spare==other_value.field_spare
  && field_nU==other_value.field_nU
  && field_e==other_value.field_e
  && field_pM==other_value.field_pM;
}

boolean Control__field__UI::is_bound() const
{
return (field_format.is_bound())
  || (field_spare.is_bound())
  || (field_nU.is_bound())
  || (field_e.is_bound())
  || (field_pM.is_bound());
}
boolean Control__field__UI::is_value() const
{
return field_format.is_value()
  && field_spare.is_value()
  && field_nU.is_value()
  && field_e.is_value()
  && field_pM.is_value();
}
void Control__field__UI::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ format := ");
field_format.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(", nU := ");
field_nU.log();
TTCN_Logger::log_event_str(", e := ");
field_e.log();
TTCN_Logger::log_event_str(", pM := ");
field_pM.log();
TTCN_Logger::log_event_str(" }");
}

void Control__field__UI::set_implicit_omit()
{
if (format().is_bound()) format().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (nU().is_bound()) nU().set_implicit_omit();
if (e().is_bound()) e().set_implicit_omit();
if (pM().is_bound()) pM().set_implicit_omit();
}

void Control__field__UI::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (5<param.get_size()) {
      param.error("record value of type @LLC_Types.Control_field_UI has 5 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) format().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nU().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) e().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) pM().set_param(*param.get_elem(4));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "format")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          format().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nU")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nU().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "e")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          e().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pM")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pM().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.Control_field_UI: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LLC_Types.Control_field_UI");
  }
}

void Control__field__UI::encode_text(Text_Buf& text_buf) const
{
field_format.encode_text(text_buf);
field_spare.encode_text(text_buf);
field_nU.encode_text(text_buf);
field_e.encode_text(text_buf);
field_pM.encode_text(text_buf);
}

void Control__field__UI::decode_text(Text_Buf& text_buf)
{
field_format.decode_text(text_buf);
field_spare.decode_text(text_buf);
field_nU.decode_text(text_buf);
field_e.decode_text(text_buf);
field_pM.decode_text(text_buf);
}

void Control__field__UI::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void Control__field__UI::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int Control__field__UI::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, Control__field__UI_format_descr_.raw->forceomit);
  decoded_field_length = field_format.RAW_decode(Control__field__UI_format_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, Control__field__UI_spare_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(Control__field__UI_spare_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_2_force_omit(2, force_omit, Control__field__UI_nU_descr_.raw->forceomit);
  decoded_field_length = field_nU.RAW_decode(Control__field__UI_nU_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_3_force_omit(3, force_omit, Control__field__UI_e_descr_.raw->forceomit);
  decoded_field_length = field_e.RAW_decode(Control__field__UI_e_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_4_force_omit(4, force_omit, Control__field__UI_pM_descr_.raw->forceomit);
  decoded_field_length = field_pM.RAW_decode(Control__field__UI_pM_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_4_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Control__field__UI::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 5;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(5);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, Control__field__UI_format_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Control__field__UI_spare_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Control__field__UI_nU_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, Control__field__UI_e_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, Control__field__UI_pM_descr_.raw);
  encoded_length += field_format.RAW_encode(Control__field__UI_format_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_spare.RAW_encode(Control__field__UI_spare_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_nU.RAW_encode(Control__field__UI_nU_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_e.RAW_encode(Control__field__UI_e_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_pM.RAW_encode(Control__field__UI_pM_descr_, *myleaf.body.node.nodes[4]);
  return myleaf.length = encoded_length;
}

struct Control__field__UI_template::single_value_struct {
BITSTRING_template field_format;
BITSTRING_template field_spare;
INTEGER_template field_nU;
BITSTRING_template field_e;
BITSTRING_template field_pM;
};

void Control__field__UI_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_format = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
single_value->field_nU = ANY_VALUE;
single_value->field_e = ANY_VALUE;
single_value->field_pM = ANY_VALUE;
}
}
}

void Control__field__UI_template::copy_value(const Control__field__UI& other_value)
{
single_value = new single_value_struct;
if (other_value.format().is_bound()) {
  single_value->field_format = other_value.format();
} else {
  single_value->field_format.clean_up();
}
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
if (other_value.nU().is_bound()) {
  single_value->field_nU = other_value.nU();
} else {
  single_value->field_nU.clean_up();
}
if (other_value.e().is_bound()) {
  single_value->field_e = other_value.e();
} else {
  single_value->field_e.clean_up();
}
if (other_value.pM().is_bound()) {
  single_value->field_pM = other_value.pM();
} else {
  single_value->field_pM.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Control__field__UI_template::copy_template(const Control__field__UI_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.format().get_selection()) {
single_value->field_format = other_value.format();
} else {
single_value->field_format.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nU().get_selection()) {
single_value->field_nU = other_value.nU();
} else {
single_value->field_nU.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.e().get_selection()) {
single_value->field_e = other_value.e();
} else {
single_value->field_e.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pM().get_selection()) {
single_value->field_pM = other_value.pM();
} else {
single_value->field_pM.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new Control__field__UI_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new Control__field__UI_template(*other_value.implication_.precondition);
implication_.implied_template = new Control__field__UI_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.Control_field_UI.");
break;
}
set_selection(other_value);
}

Control__field__UI_template::Control__field__UI_template()
{
}

Control__field__UI_template::Control__field__UI_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

Control__field__UI_template::Control__field__UI_template(const Control__field__UI& other_value)
{
copy_value(other_value);
}

Control__field__UI_template::Control__field__UI_template(const OPTIONAL<Control__field__UI>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const Control__field__UI&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.Control_field_UI from an unbound optional field.");
}
}

Control__field__UI_template::Control__field__UI_template(Control__field__UI_template* p_precondition, Control__field__UI_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

Control__field__UI_template::Control__field__UI_template(Dynamic_Match_Interface<Control__field__UI>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<Control__field__UI>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

Control__field__UI_template::Control__field__UI_template(const Control__field__UI_template& other_value)
: Base_Template()
{
copy_template(other_value);
}

Control__field__UI_template::~Control__field__UI_template()
{
clean_up();
}

Control__field__UI_template& Control__field__UI_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

Control__field__UI_template& Control__field__UI_template::operator=(const Control__field__UI& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

Control__field__UI_template& Control__field__UI_template::operator=(const OPTIONAL<Control__field__UI>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const Control__field__UI&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.Control_field_UI.");
}
return *this;
}

Control__field__UI_template& Control__field__UI_template::operator=(const Control__field__UI_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean Control__field__UI_template::match(const Control__field__UI& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.format().is_bound()) return FALSE;
if(!single_value->field_format.match(other_value.format(), legacy))return FALSE;
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
if(!other_value.nU().is_bound()) return FALSE;
if(!single_value->field_nU.match(other_value.nU(), legacy))return FALSE;
if(!other_value.e().is_bound()) return FALSE;
if(!single_value->field_e.match(other_value.e(), legacy))return FALSE;
if(!other_value.pM().is_bound()) return FALSE;
if(!single_value->field_pM.match(other_value.pM(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @LLC_Types.Control_field_UI.");
}
return FALSE;
}

boolean Control__field__UI_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_format.is_bound()
 || single_value->field_spare.is_bound()
 || single_value->field_nU.is_bound()
 || single_value->field_e.is_bound()
 || single_value->field_pM.is_bound();
}

boolean Control__field__UI_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_format.is_value()
 && single_value->field_spare.is_value()
 && single_value->field_nU.is_value()
 && single_value->field_e.is_value()
 && single_value->field_pM.is_value();
}

void Control__field__UI_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

Control__field__UI Control__field__UI_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.Control_field_UI.");
Control__field__UI ret_val;
if (single_value->field_format.is_bound()) {
ret_val.format() = single_value->field_format.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_nU.is_bound()) {
ret_val.nU() = single_value->field_nU.valueof();
}
if (single_value->field_e.is_bound()) {
ret_val.e() = single_value->field_e.valueof();
}
if (single_value->field_pM.is_bound()) {
ret_val.pM() = single_value->field_pM.valueof();
}
return ret_val;
}

void Control__field__UI_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH)
TTCN_error("Setting an invalid list for a template of type @LLC_Types.Control_field_UI.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Control__field__UI_template[list_length];
}

Control__field__UI_template& Control__field__UI_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH)
TTCN_error("Accessing a list element of a non-list template of type @LLC_Types.Control_field_UI.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LLC_Types.Control_field_UI.");
return value_list.list_value[list_index];
}

BITSTRING_template& Control__field__UI_template::format()
{
set_specific();
return single_value->field_format;
}

const BITSTRING_template& Control__field__UI_template::format() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field format of a non-specific template of type @LLC_Types.Control_field_UI.");
return single_value->field_format;
}

BITSTRING_template& Control__field__UI_template::spare()
{
set_specific();
return single_value->field_spare;
}

const BITSTRING_template& Control__field__UI_template::spare() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare of a non-specific template of type @LLC_Types.Control_field_UI.");
return single_value->field_spare;
}

INTEGER_template& Control__field__UI_template::nU()
{
set_specific();
return single_value->field_nU;
}

const INTEGER_template& Control__field__UI_template::nU() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nU of a non-specific template of type @LLC_Types.Control_field_UI.");
return single_value->field_nU;
}

BITSTRING_template& Control__field__UI_template::e()
{
set_specific();
return single_value->field_e;
}

const BITSTRING_template& Control__field__UI_template::e() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field e of a non-specific template of type @LLC_Types.Control_field_UI.");
return single_value->field_e;
}

BITSTRING_template& Control__field__UI_template::pM()
{
set_specific();
return single_value->field_pM;
}

const BITSTRING_template& Control__field__UI_template::pM() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pM of a non-specific template of type @LLC_Types.Control_field_UI.");
return single_value->field_pM;
}

int Control__field__UI_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Control_field_UI which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 5;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LLC_Types.Control_field_UI containing an empty list.");
      int item_size = value_list.list_value[0].size_of();
      for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++)
      {
        if (value_list.list_value[l_idx].size_of()!=item_size)
          TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Control_field_UI containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Control_field_UI containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Control_field_UI containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Control_field_UI containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Control_field_UI containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Control_field_UI containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Control_field_UI containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LLC_Types.Control_field_UI.");
  }
  return 0;
}

void Control__field__UI_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ format := ");
single_value->field_format.log();
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(", nU := ");
single_value->field_nU.log();
TTCN_Logger::log_event_str(", e := ");
single_value->field_e.log();
TTCN_Logger::log_event_str(", pM := ");
single_value->field_pM.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void Control__field__UI_template::log_match(const Control__field__UI& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_format.match(match_value.format(), legacy)){
TTCN_Logger::log_logmatch_info(".format");
single_value->field_format.log_match(match_value.format(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_nU.match(match_value.nU(), legacy)){
TTCN_Logger::log_logmatch_info(".nU");
single_value->field_nU.log_match(match_value.nU(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_e.match(match_value.e(), legacy)){
TTCN_Logger::log_logmatch_info(".e");
single_value->field_e.log_match(match_value.e(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pM.match(match_value.pM(), legacy)){
TTCN_Logger::log_logmatch_info(".pM");
single_value->field_pM.log_match(match_value.pM(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ format := ");
single_value->field_format.log_match(match_value.format(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(", nU := ");
single_value->field_nU.log_match(match_value.nU(), legacy);
TTCN_Logger::log_event_str(", e := ");
single_value->field_e.log_match(match_value.e(), legacy);
TTCN_Logger::log_event_str(", pM := ");
single_value->field_pM.log_match(match_value.pM(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void Control__field__UI_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (format().is_bound()) format().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (nU().is_bound()) nU().set_implicit_omit();
if (e().is_bound()) e().set_implicit_omit();
if (pM().is_bound()) pM().set_implicit_omit();
}

void Control__field__UI_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_format.encode_text(text_buf);
single_value->field_spare.encode_text(text_buf);
single_value->field_nU.encode_text(text_buf);
single_value->field_e.encode_text(text_buf);
single_value->field_pM.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.Control_field_UI.");
}
}

void Control__field__UI_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_format.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
single_value->field_nU.decode_text(text_buf);
single_value->field_e.decode_text(text_buf);
single_value->field_pM.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new Control__field__UI_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @LLC_Types.Control_field_UI.");
}
}

void Control__field__UI_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    Control__field__UI_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (5<param.get_size()) {
      param.error("record template of type @LLC_Types.Control_field_UI has 5 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) format().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nU().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) e().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) pM().set_param(*param.get_elem(4));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "format")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          format().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nU")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nU().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "e")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          e().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pM")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pM().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.Control_field_UI: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Control__field__UI_template* precondition = new Control__field__UI_template;
    precondition->set_param(*param.get_elem(0));
    Control__field__UI_template* implied_template = new Control__field__UI_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Control__field__UI_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LLC_Types.Control_field_UI");
  }
  is_ifpresent = param.get_ifpresent();
}

void Control__field__UI_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_format.check_restriction(t_res, t_name ? t_name : "@LLC_Types.Control_field_UI");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@LLC_Types.Control_field_UI");
single_value->field_nU.check_restriction(t_res, t_name ? t_name : "@LLC_Types.Control_field_UI");
single_value->field_e.check_restriction(t_res, t_name ? t_name : "@LLC_Types.Control_field_UI");
single_value->field_pM.check_restriction(t_res, t_name ? t_name : "@LLC_Types.Control_field_UI");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.Control_field_UI");
}

boolean Control__field__UI_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean Control__field__UI_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

RejectedFrameControlField__UI::RejectedFrameControlField__UI()
{
}

RejectedFrameControlField__UI::RejectedFrameControlField__UI(const Control__field__UI& par_control__field,
    const OCTETSTRING& par_spare)
  :   field_control__field(par_control__field),
  field_spare(par_spare)
{
}

RejectedFrameControlField__UI::RejectedFrameControlField__UI(const RejectedFrameControlField__UI& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.RejectedFrameControlField_UI.");
if (other_value.control__field().is_bound()) field_control__field = other_value.control__field();
else field_control__field.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
}

void RejectedFrameControlField__UI::clean_up()
{
field_control__field.clean_up();
field_spare.clean_up();
}

const TTCN_Typedescriptor_t* RejectedFrameControlField__UI::get_descriptor() const { return &RejectedFrameControlField__UI_descr_; }
RejectedFrameControlField__UI& RejectedFrameControlField__UI::operator=(const RejectedFrameControlField__UI& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LLC_Types.RejectedFrameControlField_UI.");
  if (other_value.control__field().is_bound()) field_control__field = other_value.control__field();
  else field_control__field.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
}
return *this;
}

boolean RejectedFrameControlField__UI::operator==(const RejectedFrameControlField__UI& other_value) const
{
return field_control__field==other_value.field_control__field
  && field_spare==other_value.field_spare;
}

boolean RejectedFrameControlField__UI::is_bound() const
{
return (field_control__field.is_bound())
  || (field_spare.is_bound());
}
boolean RejectedFrameControlField__UI::is_value() const
{
return field_control__field.is_value()
  && field_spare.is_value();
}
void RejectedFrameControlField__UI::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ control_field := ");
field_control__field.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(" }");
}

void RejectedFrameControlField__UI::set_implicit_omit()
{
if (control__field().is_bound()) control__field().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void RejectedFrameControlField__UI::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record value of type @LLC_Types.RejectedFrameControlField_UI has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) control__field().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "control_field")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          control__field().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.RejectedFrameControlField_UI: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LLC_Types.RejectedFrameControlField_UI");
  }
}

void RejectedFrameControlField__UI::encode_text(Text_Buf& text_buf) const
{
field_control__field.encode_text(text_buf);
field_spare.encode_text(text_buf);
}

void RejectedFrameControlField__UI::decode_text(Text_Buf& text_buf)
{
field_control__field.decode_text(text_buf);
field_spare.decode_text(text_buf);
}

void RejectedFrameControlField__UI::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void RejectedFrameControlField__UI::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int RejectedFrameControlField__UI::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, Control__field__UI_descr_.raw->forceomit);
  decoded_field_length = field_control__field.RAW_decode(Control__field__UI_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::OCT4_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(General__Types::OCT4_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int RejectedFrameControlField__UI::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 2;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(2);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, Control__field__UI_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::OCT4_descr_.raw);
  encoded_length += field_control__field.RAW_encode(Control__field__UI_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_spare.RAW_encode(General__Types::OCT4_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct RejectedFrameControlField__UI_template::single_value_struct {
Control__field__UI_template field_control__field;
OCTETSTRING_template field_spare;
};

void RejectedFrameControlField__UI_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_control__field = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
}
}
}

void RejectedFrameControlField__UI_template::copy_value(const RejectedFrameControlField__UI& other_value)
{
single_value = new single_value_struct;
if (other_value.control__field().is_bound()) {
  single_value->field_control__field = other_value.control__field();
} else {
  single_value->field_control__field.clean_up();
}
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RejectedFrameControlField__UI_template::copy_template(const RejectedFrameControlField__UI_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.control__field().get_selection()) {
single_value->field_control__field = other_value.control__field();
} else {
single_value->field_control__field.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new RejectedFrameControlField__UI_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new RejectedFrameControlField__UI_template(*other_value.implication_.precondition);
implication_.implied_template = new RejectedFrameControlField__UI_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.RejectedFrameControlField_UI.");
break;
}
set_selection(other_value);
}

RejectedFrameControlField__UI_template::RejectedFrameControlField__UI_template()
{
}

RejectedFrameControlField__UI_template::RejectedFrameControlField__UI_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

RejectedFrameControlField__UI_template::RejectedFrameControlField__UI_template(const RejectedFrameControlField__UI& other_value)
{
copy_value(other_value);
}

RejectedFrameControlField__UI_template::RejectedFrameControlField__UI_template(const OPTIONAL<RejectedFrameControlField__UI>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const RejectedFrameControlField__UI&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.RejectedFrameControlField_UI from an unbound optional field.");
}
}

RejectedFrameControlField__UI_template::RejectedFrameControlField__UI_template(RejectedFrameControlField__UI_template* p_precondition, RejectedFrameControlField__UI_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

RejectedFrameControlField__UI_template::RejectedFrameControlField__UI_template(Dynamic_Match_Interface<RejectedFrameControlField__UI>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<RejectedFrameControlField__UI>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

RejectedFrameControlField__UI_template::RejectedFrameControlField__UI_template(const RejectedFrameControlField__UI_template& other_value)
: Base_Template()
{
copy_template(other_value);
}

RejectedFrameControlField__UI_template::~RejectedFrameControlField__UI_template()
{
clean_up();
}

RejectedFrameControlField__UI_template& RejectedFrameControlField__UI_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

RejectedFrameControlField__UI_template& RejectedFrameControlField__UI_template::operator=(const RejectedFrameControlField__UI& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

RejectedFrameControlField__UI_template& RejectedFrameControlField__UI_template::operator=(const OPTIONAL<RejectedFrameControlField__UI>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const RejectedFrameControlField__UI&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.RejectedFrameControlField_UI.");
}
return *this;
}

RejectedFrameControlField__UI_template& RejectedFrameControlField__UI_template::operator=(const RejectedFrameControlField__UI_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean RejectedFrameControlField__UI_template::match(const RejectedFrameControlField__UI& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.control__field().is_bound()) return FALSE;
if(!single_value->field_control__field.match(other_value.control__field(), legacy))return FALSE;
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @LLC_Types.RejectedFrameControlField_UI.");
}
return FALSE;
}

boolean RejectedFrameControlField__UI_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_control__field.is_bound()
 || single_value->field_spare.is_bound();
}

boolean RejectedFrameControlField__UI_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_control__field.is_value()
 && single_value->field_spare.is_value();
}

void RejectedFrameControlField__UI_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

RejectedFrameControlField__UI RejectedFrameControlField__UI_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.RejectedFrameControlField_UI.");
RejectedFrameControlField__UI ret_val;
if (single_value->field_control__field.is_bound()) {
ret_val.control__field() = single_value->field_control__field.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
return ret_val;
}

void RejectedFrameControlField__UI_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH)
TTCN_error("Setting an invalid list for a template of type @LLC_Types.RejectedFrameControlField_UI.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RejectedFrameControlField__UI_template[list_length];
}

RejectedFrameControlField__UI_template& RejectedFrameControlField__UI_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH)
TTCN_error("Accessing a list element of a non-list template of type @LLC_Types.RejectedFrameControlField_UI.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LLC_Types.RejectedFrameControlField_UI.");
return value_list.list_value[list_index];
}

Control__field__UI_template& RejectedFrameControlField__UI_template::control__field()
{
set_specific();
return single_value->field_control__field;
}

const Control__field__UI_template& RejectedFrameControlField__UI_template::control__field() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field control_field of a non-specific template of type @LLC_Types.RejectedFrameControlField_UI.");
return single_value->field_control__field;
}

OCTETSTRING_template& RejectedFrameControlField__UI_template::spare()
{
set_specific();
return single_value->field_spare;
}

const OCTETSTRING_template& RejectedFrameControlField__UI_template::spare() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare of a non-specific template of type @LLC_Types.RejectedFrameControlField_UI.");
return single_value->field_spare;
}

int RejectedFrameControlField__UI_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.RejectedFrameControlField_UI which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 2;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LLC_Types.RejectedFrameControlField_UI containing an empty list.");
      int item_size = value_list.list_value[0].size_of();
      for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++)
      {
        if (value_list.list_value[l_idx].size_of()!=item_size)
          TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.RejectedFrameControlField_UI containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.RejectedFrameControlField_UI containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.RejectedFrameControlField_UI containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.RejectedFrameControlField_UI containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.RejectedFrameControlField_UI containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.RejectedFrameControlField_UI containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.RejectedFrameControlField_UI containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LLC_Types.RejectedFrameControlField_UI.");
  }
  return 0;
}

void RejectedFrameControlField__UI_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ control_field := ");
single_value->field_control__field.log();
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void RejectedFrameControlField__UI_template::log_match(const RejectedFrameControlField__UI& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_control__field.match(match_value.control__field(), legacy)){
TTCN_Logger::log_logmatch_info(".control_field");
single_value->field_control__field.log_match(match_value.control__field(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ control_field := ");
single_value->field_control__field.log_match(match_value.control__field(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void RejectedFrameControlField__UI_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (control__field().is_bound()) control__field().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void RejectedFrameControlField__UI_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_control__field.encode_text(text_buf);
single_value->field_spare.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.RejectedFrameControlField_UI.");
}
}

void RejectedFrameControlField__UI_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_control__field.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new RejectedFrameControlField__UI_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @LLC_Types.RejectedFrameControlField_UI.");
}
}

void RejectedFrameControlField__UI_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    RejectedFrameControlField__UI_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @LLC_Types.RejectedFrameControlField_UI has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) control__field().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "control_field")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          control__field().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.RejectedFrameControlField_UI: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    RejectedFrameControlField__UI_template* precondition = new RejectedFrameControlField__UI_template;
    precondition->set_param(*param.get_elem(0));
    RejectedFrameControlField__UI_template* implied_template = new RejectedFrameControlField__UI_template;
    implied_template->set_param(*param.get_elem(1));
    *this = RejectedFrameControlField__UI_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LLC_Types.RejectedFrameControlField_UI");
  }
  is_ifpresent = param.get_ifpresent();
}

void RejectedFrameControlField__UI_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_control__field.check_restriction(t_res, t_name ? t_name : "@LLC_Types.RejectedFrameControlField_UI");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@LLC_Types.RejectedFrameControlField_UI");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.RejectedFrameControlField_UI");
}

boolean RejectedFrameControlField__UI_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean RejectedFrameControlField__UI_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

Control__field__U::Control__field__U()
{
}

Control__field__U::Control__field__U(const BITSTRING& par_mBits,
    const BITSTRING& par_pF,
    const BITSTRING& par_format)
  :   field_mBits(par_mBits),
  field_pF(par_pF),
  field_format(par_format)
{
}

Control__field__U::Control__field__U(const Control__field__U& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.Control_field_U.");
if (other_value.mBits().is_bound()) field_mBits = other_value.mBits();
else field_mBits.clean_up();
if (other_value.pF().is_bound()) field_pF = other_value.pF();
else field_pF.clean_up();
if (other_value.format().is_bound()) field_format = other_value.format();
else field_format.clean_up();
}

void Control__field__U::clean_up()
{
field_mBits.clean_up();
field_pF.clean_up();
field_format.clean_up();
}

const TTCN_Typedescriptor_t* Control__field__U::get_descriptor() const { return &Control__field__U_descr_; }
Control__field__U& Control__field__U::operator=(const Control__field__U& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LLC_Types.Control_field_U.");
  if (other_value.mBits().is_bound()) field_mBits = other_value.mBits();
  else field_mBits.clean_up();
  if (other_value.pF().is_bound()) field_pF = other_value.pF();
  else field_pF.clean_up();
  if (other_value.format().is_bound()) field_format = other_value.format();
  else field_format.clean_up();
}
return *this;
}

boolean Control__field__U::operator==(const Control__field__U& other_value) const
{
return field_mBits==other_value.field_mBits
  && field_pF==other_value.field_pF
  && field_format==other_value.field_format;
}

boolean Control__field__U::is_bound() const
{
return (field_mBits.is_bound())
  || (field_pF.is_bound())
  || (field_format.is_bound());
}
boolean Control__field__U::is_value() const
{
return field_mBits.is_value()
  && field_pF.is_value()
  && field_format.is_value();
}
void Control__field__U::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ mBits := ");
field_mBits.log();
TTCN_Logger::log_event_str(", pF := ");
field_pF.log();
TTCN_Logger::log_event_str(", format := ");
field_format.log();
TTCN_Logger::log_event_str(" }");
}

void Control__field__U::set_implicit_omit()
{
if (mBits().is_bound()) mBits().set_implicit_omit();
if (pF().is_bound()) pF().set_implicit_omit();
if (format().is_bound()) format().set_implicit_omit();
}

void Control__field__U::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (3<param.get_size()) {
      param.error("record value of type @LLC_Types.Control_field_U has 3 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) mBits().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) pF().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) format().set_param(*param.get_elem(2));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mBits")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mBits().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pF")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pF().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "format")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          format().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.Control_field_U: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LLC_Types.Control_field_U");
  }
}

void Control__field__U::encode_text(Text_Buf& text_buf) const
{
field_mBits.encode_text(text_buf);
field_pF.encode_text(text_buf);
field_format.encode_text(text_buf);
}

void Control__field__U::decode_text(Text_Buf& text_buf)
{
field_mBits.decode_text(text_buf);
field_pF.decode_text(text_buf);
field_format.decode_text(text_buf);
}

void Control__field__U::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void Control__field__U::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int Control__field__U::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::BIT4_descr_.raw->forceomit);
  decoded_field_length = field_mBits.RAW_decode(General__Types::BIT4_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_pF.RAW_decode(General__Types::BIT1_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT3_descr_.raw->forceomit);
  decoded_field_length = field_format.RAW_decode(General__Types::BIT3_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Control__field__U::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 3;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(3);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::BIT4_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT3_descr_.raw);
  encoded_length += field_mBits.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_pF.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_format.RAW_encode(General__Types::BIT3_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct Control__field__U_template::single_value_struct {
BITSTRING_template field_mBits;
BITSTRING_template field_pF;
BITSTRING_template field_format;
};

void Control__field__U_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_mBits = ANY_VALUE;
single_value->field_pF = ANY_VALUE;
single_value->field_format = ANY_VALUE;
}
}
}

void Control__field__U_template::copy_value(const Control__field__U& other_value)
{
single_value = new single_value_struct;
if (other_value.mBits().is_bound()) {
  single_value->field_mBits = other_value.mBits();
} else {
  single_value->field_mBits.clean_up();
}
if (other_value.pF().is_bound()) {
  single_value->field_pF = other_value.pF();
} else {
  single_value->field_pF.clean_up();
}
if (other_value.format().is_bound()) {
  single_value->field_format = other_value.format();
} else {
  single_value->field_format.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Control__field__U_template::copy_template(const Control__field__U_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.mBits().get_selection()) {
single_value->field_mBits = other_value.mBits();
} else {
single_value->field_mBits.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pF().get_selection()) {
single_value->field_pF = other_value.pF();
} else {
single_value->field_pF.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.format().get_selection()) {
single_value->field_format = other_value.format();
} else {
single_value->field_format.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new Control__field__U_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new Control__field__U_template(*other_value.implication_.precondition);
implication_.implied_template = new Control__field__U_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.Control_field_U.");
break;
}
set_selection(other_value);
}

Control__field__U_template::Control__field__U_template()
{
}

Control__field__U_template::Control__field__U_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

Control__field__U_template::Control__field__U_template(const Control__field__U& other_value)
{
copy_value(other_value);
}

Control__field__U_template::Control__field__U_template(const OPTIONAL<Control__field__U>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const Control__field__U&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.Control_field_U from an unbound optional field.");
}
}

Control__field__U_template::Control__field__U_template(Control__field__U_template* p_precondition, Control__field__U_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

Control__field__U_template::Control__field__U_template(Dynamic_Match_Interface<Control__field__U>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<Control__field__U>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

Control__field__U_template::Control__field__U_template(const Control__field__U_template& other_value)
: Base_Template()
{
copy_template(other_value);
}

Control__field__U_template::~Control__field__U_template()
{
clean_up();
}

Control__field__U_template& Control__field__U_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

Control__field__U_template& Control__field__U_template::operator=(const Control__field__U& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

Control__field__U_template& Control__field__U_template::operator=(const OPTIONAL<Control__field__U>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const Control__field__U&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.Control_field_U.");
}
return *this;
}

Control__field__U_template& Control__field__U_template::operator=(const Control__field__U_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean Control__field__U_template::match(const Control__field__U& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.mBits().is_bound()) return FALSE;
if(!single_value->field_mBits.match(other_value.mBits(), legacy))return FALSE;
if(!other_value.pF().is_bound()) return FALSE;
if(!single_value->field_pF.match(other_value.pF(), legacy))return FALSE;
if(!other_value.format().is_bound()) return FALSE;
if(!single_value->field_format.match(other_value.format(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @LLC_Types.Control_field_U.");
}
return FALSE;
}

boolean Control__field__U_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_mBits.is_bound()
 || single_value->field_pF.is_bound()
 || single_value->field_format.is_bound();
}

boolean Control__field__U_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_mBits.is_value()
 && single_value->field_pF.is_value()
 && single_value->field_format.is_value();
}

void Control__field__U_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

Control__field__U Control__field__U_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.Control_field_U.");
Control__field__U ret_val;
if (single_value->field_mBits.is_bound()) {
ret_val.mBits() = single_value->field_mBits.valueof();
}
if (single_value->field_pF.is_bound()) {
ret_val.pF() = single_value->field_pF.valueof();
}
if (single_value->field_format.is_bound()) {
ret_val.format() = single_value->field_format.valueof();
}
return ret_val;
}

void Control__field__U_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH)
TTCN_error("Setting an invalid list for a template of type @LLC_Types.Control_field_U.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Control__field__U_template[list_length];
}

Control__field__U_template& Control__field__U_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH)
TTCN_error("Accessing a list element of a non-list template of type @LLC_Types.Control_field_U.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LLC_Types.Control_field_U.");
return value_list.list_value[list_index];
}

BITSTRING_template& Control__field__U_template::mBits()
{
set_specific();
return single_value->field_mBits;
}

const BITSTRING_template& Control__field__U_template::mBits() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mBits of a non-specific template of type @LLC_Types.Control_field_U.");
return single_value->field_mBits;
}

BITSTRING_template& Control__field__U_template::pF()
{
set_specific();
return single_value->field_pF;
}

const BITSTRING_template& Control__field__U_template::pF() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pF of a non-specific template of type @LLC_Types.Control_field_U.");
return single_value->field_pF;
}

BITSTRING_template& Control__field__U_template::format()
{
set_specific();
return single_value->field_format;
}

const BITSTRING_template& Control__field__U_template::format() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field format of a non-specific template of type @LLC_Types.Control_field_U.");
return single_value->field_format;
}

int Control__field__U_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Control_field_U which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 3;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LLC_Types.Control_field_U containing an empty list.");
      int item_size = value_list.list_value[0].size_of();
      for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++)
      {
        if (value_list.list_value[l_idx].size_of()!=item_size)
          TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Control_field_U containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Control_field_U containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Control_field_U containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Control_field_U containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Control_field_U containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Control_field_U containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Control_field_U containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LLC_Types.Control_field_U.");
  }
  return 0;
}

void Control__field__U_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ mBits := ");
single_value->field_mBits.log();
TTCN_Logger::log_event_str(", pF := ");
single_value->field_pF.log();
TTCN_Logger::log_event_str(", format := ");
single_value->field_format.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void Control__field__U_template::log_match(const Control__field__U& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_mBits.match(match_value.mBits(), legacy)){
TTCN_Logger::log_logmatch_info(".mBits");
single_value->field_mBits.log_match(match_value.mBits(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pF.match(match_value.pF(), legacy)){
TTCN_Logger::log_logmatch_info(".pF");
single_value->field_pF.log_match(match_value.pF(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_format.match(match_value.format(), legacy)){
TTCN_Logger::log_logmatch_info(".format");
single_value->field_format.log_match(match_value.format(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ mBits := ");
single_value->field_mBits.log_match(match_value.mBits(), legacy);
TTCN_Logger::log_event_str(", pF := ");
single_value->field_pF.log_match(match_value.pF(), legacy);
TTCN_Logger::log_event_str(", format := ");
single_value->field_format.log_match(match_value.format(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void Control__field__U_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (mBits().is_bound()) mBits().set_implicit_omit();
if (pF().is_bound()) pF().set_implicit_omit();
if (format().is_bound()) format().set_implicit_omit();
}

void Control__field__U_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_mBits.encode_text(text_buf);
single_value->field_pF.encode_text(text_buf);
single_value->field_format.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.Control_field_U.");
}
}

void Control__field__U_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_mBits.decode_text(text_buf);
single_value->field_pF.decode_text(text_buf);
single_value->field_format.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new Control__field__U_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @LLC_Types.Control_field_U.");
}
}

void Control__field__U_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    Control__field__U_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (3<param.get_size()) {
      param.error("record template of type @LLC_Types.Control_field_U has 3 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) mBits().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) pF().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) format().set_param(*param.get_elem(2));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mBits")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mBits().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pF")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pF().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "format")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          format().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.Control_field_U: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Control__field__U_template* precondition = new Control__field__U_template;
    precondition->set_param(*param.get_elem(0));
    Control__field__U_template* implied_template = new Control__field__U_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Control__field__U_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LLC_Types.Control_field_U");
  }
  is_ifpresent = param.get_ifpresent();
}

void Control__field__U_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_mBits.check_restriction(t_res, t_name ? t_name : "@LLC_Types.Control_field_U");
single_value->field_pF.check_restriction(t_res, t_name ? t_name : "@LLC_Types.Control_field_U");
single_value->field_format.check_restriction(t_res, t_name ? t_name : "@LLC_Types.Control_field_U");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.Control_field_U");
}

boolean Control__field__U_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean Control__field__U_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

RejectedFrameControlField__U::RejectedFrameControlField__U()
{
}

RejectedFrameControlField__U::RejectedFrameControlField__U(const Control__field__U& par_control__field,
    const OCTETSTRING& par_spare)
  :   field_control__field(par_control__field),
  field_spare(par_spare)
{
}

RejectedFrameControlField__U::RejectedFrameControlField__U(const RejectedFrameControlField__U& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.RejectedFrameControlField_U.");
if (other_value.control__field().is_bound()) field_control__field = other_value.control__field();
else field_control__field.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
}

void RejectedFrameControlField__U::clean_up()
{
field_control__field.clean_up();
field_spare.clean_up();
}

const TTCN_Typedescriptor_t* RejectedFrameControlField__U::get_descriptor() const { return &RejectedFrameControlField__U_descr_; }
RejectedFrameControlField__U& RejectedFrameControlField__U::operator=(const RejectedFrameControlField__U& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LLC_Types.RejectedFrameControlField_U.");
  if (other_value.control__field().is_bound()) field_control__field = other_value.control__field();
  else field_control__field.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
}
return *this;
}

boolean RejectedFrameControlField__U::operator==(const RejectedFrameControlField__U& other_value) const
{
return field_control__field==other_value.field_control__field
  && field_spare==other_value.field_spare;
}

boolean RejectedFrameControlField__U::is_bound() const
{
return (field_control__field.is_bound())
  || (field_spare.is_bound());
}
boolean RejectedFrameControlField__U::is_value() const
{
return field_control__field.is_value()
  && field_spare.is_value();
}
void RejectedFrameControlField__U::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ control_field := ");
field_control__field.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(" }");
}

void RejectedFrameControlField__U::set_implicit_omit()
{
if (control__field().is_bound()) control__field().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void RejectedFrameControlField__U::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record value of type @LLC_Types.RejectedFrameControlField_U has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) control__field().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "control_field")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          control__field().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.RejectedFrameControlField_U: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LLC_Types.RejectedFrameControlField_U");
  }
}

void RejectedFrameControlField__U::encode_text(Text_Buf& text_buf) const
{
field_control__field.encode_text(text_buf);
field_spare.encode_text(text_buf);
}

void RejectedFrameControlField__U::decode_text(Text_Buf& text_buf)
{
field_control__field.decode_text(text_buf);
field_spare.decode_text(text_buf);
}

void RejectedFrameControlField__U::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void RejectedFrameControlField__U::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int RejectedFrameControlField__U::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, Control__field__U_descr_.raw->forceomit);
  decoded_field_length = field_control__field.RAW_decode(Control__field__U_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::OCT5_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(General__Types::OCT5_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int RejectedFrameControlField__U::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 2;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(2);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, Control__field__U_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::OCT5_descr_.raw);
  encoded_length += field_control__field.RAW_encode(Control__field__U_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_spare.RAW_encode(General__Types::OCT5_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct RejectedFrameControlField__U_template::single_value_struct {
Control__field__U_template field_control__field;
OCTETSTRING_template field_spare;
};

void RejectedFrameControlField__U_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_control__field = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
}
}
}

void RejectedFrameControlField__U_template::copy_value(const RejectedFrameControlField__U& other_value)
{
single_value = new single_value_struct;
if (other_value.control__field().is_bound()) {
  single_value->field_control__field = other_value.control__field();
} else {
  single_value->field_control__field.clean_up();
}
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RejectedFrameControlField__U_template::copy_template(const RejectedFrameControlField__U_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.control__field().get_selection()) {
single_value->field_control__field = other_value.control__field();
} else {
single_value->field_control__field.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new RejectedFrameControlField__U_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new RejectedFrameControlField__U_template(*other_value.implication_.precondition);
implication_.implied_template = new RejectedFrameControlField__U_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.RejectedFrameControlField_U.");
break;
}
set_selection(other_value);
}

RejectedFrameControlField__U_template::RejectedFrameControlField__U_template()
{
}

RejectedFrameControlField__U_template::RejectedFrameControlField__U_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

RejectedFrameControlField__U_template::RejectedFrameControlField__U_template(const RejectedFrameControlField__U& other_value)
{
copy_value(other_value);
}

RejectedFrameControlField__U_template::RejectedFrameControlField__U_template(const OPTIONAL<RejectedFrameControlField__U>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const RejectedFrameControlField__U&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.RejectedFrameControlField_U from an unbound optional field.");
}
}

RejectedFrameControlField__U_template::RejectedFrameControlField__U_template(RejectedFrameControlField__U_template* p_precondition, RejectedFrameControlField__U_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

RejectedFrameControlField__U_template::RejectedFrameControlField__U_template(Dynamic_Match_Interface<RejectedFrameControlField__U>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<RejectedFrameControlField__U>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

RejectedFrameControlField__U_template::RejectedFrameControlField__U_template(const RejectedFrameControlField__U_template& other_value)
: Base_Template()
{
copy_template(other_value);
}

RejectedFrameControlField__U_template::~RejectedFrameControlField__U_template()
{
clean_up();
}

RejectedFrameControlField__U_template& RejectedFrameControlField__U_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

RejectedFrameControlField__U_template& RejectedFrameControlField__U_template::operator=(const RejectedFrameControlField__U& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

RejectedFrameControlField__U_template& RejectedFrameControlField__U_template::operator=(const OPTIONAL<RejectedFrameControlField__U>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const RejectedFrameControlField__U&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.RejectedFrameControlField_U.");
}
return *this;
}

RejectedFrameControlField__U_template& RejectedFrameControlField__U_template::operator=(const RejectedFrameControlField__U_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean RejectedFrameControlField__U_template::match(const RejectedFrameControlField__U& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.control__field().is_bound()) return FALSE;
if(!single_value->field_control__field.match(other_value.control__field(), legacy))return FALSE;
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @LLC_Types.RejectedFrameControlField_U.");
}
return FALSE;
}

boolean RejectedFrameControlField__U_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_control__field.is_bound()
 || single_value->field_spare.is_bound();
}

boolean RejectedFrameControlField__U_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_control__field.is_value()
 && single_value->field_spare.is_value();
}

void RejectedFrameControlField__U_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

RejectedFrameControlField__U RejectedFrameControlField__U_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.RejectedFrameControlField_U.");
RejectedFrameControlField__U ret_val;
if (single_value->field_control__field.is_bound()) {
ret_val.control__field() = single_value->field_control__field.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
return ret_val;
}

void RejectedFrameControlField__U_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH)
TTCN_error("Setting an invalid list for a template of type @LLC_Types.RejectedFrameControlField_U.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RejectedFrameControlField__U_template[list_length];
}

RejectedFrameControlField__U_template& RejectedFrameControlField__U_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH)
TTCN_error("Accessing a list element of a non-list template of type @LLC_Types.RejectedFrameControlField_U.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LLC_Types.RejectedFrameControlField_U.");
return value_list.list_value[list_index];
}

Control__field__U_template& RejectedFrameControlField__U_template::control__field()
{
set_specific();
return single_value->field_control__field;
}

const Control__field__U_template& RejectedFrameControlField__U_template::control__field() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field control_field of a non-specific template of type @LLC_Types.RejectedFrameControlField_U.");
return single_value->field_control__field;
}

OCTETSTRING_template& RejectedFrameControlField__U_template::spare()
{
set_specific();
return single_value->field_spare;
}

const OCTETSTRING_template& RejectedFrameControlField__U_template::spare() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare of a non-specific template of type @LLC_Types.RejectedFrameControlField_U.");
return single_value->field_spare;
}

int RejectedFrameControlField__U_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.RejectedFrameControlField_U which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 2;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LLC_Types.RejectedFrameControlField_U containing an empty list.");
      int item_size = value_list.list_value[0].size_of();
      for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++)
      {
        if (value_list.list_value[l_idx].size_of()!=item_size)
          TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.RejectedFrameControlField_U containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.RejectedFrameControlField_U containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.RejectedFrameControlField_U containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.RejectedFrameControlField_U containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.RejectedFrameControlField_U containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.RejectedFrameControlField_U containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.RejectedFrameControlField_U containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LLC_Types.RejectedFrameControlField_U.");
  }
  return 0;
}

void RejectedFrameControlField__U_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ control_field := ");
single_value->field_control__field.log();
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void RejectedFrameControlField__U_template::log_match(const RejectedFrameControlField__U& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_control__field.match(match_value.control__field(), legacy)){
TTCN_Logger::log_logmatch_info(".control_field");
single_value->field_control__field.log_match(match_value.control__field(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ control_field := ");
single_value->field_control__field.log_match(match_value.control__field(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void RejectedFrameControlField__U_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (control__field().is_bound()) control__field().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void RejectedFrameControlField__U_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_control__field.encode_text(text_buf);
single_value->field_spare.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.RejectedFrameControlField_U.");
}
}

void RejectedFrameControlField__U_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_control__field.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new RejectedFrameControlField__U_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @LLC_Types.RejectedFrameControlField_U.");
}
}

void RejectedFrameControlField__U_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    RejectedFrameControlField__U_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @LLC_Types.RejectedFrameControlField_U has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) control__field().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "control_field")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          control__field().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.RejectedFrameControlField_U: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    RejectedFrameControlField__U_template* precondition = new RejectedFrameControlField__U_template;
    precondition->set_param(*param.get_elem(0));
    RejectedFrameControlField__U_template* implied_template = new RejectedFrameControlField__U_template;
    implied_template->set_param(*param.get_elem(1));
    *this = RejectedFrameControlField__U_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LLC_Types.RejectedFrameControlField_U");
  }
  is_ifpresent = param.get_ifpresent();
}

void RejectedFrameControlField__U_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_control__field.check_restriction(t_res, t_name ? t_name : "@LLC_Types.RejectedFrameControlField_U");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@LLC_Types.RejectedFrameControlField_U");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.RejectedFrameControlField_U");
}

boolean RejectedFrameControlField__U_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean RejectedFrameControlField__U_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

void RejectedFrameControlField::copy_value(const RejectedFrameControlField& other_value)
{
switch (other_value.union_selection) {
case ALT_rejectedFrameControlField__UI:
field_rejectedFrameControlField__UI = new RejectedFrameControlField__UI(*other_value.field_rejectedFrameControlField__UI);
break;
case ALT_rejectedFrameControlField__U:
field_rejectedFrameControlField__U = new RejectedFrameControlField__U(*other_value.field_rejectedFrameControlField__U);
break;
default:
TTCN_error("Assignment of an unbound union value of type @LLC_Types.RejectedFrameControlField.");
}
union_selection = other_value.union_selection;
}

RejectedFrameControlField::RejectedFrameControlField()
{
union_selection = UNBOUND_VALUE;
}

RejectedFrameControlField::RejectedFrameControlField(const RejectedFrameControlField& other_value)
: Base_Type(){
copy_value(other_value);
}

RejectedFrameControlField::~RejectedFrameControlField()
{
clean_up();
}

RejectedFrameControlField& RejectedFrameControlField::operator=(const RejectedFrameControlField& other_value)
{
if (this != &other_value) {
clean_up();
copy_value(other_value);
}
return *this;
}

boolean RejectedFrameControlField::operator==(const RejectedFrameControlField& other_value) const
{
if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @LLC_Types.RejectedFrameControlField.");
if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @LLC_Types.RejectedFrameControlField.");
if (union_selection != other_value.union_selection) return FALSE;
switch (union_selection) {
case ALT_rejectedFrameControlField__UI:
return *field_rejectedFrameControlField__UI == *other_value.field_rejectedFrameControlField__UI;
case ALT_rejectedFrameControlField__U:
return *field_rejectedFrameControlField__U == *other_value.field_rejectedFrameControlField__U;
default:
return FALSE;
}
}

RejectedFrameControlField__UI& RejectedFrameControlField::rejectedFrameControlField__UI()
{
if (union_selection != ALT_rejectedFrameControlField__UI) {
clean_up();
field_rejectedFrameControlField__UI = new RejectedFrameControlField__UI;
union_selection = ALT_rejectedFrameControlField__UI;
}
return *field_rejectedFrameControlField__UI;
}

const RejectedFrameControlField__UI& RejectedFrameControlField::rejectedFrameControlField__UI() const
{
if (union_selection != ALT_rejectedFrameControlField__UI) TTCN_error("Using non-selected field rejectedFrameControlField_UI in a value of union type @LLC_Types.RejectedFrameControlField.");
return *field_rejectedFrameControlField__UI;
}

RejectedFrameControlField__U& RejectedFrameControlField::rejectedFrameControlField__U()
{
if (union_selection != ALT_rejectedFrameControlField__U) {
clean_up();
field_rejectedFrameControlField__U = new RejectedFrameControlField__U;
union_selection = ALT_rejectedFrameControlField__U;
}
return *field_rejectedFrameControlField__U;
}

const RejectedFrameControlField__U& RejectedFrameControlField::rejectedFrameControlField__U() const
{
if (union_selection != ALT_rejectedFrameControlField__U) TTCN_error("Using non-selected field rejectedFrameControlField_U in a value of union type @LLC_Types.RejectedFrameControlField.");
return *field_rejectedFrameControlField__U;
}

boolean RejectedFrameControlField::ischosen(union_selection_type checked_selection) const
{
if (checked_selection == UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @LLC_Types.RejectedFrameControlField.");
return union_selection == checked_selection;
}

boolean RejectedFrameControlField::is_bound() const
{
  return union_selection != UNBOUND_VALUE;
}

boolean RejectedFrameControlField::is_value() const
{
switch (union_selection) {
case UNBOUND_VALUE: return FALSE;
case ALT_rejectedFrameControlField__UI: return field_rejectedFrameControlField__UI->is_value();
case ALT_rejectedFrameControlField__U: return field_rejectedFrameControlField__U->is_value();
default: TTCN_error("Invalid selection in union is_bound");}
}

void RejectedFrameControlField::clean_up()
{
switch (union_selection) {
case ALT_rejectedFrameControlField__UI:
  delete field_rejectedFrameControlField__UI;
  break;
case ALT_rejectedFrameControlField__U:
  delete field_rejectedFrameControlField__U;
  break;
default:
  break;
}
union_selection = UNBOUND_VALUE;
}

void RejectedFrameControlField::log() const
{
switch (union_selection) {
case ALT_rejectedFrameControlField__UI:
TTCN_Logger::log_event_str("{ rejectedFrameControlField_UI := ");
field_rejectedFrameControlField__UI->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_rejectedFrameControlField__U:
TTCN_Logger::log_event_str("{ rejectedFrameControlField_U := ");
field_rejectedFrameControlField__U->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_unbound();
}
}

void RejectedFrameControlField::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "union value");
  Module_Param_Ptr m_p = &param;
  if (m_p->get_type()==Module_Param::MP_Value_List && m_p->get_size()==0) return;
  if (m_p->get_type()!=Module_Param::MP_Assignment_List) {
    param.error("union value with field name was expected");
  }
  Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1);
  char* last_name = mp_last->get_id()->get_name();
  if (!strcmp(last_name, "rejectedFrameControlField_UI")) {
    rejectedFrameControlField__UI().set_param(*mp_last);
    if (!rejectedFrameControlField__UI().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "rejectedFrameControlField_U")) {
    rejectedFrameControlField__U().set_param(*mp_last);
    if (!rejectedFrameControlField__U().is_bound()) clean_up();
    return;
  }
  mp_last->error("Field %s does not exist in type @LLC_Types.RejectedFrameControlField.", last_name);
}

void RejectedFrameControlField::set_implicit_omit()
{
switch (union_selection) {
case ALT_rejectedFrameControlField__UI:
field_rejectedFrameControlField__UI->set_implicit_omit(); break;
case ALT_rejectedFrameControlField__U:
field_rejectedFrameControlField__U->set_implicit_omit(); break;
default: break;
}
}

void RejectedFrameControlField::encode_text(Text_Buf& text_buf) const
{
text_buf.push_int(union_selection);
switch (union_selection) {
case ALT_rejectedFrameControlField__UI:
field_rejectedFrameControlField__UI->encode_text(text_buf);
break;
case ALT_rejectedFrameControlField__U:
field_rejectedFrameControlField__U->encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an unbound value of union type @LLC_Types.RejectedFrameControlField.");
}
}

void RejectedFrameControlField::decode_text(Text_Buf& text_buf)
{
switch ((union_selection_type)text_buf.pull_int().get_val()) {
case ALT_rejectedFrameControlField__UI:
rejectedFrameControlField__UI().decode_text(text_buf);
break;
case ALT_rejectedFrameControlField__U:
rejectedFrameControlField__U().decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for type @LLC_Types.RejectedFrameControlField.");
}
}

void RejectedFrameControlField::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void RejectedFrameControlField::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int RejectedFrameControlField::RAW_decode(
const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, 
raw_order_t top_bit_ord, boolean no_err, int sel_field, boolean, const RAW_Force_Omit* force_omit)
{
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  int decoded_length=0;
  int starting_pos=p_buf.get_pos_bit();
  if(sel_field!=-1){
    switch(sel_field){
    case 0: {
      RAW_Force_Omit field_force_omit(0, force_omit, RejectedFrameControlField__UI_descr_.raw->forceomit);
      decoded_length = rejectedFrameControlField__UI().RAW_decode(RejectedFrameControlField__UI_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 1: {
      RAW_Force_Omit field_force_omit(1, force_omit, RejectedFrameControlField__U_descr_.raw->forceomit);
      decoded_length = rejectedFrameControlField__U().RAW_decode(RejectedFrameControlField__U_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    default: break;
    }
    return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
  } else {
    boolean already_failed = FALSE;
    already_failed = FALSE;
    if (!already_failed) {
      BITSTRING temporal_0;
      int decoded_0_length;
      p_buf.set_pos_bit(starting_pos + 0);
      decoded_0_length = temporal_0.RAW_decode(Control__field__UI_format_descr_, p_buf, limit, top_bit_ord, TRUE);
      if (decoded_0_length > 0) {
        if (temporal_0 ==  bs_15) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(0, force_omit, RejectedFrameControlField__UI_descr_.raw->forceomit);
          decoded_length = rejectedFrameControlField__UI().RAW_decode(RejectedFrameControlField__UI_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_rejectedFrameControlField__UI).control__field().format() ==  bs_15) {
               return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
             }else already_failed = TRUE;
          }
        }
      }
    }
    already_failed = FALSE;
    if (!already_failed) {
      BITSTRING temporal_1;
      int decoded_1_length;
      p_buf.set_pos_bit(starting_pos + 5);
      decoded_1_length = temporal_1.RAW_decode(General__Types::BIT3_descr_, p_buf, limit, top_bit_ord, TRUE);
      if (decoded_1_length > 0) {
        if (temporal_1 ==  bs_16) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(1, force_omit, RejectedFrameControlField__U_descr_.raw->forceomit);
          decoded_length = rejectedFrameControlField__U().RAW_decode(RejectedFrameControlField__U_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_rejectedFrameControlField__U).control__field().format() ==  bs_16) {
               return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
             }else already_failed = TRUE;
          }
        }
      }
    }
 }
 clean_up();
 return -1;
}

int RejectedFrameControlField::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const
{
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 2;  myleaf.body.node.nodes = init_nodes_of_enc_tree(2);
  memset(myleaf.body.node.nodes, 0, 2 * sizeof(RAW_enc_tree *));
  switch (union_selection) {
  case ALT_rejectedFrameControlField__UI:
    myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, RejectedFrameControlField__UI_descr_.raw);
    encoded_length = field_rejectedFrameControlField__UI->RAW_encode(RejectedFrameControlField__UI_descr_, *myleaf.body.node.nodes[0]);
    myleaf.body.node.nodes[0]->coding_descr = &RejectedFrameControlField__UI_descr_;
    if ((*field_rejectedFrameControlField__UI).control__field().format() !=  bs_15) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+3;
  int new_pos0[]={0,0,0};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,3,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
   bs_15.RAW_encode(Control__field__UI_format_descr_,*temp_leaf);
  } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  }
  free_tree_pos(pr_pos0.pos);
  }
    }
    break;
  case ALT_rejectedFrameControlField__U:
    myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, RejectedFrameControlField__U_descr_.raw);
    encoded_length = field_rejectedFrameControlField__U->RAW_encode(RejectedFrameControlField__U_descr_, *myleaf.body.node.nodes[1]);
    myleaf.body.node.nodes[1]->coding_descr = &RejectedFrameControlField__U_descr_;
    if ((*field_rejectedFrameControlField__U).control__field().format() !=  bs_16) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+3;
  int new_pos0[]={1,0,2};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,3,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
   bs_16.RAW_encode(General__Types::BIT3_descr_,*temp_leaf);
  } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  }
  free_tree_pos(pr_pos0.pos);
  }
    }
    break;
  default:
    TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  }
  return encoded_length;
}

void RejectedFrameControlField_template::copy_value(const RejectedFrameControlField& other_value)
{
single_value.union_selection = other_value.get_selection();
switch (single_value.union_selection) {
case RejectedFrameControlField::ALT_rejectedFrameControlField__UI:
single_value.field_rejectedFrameControlField__UI = new RejectedFrameControlField__UI_template(other_value.rejectedFrameControlField__UI());
break;
case RejectedFrameControlField::ALT_rejectedFrameControlField__U:
single_value.field_rejectedFrameControlField__U = new RejectedFrameControlField__U_template(other_value.rejectedFrameControlField__U());
break;
default:
TTCN_error("Initializing a template with an unbound value of type @LLC_Types.RejectedFrameControlField.");
}
set_selection(SPECIFIC_VALUE);
}

void RejectedFrameControlField_template::copy_template(const RejectedFrameControlField_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value.union_selection = other_value.single_value.union_selection;
switch (single_value.union_selection) {
case RejectedFrameControlField::ALT_rejectedFrameControlField__UI:
single_value.field_rejectedFrameControlField__UI = new RejectedFrameControlField__UI_template(*other_value.single_value.field_rejectedFrameControlField__UI);
break;
case RejectedFrameControlField::ALT_rejectedFrameControlField__U:
single_value.field_rejectedFrameControlField__U = new RejectedFrameControlField__U_template(*other_value.single_value.field_rejectedFrameControlField__U);
break;
default:
TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @LLC_Types.RejectedFrameControlField.");
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new RejectedFrameControlField_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new RejectedFrameControlField_template(*other_value.implication_.precondition);
implication_.implied_template = new RejectedFrameControlField_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized template of union type @LLC_Types.RejectedFrameControlField.");
}
set_selection(other_value);
}

RejectedFrameControlField_template::RejectedFrameControlField_template()
{
}

RejectedFrameControlField_template::RejectedFrameControlField_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

RejectedFrameControlField_template::RejectedFrameControlField_template(const RejectedFrameControlField& other_value)
{
copy_value(other_value);
}

RejectedFrameControlField_template::RejectedFrameControlField_template(const OPTIONAL<RejectedFrameControlField>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const RejectedFrameControlField&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of union type @LLC_Types.RejectedFrameControlField from an unbound optional field.");
}
}

RejectedFrameControlField_template::RejectedFrameControlField_template(RejectedFrameControlField_template* p_precondition, RejectedFrameControlField_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

RejectedFrameControlField_template::RejectedFrameControlField_template(Dynamic_Match_Interface<RejectedFrameControlField>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<RejectedFrameControlField>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

RejectedFrameControlField_template::RejectedFrameControlField_template(const RejectedFrameControlField_template& other_value)
: Base_Template(){
copy_template(other_value);
}

RejectedFrameControlField_template::~RejectedFrameControlField_template()
{
clean_up();
}

void RejectedFrameControlField_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case RejectedFrameControlField::ALT_rejectedFrameControlField__UI:
delete single_value.field_rejectedFrameControlField__UI;
break;
case RejectedFrameControlField::ALT_rejectedFrameControlField__U:
delete single_value.field_rejectedFrameControlField__U;
default:
break;
}
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

RejectedFrameControlField_template& RejectedFrameControlField_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

RejectedFrameControlField_template& RejectedFrameControlField_template::operator=(const RejectedFrameControlField& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

RejectedFrameControlField_template& RejectedFrameControlField_template::operator=(const OPTIONAL<RejectedFrameControlField>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const RejectedFrameControlField&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of union type @LLC_Types.RejectedFrameControlField.");
}
return *this;
}

RejectedFrameControlField_template& RejectedFrameControlField_template::operator=(const RejectedFrameControlField_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean RejectedFrameControlField_template::match(const RejectedFrameControlField& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
{
RejectedFrameControlField::union_selection_type value_selection = other_value.get_selection();
if (value_selection == RejectedFrameControlField::UNBOUND_VALUE) return FALSE;
if (value_selection != single_value.union_selection) return FALSE;
switch (value_selection) {
case RejectedFrameControlField::ALT_rejectedFrameControlField__UI:
return single_value.field_rejectedFrameControlField__UI->match(other_value.rejectedFrameControlField__UI(), legacy);
case RejectedFrameControlField::ALT_rejectedFrameControlField__U:
return single_value.field_rejectedFrameControlField__U->match(other_value.rejectedFrameControlField__U(), legacy);
default:
TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @LLC_Types.RejectedFrameControlField.");
}
}
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error ("Matching an uninitialized template of union type @LLC_Types.RejectedFrameControlField.");
}
return FALSE;
}

boolean RejectedFrameControlField_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
switch (single_value.union_selection) {
case RejectedFrameControlField::ALT_rejectedFrameControlField__UI:
return single_value.field_rejectedFrameControlField__UI->is_value();
case RejectedFrameControlField::ALT_rejectedFrameControlField__U:
return single_value.field_rejectedFrameControlField__U->is_value();
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @LLC_Types.RejectedFrameControlField.");
}
}

RejectedFrameControlField RejectedFrameControlField_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of union type @LLC_Types.RejectedFrameControlField.");
RejectedFrameControlField ret_val;
switch (single_value.union_selection) {
case RejectedFrameControlField::ALT_rejectedFrameControlField__UI:
ret_val.rejectedFrameControlField__UI() = single_value.field_rejectedFrameControlField__UI->valueof();
break;
case RejectedFrameControlField::ALT_rejectedFrameControlField__U:
ret_val.rejectedFrameControlField__U() = single_value.field_rejectedFrameControlField__U->valueof();
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @LLC_Types.RejectedFrameControlField.");
}
return ret_val;
}

RejectedFrameControlField_template& RejectedFrameControlField_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Internal error: Accessing a list element of a non-list template of union type @LLC_Types.RejectedFrameControlField.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @LLC_Types.RejectedFrameControlField.");
return value_list.list_value[list_index];
}
void RejectedFrameControlField_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error ("Internal error: Setting an invalid list for a template of union type @LLC_Types.RejectedFrameControlField.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RejectedFrameControlField_template[list_length];
}

RejectedFrameControlField__UI_template& RejectedFrameControlField_template::rejectedFrameControlField__UI()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RejectedFrameControlField::ALT_rejectedFrameControlField__UI) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_rejectedFrameControlField__UI = new RejectedFrameControlField__UI_template(ANY_VALUE);
else single_value.field_rejectedFrameControlField__UI = new RejectedFrameControlField__UI_template;
single_value.union_selection = RejectedFrameControlField::ALT_rejectedFrameControlField__UI;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_rejectedFrameControlField__UI;
}

const RejectedFrameControlField__UI_template& RejectedFrameControlField_template::rejectedFrameControlField__UI() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rejectedFrameControlField_UI in a non-specific template of union type @LLC_Types.RejectedFrameControlField.");
if (single_value.union_selection != RejectedFrameControlField::ALT_rejectedFrameControlField__UI) TTCN_error("Accessing non-selected field rejectedFrameControlField_UI in a template of union type @LLC_Types.RejectedFrameControlField.");
return *single_value.field_rejectedFrameControlField__UI;
}

RejectedFrameControlField__U_template& RejectedFrameControlField_template::rejectedFrameControlField__U()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RejectedFrameControlField::ALT_rejectedFrameControlField__U) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_rejectedFrameControlField__U = new RejectedFrameControlField__U_template(ANY_VALUE);
else single_value.field_rejectedFrameControlField__U = new RejectedFrameControlField__U_template;
single_value.union_selection = RejectedFrameControlField::ALT_rejectedFrameControlField__U;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_rejectedFrameControlField__U;
}

const RejectedFrameControlField__U_template& RejectedFrameControlField_template::rejectedFrameControlField__U() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rejectedFrameControlField_U in a non-specific template of union type @LLC_Types.RejectedFrameControlField.");
if (single_value.union_selection != RejectedFrameControlField::ALT_rejectedFrameControlField__U) TTCN_error("Accessing non-selected field rejectedFrameControlField_U in a template of union type @LLC_Types.RejectedFrameControlField.");
return *single_value.field_rejectedFrameControlField__U;
}

boolean RejectedFrameControlField_template::ischosen(RejectedFrameControlField::union_selection_type checked_selection) const
{
if (checked_selection == RejectedFrameControlField::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @LLC_Types.RejectedFrameControlField.");
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.union_selection == RejectedFrameControlField::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @LLC_Types.RejectedFrameControlField.");
return single_value.union_selection == checked_selection;
case VALUE_LIST:
{
if (value_list.n_values < 1)
TTCN_error("Internal error: Performing ischosen() operation on a template of union type @LLC_Types.RejectedFrameControlField containing an empty list.");
boolean ret_val = value_list.list_value[0].ischosen(checked_selection);
for (unsigned int list_count = 1; ret_val == TRUE && list_count < value_list.n_values; list_count++) {
ret_val = value_list.list_value[list_count].ischosen(checked_selection);
}
return ret_val;
}
default:
return FALSE;
}
return FALSE;
}

void RejectedFrameControlField_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case RejectedFrameControlField::ALT_rejectedFrameControlField__UI:
TTCN_Logger::log_event_str("{ rejectedFrameControlField_UI := ");
single_value.field_rejectedFrameControlField__UI->log();
TTCN_Logger::log_event_str(" }");
break;
case RejectedFrameControlField::ALT_rejectedFrameControlField__U:
TTCN_Logger::log_event_str("{ rejectedFrameControlField_U := ");
single_value.field_rejectedFrameControlField__U->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_str("<invalid selector>");
}
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void RejectedFrameControlField_template::log_match(const RejectedFrameControlField& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity() && match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
return;
}
if (template_selection == SPECIFIC_VALUE && single_value.union_selection == match_value.get_selection()) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
switch (single_value.union_selection) {
case RejectedFrameControlField::ALT_rejectedFrameControlField__UI:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".rejectedFrameControlField_UI");
single_value.field_rejectedFrameControlField__UI->log_match(match_value.rejectedFrameControlField__UI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ rejectedFrameControlField_UI := ");
single_value.field_rejectedFrameControlField__UI->log_match(match_value.rejectedFrameControlField__UI(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case RejectedFrameControlField::ALT_rejectedFrameControlField__U:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".rejectedFrameControlField_U");
single_value.field_rejectedFrameControlField__U->log_match(match_value.rejectedFrameControlField__U(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ rejectedFrameControlField_U := ");
single_value.field_rejectedFrameControlField__U->log_match(match_value.rejectedFrameControlField__U(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
default:
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str("<invalid selector>");
}
} else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void RejectedFrameControlField_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
switch (single_value.union_selection) {
case RejectedFrameControlField::ALT_rejectedFrameControlField__UI:
single_value.field_rejectedFrameControlField__UI->set_implicit_omit(); break;
case RejectedFrameControlField::ALT_rejectedFrameControlField__U:
single_value.field_rejectedFrameControlField__U->set_implicit_omit(); break;
default: break;
}
}

void RejectedFrameControlField_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
text_buf.push_int(single_value.union_selection);
switch (single_value.union_selection) {
case RejectedFrameControlField::ALT_rejectedFrameControlField__UI:
single_value.field_rejectedFrameControlField__UI->encode_text(text_buf);
break;
case RejectedFrameControlField::ALT_rejectedFrameControlField__U:
single_value.field_rejectedFrameControlField__U->encode_text(text_buf);
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @LLC_Types.RejectedFrameControlField.");
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized template of type @LLC_Types.RejectedFrameControlField.");
}
}

void RejectedFrameControlField_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
{
single_value.union_selection = RejectedFrameControlField::UNBOUND_VALUE;
RejectedFrameControlField::union_selection_type new_selection = (RejectedFrameControlField::union_selection_type)text_buf.pull_int().get_val();
switch (new_selection) {
case RejectedFrameControlField::ALT_rejectedFrameControlField__UI:
single_value.field_rejectedFrameControlField__UI = new RejectedFrameControlField__UI_template;
single_value.field_rejectedFrameControlField__UI->decode_text(text_buf);
break;
case RejectedFrameControlField::ALT_rejectedFrameControlField__U:
single_value.field_rejectedFrameControlField__U = new RejectedFrameControlField__U_template;
single_value.field_rejectedFrameControlField__U->decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @LLC_Types.RejectedFrameControlField.");
}
single_value.union_selection = new_selection;
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new RejectedFrameControlField_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized selector was received in a template of type @LLC_Types.RejectedFrameControlField.");
}
}

boolean RejectedFrameControlField_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean RejectedFrameControlField_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int v_idx=0; v_idx<value_list.n_values; v_idx++)
if (value_list.list_value[v_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

void RejectedFrameControlField_template::set_param(Module_Param& param)
{
  if (dynamic_cast<Module_Param_Name*>(param.get_id()) != NULL &&
      param.get_id()->next_name()) {
    char* param_field = param.get_id()->get_current_name();
    if (param_field[0] >= '0' && param_field[0] <= '9') {
      param.error("Unexpected array index in module parameter, expected a valid field"
        " name for union template type `@LLC_Types.RejectedFrameControlField'");
    }
    if (strcmp("rejectedFrameControlField_UI", param_field) == 0) {
      rejectedFrameControlField__UI().set_param(param);
      return;
    } else if (strcmp("rejectedFrameControlField_U", param_field) == 0) {
      rejectedFrameControlField__U().set_param(param);
      return;
    } else param.error("Field `%s' not found in union template type `@LLC_Types.RejectedFrameControlField'", param_field);
  }
  param.basic_check(Module_Param::BC_TEMPLATE, "union template");
  Module_Param_Ptr m_p = &param;
  switch (m_p->get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    RejectedFrameControlField_template new_temp;
    new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size());
    for (size_t p_i=0; p_i<m_p->get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (m_p->get_size()==0) break;
    param.type_error("union template", "@LLC_Types.RejectedFrameControlField");
    break;
  case Module_Param::MP_Assignment_List: {
    Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1);
    char* last_name = mp_last->get_id()->get_name();
    if (!strcmp(last_name, "rejectedFrameControlField_UI")) {
      rejectedFrameControlField__UI().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "rejectedFrameControlField_U")) {
      rejectedFrameControlField__U().set_param(*mp_last);
      break;
    }
    mp_last->error("Field %s does not exist in type @LLC_Types.RejectedFrameControlField.", last_name);
  } break;
  case Module_Param::MP_Implication_Template: {
    RejectedFrameControlField_template* precondition = new RejectedFrameControlField_template;
    precondition->set_param(*m_p->get_elem(0));
    RejectedFrameControlField_template* implied_template = new RejectedFrameControlField_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = RejectedFrameControlField_template(precondition, implied_template);
  } break;
  default:
    param.type_error("union template", "@LLC_Types.RejectedFrameControlField");
  }
  is_ifpresent = param.get_ifpresent();
}

void RejectedFrameControlField_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
switch (single_value.union_selection) {
case RejectedFrameControlField::ALT_rejectedFrameControlField__UI:
single_value.field_rejectedFrameControlField__UI->check_restriction(t_res, t_name ? t_name : "@LLC_Types.RejectedFrameControlField");
return;
case RejectedFrameControlField::ALT_rejectedFrameControlField__U:
single_value.field_rejectedFrameControlField__U->check_restriction(t_res, t_name ? t_name : "@LLC_Types.RejectedFrameControlField");
return;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @LLC_Types.RejectedFrameControlField.");
}
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.RejectedFrameControlField");
}


const XID UA__Information::UNBOUND_ELEM;
UA__Information::UA__Information()
{
val_ptr = NULL;
}

UA__Information::UA__Information(null_type)
{
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
}

UA__Information::UA__Information(const UA__Information& other_value)
{
if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.UA_Information.");
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}

UA__Information::~UA__Information()
{
clean_up();
if (val_ptr != NULL) val_ptr = NULL;
}

void UA__Information::clean_up()
{
if (val_ptr != NULL) {
if (val_ptr->ref_count > 1) {
val_ptr->ref_count--;
val_ptr = NULL;
}
else if (val_ptr->ref_count == 1) {
for (int elem_count = 0; elem_count < val_ptr->n_elements;
elem_count++)
if (val_ptr->value_elements[elem_count] != NULL)
delete val_ptr->value_elements[elem_count];
free_pointers((void**)val_ptr->value_elements);
delete val_ptr;
val_ptr = NULL;
}
else
TTCN_error("Internal error: Invalid reference counter in a record of/set of value.");
}
}

UA__Information& UA__Information::operator=(null_type)
{
clean_up();
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
return *this;
}

UA__Information& UA__Information::operator=(const UA__Information& other_value)
{
if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @LLC_Types.UA_Information.");
if (this != &other_value) {
clean_up();
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}
return *this;
}

boolean UA__Information::operator==(null_type) const
{
if (val_ptr == NULL)
TTCN_error("The left operand of comparison is an unbound value of type @LLC_Types.UA_Information.");
return val_ptr->n_elements == 0 ;
}

boolean UA__Information::operator==(const UA__Information& other_value) const
{
if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @LLC_Types.UA_Information.");
if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @LLC_Types.UA_Information.");
if (val_ptr == other_value.val_ptr) return TRUE;
if (val_ptr->n_elements != (other_value.val_ptr)->n_elements)
return FALSE;
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){
if (val_ptr->value_elements[elem_count] != NULL){
if ((other_value.val_ptr)->value_elements[elem_count] != NULL){
  if (*val_ptr->value_elements[elem_count] != *(other_value.val_ptr)->value_elements[elem_count]) return FALSE;
} else return FALSE;
} else {
if ((other_value.val_ptr)->value_elements[elem_count] != NULL) return FALSE;
}
}
return TRUE;
}

XID& UA__Information::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of type @LLC_Types.UA_Information using a negative index: %d.", index_value);
if (val_ptr == NULL) {
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
} else if (val_ptr->ref_count > 1) {
struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct;
new_val_ptr->ref_count = 1;
new_val_ptr->n_elements = (index_value >= val_ptr->n_elements) ? index_value + 1 : val_ptr->n_elements;
new_val_ptr->value_elements = (XID**)allocate_pointers(new_val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){
if (val_ptr->value_elements[elem_count] != NULL){
new_val_ptr->value_elements[elem_count] = new XID(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (index_value >= val_ptr->n_elements) set_size(index_value + 1);
if (val_ptr->value_elements[index_value] == NULL) {
val_ptr->value_elements[index_value] = new XID;
}
return *val_ptr->value_elements[index_value];
}

XID& UA__Information::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @LLC_Types.UA_Information.");
return (*this)[(int)index_value];
}

const XID& UA__Information::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @LLC_Types.UA_Information.");
if (index_value < 0) TTCN_error("Accessing an element of type @LLC_Types.UA_Information using a negative index: %d.", index_value);
if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @LLC_Types.UA_Information: The index is %d, but the value has only %d elements.", index_value, val_ptr->n_elements);
return (val_ptr->value_elements[index_value] == NULL) ?
UNBOUND_ELEM : *val_ptr->value_elements[index_value];
}

const XID& UA__Information::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @LLC_Types.UA_Information.");
return (*this)[(int)index_value];
}

UA__Information UA__Information::operator<<=(int rotate_count) const
{
return *this >>= (-rotate_count);
}

UA__Information UA__Information::operator<<=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate left operator.");
return *this >>= (int)(-rotate_count);
}

UA__Information UA__Information::operator>>=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate right operator.");
return *this >>= (int)rotate_count;
}

UA__Information UA__Information::operator>>=(int rotate_count) const
{
if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @LLC_Types.UA_Information.");
if (val_ptr->n_elements == 0) return *this;
int rc;
if (rotate_count>=0) rc = rotate_count % val_ptr->n_elements;
else rc = val_ptr->n_elements - ((-rotate_count) % val_ptr->n_elements);
if (rc == 0) return *this;
UA__Information ret_val;
ret_val.set_size(val_ptr->n_elements);
for (int i=0; i<val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[(i+rc)%val_ptr->n_elements] =new XID(*val_ptr->value_elements[i]);
}
}
return ret_val;
}

UA__Information UA__Information::operator+(const UA__Information& other_value) const
{
if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @LLC_Types.UA_Information concatenation.");
if (val_ptr->n_elements == 0) return other_value;
if (other_value.val_ptr->n_elements == 0) return *this;
UA__Information ret_val;
ret_val.set_size(val_ptr->n_elements+other_value.val_ptr->n_elements);
for (int i=0; i<val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i] = new XID(*val_ptr->value_elements[i]);
}
}
for (int i=0; i<other_value.val_ptr->n_elements; i++) {
if (other_value.val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i+val_ptr->n_elements] = new XID(*other_value.val_ptr->value_elements[i]);
}
}
return ret_val;
}

UA__Information UA__Information::substr(int index, int returncount) const
{
if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @LLC_Types.UA_Information.");
check_substr_arguments(val_ptr->n_elements, index, returncount, "@LLC_Types.UA_Information","element");
UA__Information ret_val;
ret_val.set_size(returncount);
for (int i=0; i<returncount; i++) {
if (val_ptr->value_elements[i+index] != NULL) {
ret_val.val_ptr->value_elements[i] = new XID(*val_ptr->value_elements[i+index]);
}
}
return ret_val;
}

UA__Information UA__Information::replace(int index, int len, const UA__Information& repl) const
{
if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @LLC_Types.UA_Information.");
if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @LLC_Types.UA_Information.");
check_replace_arguments(val_ptr->n_elements, index, len, "@LLC_Types.UA_Information","element");
UA__Information ret_val;
ret_val.set_size(val_ptr->n_elements + repl.val_ptr->n_elements - len);
for (int i = 0; i < index; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i] = new XID(*val_ptr->value_elements[i]);
}
}
for (int i = 0; i < repl.val_ptr->n_elements; i++) {
if (repl.val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i+index] = new XID(*repl.val_ptr->value_elements[i]);
}
}
for (int i = 0; i < val_ptr->n_elements - index - len; i++) {
if (val_ptr->value_elements[index+i+len] != NULL) {
ret_val.val_ptr->value_elements[index+i+repl.val_ptr->n_elements] = new XID(*val_ptr->value_elements[index+i+len]);
}
}
return ret_val;
}

UA__Information UA__Information::replace(int index, int len, const UA__Information_template& repl) const
{
if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value.");
return replace(index, len, repl.valueof());
}

void UA__Information::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @LLC_Types.UA_Information.");
if (val_ptr == NULL) {
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
} else if (val_ptr->ref_count > 1) {
struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct;
new_val_ptr->ref_count = 1;
new_val_ptr->n_elements = (new_size < val_ptr->n_elements) ? new_size : val_ptr->n_elements;
new_val_ptr->value_elements = (XID**)allocate_pointers(new_val_ptr->n_elements);
for (int elem_count = 0; elem_count < new_val_ptr->n_elements; elem_count++) {
if (val_ptr->value_elements[elem_count] != NULL){
new_val_ptr->value_elements[elem_count] = new XID(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (XID**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
#ifdef TITAN_MEMORY_DEBUG_SET_RECORD_OF
if((val_ptr->n_elements/1000)!=(new_size/1000)) TTCN_warning("New size of type @LLC_Types.UA_Information: %d",new_size);
#endif
val_ptr->n_elements = new_size;
} else if (new_size < val_ptr->n_elements) {
for (int elem_count = new_size; elem_count < val_ptr->n_elements; elem_count++)
if (val_ptr->value_elements[elem_count] != NULL)delete val_ptr->value_elements[elem_count];
val_ptr->value_elements = (XID**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}

boolean UA__Information::is_value() const
{
if (val_ptr == NULL) return FALSE;
for(int i = 0; i < val_ptr->n_elements; ++i) {
if (val_ptr->value_elements[i] == NULL || !val_ptr->value_elements[i]->is_value()) return FALSE;
}
return TRUE;
}

int UA__Information::size_of() const
{
if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @LLC_Types.UA_Information.");
return val_ptr->n_elements;
}

int UA__Information::lengthof() const
{
if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @LLC_Types.UA_Information.");
for (int my_length=val_ptr->n_elements; my_length>0; my_length--) if (val_ptr->value_elements[my_length-1] != NULL) return my_length;
return 0;
}

void UA__Information::log() const
{
if (val_ptr == NULL) {;
TTCN_Logger::log_event_unbound();
return;
}
switch (val_ptr->n_elements) {
case 0:
TTCN_Logger::log_event_str("{ }");
break;
default:
TTCN_Logger::log_event_str("{ ");
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
(*this)[elem_count].log();
}
TTCN_Logger::log_event_str(" }");
}
}

void UA__Information::set_implicit_omit()
{
if (val_ptr == NULL) return;
for (int i = 0; i < val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) val_ptr->value_elements[i]->set_implicit_omit();
}
}

void UA__Information::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE|Module_Param::BC_LIST, "record of value");
  switch (param.get_operation_type()) {
  case Module_Param::OT_ASSIGN:
    if (param.get_type()==Module_Param::MP_Value_List && param.get_size()==0) {
      *this = NULL_VALUE;
      return;
    }
    switch (param.get_type()) {
    case Module_Param::MP_Value_List:
      set_size(param.get_size());
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        if (curr->get_type()!=Module_Param::MP_NotUsed) {
          (*this)[i].set_param(*curr);
          if (!(*this)[i].is_bound()) {
            delete val_ptr->value_elements[i];
            val_ptr->value_elements[i] = NULL;
          }
        }
      }
      break;
    case Module_Param::MP_Indexed_List:
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        (*this)[curr->get_id()->get_index()].set_param(*curr);
        if (!(*this)[curr->get_id()->get_index()].is_bound()) {
          delete val_ptr->value_elements[curr->get_id()->get_index()];
          val_ptr->value_elements[curr->get_id()->get_index()] = NULL;
        }
      }
      break;
    default:
      param.type_error("record of value", "@LLC_Types.UA_Information");
    }
    break;
  case Module_Param::OT_CONCAT:
    switch (param.get_type()) {
    case Module_Param::MP_Value_List: {
      if (!is_bound()) *this = NULL_VALUE;
      int start_idx = lengthof();
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        if ((curr->get_type()!=Module_Param::MP_NotUsed)) {
          (*this)[start_idx+(int)i].set_param(*curr);
        }
      }
    } break;
    case Module_Param::MP_Indexed_List:
      param.error("Cannot concatenate an indexed value list");
      break;
    default:
      param.type_error("record of value", "@LLC_Types.UA_Information");
    }
    break;
  default:
    TTCN_error("Internal error: Unknown operation type.");
  }
}

void UA__Information::encode_text(Text_Buf& text_buf) const
{
if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @LLC_Types.UA_Information.");
text_buf.push_int(val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++)
(*this)[elem_count].encode_text(text_buf);
}

void UA__Information::decode_text(Text_Buf& text_buf)
{
clean_up();
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = text_buf.pull_int().get_val();
if (val_ptr->n_elements < 0) TTCN_error("Text decoder: Negative size was received for a value of type @LLC_Types.UA_Information.");
val_ptr->value_elements = (XID**)allocate_pointers(val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) {
val_ptr->value_elements[elem_count] = new XID;
val_ptr->value_elements[elem_count]->decode_text(text_buf);
}
}

void UA__Information::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void UA__Information::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int UA__Information::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean /*no_err*/, int sel_field, boolean first_call, const RAW_Force_Omit*){
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  int decoded_length=0;
  int decoded_field_length=0;
  size_t start_of_field=0;
  if(first_call) {
    clean_up();
    val_ptr=new recordof_setof_struct;
    val_ptr->ref_count=1;
    val_ptr->n_elements=0;
    val_ptr->value_elements=NULL;
  }
  int start_field=val_ptr->n_elements;
  if(p_td.raw->fieldlength || sel_field!=-1){
    int a=0;
    if(sel_field==-1) sel_field=p_td.raw->fieldlength;
    start_of_field=p_buf.get_pos_bit();
    for(a=0;a<sel_field;a++){
      decoded_field_length=(*this)[a+start_field].RAW_decode(*p_td.oftype_descr,p_buf,limit,top_bit_ord,TRUE);
      if(decoded_field_length < 0){
        while(a>=0){
          delete &(*this)[a+start_field];
          a--;
          val_ptr->n_elements--;
        }
        p_buf.set_pos_bit(start_of_field);
        return decoded_field_length;
      }
      decoded_length+=decoded_field_length;
      limit-=decoded_field_length;
    }
    if(a==0) val_ptr->n_elements=0;
  } else {
    if(limit==0){
      if(!first_call) return -1;
      val_ptr->n_elements=0;
      return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength;
    }
    int a=start_field;
    while(limit>0){
      start_of_field=p_buf.get_pos_bit();
      decoded_field_length=(*this)[a].RAW_decode(*p_td.oftype_descr,p_buf,limit,top_bit_ord,TRUE);
      if(decoded_field_length < 0){
        delete &(*this)[a];
        val_ptr->n_elements--;
        p_buf.set_pos_bit(start_of_field);
        if(a>start_field){
        return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength;
        } else return -1;
      }
      decoded_length+=decoded_field_length;
      limit-=decoded_field_length;
      a++;
    }
  }
 return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength;
}

int UA__Information::RAW_encode(const TTCN_Typedescriptor_t& p_td,RAW_enc_tree& myleaf) const{
  int encoded_length=0;
  int encoded_num_of_records=p_td.raw->fieldlength?smaller(val_ptr->n_elements, p_td.raw->fieldlength):val_ptr->n_elements;
  myleaf.isleaf=FALSE;
  myleaf.rec_of=TRUE;
  myleaf.body.node.num_of_nodes=encoded_num_of_records;
  myleaf.body.node.nodes=init_nodes_of_enc_tree(encoded_num_of_records);
  for(int a=0;a<encoded_num_of_records;a++){
    myleaf.body.node.nodes[a]=new RAW_enc_tree(TRUE,&myleaf,&(myleaf.curr_pos),a,p_td.oftype_descr->raw);
    encoded_length+=(*this)[a].RAW_encode(*p_td.oftype_descr,*myleaf.body.node.nodes[a]);
  }
 return myleaf.length=encoded_length;
}

void UA__Information_template::copy_value(const UA__Information& other_value)
{
if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @LLC_Types.UA_Information with an unbound value.");
single_value.n_elements = other_value.size_of();
single_value.value_elements = (XID_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (other_value[elem_count].is_bound()) {
single_value.value_elements[elem_count] = new XID_template(other_value[elem_count]);
} else {
single_value.value_elements[elem_count] = new XID_template;
}
}
set_selection(SPECIFIC_VALUE);
}

void UA__Information_template::copy_template(const UA__Information_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value.n_elements = other_value.single_value.n_elements;
single_value.value_elements = (XID_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (UNINITIALIZED_TEMPLATE != other_value.single_value.value_elements[elem_count]->get_selection()) {
single_value.value_elements[elem_count] = new XID_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new XID_template;
}
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new UA__Information_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new UA__Information_template(*other_value.implication_.precondition);
implication_.implied_template = new UA__Information_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.UA_Information.");
break;
}
set_selection(other_value);
}

boolean UA__Information_template::match_function_specific(const Base_Type *value_ptr, int value_index, const Restricted_Length_Template *template_ptr, int template_index, boolean legacy)
{
if (value_index >= 0) return ((const UA__Information_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const UA__Information*)value_ptr)[value_index], legacy);
else return ((const UA__Information_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit();
}

UA__Information_template::UA__Information_template()
{
}

UA__Information_template::UA__Information_template(template_sel other_value)
 : Base_Record_Of_Template(other_value)
{
check_single_selection(other_value);
}

UA__Information_template::UA__Information_template(null_type)
 : Base_Record_Of_Template(SPECIFIC_VALUE)
{
single_value.n_elements = 0;
single_value.value_elements = NULL;
}

UA__Information_template::UA__Information_template(const UA__Information& other_value)
{
copy_value(other_value);
}

UA__Information_template::UA__Information_template(const OPTIONAL<UA__Information>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const UA__Information&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.UA_Information from an unbound optional field.");
}
}

UA__Information_template::UA__Information_template(UA__Information_template* p_precondition, UA__Information_template* p_implied_template)
 : Base_Record_Of_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

UA__Information_template::UA__Information_template(Dynamic_Match_Interface<UA__Information>* p_dyn_match)
 : Base_Record_Of_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<UA__Information>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

UA__Information_template::UA__Information_template(const UA__Information_template& other_value)
 : Base_Record_Of_Template()
{
copy_template(other_value);
}

UA__Information_template::~UA__Information_template()
{
clean_up();
}

void UA__Information_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
delete single_value.value_elements[elem_count];
free_pointers((void**)single_value.value_elements);
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

UA__Information_template& UA__Information_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

UA__Information_template& UA__Information_template::operator=(null_type)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value.n_elements = 0;
single_value.value_elements = NULL;
return *this;
}

UA__Information_template& UA__Information_template::operator=(const UA__Information& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

UA__Information_template& UA__Information_template::operator=(const OPTIONAL<UA__Information>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const UA__Information&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.UA_Information.");
}
return *this;
}

UA__Information_template& UA__Information_template::operator=(const UA__Information_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

XID_template& UA__Information_template::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @LLC_Types.UA_Information using a negative index: %d.", index_value);
switch (template_selection)
{
  case SPECIFIC_VALUE:
    if(index_value < single_value.n_elements) break;
    // no break
  case OMIT_VALUE:
  case ANY_VALUE:
  case ANY_OR_OMIT:
  case UNINITIALIZED_TEMPLATE:
    set_size(index_value + 1);
    break;
  default:
    TTCN_error("Accessing an element of a non-specific template for type @LLC_Types.UA_Information.");
    break;
}
return *single_value.value_elements[index_value];
}

XID_template& UA__Information_template::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @LLC_Types.UA_Information.");
return (*this)[(int)index_value];
}

const XID_template& UA__Information_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @LLC_Types.UA_Information using a negative index: %d.", index_value);
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @LLC_Types.UA_Information.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @LLC_Types.UA_Information: The index is %d, but the template has only %d elements.", index_value, single_value.n_elements);
return *single_value.value_elements[index_value];
}

const XID_template& UA__Information_template::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @LLC_Types.UA_Information.");
return (*this)[(int)index_value];
}

void UA__Information_template::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @LLC_Types.UA_Information.");
template_sel old_selection = template_selection;
if (old_selection != SPECIFIC_VALUE) {
clean_up();
set_selection(SPECIFIC_VALUE);
single_value.n_elements = 0;
single_value.value_elements = NULL;
}
if (new_size > single_value.n_elements) {
single_value.value_elements = (XID_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++)
single_value.value_elements[elem_count] = new XID_template(ANY_VALUE);
} else {
for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++)
single_value.value_elements[elem_count] = new XID_template;
}
single_value.n_elements = new_size;
} else if (new_size < single_value.n_elements) {
for (int elem_count = new_size; elem_count < single_value.n_elements; elem_count++)
delete single_value.value_elements[elem_count];
single_value.value_elements = (XID_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}

int UA__Information_template::n_elem() const
{
  switch (template_selection) {
  case SPECIFIC_VALUE:
    return single_value.n_elements;
    break;
  case VALUE_LIST:
    return value_list.n_values;
    break;
  default:
    TTCN_error("Performing n_elem");
  }
}

int UA__Information_template::size_of(boolean is_size) const
{
const char* op_name = is_size ? "size" : "length";
int min_size;
boolean has_any_or_none;
if (is_ifpresent) TTCN_error("Performing %sof() operation on a template of type @LLC_Types.UA_Information which has an ifpresent attribute.", op_name);
switch (template_selection)
{
case SPECIFIC_VALUE: {
  min_size = 0;
  has_any_or_none = FALSE;
  int elem_count = single_value.n_elements;
  if (!is_size) { while (elem_count>0 && !single_value.value_elements[elem_count-1]->is_bound()) elem_count--; }
  for (int i=0; i<elem_count; i++) {
    switch (single_value.value_elements[i]->get_selection()) {
    case OMIT_VALUE:
      TTCN_error("Performing %sof() operation on a template of type @LLC_Types.UA_Information containing omit element.", op_name);
    case ANY_OR_OMIT:
      has_any_or_none = TRUE;
      break;
    default:
      min_size++;
      break;
    }
  }
} break;
case OMIT_VALUE:
  TTCN_error("Performing %sof() operation on a template of type @LLC_Types.UA_Information containing omit value.", op_name);
case ANY_VALUE:
case ANY_OR_OMIT:
  min_size = 0;
  has_any_or_none = TRUE;
  break;
case VALUE_LIST:
{
  if (value_list.n_values<1)
    TTCN_error("Performing %sof() operation on a template of type @LLC_Types.UA_Information containing an empty list.", op_name);
  int item_size = value_list.list_value[0].size_of(is_size);
  for (unsigned int i = 1; i < value_list.n_values; i++) {
    if (value_list.list_value[i].size_of(is_size)!=item_size)
      TTCN_error("Performing %sof() operation on a template of type @LLC_Types.UA_Information containing a value list with different sizes.", op_name);
  }
  min_size = item_size;
  has_any_or_none = FALSE;
  break;
}
case COMPLEMENTED_LIST:
  TTCN_error("Performing %sof() operation on a template of type @LLC_Types.UA_Information containing complemented list.", op_name);
default:
  TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @LLC_Types.UA_Information.", op_name);
}
return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @LLC_Types.UA_Information");
}

boolean UA__Information_template::match(const UA__Information& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
int value_length = other_value.size_of();
if (!match_length(value_length)) return FALSE;
switch (template_selection) {
case SPECIFIC_VALUE:
return match_record_of(&other_value, value_length, this, single_value.n_elements, match_function_specific, legacy);
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching with an uninitialized/unsupported template of type @LLC_Types.UA_Information.");
}
return FALSE;
}

boolean UA__Information_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
if (!single_value.value_elements[elem_count]->is_value()) return FALSE;
return TRUE;
}

UA__Information UA__Information_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.UA_Information.");
UA__Information ret_val;
ret_val.set_size(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
if (single_value.value_elements[elem_count]->is_bound()) {
ret_val[elem_count] = single_value.value_elements[elem_count]->valueof();
}
return ret_val;
}

UA__Information UA__Information_template::substr(int index, int returncount) const
{
if (!is_value()) TTCN_error("The first argument of function substr() is a template with non-specific value.");
return valueof().substr(index, returncount);
}

UA__Information UA__Information_template::replace(int index, int len, const UA__Information_template& repl) const
{
if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value.");
if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value.");
return valueof().replace(index, len, repl.valueof());
}

UA__Information UA__Information_template::replace(int index, int len, const UA__Information& repl) const
{
if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value.");
return valueof().replace(index, len, repl);
}

void UA__Information_template::set_type(template_sel template_type, unsigned int list_length)
{
clean_up();
switch (template_type) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = list_length;
value_list.list_value = new UA__Information_template[list_length];
break;
default:
TTCN_error("Internal error: Setting an invalid type for a template of type @LLC_Types.UA_Information.");
}
set_selection(template_type);
}

UA__Information_template& UA__Information_template::list_item(unsigned int list_index)
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Internal error: Accessing a list element of a non-list template of type @LLC_Types.UA_Information.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @LLC_Types.UA_Information.");
return value_list.list_value[list_index];
}

void UA__Information_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.n_elements > 0) {
TTCN_Logger::log_event_str("{ ");
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
if (permutation_starts_at(elem_count)) TTCN_Logger::log_event_str("permutation(");
single_value.value_elements[elem_count]->log();
if (permutation_ends_at(elem_count)) TTCN_Logger::log_char(')');
}
TTCN_Logger::log_event_str(" }");
} else TTCN_Logger::log_event_str("{ }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_restricted();
log_ifpresent();
}

void UA__Information_template::log_match(const UA__Information& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
}else{
if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if(!single_value.value_elements[elem_count]->match(match_value[elem_count], legacy)){
TTCN_Logger::log_logmatch_info("[%d]", elem_count);
single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
log_match_length(single_value.n_elements);
} else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) {
TTCN_Logger::log_event_str("{ ");
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy);
}
TTCN_Logger::log_event_str(" }");
log_match_length(single_value.n_elements);
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void UA__Information_template::encode_text(Text_Buf& text_buf) const
{
encode_text_permutation(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
text_buf.push_int(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
single_value.value_elements[elem_count]->encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.UA_Information.");
}
}

void UA__Information_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_permutation(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value.n_elements = text_buf.pull_int().get_val();
if (single_value.n_elements < 0) TTCN_error("Text decoder: Negative size was received for a template of type @LLC_Types.UA_Information.");
single_value.value_elements = (XID_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
single_value.value_elements[elem_count] = new XID_template;
single_value.value_elements[elem_count]->decode_text(text_buf);
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new UA__Information_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of type @LLC_Types.UA_Information.");
}
}

boolean UA__Information_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean UA__Information_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int i=0; i<value_list.n_values; i++)
if (value_list.list_value[i].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

void UA__Information_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
for (int i = 0; i < single_value.n_elements; i++) {
if (single_value.value_elements[i] != NULL) single_value.value_elements[i]->set_implicit_omit();
}
}

void UA__Information_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE|Module_Param::BC_LIST, "record of template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    UA__Information_template temp;
    temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = temp;
    break; }
  case Module_Param::MP_Indexed_List:
    if (template_selection!=SPECIFIC_VALUE) set_size(0);
    for (size_t p_i=0; p_i<param.get_size(); ++p_i) {
      (*this)[(int)(param.get_elem(p_i)->get_id()->get_index())].set_param(*param.get_elem(p_i));
    }
    break;
  case Module_Param::MP_Value_List: {
    set_size(param.get_size());
    int curr_idx = 0;
    for (size_t p_i=0; p_i<param.get_size(); ++p_i) {
      switch (param.get_elem(p_i)->get_type()) {
      case Module_Param::MP_NotUsed:
        curr_idx++;
        break;
      case Module_Param::MP_Permutation_Template: {
        int perm_start_idx = curr_idx;
        Module_Param* param_i = param.get_elem(p_i);
        for (size_t perm_i=0; perm_i<param_i->get_size(); perm_i++) {
          (*this)[curr_idx].set_param(*(param_i->get_elem(perm_i)));
          curr_idx++;
        }
        int perm_end_idx = curr_idx - 1;
        add_permutation(perm_start_idx, perm_end_idx);
      } break;
      default:
        (*this)[curr_idx].set_param(*param.get_elem(p_i));
        curr_idx++;
      }
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    UA__Information_template* precondition = new UA__Information_template;
    precondition->set_param(*param.get_elem(0));
    UA__Information_template* implied_template = new UA__Information_template;
    implied_template->set_param(*param.get_elem(1));
    *this = UA__Information_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record of template", "@LLC_Types.UA_Information");
  }
  is_ifpresent = param.get_ifpresent();
  set_length_range(param);
}

void UA__Information_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
for (int i=0; i<single_value.n_elements; i++) single_value.value_elements[i]->check_restriction(t_res, t_name ? t_name : "@LLC_Types.UA_Information");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.UA_Information");
}

boolean UA__Information_template::get_istemplate_kind(const char* type) const {
if (!strcmp(type, "AnyElement")) {
  if (template_selection != SPECIFIC_VALUE) {
    return FALSE;
  }
  for (int i = 0; i < single_value.n_elements; i++) {
    if (single_value.value_elements[i]->get_selection() == ANY_VALUE) {
      return TRUE;
    }
  }
  return FALSE;
} else if (!strcmp(type, "AnyElementsOrNone")) {
  if (template_selection != SPECIFIC_VALUE) {
    return FALSE;
  }
  for (int i = 0; i < single_value.n_elements; i++) {
    if (single_value.value_elements[i]->get_selection() == ANY_OR_OMIT) {
      return TRUE;
    }
  }
  return FALSE;
} else if (!strcmp(type, "permutation")) {
  return number_of_permutations;
} else if (!strcmp(type, "length")) {
  return length_restriction_type != NO_LENGTH_RESTRICTION;
} else {
  return Base_Template::get_istemplate_kind(type);
}
}

const XID SABM__Information::UNBOUND_ELEM;
SABM__Information::SABM__Information()
{
val_ptr = NULL;
}

SABM__Information::SABM__Information(null_type)
{
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
}

SABM__Information::SABM__Information(const SABM__Information& other_value)
{
if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.SABM_Information.");
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}

SABM__Information::~SABM__Information()
{
clean_up();
if (val_ptr != NULL) val_ptr = NULL;
}

void SABM__Information::clean_up()
{
if (val_ptr != NULL) {
if (val_ptr->ref_count > 1) {
val_ptr->ref_count--;
val_ptr = NULL;
}
else if (val_ptr->ref_count == 1) {
for (int elem_count = 0; elem_count < val_ptr->n_elements;
elem_count++)
if (val_ptr->value_elements[elem_count] != NULL)
delete val_ptr->value_elements[elem_count];
free_pointers((void**)val_ptr->value_elements);
delete val_ptr;
val_ptr = NULL;
}
else
TTCN_error("Internal error: Invalid reference counter in a record of/set of value.");
}
}

SABM__Information& SABM__Information::operator=(null_type)
{
clean_up();
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
return *this;
}

SABM__Information& SABM__Information::operator=(const SABM__Information& other_value)
{
if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @LLC_Types.SABM_Information.");
if (this != &other_value) {
clean_up();
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}
return *this;
}

boolean SABM__Information::operator==(null_type) const
{
if (val_ptr == NULL)
TTCN_error("The left operand of comparison is an unbound value of type @LLC_Types.SABM_Information.");
return val_ptr->n_elements == 0 ;
}

boolean SABM__Information::operator==(const SABM__Information& other_value) const
{
if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @LLC_Types.SABM_Information.");
if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @LLC_Types.SABM_Information.");
if (val_ptr == other_value.val_ptr) return TRUE;
if (val_ptr->n_elements != (other_value.val_ptr)->n_elements)
return FALSE;
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){
if (val_ptr->value_elements[elem_count] != NULL){
if ((other_value.val_ptr)->value_elements[elem_count] != NULL){
  if (*val_ptr->value_elements[elem_count] != *(other_value.val_ptr)->value_elements[elem_count]) return FALSE;
} else return FALSE;
} else {
if ((other_value.val_ptr)->value_elements[elem_count] != NULL) return FALSE;
}
}
return TRUE;
}

XID& SABM__Information::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of type @LLC_Types.SABM_Information using a negative index: %d.", index_value);
if (val_ptr == NULL) {
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
} else if (val_ptr->ref_count > 1) {
struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct;
new_val_ptr->ref_count = 1;
new_val_ptr->n_elements = (index_value >= val_ptr->n_elements) ? index_value + 1 : val_ptr->n_elements;
new_val_ptr->value_elements = (XID**)allocate_pointers(new_val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){
if (val_ptr->value_elements[elem_count] != NULL){
new_val_ptr->value_elements[elem_count] = new XID(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (index_value >= val_ptr->n_elements) set_size(index_value + 1);
if (val_ptr->value_elements[index_value] == NULL) {
val_ptr->value_elements[index_value] = new XID;
}
return *val_ptr->value_elements[index_value];
}

XID& SABM__Information::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @LLC_Types.SABM_Information.");
return (*this)[(int)index_value];
}

const XID& SABM__Information::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @LLC_Types.SABM_Information.");
if (index_value < 0) TTCN_error("Accessing an element of type @LLC_Types.SABM_Information using a negative index: %d.", index_value);
if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @LLC_Types.SABM_Information: The index is %d, but the value has only %d elements.", index_value, val_ptr->n_elements);
return (val_ptr->value_elements[index_value] == NULL) ?
UNBOUND_ELEM : *val_ptr->value_elements[index_value];
}

const XID& SABM__Information::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @LLC_Types.SABM_Information.");
return (*this)[(int)index_value];
}

SABM__Information SABM__Information::operator<<=(int rotate_count) const
{
return *this >>= (-rotate_count);
}

SABM__Information SABM__Information::operator<<=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate left operator.");
return *this >>= (int)(-rotate_count);
}

SABM__Information SABM__Information::operator>>=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate right operator.");
return *this >>= (int)rotate_count;
}

SABM__Information SABM__Information::operator>>=(int rotate_count) const
{
if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @LLC_Types.SABM_Information.");
if (val_ptr->n_elements == 0) return *this;
int rc;
if (rotate_count>=0) rc = rotate_count % val_ptr->n_elements;
else rc = val_ptr->n_elements - ((-rotate_count) % val_ptr->n_elements);
if (rc == 0) return *this;
SABM__Information ret_val;
ret_val.set_size(val_ptr->n_elements);
for (int i=0; i<val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[(i+rc)%val_ptr->n_elements] =new XID(*val_ptr->value_elements[i]);
}
}
return ret_val;
}

SABM__Information SABM__Information::operator+(const SABM__Information& other_value) const
{
if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @LLC_Types.SABM_Information concatenation.");
if (val_ptr->n_elements == 0) return other_value;
if (other_value.val_ptr->n_elements == 0) return *this;
SABM__Information ret_val;
ret_val.set_size(val_ptr->n_elements+other_value.val_ptr->n_elements);
for (int i=0; i<val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i] = new XID(*val_ptr->value_elements[i]);
}
}
for (int i=0; i<other_value.val_ptr->n_elements; i++) {
if (other_value.val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i+val_ptr->n_elements] = new XID(*other_value.val_ptr->value_elements[i]);
}
}
return ret_val;
}

SABM__Information SABM__Information::substr(int index, int returncount) const
{
if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @LLC_Types.SABM_Information.");
check_substr_arguments(val_ptr->n_elements, index, returncount, "@LLC_Types.SABM_Information","element");
SABM__Information ret_val;
ret_val.set_size(returncount);
for (int i=0; i<returncount; i++) {
if (val_ptr->value_elements[i+index] != NULL) {
ret_val.val_ptr->value_elements[i] = new XID(*val_ptr->value_elements[i+index]);
}
}
return ret_val;
}

SABM__Information SABM__Information::replace(int index, int len, const SABM__Information& repl) const
{
if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @LLC_Types.SABM_Information.");
if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @LLC_Types.SABM_Information.");
check_replace_arguments(val_ptr->n_elements, index, len, "@LLC_Types.SABM_Information","element");
SABM__Information ret_val;
ret_val.set_size(val_ptr->n_elements + repl.val_ptr->n_elements - len);
for (int i = 0; i < index; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i] = new XID(*val_ptr->value_elements[i]);
}
}
for (int i = 0; i < repl.val_ptr->n_elements; i++) {
if (repl.val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i+index] = new XID(*repl.val_ptr->value_elements[i]);
}
}
for (int i = 0; i < val_ptr->n_elements - index - len; i++) {
if (val_ptr->value_elements[index+i+len] != NULL) {
ret_val.val_ptr->value_elements[index+i+repl.val_ptr->n_elements] = new XID(*val_ptr->value_elements[index+i+len]);
}
}
return ret_val;
}

SABM__Information SABM__Information::replace(int index, int len, const SABM__Information_template& repl) const
{
if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value.");
return replace(index, len, repl.valueof());
}

void SABM__Information::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @LLC_Types.SABM_Information.");
if (val_ptr == NULL) {
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
} else if (val_ptr->ref_count > 1) {
struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct;
new_val_ptr->ref_count = 1;
new_val_ptr->n_elements = (new_size < val_ptr->n_elements) ? new_size : val_ptr->n_elements;
new_val_ptr->value_elements = (XID**)allocate_pointers(new_val_ptr->n_elements);
for (int elem_count = 0; elem_count < new_val_ptr->n_elements; elem_count++) {
if (val_ptr->value_elements[elem_count] != NULL){
new_val_ptr->value_elements[elem_count] = new XID(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (XID**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
#ifdef TITAN_MEMORY_DEBUG_SET_RECORD_OF
if((val_ptr->n_elements/1000)!=(new_size/1000)) TTCN_warning("New size of type @LLC_Types.SABM_Information: %d",new_size);
#endif
val_ptr->n_elements = new_size;
} else if (new_size < val_ptr->n_elements) {
for (int elem_count = new_size; elem_count < val_ptr->n_elements; elem_count++)
if (val_ptr->value_elements[elem_count] != NULL)delete val_ptr->value_elements[elem_count];
val_ptr->value_elements = (XID**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}

boolean SABM__Information::is_value() const
{
if (val_ptr == NULL) return FALSE;
for(int i = 0; i < val_ptr->n_elements; ++i) {
if (val_ptr->value_elements[i] == NULL || !val_ptr->value_elements[i]->is_value()) return FALSE;
}
return TRUE;
}

int SABM__Information::size_of() const
{
if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @LLC_Types.SABM_Information.");
return val_ptr->n_elements;
}

int SABM__Information::lengthof() const
{
if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @LLC_Types.SABM_Information.");
for (int my_length=val_ptr->n_elements; my_length>0; my_length--) if (val_ptr->value_elements[my_length-1] != NULL) return my_length;
return 0;
}

void SABM__Information::log() const
{
if (val_ptr == NULL) {;
TTCN_Logger::log_event_unbound();
return;
}
switch (val_ptr->n_elements) {
case 0:
TTCN_Logger::log_event_str("{ }");
break;
default:
TTCN_Logger::log_event_str("{ ");
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
(*this)[elem_count].log();
}
TTCN_Logger::log_event_str(" }");
}
}

void SABM__Information::set_implicit_omit()
{
if (val_ptr == NULL) return;
for (int i = 0; i < val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) val_ptr->value_elements[i]->set_implicit_omit();
}
}

void SABM__Information::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE|Module_Param::BC_LIST, "record of value");
  switch (param.get_operation_type()) {
  case Module_Param::OT_ASSIGN:
    if (param.get_type()==Module_Param::MP_Value_List && param.get_size()==0) {
      *this = NULL_VALUE;
      return;
    }
    switch (param.get_type()) {
    case Module_Param::MP_Value_List:
      set_size(param.get_size());
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        if (curr->get_type()!=Module_Param::MP_NotUsed) {
          (*this)[i].set_param(*curr);
          if (!(*this)[i].is_bound()) {
            delete val_ptr->value_elements[i];
            val_ptr->value_elements[i] = NULL;
          }
        }
      }
      break;
    case Module_Param::MP_Indexed_List:
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        (*this)[curr->get_id()->get_index()].set_param(*curr);
        if (!(*this)[curr->get_id()->get_index()].is_bound()) {
          delete val_ptr->value_elements[curr->get_id()->get_index()];
          val_ptr->value_elements[curr->get_id()->get_index()] = NULL;
        }
      }
      break;
    default:
      param.type_error("record of value", "@LLC_Types.SABM_Information");
    }
    break;
  case Module_Param::OT_CONCAT:
    switch (param.get_type()) {
    case Module_Param::MP_Value_List: {
      if (!is_bound()) *this = NULL_VALUE;
      int start_idx = lengthof();
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        if ((curr->get_type()!=Module_Param::MP_NotUsed)) {
          (*this)[start_idx+(int)i].set_param(*curr);
        }
      }
    } break;
    case Module_Param::MP_Indexed_List:
      param.error("Cannot concatenate an indexed value list");
      break;
    default:
      param.type_error("record of value", "@LLC_Types.SABM_Information");
    }
    break;
  default:
    TTCN_error("Internal error: Unknown operation type.");
  }
}

void SABM__Information::encode_text(Text_Buf& text_buf) const
{
if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @LLC_Types.SABM_Information.");
text_buf.push_int(val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++)
(*this)[elem_count].encode_text(text_buf);
}

void SABM__Information::decode_text(Text_Buf& text_buf)
{
clean_up();
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = text_buf.pull_int().get_val();
if (val_ptr->n_elements < 0) TTCN_error("Text decoder: Negative size was received for a value of type @LLC_Types.SABM_Information.");
val_ptr->value_elements = (XID**)allocate_pointers(val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) {
val_ptr->value_elements[elem_count] = new XID;
val_ptr->value_elements[elem_count]->decode_text(text_buf);
}
}

void SABM__Information::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void SABM__Information::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int SABM__Information::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean /*no_err*/, int sel_field, boolean first_call, const RAW_Force_Omit*){
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  int decoded_length=0;
  int decoded_field_length=0;
  size_t start_of_field=0;
  if(first_call) {
    clean_up();
    val_ptr=new recordof_setof_struct;
    val_ptr->ref_count=1;
    val_ptr->n_elements=0;
    val_ptr->value_elements=NULL;
  }
  int start_field=val_ptr->n_elements;
  if(p_td.raw->fieldlength || sel_field!=-1){
    int a=0;
    if(sel_field==-1) sel_field=p_td.raw->fieldlength;
    start_of_field=p_buf.get_pos_bit();
    for(a=0;a<sel_field;a++){
      decoded_field_length=(*this)[a+start_field].RAW_decode(*p_td.oftype_descr,p_buf,limit,top_bit_ord,TRUE);
      if(decoded_field_length < 0){
        while(a>=0){
          delete &(*this)[a+start_field];
          a--;
          val_ptr->n_elements--;
        }
        p_buf.set_pos_bit(start_of_field);
        return decoded_field_length;
      }
      decoded_length+=decoded_field_length;
      limit-=decoded_field_length;
    }
    if(a==0) val_ptr->n_elements=0;
  } else {
    if(limit==0){
      if(!first_call) return -1;
      val_ptr->n_elements=0;
      return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength;
    }
    int a=start_field;
    while(limit>0){
      start_of_field=p_buf.get_pos_bit();
      decoded_field_length=(*this)[a].RAW_decode(*p_td.oftype_descr,p_buf,limit,top_bit_ord,TRUE);
      if(decoded_field_length < 0){
        delete &(*this)[a];
        val_ptr->n_elements--;
        p_buf.set_pos_bit(start_of_field);
        if(a>start_field){
        return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength;
        } else return -1;
      }
      decoded_length+=decoded_field_length;
      limit-=decoded_field_length;
      a++;
    }
  }
 return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength;
}

int SABM__Information::RAW_encode(const TTCN_Typedescriptor_t& p_td,RAW_enc_tree& myleaf) const{
  int encoded_length=0;
  int encoded_num_of_records=p_td.raw->fieldlength?smaller(val_ptr->n_elements, p_td.raw->fieldlength):val_ptr->n_elements;
  myleaf.isleaf=FALSE;
  myleaf.rec_of=TRUE;
  myleaf.body.node.num_of_nodes=encoded_num_of_records;
  myleaf.body.node.nodes=init_nodes_of_enc_tree(encoded_num_of_records);
  for(int a=0;a<encoded_num_of_records;a++){
    myleaf.body.node.nodes[a]=new RAW_enc_tree(TRUE,&myleaf,&(myleaf.curr_pos),a,p_td.oftype_descr->raw);
    encoded_length+=(*this)[a].RAW_encode(*p_td.oftype_descr,*myleaf.body.node.nodes[a]);
  }
 return myleaf.length=encoded_length;
}

void SABM__Information_template::copy_value(const SABM__Information& other_value)
{
if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @LLC_Types.SABM_Information with an unbound value.");
single_value.n_elements = other_value.size_of();
single_value.value_elements = (XID_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (other_value[elem_count].is_bound()) {
single_value.value_elements[elem_count] = new XID_template(other_value[elem_count]);
} else {
single_value.value_elements[elem_count] = new XID_template;
}
}
set_selection(SPECIFIC_VALUE);
}

void SABM__Information_template::copy_template(const SABM__Information_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value.n_elements = other_value.single_value.n_elements;
single_value.value_elements = (XID_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (UNINITIALIZED_TEMPLATE != other_value.single_value.value_elements[elem_count]->get_selection()) {
single_value.value_elements[elem_count] = new XID_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new XID_template;
}
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new SABM__Information_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new SABM__Information_template(*other_value.implication_.precondition);
implication_.implied_template = new SABM__Information_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.SABM_Information.");
break;
}
set_selection(other_value);
}

boolean SABM__Information_template::match_function_specific(const Base_Type *value_ptr, int value_index, const Restricted_Length_Template *template_ptr, int template_index, boolean legacy)
{
if (value_index >= 0) return ((const SABM__Information_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const SABM__Information*)value_ptr)[value_index], legacy);
else return ((const SABM__Information_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit();
}

SABM__Information_template::SABM__Information_template()
{
}

SABM__Information_template::SABM__Information_template(template_sel other_value)
 : Base_Record_Of_Template(other_value)
{
check_single_selection(other_value);
}

SABM__Information_template::SABM__Information_template(null_type)
 : Base_Record_Of_Template(SPECIFIC_VALUE)
{
single_value.n_elements = 0;
single_value.value_elements = NULL;
}

SABM__Information_template::SABM__Information_template(const SABM__Information& other_value)
{
copy_value(other_value);
}

SABM__Information_template::SABM__Information_template(const OPTIONAL<SABM__Information>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const SABM__Information&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.SABM_Information from an unbound optional field.");
}
}

SABM__Information_template::SABM__Information_template(SABM__Information_template* p_precondition, SABM__Information_template* p_implied_template)
 : Base_Record_Of_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

SABM__Information_template::SABM__Information_template(Dynamic_Match_Interface<SABM__Information>* p_dyn_match)
 : Base_Record_Of_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<SABM__Information>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

SABM__Information_template::SABM__Information_template(const SABM__Information_template& other_value)
 : Base_Record_Of_Template()
{
copy_template(other_value);
}

SABM__Information_template::~SABM__Information_template()
{
clean_up();
}

void SABM__Information_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
delete single_value.value_elements[elem_count];
free_pointers((void**)single_value.value_elements);
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

SABM__Information_template& SABM__Information_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

SABM__Information_template& SABM__Information_template::operator=(null_type)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value.n_elements = 0;
single_value.value_elements = NULL;
return *this;
}

SABM__Information_template& SABM__Information_template::operator=(const SABM__Information& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

SABM__Information_template& SABM__Information_template::operator=(const OPTIONAL<SABM__Information>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const SABM__Information&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.SABM_Information.");
}
return *this;
}

SABM__Information_template& SABM__Information_template::operator=(const SABM__Information_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

XID_template& SABM__Information_template::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @LLC_Types.SABM_Information using a negative index: %d.", index_value);
switch (template_selection)
{
  case SPECIFIC_VALUE:
    if(index_value < single_value.n_elements) break;
    // no break
  case OMIT_VALUE:
  case ANY_VALUE:
  case ANY_OR_OMIT:
  case UNINITIALIZED_TEMPLATE:
    set_size(index_value + 1);
    break;
  default:
    TTCN_error("Accessing an element of a non-specific template for type @LLC_Types.SABM_Information.");
    break;
}
return *single_value.value_elements[index_value];
}

XID_template& SABM__Information_template::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @LLC_Types.SABM_Information.");
return (*this)[(int)index_value];
}

const XID_template& SABM__Information_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @LLC_Types.SABM_Information using a negative index: %d.", index_value);
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @LLC_Types.SABM_Information.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @LLC_Types.SABM_Information: The index is %d, but the template has only %d elements.", index_value, single_value.n_elements);
return *single_value.value_elements[index_value];
}

const XID_template& SABM__Information_template::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @LLC_Types.SABM_Information.");
return (*this)[(int)index_value];
}

void SABM__Information_template::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @LLC_Types.SABM_Information.");
template_sel old_selection = template_selection;
if (old_selection != SPECIFIC_VALUE) {
clean_up();
set_selection(SPECIFIC_VALUE);
single_value.n_elements = 0;
single_value.value_elements = NULL;
}
if (new_size > single_value.n_elements) {
single_value.value_elements = (XID_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++)
single_value.value_elements[elem_count] = new XID_template(ANY_VALUE);
} else {
for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++)
single_value.value_elements[elem_count] = new XID_template;
}
single_value.n_elements = new_size;
} else if (new_size < single_value.n_elements) {
for (int elem_count = new_size; elem_count < single_value.n_elements; elem_count++)
delete single_value.value_elements[elem_count];
single_value.value_elements = (XID_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}

int SABM__Information_template::n_elem() const
{
  switch (template_selection) {
  case SPECIFIC_VALUE:
    return single_value.n_elements;
    break;
  case VALUE_LIST:
    return value_list.n_values;
    break;
  default:
    TTCN_error("Performing n_elem");
  }
}

int SABM__Information_template::size_of(boolean is_size) const
{
const char* op_name = is_size ? "size" : "length";
int min_size;
boolean has_any_or_none;
if (is_ifpresent) TTCN_error("Performing %sof() operation on a template of type @LLC_Types.SABM_Information which has an ifpresent attribute.", op_name);
switch (template_selection)
{
case SPECIFIC_VALUE: {
  min_size = 0;
  has_any_or_none = FALSE;
  int elem_count = single_value.n_elements;
  if (!is_size) { while (elem_count>0 && !single_value.value_elements[elem_count-1]->is_bound()) elem_count--; }
  for (int i=0; i<elem_count; i++) {
    switch (single_value.value_elements[i]->get_selection()) {
    case OMIT_VALUE:
      TTCN_error("Performing %sof() operation on a template of type @LLC_Types.SABM_Information containing omit element.", op_name);
    case ANY_OR_OMIT:
      has_any_or_none = TRUE;
      break;
    default:
      min_size++;
      break;
    }
  }
} break;
case OMIT_VALUE:
  TTCN_error("Performing %sof() operation on a template of type @LLC_Types.SABM_Information containing omit value.", op_name);
case ANY_VALUE:
case ANY_OR_OMIT:
  min_size = 0;
  has_any_or_none = TRUE;
  break;
case VALUE_LIST:
{
  if (value_list.n_values<1)
    TTCN_error("Performing %sof() operation on a template of type @LLC_Types.SABM_Information containing an empty list.", op_name);
  int item_size = value_list.list_value[0].size_of(is_size);
  for (unsigned int i = 1; i < value_list.n_values; i++) {
    if (value_list.list_value[i].size_of(is_size)!=item_size)
      TTCN_error("Performing %sof() operation on a template of type @LLC_Types.SABM_Information containing a value list with different sizes.", op_name);
  }
  min_size = item_size;
  has_any_or_none = FALSE;
  break;
}
case COMPLEMENTED_LIST:
  TTCN_error("Performing %sof() operation on a template of type @LLC_Types.SABM_Information containing complemented list.", op_name);
default:
  TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @LLC_Types.SABM_Information.", op_name);
}
return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @LLC_Types.SABM_Information");
}

boolean SABM__Information_template::match(const SABM__Information& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
int value_length = other_value.size_of();
if (!match_length(value_length)) return FALSE;
switch (template_selection) {
case SPECIFIC_VALUE:
return match_record_of(&other_value, value_length, this, single_value.n_elements, match_function_specific, legacy);
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching with an uninitialized/unsupported template of type @LLC_Types.SABM_Information.");
}
return FALSE;
}

boolean SABM__Information_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
if (!single_value.value_elements[elem_count]->is_value()) return FALSE;
return TRUE;
}

SABM__Information SABM__Information_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.SABM_Information.");
SABM__Information ret_val;
ret_val.set_size(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
if (single_value.value_elements[elem_count]->is_bound()) {
ret_val[elem_count] = single_value.value_elements[elem_count]->valueof();
}
return ret_val;
}

SABM__Information SABM__Information_template::substr(int index, int returncount) const
{
if (!is_value()) TTCN_error("The first argument of function substr() is a template with non-specific value.");
return valueof().substr(index, returncount);
}

SABM__Information SABM__Information_template::replace(int index, int len, const SABM__Information_template& repl) const
{
if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value.");
if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value.");
return valueof().replace(index, len, repl.valueof());
}

SABM__Information SABM__Information_template::replace(int index, int len, const SABM__Information& repl) const
{
if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value.");
return valueof().replace(index, len, repl);
}

void SABM__Information_template::set_type(template_sel template_type, unsigned int list_length)
{
clean_up();
switch (template_type) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = list_length;
value_list.list_value = new SABM__Information_template[list_length];
break;
default:
TTCN_error("Internal error: Setting an invalid type for a template of type @LLC_Types.SABM_Information.");
}
set_selection(template_type);
}

SABM__Information_template& SABM__Information_template::list_item(unsigned int list_index)
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Internal error: Accessing a list element of a non-list template of type @LLC_Types.SABM_Information.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @LLC_Types.SABM_Information.");
return value_list.list_value[list_index];
}

void SABM__Information_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.n_elements > 0) {
TTCN_Logger::log_event_str("{ ");
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
if (permutation_starts_at(elem_count)) TTCN_Logger::log_event_str("permutation(");
single_value.value_elements[elem_count]->log();
if (permutation_ends_at(elem_count)) TTCN_Logger::log_char(')');
}
TTCN_Logger::log_event_str(" }");
} else TTCN_Logger::log_event_str("{ }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_restricted();
log_ifpresent();
}

void SABM__Information_template::log_match(const SABM__Information& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
}else{
if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if(!single_value.value_elements[elem_count]->match(match_value[elem_count], legacy)){
TTCN_Logger::log_logmatch_info("[%d]", elem_count);
single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
log_match_length(single_value.n_elements);
} else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) {
TTCN_Logger::log_event_str("{ ");
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy);
}
TTCN_Logger::log_event_str(" }");
log_match_length(single_value.n_elements);
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void SABM__Information_template::encode_text(Text_Buf& text_buf) const
{
encode_text_permutation(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
text_buf.push_int(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
single_value.value_elements[elem_count]->encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.SABM_Information.");
}
}

void SABM__Information_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_permutation(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value.n_elements = text_buf.pull_int().get_val();
if (single_value.n_elements < 0) TTCN_error("Text decoder: Negative size was received for a template of type @LLC_Types.SABM_Information.");
single_value.value_elements = (XID_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
single_value.value_elements[elem_count] = new XID_template;
single_value.value_elements[elem_count]->decode_text(text_buf);
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new SABM__Information_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of type @LLC_Types.SABM_Information.");
}
}

boolean SABM__Information_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean SABM__Information_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int i=0; i<value_list.n_values; i++)
if (value_list.list_value[i].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

void SABM__Information_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
for (int i = 0; i < single_value.n_elements; i++) {
if (single_value.value_elements[i] != NULL) single_value.value_elements[i]->set_implicit_omit();
}
}

void SABM__Information_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE|Module_Param::BC_LIST, "record of template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    SABM__Information_template temp;
    temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = temp;
    break; }
  case Module_Param::MP_Indexed_List:
    if (template_selection!=SPECIFIC_VALUE) set_size(0);
    for (size_t p_i=0; p_i<param.get_size(); ++p_i) {
      (*this)[(int)(param.get_elem(p_i)->get_id()->get_index())].set_param(*param.get_elem(p_i));
    }
    break;
  case Module_Param::MP_Value_List: {
    set_size(param.get_size());
    int curr_idx = 0;
    for (size_t p_i=0; p_i<param.get_size(); ++p_i) {
      switch (param.get_elem(p_i)->get_type()) {
      case Module_Param::MP_NotUsed:
        curr_idx++;
        break;
      case Module_Param::MP_Permutation_Template: {
        int perm_start_idx = curr_idx;
        Module_Param* param_i = param.get_elem(p_i);
        for (size_t perm_i=0; perm_i<param_i->get_size(); perm_i++) {
          (*this)[curr_idx].set_param(*(param_i->get_elem(perm_i)));
          curr_idx++;
        }
        int perm_end_idx = curr_idx - 1;
        add_permutation(perm_start_idx, perm_end_idx);
      } break;
      default:
        (*this)[curr_idx].set_param(*param.get_elem(p_i));
        curr_idx++;
      }
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    SABM__Information_template* precondition = new SABM__Information_template;
    precondition->set_param(*param.get_elem(0));
    SABM__Information_template* implied_template = new SABM__Information_template;
    implied_template->set_param(*param.get_elem(1));
    *this = SABM__Information_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record of template", "@LLC_Types.SABM_Information");
  }
  is_ifpresent = param.get_ifpresent();
  set_length_range(param);
}

void SABM__Information_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
for (int i=0; i<single_value.n_elements; i++) single_value.value_elements[i]->check_restriction(t_res, t_name ? t_name : "@LLC_Types.SABM_Information");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.SABM_Information");
}

boolean SABM__Information_template::get_istemplate_kind(const char* type) const {
if (!strcmp(type, "AnyElement")) {
  if (template_selection != SPECIFIC_VALUE) {
    return FALSE;
  }
  for (int i = 0; i < single_value.n_elements; i++) {
    if (single_value.value_elements[i]->get_selection() == ANY_VALUE) {
      return TRUE;
    }
  }
  return FALSE;
} else if (!strcmp(type, "AnyElementsOrNone")) {
  if (template_selection != SPECIFIC_VALUE) {
    return FALSE;
  }
  for (int i = 0; i < single_value.n_elements; i++) {
    if (single_value.value_elements[i]->get_selection() == ANY_OR_OMIT) {
      return TRUE;
    }
  }
  return FALSE;
} else if (!strcmp(type, "permutation")) {
  return number_of_permutations;
} else if (!strcmp(type, "length")) {
  return length_restriction_type != NO_LENGTH_RESTRICTION;
} else {
  return Base_Template::get_istemplate_kind(type);
}
}

const XID XID__Information::UNBOUND_ELEM;
XID__Information::XID__Information()
{
val_ptr = NULL;
}

XID__Information::XID__Information(null_type)
{
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
}

XID__Information::XID__Information(const XID__Information& other_value)
{
if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.XID_Information.");
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}

XID__Information::~XID__Information()
{
clean_up();
if (val_ptr != NULL) val_ptr = NULL;
}

void XID__Information::clean_up()
{
if (val_ptr != NULL) {
if (val_ptr->ref_count > 1) {
val_ptr->ref_count--;
val_ptr = NULL;
}
else if (val_ptr->ref_count == 1) {
for (int elem_count = 0; elem_count < val_ptr->n_elements;
elem_count++)
if (val_ptr->value_elements[elem_count] != NULL)
delete val_ptr->value_elements[elem_count];
free_pointers((void**)val_ptr->value_elements);
delete val_ptr;
val_ptr = NULL;
}
else
TTCN_error("Internal error: Invalid reference counter in a record of/set of value.");
}
}

XID__Information& XID__Information::operator=(null_type)
{
clean_up();
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
return *this;
}

XID__Information& XID__Information::operator=(const XID__Information& other_value)
{
if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @LLC_Types.XID_Information.");
if (this != &other_value) {
clean_up();
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}
return *this;
}

boolean XID__Information::operator==(null_type) const
{
if (val_ptr == NULL)
TTCN_error("The left operand of comparison is an unbound value of type @LLC_Types.XID_Information.");
return val_ptr->n_elements == 0 ;
}

boolean XID__Information::operator==(const XID__Information& other_value) const
{
if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @LLC_Types.XID_Information.");
if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @LLC_Types.XID_Information.");
if (val_ptr == other_value.val_ptr) return TRUE;
if (val_ptr->n_elements != (other_value.val_ptr)->n_elements)
return FALSE;
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){
if (val_ptr->value_elements[elem_count] != NULL){
if ((other_value.val_ptr)->value_elements[elem_count] != NULL){
  if (*val_ptr->value_elements[elem_count] != *(other_value.val_ptr)->value_elements[elem_count]) return FALSE;
} else return FALSE;
} else {
if ((other_value.val_ptr)->value_elements[elem_count] != NULL) return FALSE;
}
}
return TRUE;
}

XID& XID__Information::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of type @LLC_Types.XID_Information using a negative index: %d.", index_value);
if (val_ptr == NULL) {
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
} else if (val_ptr->ref_count > 1) {
struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct;
new_val_ptr->ref_count = 1;
new_val_ptr->n_elements = (index_value >= val_ptr->n_elements) ? index_value + 1 : val_ptr->n_elements;
new_val_ptr->value_elements = (XID**)allocate_pointers(new_val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){
if (val_ptr->value_elements[elem_count] != NULL){
new_val_ptr->value_elements[elem_count] = new XID(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (index_value >= val_ptr->n_elements) set_size(index_value + 1);
if (val_ptr->value_elements[index_value] == NULL) {
val_ptr->value_elements[index_value] = new XID;
}
return *val_ptr->value_elements[index_value];
}

XID& XID__Information::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @LLC_Types.XID_Information.");
return (*this)[(int)index_value];
}

const XID& XID__Information::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @LLC_Types.XID_Information.");
if (index_value < 0) TTCN_error("Accessing an element of type @LLC_Types.XID_Information using a negative index: %d.", index_value);
if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @LLC_Types.XID_Information: The index is %d, but the value has only %d elements.", index_value, val_ptr->n_elements);
return (val_ptr->value_elements[index_value] == NULL) ?
UNBOUND_ELEM : *val_ptr->value_elements[index_value];
}

const XID& XID__Information::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @LLC_Types.XID_Information.");
return (*this)[(int)index_value];
}

XID__Information XID__Information::operator<<=(int rotate_count) const
{
return *this >>= (-rotate_count);
}

XID__Information XID__Information::operator<<=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate left operator.");
return *this >>= (int)(-rotate_count);
}

XID__Information XID__Information::operator>>=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate right operator.");
return *this >>= (int)rotate_count;
}

XID__Information XID__Information::operator>>=(int rotate_count) const
{
if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @LLC_Types.XID_Information.");
if (val_ptr->n_elements == 0) return *this;
int rc;
if (rotate_count>=0) rc = rotate_count % val_ptr->n_elements;
else rc = val_ptr->n_elements - ((-rotate_count) % val_ptr->n_elements);
if (rc == 0) return *this;
XID__Information ret_val;
ret_val.set_size(val_ptr->n_elements);
for (int i=0; i<val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[(i+rc)%val_ptr->n_elements] =new XID(*val_ptr->value_elements[i]);
}
}
return ret_val;
}

XID__Information XID__Information::operator+(const XID__Information& other_value) const
{
if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @LLC_Types.XID_Information concatenation.");
if (val_ptr->n_elements == 0) return other_value;
if (other_value.val_ptr->n_elements == 0) return *this;
XID__Information ret_val;
ret_val.set_size(val_ptr->n_elements+other_value.val_ptr->n_elements);
for (int i=0; i<val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i] = new XID(*val_ptr->value_elements[i]);
}
}
for (int i=0; i<other_value.val_ptr->n_elements; i++) {
if (other_value.val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i+val_ptr->n_elements] = new XID(*other_value.val_ptr->value_elements[i]);
}
}
return ret_val;
}

XID__Information XID__Information::substr(int index, int returncount) const
{
if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @LLC_Types.XID_Information.");
check_substr_arguments(val_ptr->n_elements, index, returncount, "@LLC_Types.XID_Information","element");
XID__Information ret_val;
ret_val.set_size(returncount);
for (int i=0; i<returncount; i++) {
if (val_ptr->value_elements[i+index] != NULL) {
ret_val.val_ptr->value_elements[i] = new XID(*val_ptr->value_elements[i+index]);
}
}
return ret_val;
}

XID__Information XID__Information::replace(int index, int len, const XID__Information& repl) const
{
if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @LLC_Types.XID_Information.");
if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @LLC_Types.XID_Information.");
check_replace_arguments(val_ptr->n_elements, index, len, "@LLC_Types.XID_Information","element");
XID__Information ret_val;
ret_val.set_size(val_ptr->n_elements + repl.val_ptr->n_elements - len);
for (int i = 0; i < index; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i] = new XID(*val_ptr->value_elements[i]);
}
}
for (int i = 0; i < repl.val_ptr->n_elements; i++) {
if (repl.val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i+index] = new XID(*repl.val_ptr->value_elements[i]);
}
}
for (int i = 0; i < val_ptr->n_elements - index - len; i++) {
if (val_ptr->value_elements[index+i+len] != NULL) {
ret_val.val_ptr->value_elements[index+i+repl.val_ptr->n_elements] = new XID(*val_ptr->value_elements[index+i+len]);
}
}
return ret_val;
}

XID__Information XID__Information::replace(int index, int len, const XID__Information_template& repl) const
{
if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value.");
return replace(index, len, repl.valueof());
}

void XID__Information::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @LLC_Types.XID_Information.");
if (val_ptr == NULL) {
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
} else if (val_ptr->ref_count > 1) {
struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct;
new_val_ptr->ref_count = 1;
new_val_ptr->n_elements = (new_size < val_ptr->n_elements) ? new_size : val_ptr->n_elements;
new_val_ptr->value_elements = (XID**)allocate_pointers(new_val_ptr->n_elements);
for (int elem_count = 0; elem_count < new_val_ptr->n_elements; elem_count++) {
if (val_ptr->value_elements[elem_count] != NULL){
new_val_ptr->value_elements[elem_count] = new XID(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (XID**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
#ifdef TITAN_MEMORY_DEBUG_SET_RECORD_OF
if((val_ptr->n_elements/1000)!=(new_size/1000)) TTCN_warning("New size of type @LLC_Types.XID_Information: %d",new_size);
#endif
val_ptr->n_elements = new_size;
} else if (new_size < val_ptr->n_elements) {
for (int elem_count = new_size; elem_count < val_ptr->n_elements; elem_count++)
if (val_ptr->value_elements[elem_count] != NULL)delete val_ptr->value_elements[elem_count];
val_ptr->value_elements = (XID**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}

boolean XID__Information::is_value() const
{
if (val_ptr == NULL) return FALSE;
for(int i = 0; i < val_ptr->n_elements; ++i) {
if (val_ptr->value_elements[i] == NULL || !val_ptr->value_elements[i]->is_value()) return FALSE;
}
return TRUE;
}

int XID__Information::size_of() const
{
if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @LLC_Types.XID_Information.");
return val_ptr->n_elements;
}

int XID__Information::lengthof() const
{
if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @LLC_Types.XID_Information.");
for (int my_length=val_ptr->n_elements; my_length>0; my_length--) if (val_ptr->value_elements[my_length-1] != NULL) return my_length;
return 0;
}

void XID__Information::log() const
{
if (val_ptr == NULL) {;
TTCN_Logger::log_event_unbound();
return;
}
switch (val_ptr->n_elements) {
case 0:
TTCN_Logger::log_event_str("{ }");
break;
default:
TTCN_Logger::log_event_str("{ ");
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
(*this)[elem_count].log();
}
TTCN_Logger::log_event_str(" }");
}
}

void XID__Information::set_implicit_omit()
{
if (val_ptr == NULL) return;
for (int i = 0; i < val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) val_ptr->value_elements[i]->set_implicit_omit();
}
}

void XID__Information::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE|Module_Param::BC_LIST, "record of value");
  switch (param.get_operation_type()) {
  case Module_Param::OT_ASSIGN:
    if (param.get_type()==Module_Param::MP_Value_List && param.get_size()==0) {
      *this = NULL_VALUE;
      return;
    }
    switch (param.get_type()) {
    case Module_Param::MP_Value_List:
      set_size(param.get_size());
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        if (curr->get_type()!=Module_Param::MP_NotUsed) {
          (*this)[i].set_param(*curr);
          if (!(*this)[i].is_bound()) {
            delete val_ptr->value_elements[i];
            val_ptr->value_elements[i] = NULL;
          }
        }
      }
      break;
    case Module_Param::MP_Indexed_List:
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        (*this)[curr->get_id()->get_index()].set_param(*curr);
        if (!(*this)[curr->get_id()->get_index()].is_bound()) {
          delete val_ptr->value_elements[curr->get_id()->get_index()];
          val_ptr->value_elements[curr->get_id()->get_index()] = NULL;
        }
      }
      break;
    default:
      param.type_error("record of value", "@LLC_Types.XID_Information");
    }
    break;
  case Module_Param::OT_CONCAT:
    switch (param.get_type()) {
    case Module_Param::MP_Value_List: {
      if (!is_bound()) *this = NULL_VALUE;
      int start_idx = lengthof();
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        if ((curr->get_type()!=Module_Param::MP_NotUsed)) {
          (*this)[start_idx+(int)i].set_param(*curr);
        }
      }
    } break;
    case Module_Param::MP_Indexed_List:
      param.error("Cannot concatenate an indexed value list");
      break;
    default:
      param.type_error("record of value", "@LLC_Types.XID_Information");
    }
    break;
  default:
    TTCN_error("Internal error: Unknown operation type.");
  }
}

void XID__Information::encode_text(Text_Buf& text_buf) const
{
if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @LLC_Types.XID_Information.");
text_buf.push_int(val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++)
(*this)[elem_count].encode_text(text_buf);
}

void XID__Information::decode_text(Text_Buf& text_buf)
{
clean_up();
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = text_buf.pull_int().get_val();
if (val_ptr->n_elements < 0) TTCN_error("Text decoder: Negative size was received for a value of type @LLC_Types.XID_Information.");
val_ptr->value_elements = (XID**)allocate_pointers(val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) {
val_ptr->value_elements[elem_count] = new XID;
val_ptr->value_elements[elem_count]->decode_text(text_buf);
}
}

void XID__Information::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void XID__Information::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int XID__Information::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean /*no_err*/, int sel_field, boolean first_call, const RAW_Force_Omit*){
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  int decoded_length=0;
  int decoded_field_length=0;
  size_t start_of_field=0;
  if(first_call) {
    clean_up();
    val_ptr=new recordof_setof_struct;
    val_ptr->ref_count=1;
    val_ptr->n_elements=0;
    val_ptr->value_elements=NULL;
  }
  int start_field=val_ptr->n_elements;
  if(p_td.raw->fieldlength || sel_field!=-1){
    int a=0;
    if(sel_field==-1) sel_field=p_td.raw->fieldlength;
    start_of_field=p_buf.get_pos_bit();
    for(a=0;a<sel_field;a++){
      decoded_field_length=(*this)[a+start_field].RAW_decode(*p_td.oftype_descr,p_buf,limit,top_bit_ord,TRUE);
      if(decoded_field_length < 0){
        while(a>=0){
          delete &(*this)[a+start_field];
          a--;
          val_ptr->n_elements--;
        }
        p_buf.set_pos_bit(start_of_field);
        return decoded_field_length;
      }
      decoded_length+=decoded_field_length;
      limit-=decoded_field_length;
    }
    if(a==0) val_ptr->n_elements=0;
  } else {
    if(limit==0){
      if(!first_call) return -1;
      val_ptr->n_elements=0;
      return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength;
    }
    int a=start_field;
    while(limit>0){
      start_of_field=p_buf.get_pos_bit();
      decoded_field_length=(*this)[a].RAW_decode(*p_td.oftype_descr,p_buf,limit,top_bit_ord,TRUE);
      if(decoded_field_length < 0){
        delete &(*this)[a];
        val_ptr->n_elements--;
        p_buf.set_pos_bit(start_of_field);
        if(a>start_field){
        return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength;
        } else return -1;
      }
      decoded_length+=decoded_field_length;
      limit-=decoded_field_length;
      a++;
    }
  }
 return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength;
}

int XID__Information::RAW_encode(const TTCN_Typedescriptor_t& p_td,RAW_enc_tree& myleaf) const{
  int encoded_length=0;
  int encoded_num_of_records=p_td.raw->fieldlength?smaller(val_ptr->n_elements, p_td.raw->fieldlength):val_ptr->n_elements;
  myleaf.isleaf=FALSE;
  myleaf.rec_of=TRUE;
  myleaf.body.node.num_of_nodes=encoded_num_of_records;
  myleaf.body.node.nodes=init_nodes_of_enc_tree(encoded_num_of_records);
  for(int a=0;a<encoded_num_of_records;a++){
    myleaf.body.node.nodes[a]=new RAW_enc_tree(TRUE,&myleaf,&(myleaf.curr_pos),a,p_td.oftype_descr->raw);
    encoded_length+=(*this)[a].RAW_encode(*p_td.oftype_descr,*myleaf.body.node.nodes[a]);
  }
 return myleaf.length=encoded_length;
}

void XID__Information_template::copy_value(const XID__Information& other_value)
{
if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @LLC_Types.XID_Information with an unbound value.");
single_value.n_elements = other_value.size_of();
single_value.value_elements = (XID_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (other_value[elem_count].is_bound()) {
single_value.value_elements[elem_count] = new XID_template(other_value[elem_count]);
} else {
single_value.value_elements[elem_count] = new XID_template;
}
}
set_selection(SPECIFIC_VALUE);
}

void XID__Information_template::copy_template(const XID__Information_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value.n_elements = other_value.single_value.n_elements;
single_value.value_elements = (XID_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (UNINITIALIZED_TEMPLATE != other_value.single_value.value_elements[elem_count]->get_selection()) {
single_value.value_elements[elem_count] = new XID_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new XID_template;
}
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new XID__Information_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new XID__Information_template(*other_value.implication_.precondition);
implication_.implied_template = new XID__Information_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.XID_Information.");
break;
}
set_selection(other_value);
}

boolean XID__Information_template::match_function_specific(const Base_Type *value_ptr, int value_index, const Restricted_Length_Template *template_ptr, int template_index, boolean legacy)
{
if (value_index >= 0) return ((const XID__Information_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const XID__Information*)value_ptr)[value_index], legacy);
else return ((const XID__Information_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit();
}

XID__Information_template::XID__Information_template()
{
}

XID__Information_template::XID__Information_template(template_sel other_value)
 : Base_Record_Of_Template(other_value)
{
check_single_selection(other_value);
}

XID__Information_template::XID__Information_template(null_type)
 : Base_Record_Of_Template(SPECIFIC_VALUE)
{
single_value.n_elements = 0;
single_value.value_elements = NULL;
}

XID__Information_template::XID__Information_template(const XID__Information& other_value)
{
copy_value(other_value);
}

XID__Information_template::XID__Information_template(const OPTIONAL<XID__Information>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const XID__Information&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.XID_Information from an unbound optional field.");
}
}

XID__Information_template::XID__Information_template(XID__Information_template* p_precondition, XID__Information_template* p_implied_template)
 : Base_Record_Of_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

XID__Information_template::XID__Information_template(Dynamic_Match_Interface<XID__Information>* p_dyn_match)
 : Base_Record_Of_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<XID__Information>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

XID__Information_template::XID__Information_template(const XID__Information_template& other_value)
 : Base_Record_Of_Template()
{
copy_template(other_value);
}

XID__Information_template::~XID__Information_template()
{
clean_up();
}

void XID__Information_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
delete single_value.value_elements[elem_count];
free_pointers((void**)single_value.value_elements);
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

XID__Information_template& XID__Information_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

XID__Information_template& XID__Information_template::operator=(null_type)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value.n_elements = 0;
single_value.value_elements = NULL;
return *this;
}

XID__Information_template& XID__Information_template::operator=(const XID__Information& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

XID__Information_template& XID__Information_template::operator=(const OPTIONAL<XID__Information>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const XID__Information&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.XID_Information.");
}
return *this;
}

XID__Information_template& XID__Information_template::operator=(const XID__Information_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

XID_template& XID__Information_template::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @LLC_Types.XID_Information using a negative index: %d.", index_value);
switch (template_selection)
{
  case SPECIFIC_VALUE:
    if(index_value < single_value.n_elements) break;
    // no break
  case OMIT_VALUE:
  case ANY_VALUE:
  case ANY_OR_OMIT:
  case UNINITIALIZED_TEMPLATE:
    set_size(index_value + 1);
    break;
  default:
    TTCN_error("Accessing an element of a non-specific template for type @LLC_Types.XID_Information.");
    break;
}
return *single_value.value_elements[index_value];
}

XID_template& XID__Information_template::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @LLC_Types.XID_Information.");
return (*this)[(int)index_value];
}

const XID_template& XID__Information_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @LLC_Types.XID_Information using a negative index: %d.", index_value);
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @LLC_Types.XID_Information.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @LLC_Types.XID_Information: The index is %d, but the template has only %d elements.", index_value, single_value.n_elements);
return *single_value.value_elements[index_value];
}

const XID_template& XID__Information_template::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @LLC_Types.XID_Information.");
return (*this)[(int)index_value];
}

void XID__Information_template::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @LLC_Types.XID_Information.");
template_sel old_selection = template_selection;
if (old_selection != SPECIFIC_VALUE) {
clean_up();
set_selection(SPECIFIC_VALUE);
single_value.n_elements = 0;
single_value.value_elements = NULL;
}
if (new_size > single_value.n_elements) {
single_value.value_elements = (XID_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++)
single_value.value_elements[elem_count] = new XID_template(ANY_VALUE);
} else {
for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++)
single_value.value_elements[elem_count] = new XID_template;
}
single_value.n_elements = new_size;
} else if (new_size < single_value.n_elements) {
for (int elem_count = new_size; elem_count < single_value.n_elements; elem_count++)
delete single_value.value_elements[elem_count];
single_value.value_elements = (XID_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}

int XID__Information_template::n_elem() const
{
  switch (template_selection) {
  case SPECIFIC_VALUE:
    return single_value.n_elements;
    break;
  case VALUE_LIST:
    return value_list.n_values;
    break;
  default:
    TTCN_error("Performing n_elem");
  }
}

int XID__Information_template::size_of(boolean is_size) const
{
const char* op_name = is_size ? "size" : "length";
int min_size;
boolean has_any_or_none;
if (is_ifpresent) TTCN_error("Performing %sof() operation on a template of type @LLC_Types.XID_Information which has an ifpresent attribute.", op_name);
switch (template_selection)
{
case SPECIFIC_VALUE: {
  min_size = 0;
  has_any_or_none = FALSE;
  int elem_count = single_value.n_elements;
  if (!is_size) { while (elem_count>0 && !single_value.value_elements[elem_count-1]->is_bound()) elem_count--; }
  for (int i=0; i<elem_count; i++) {
    switch (single_value.value_elements[i]->get_selection()) {
    case OMIT_VALUE:
      TTCN_error("Performing %sof() operation on a template of type @LLC_Types.XID_Information containing omit element.", op_name);
    case ANY_OR_OMIT:
      has_any_or_none = TRUE;
      break;
    default:
      min_size++;
      break;
    }
  }
} break;
case OMIT_VALUE:
  TTCN_error("Performing %sof() operation on a template of type @LLC_Types.XID_Information containing omit value.", op_name);
case ANY_VALUE:
case ANY_OR_OMIT:
  min_size = 0;
  has_any_or_none = TRUE;
  break;
case VALUE_LIST:
{
  if (value_list.n_values<1)
    TTCN_error("Performing %sof() operation on a template of type @LLC_Types.XID_Information containing an empty list.", op_name);
  int item_size = value_list.list_value[0].size_of(is_size);
  for (unsigned int i = 1; i < value_list.n_values; i++) {
    if (value_list.list_value[i].size_of(is_size)!=item_size)
      TTCN_error("Performing %sof() operation on a template of type @LLC_Types.XID_Information containing a value list with different sizes.", op_name);
  }
  min_size = item_size;
  has_any_or_none = FALSE;
  break;
}
case COMPLEMENTED_LIST:
  TTCN_error("Performing %sof() operation on a template of type @LLC_Types.XID_Information containing complemented list.", op_name);
default:
  TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @LLC_Types.XID_Information.", op_name);
}
return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @LLC_Types.XID_Information");
}

boolean XID__Information_template::match(const XID__Information& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
int value_length = other_value.size_of();
if (!match_length(value_length)) return FALSE;
switch (template_selection) {
case SPECIFIC_VALUE:
return match_record_of(&other_value, value_length, this, single_value.n_elements, match_function_specific, legacy);
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching with an uninitialized/unsupported template of type @LLC_Types.XID_Information.");
}
return FALSE;
}

boolean XID__Information_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
if (!single_value.value_elements[elem_count]->is_value()) return FALSE;
return TRUE;
}

XID__Information XID__Information_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.XID_Information.");
XID__Information ret_val;
ret_val.set_size(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
if (single_value.value_elements[elem_count]->is_bound()) {
ret_val[elem_count] = single_value.value_elements[elem_count]->valueof();
}
return ret_val;
}

XID__Information XID__Information_template::substr(int index, int returncount) const
{
if (!is_value()) TTCN_error("The first argument of function substr() is a template with non-specific value.");
return valueof().substr(index, returncount);
}

XID__Information XID__Information_template::replace(int index, int len, const XID__Information_template& repl) const
{
if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value.");
if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value.");
return valueof().replace(index, len, repl.valueof());
}

XID__Information XID__Information_template::replace(int index, int len, const XID__Information& repl) const
{
if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value.");
return valueof().replace(index, len, repl);
}

void XID__Information_template::set_type(template_sel template_type, unsigned int list_length)
{
clean_up();
switch (template_type) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = list_length;
value_list.list_value = new XID__Information_template[list_length];
break;
default:
TTCN_error("Internal error: Setting an invalid type for a template of type @LLC_Types.XID_Information.");
}
set_selection(template_type);
}

XID__Information_template& XID__Information_template::list_item(unsigned int list_index)
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Internal error: Accessing a list element of a non-list template of type @LLC_Types.XID_Information.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @LLC_Types.XID_Information.");
return value_list.list_value[list_index];
}

void XID__Information_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.n_elements > 0) {
TTCN_Logger::log_event_str("{ ");
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
if (permutation_starts_at(elem_count)) TTCN_Logger::log_event_str("permutation(");
single_value.value_elements[elem_count]->log();
if (permutation_ends_at(elem_count)) TTCN_Logger::log_char(')');
}
TTCN_Logger::log_event_str(" }");
} else TTCN_Logger::log_event_str("{ }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_restricted();
log_ifpresent();
}

void XID__Information_template::log_match(const XID__Information& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
}else{
if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if(!single_value.value_elements[elem_count]->match(match_value[elem_count], legacy)){
TTCN_Logger::log_logmatch_info("[%d]", elem_count);
single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
log_match_length(single_value.n_elements);
} else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) {
TTCN_Logger::log_event_str("{ ");
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy);
}
TTCN_Logger::log_event_str(" }");
log_match_length(single_value.n_elements);
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void XID__Information_template::encode_text(Text_Buf& text_buf) const
{
encode_text_permutation(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
text_buf.push_int(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
single_value.value_elements[elem_count]->encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.XID_Information.");
}
}

void XID__Information_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_permutation(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value.n_elements = text_buf.pull_int().get_val();
if (single_value.n_elements < 0) TTCN_error("Text decoder: Negative size was received for a template of type @LLC_Types.XID_Information.");
single_value.value_elements = (XID_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
single_value.value_elements[elem_count] = new XID_template;
single_value.value_elements[elem_count]->decode_text(text_buf);
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new XID__Information_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of type @LLC_Types.XID_Information.");
}
}

boolean XID__Information_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean XID__Information_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int i=0; i<value_list.n_values; i++)
if (value_list.list_value[i].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

void XID__Information_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
for (int i = 0; i < single_value.n_elements; i++) {
if (single_value.value_elements[i] != NULL) single_value.value_elements[i]->set_implicit_omit();
}
}

void XID__Information_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE|Module_Param::BC_LIST, "record of template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    XID__Information_template temp;
    temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = temp;
    break; }
  case Module_Param::MP_Indexed_List:
    if (template_selection!=SPECIFIC_VALUE) set_size(0);
    for (size_t p_i=0; p_i<param.get_size(); ++p_i) {
      (*this)[(int)(param.get_elem(p_i)->get_id()->get_index())].set_param(*param.get_elem(p_i));
    }
    break;
  case Module_Param::MP_Value_List: {
    set_size(param.get_size());
    int curr_idx = 0;
    for (size_t p_i=0; p_i<param.get_size(); ++p_i) {
      switch (param.get_elem(p_i)->get_type()) {
      case Module_Param::MP_NotUsed:
        curr_idx++;
        break;
      case Module_Param::MP_Permutation_Template: {
        int perm_start_idx = curr_idx;
        Module_Param* param_i = param.get_elem(p_i);
        for (size_t perm_i=0; perm_i<param_i->get_size(); perm_i++) {
          (*this)[curr_idx].set_param(*(param_i->get_elem(perm_i)));
          curr_idx++;
        }
        int perm_end_idx = curr_idx - 1;
        add_permutation(perm_start_idx, perm_end_idx);
      } break;
      default:
        (*this)[curr_idx].set_param(*param.get_elem(p_i));
        curr_idx++;
      }
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    XID__Information_template* precondition = new XID__Information_template;
    precondition->set_param(*param.get_elem(0));
    XID__Information_template* implied_template = new XID__Information_template;
    implied_template->set_param(*param.get_elem(1));
    *this = XID__Information_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record of template", "@LLC_Types.XID_Information");
  }
  is_ifpresent = param.get_ifpresent();
  set_length_range(param);
}

void XID__Information_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
for (int i=0; i<single_value.n_elements; i++) single_value.value_elements[i]->check_restriction(t_res, t_name ? t_name : "@LLC_Types.XID_Information");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.XID_Information");
}

boolean XID__Information_template::get_istemplate_kind(const char* type) const {
if (!strcmp(type, "AnyElement")) {
  if (template_selection != SPECIFIC_VALUE) {
    return FALSE;
  }
  for (int i = 0; i < single_value.n_elements; i++) {
    if (single_value.value_elements[i]->get_selection() == ANY_VALUE) {
      return TRUE;
    }
  }
  return FALSE;
} else if (!strcmp(type, "AnyElementsOrNone")) {
  if (template_selection != SPECIFIC_VALUE) {
    return FALSE;
  }
  for (int i = 0; i < single_value.n_elements; i++) {
    if (single_value.value_elements[i]->get_selection() == ANY_OR_OMIT) {
      return TRUE;
    }
  }
  return FALSE;
} else if (!strcmp(type, "permutation")) {
  return number_of_permutations;
} else if (!strcmp(type, "length")) {
  return length_restriction_type != NO_LENGTH_RESTRICTION;
} else {
  return Base_Template::get_istemplate_kind(type);
}
}
FRMR__Information::FRMR__Information()
{
}

FRMR__Information::FRMR__Information(const RejectedFrameControlField& par_rejectedFrameControlField,
    const BITSTRING& par_spare1,
    const BITSTRING& par_vS,
    const BITSTRING& par_spare2,
    const BITSTRING& par_vR,
    const BITSTRING& par_cR,
    const BITSTRING& par_spare3,
    const BITSTRING& par_w4,
    const BITSTRING& par_w3,
    const BITSTRING& par_w2,
    const BITSTRING& par_w1)
  :   field_rejectedFrameControlField(par_rejectedFrameControlField),
  field_spare1(par_spare1),
  field_vS(par_vS),
  field_spare2(par_spare2),
  field_vR(par_vR),
  field_cR(par_cR),
  field_spare3(par_spare3),
  field_w4(par_w4),
  field_w3(par_w3),
  field_w2(par_w2),
  field_w1(par_w1)
{
}

FRMR__Information::FRMR__Information(const FRMR__Information& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.FRMR_Information.");
if (other_value.rejectedFrameControlField().is_bound()) field_rejectedFrameControlField = other_value.rejectedFrameControlField();
else field_rejectedFrameControlField.clean_up();
if (other_value.spare1().is_bound()) field_spare1 = other_value.spare1();
else field_spare1.clean_up();
if (other_value.vS().is_bound()) field_vS = other_value.vS();
else field_vS.clean_up();
if (other_value.spare2().is_bound()) field_spare2 = other_value.spare2();
else field_spare2.clean_up();
if (other_value.vR().is_bound()) field_vR = other_value.vR();
else field_vR.clean_up();
if (other_value.cR().is_bound()) field_cR = other_value.cR();
else field_cR.clean_up();
if (other_value.spare3().is_bound()) field_spare3 = other_value.spare3();
else field_spare3.clean_up();
if (other_value.w4().is_bound()) field_w4 = other_value.w4();
else field_w4.clean_up();
if (other_value.w3().is_bound()) field_w3 = other_value.w3();
else field_w3.clean_up();
if (other_value.w2().is_bound()) field_w2 = other_value.w2();
else field_w2.clean_up();
if (other_value.w1().is_bound()) field_w1 = other_value.w1();
else field_w1.clean_up();
}

void FRMR__Information::clean_up()
{
field_rejectedFrameControlField.clean_up();
field_spare1.clean_up();
field_vS.clean_up();
field_spare2.clean_up();
field_vR.clean_up();
field_cR.clean_up();
field_spare3.clean_up();
field_w4.clean_up();
field_w3.clean_up();
field_w2.clean_up();
field_w1.clean_up();
}

const TTCN_Typedescriptor_t* FRMR__Information::get_descriptor() const { return &FRMR__Information_descr_; }
FRMR__Information& FRMR__Information::operator=(const FRMR__Information& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LLC_Types.FRMR_Information.");
  if (other_value.rejectedFrameControlField().is_bound()) field_rejectedFrameControlField = other_value.rejectedFrameControlField();
  else field_rejectedFrameControlField.clean_up();
  if (other_value.spare1().is_bound()) field_spare1 = other_value.spare1();
  else field_spare1.clean_up();
  if (other_value.vS().is_bound()) field_vS = other_value.vS();
  else field_vS.clean_up();
  if (other_value.spare2().is_bound()) field_spare2 = other_value.spare2();
  else field_spare2.clean_up();
  if (other_value.vR().is_bound()) field_vR = other_value.vR();
  else field_vR.clean_up();
  if (other_value.cR().is_bound()) field_cR = other_value.cR();
  else field_cR.clean_up();
  if (other_value.spare3().is_bound()) field_spare3 = other_value.spare3();
  else field_spare3.clean_up();
  if (other_value.w4().is_bound()) field_w4 = other_value.w4();
  else field_w4.clean_up();
  if (other_value.w3().is_bound()) field_w3 = other_value.w3();
  else field_w3.clean_up();
  if (other_value.w2().is_bound()) field_w2 = other_value.w2();
  else field_w2.clean_up();
  if (other_value.w1().is_bound()) field_w1 = other_value.w1();
  else field_w1.clean_up();
}
return *this;
}

boolean FRMR__Information::operator==(const FRMR__Information& other_value) const
{
return field_rejectedFrameControlField==other_value.field_rejectedFrameControlField
  && field_spare1==other_value.field_spare1
  && field_vS==other_value.field_vS
  && field_spare2==other_value.field_spare2
  && field_vR==other_value.field_vR
  && field_cR==other_value.field_cR
  && field_spare3==other_value.field_spare3
  && field_w4==other_value.field_w4
  && field_w3==other_value.field_w3
  && field_w2==other_value.field_w2
  && field_w1==other_value.field_w1;
}

boolean FRMR__Information::is_bound() const
{
return (field_rejectedFrameControlField.is_bound())
  || (field_spare1.is_bound())
  || (field_vS.is_bound())
  || (field_spare2.is_bound())
  || (field_vR.is_bound())
  || (field_cR.is_bound())
  || (field_spare3.is_bound())
  || (field_w4.is_bound())
  || (field_w3.is_bound())
  || (field_w2.is_bound())
  || (field_w1.is_bound());
}
boolean FRMR__Information::is_value() const
{
return field_rejectedFrameControlField.is_value()
  && field_spare1.is_value()
  && field_vS.is_value()
  && field_spare2.is_value()
  && field_vR.is_value()
  && field_cR.is_value()
  && field_spare3.is_value()
  && field_w4.is_value()
  && field_w3.is_value()
  && field_w2.is_value()
  && field_w1.is_value();
}
void FRMR__Information::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ rejectedFrameControlField := ");
field_rejectedFrameControlField.log();
TTCN_Logger::log_event_str(", spare1 := ");
field_spare1.log();
TTCN_Logger::log_event_str(", vS := ");
field_vS.log();
TTCN_Logger::log_event_str(", spare2 := ");
field_spare2.log();
TTCN_Logger::log_event_str(", vR := ");
field_vR.log();
TTCN_Logger::log_event_str(", cR := ");
field_cR.log();
TTCN_Logger::log_event_str(", spare3 := ");
field_spare3.log();
TTCN_Logger::log_event_str(", w4 := ");
field_w4.log();
TTCN_Logger::log_event_str(", w3 := ");
field_w3.log();
TTCN_Logger::log_event_str(", w2 := ");
field_w2.log();
TTCN_Logger::log_event_str(", w1 := ");
field_w1.log();
TTCN_Logger::log_event_str(" }");
}

void FRMR__Information::set_implicit_omit()
{
if (rejectedFrameControlField().is_bound()) rejectedFrameControlField().set_implicit_omit();
if (spare1().is_bound()) spare1().set_implicit_omit();
if (vS().is_bound()) vS().set_implicit_omit();
if (spare2().is_bound()) spare2().set_implicit_omit();
if (vR().is_bound()) vR().set_implicit_omit();
if (cR().is_bound()) cR().set_implicit_omit();
if (spare3().is_bound()) spare3().set_implicit_omit();
if (w4().is_bound()) w4().set_implicit_omit();
if (w3().is_bound()) w3().set_implicit_omit();
if (w2().is_bound()) w2().set_implicit_omit();
if (w1().is_bound()) w1().set_implicit_omit();
}

void FRMR__Information::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (11<param.get_size()) {
      param.error("record value of type @LLC_Types.FRMR_Information has 11 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) rejectedFrameControlField().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare1().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) vS().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare2().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) vR().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) cR().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) spare3().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) w4().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) w3().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) w2().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) w1().set_param(*param.get_elem(10));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rejectedFrameControlField")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rejectedFrameControlField().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare1().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "vS")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          vS().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare2().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "vR")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          vR().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cR")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cR().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare3")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare3().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "w4")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          w4().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "w3")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          w3().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "w2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          w2().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "w1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          w1().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.FRMR_Information: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LLC_Types.FRMR_Information");
  }
}

void FRMR__Information::encode_text(Text_Buf& text_buf) const
{
field_rejectedFrameControlField.encode_text(text_buf);
field_spare1.encode_text(text_buf);
field_vS.encode_text(text_buf);
field_spare2.encode_text(text_buf);
field_vR.encode_text(text_buf);
field_cR.encode_text(text_buf);
field_spare3.encode_text(text_buf);
field_w4.encode_text(text_buf);
field_w3.encode_text(text_buf);
field_w2.encode_text(text_buf);
field_w1.encode_text(text_buf);
}

void FRMR__Information::decode_text(Text_Buf& text_buf)
{
field_rejectedFrameControlField.decode_text(text_buf);
field_spare1.decode_text(text_buf);
field_vS.decode_text(text_buf);
field_spare2.decode_text(text_buf);
field_vR.decode_text(text_buf);
field_cR.decode_text(text_buf);
field_spare3.decode_text(text_buf);
field_w4.decode_text(text_buf);
field_w3.decode_text(text_buf);
field_w2.decode_text(text_buf);
field_w1.decode_text(text_buf);
}

void FRMR__Information::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void FRMR__Information::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int FRMR__Information::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, FRMR__Information_rejectedFrameControlField_descr_.raw->forceomit);
  decoded_field_length = field_rejectedFrameControlField.RAW_decode(FRMR__Information_rejectedFrameControlField_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, FRMR__Information_spare1_descr_.raw->forceomit);
  decoded_field_length = field_spare1.RAW_decode(FRMR__Information_spare1_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_2_force_omit(2, force_omit, FRMR__Information_vS_descr_.raw->forceomit);
  decoded_field_length = field_vS.RAW_decode(FRMR__Information_vS_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_3_force_omit(3, force_omit, FRMR__Information_spare2_descr_.raw->forceomit);
  decoded_field_length = field_spare2.RAW_decode(FRMR__Information_spare2_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_4_force_omit(4, force_omit, FRMR__Information_vR_descr_.raw->forceomit);
  decoded_field_length = field_vR.RAW_decode(FRMR__Information_vR_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_4_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_5_force_omit(5, force_omit, FRMR__Information_cR_descr_.raw->forceomit);
  decoded_field_length = field_cR.RAW_decode(FRMR__Information_cR_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_6_force_omit(6, force_omit, FRMR__Information_spare3_descr_.raw->forceomit);
  decoded_field_length = field_spare3.RAW_decode(FRMR__Information_spare3_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_6_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_7_force_omit(7, force_omit, FRMR__Information_w4_descr_.raw->forceomit);
  decoded_field_length = field_w4.RAW_decode(FRMR__Information_w4_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_7_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_8_force_omit(8, force_omit, FRMR__Information_w3_descr_.raw->forceomit);
  decoded_field_length = field_w3.RAW_decode(FRMR__Information_w3_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_8_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_9_force_omit(9, force_omit, FRMR__Information_w2_descr_.raw->forceomit);
  decoded_field_length = field_w2.RAW_decode(FRMR__Information_w2_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_9_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_10_force_omit(10, force_omit, FRMR__Information_w1_descr_.raw->forceomit);
  decoded_field_length = field_w1.RAW_decode(FRMR__Information_w1_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_10_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int FRMR__Information::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 11;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(11);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, FRMR__Information_rejectedFrameControlField_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, FRMR__Information_spare1_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, FRMR__Information_vS_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, FRMR__Information_spare2_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, FRMR__Information_vR_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, FRMR__Information_cR_descr_.raw);
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, FRMR__Information_spare3_descr_.raw);
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, FRMR__Information_w4_descr_.raw);
  myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, FRMR__Information_w3_descr_.raw);
  myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, FRMR__Information_w2_descr_.raw);
  myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 10, FRMR__Information_w1_descr_.raw);
  encoded_length += field_rejectedFrameControlField.RAW_encode(FRMR__Information_rejectedFrameControlField_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_spare1.RAW_encode(FRMR__Information_spare1_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_vS.RAW_encode(FRMR__Information_vS_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_spare2.RAW_encode(FRMR__Information_spare2_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_vR.RAW_encode(FRMR__Information_vR_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_cR.RAW_encode(FRMR__Information_cR_descr_, *myleaf.body.node.nodes[5]);
  encoded_length += field_spare3.RAW_encode(FRMR__Information_spare3_descr_, *myleaf.body.node.nodes[6]);
  encoded_length += field_w4.RAW_encode(FRMR__Information_w4_descr_, *myleaf.body.node.nodes[7]);
  encoded_length += field_w3.RAW_encode(FRMR__Information_w3_descr_, *myleaf.body.node.nodes[8]);
  encoded_length += field_w2.RAW_encode(FRMR__Information_w2_descr_, *myleaf.body.node.nodes[9]);
  encoded_length += field_w1.RAW_encode(FRMR__Information_w1_descr_, *myleaf.body.node.nodes[10]);
  return myleaf.length = encoded_length;
}

struct FRMR__Information_template::single_value_struct {
RejectedFrameControlField_template field_rejectedFrameControlField;
BITSTRING_template field_spare1;
BITSTRING_template field_vS;
BITSTRING_template field_spare2;
BITSTRING_template field_vR;
BITSTRING_template field_cR;
BITSTRING_template field_spare3;
BITSTRING_template field_w4;
BITSTRING_template field_w3;
BITSTRING_template field_w2;
BITSTRING_template field_w1;
};

void FRMR__Information_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_rejectedFrameControlField = ANY_VALUE;
single_value->field_spare1 = ANY_VALUE;
single_value->field_vS = ANY_VALUE;
single_value->field_spare2 = ANY_VALUE;
single_value->field_vR = ANY_VALUE;
single_value->field_cR = ANY_VALUE;
single_value->field_spare3 = ANY_VALUE;
single_value->field_w4 = ANY_VALUE;
single_value->field_w3 = ANY_VALUE;
single_value->field_w2 = ANY_VALUE;
single_value->field_w1 = ANY_VALUE;
}
}
}

void FRMR__Information_template::copy_value(const FRMR__Information& other_value)
{
single_value = new single_value_struct;
if (other_value.rejectedFrameControlField().is_bound()) {
  single_value->field_rejectedFrameControlField = other_value.rejectedFrameControlField();
} else {
  single_value->field_rejectedFrameControlField.clean_up();
}
if (other_value.spare1().is_bound()) {
  single_value->field_spare1 = other_value.spare1();
} else {
  single_value->field_spare1.clean_up();
}
if (other_value.vS().is_bound()) {
  single_value->field_vS = other_value.vS();
} else {
  single_value->field_vS.clean_up();
}
if (other_value.spare2().is_bound()) {
  single_value->field_spare2 = other_value.spare2();
} else {
  single_value->field_spare2.clean_up();
}
if (other_value.vR().is_bound()) {
  single_value->field_vR = other_value.vR();
} else {
  single_value->field_vR.clean_up();
}
if (other_value.cR().is_bound()) {
  single_value->field_cR = other_value.cR();
} else {
  single_value->field_cR.clean_up();
}
if (other_value.spare3().is_bound()) {
  single_value->field_spare3 = other_value.spare3();
} else {
  single_value->field_spare3.clean_up();
}
if (other_value.w4().is_bound()) {
  single_value->field_w4 = other_value.w4();
} else {
  single_value->field_w4.clean_up();
}
if (other_value.w3().is_bound()) {
  single_value->field_w3 = other_value.w3();
} else {
  single_value->field_w3.clean_up();
}
if (other_value.w2().is_bound()) {
  single_value->field_w2 = other_value.w2();
} else {
  single_value->field_w2.clean_up();
}
if (other_value.w1().is_bound()) {
  single_value->field_w1 = other_value.w1();
} else {
  single_value->field_w1.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void FRMR__Information_template::copy_template(const FRMR__Information_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.rejectedFrameControlField().get_selection()) {
single_value->field_rejectedFrameControlField = other_value.rejectedFrameControlField();
} else {
single_value->field_rejectedFrameControlField.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare1().get_selection()) {
single_value->field_spare1 = other_value.spare1();
} else {
single_value->field_spare1.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.vS().get_selection()) {
single_value->field_vS = other_value.vS();
} else {
single_value->field_vS.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare2().get_selection()) {
single_value->field_spare2 = other_value.spare2();
} else {
single_value->field_spare2.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.vR().get_selection()) {
single_value->field_vR = other_value.vR();
} else {
single_value->field_vR.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.cR().get_selection()) {
single_value->field_cR = other_value.cR();
} else {
single_value->field_cR.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare3().get_selection()) {
single_value->field_spare3 = other_value.spare3();
} else {
single_value->field_spare3.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.w4().get_selection()) {
single_value->field_w4 = other_value.w4();
} else {
single_value->field_w4.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.w3().get_selection()) {
single_value->field_w3 = other_value.w3();
} else {
single_value->field_w3.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.w2().get_selection()) {
single_value->field_w2 = other_value.w2();
} else {
single_value->field_w2.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.w1().get_selection()) {
single_value->field_w1 = other_value.w1();
} else {
single_value->field_w1.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new FRMR__Information_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new FRMR__Information_template(*other_value.implication_.precondition);
implication_.implied_template = new FRMR__Information_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.FRMR_Information.");
break;
}
set_selection(other_value);
}

FRMR__Information_template::FRMR__Information_template()
{
}

FRMR__Information_template::FRMR__Information_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

FRMR__Information_template::FRMR__Information_template(const FRMR__Information& other_value)
{
copy_value(other_value);
}

FRMR__Information_template::FRMR__Information_template(const OPTIONAL<FRMR__Information>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const FRMR__Information&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.FRMR_Information from an unbound optional field.");
}
}

FRMR__Information_template::FRMR__Information_template(FRMR__Information_template* p_precondition, FRMR__Information_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

FRMR__Information_template::FRMR__Information_template(Dynamic_Match_Interface<FRMR__Information>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<FRMR__Information>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

FRMR__Information_template::FRMR__Information_template(const FRMR__Information_template& other_value)
: Base_Template()
{
copy_template(other_value);
}

FRMR__Information_template::~FRMR__Information_template()
{
clean_up();
}

FRMR__Information_template& FRMR__Information_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

FRMR__Information_template& FRMR__Information_template::operator=(const FRMR__Information& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

FRMR__Information_template& FRMR__Information_template::operator=(const OPTIONAL<FRMR__Information>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const FRMR__Information&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.FRMR_Information.");
}
return *this;
}

FRMR__Information_template& FRMR__Information_template::operator=(const FRMR__Information_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean FRMR__Information_template::match(const FRMR__Information& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.rejectedFrameControlField().is_bound()) return FALSE;
if(!single_value->field_rejectedFrameControlField.match(other_value.rejectedFrameControlField(), legacy))return FALSE;
if(!other_value.spare1().is_bound()) return FALSE;
if(!single_value->field_spare1.match(other_value.spare1(), legacy))return FALSE;
if(!other_value.vS().is_bound()) return FALSE;
if(!single_value->field_vS.match(other_value.vS(), legacy))return FALSE;
if(!other_value.spare2().is_bound()) return FALSE;
if(!single_value->field_spare2.match(other_value.spare2(), legacy))return FALSE;
if(!other_value.vR().is_bound()) return FALSE;
if(!single_value->field_vR.match(other_value.vR(), legacy))return FALSE;
if(!other_value.cR().is_bound()) return FALSE;
if(!single_value->field_cR.match(other_value.cR(), legacy))return FALSE;
if(!other_value.spare3().is_bound()) return FALSE;
if(!single_value->field_spare3.match(other_value.spare3(), legacy))return FALSE;
if(!other_value.w4().is_bound()) return FALSE;
if(!single_value->field_w4.match(other_value.w4(), legacy))return FALSE;
if(!other_value.w3().is_bound()) return FALSE;
if(!single_value->field_w3.match(other_value.w3(), legacy))return FALSE;
if(!other_value.w2().is_bound()) return FALSE;
if(!single_value->field_w2.match(other_value.w2(), legacy))return FALSE;
if(!other_value.w1().is_bound()) return FALSE;
if(!single_value->field_w1.match(other_value.w1(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @LLC_Types.FRMR_Information.");
}
return FALSE;
}

boolean FRMR__Information_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_rejectedFrameControlField.is_bound()
 || single_value->field_spare1.is_bound()
 || single_value->field_vS.is_bound()
 || single_value->field_spare2.is_bound()
 || single_value->field_vR.is_bound()
 || single_value->field_cR.is_bound()
 || single_value->field_spare3.is_bound()
 || single_value->field_w4.is_bound()
 || single_value->field_w3.is_bound()
 || single_value->field_w2.is_bound()
 || single_value->field_w1.is_bound();
}

boolean FRMR__Information_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_rejectedFrameControlField.is_value()
 && single_value->field_spare1.is_value()
 && single_value->field_vS.is_value()
 && single_value->field_spare2.is_value()
 && single_value->field_vR.is_value()
 && single_value->field_cR.is_value()
 && single_value->field_spare3.is_value()
 && single_value->field_w4.is_value()
 && single_value->field_w3.is_value()
 && single_value->field_w2.is_value()
 && single_value->field_w1.is_value();
}

void FRMR__Information_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

FRMR__Information FRMR__Information_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.FRMR_Information.");
FRMR__Information ret_val;
if (single_value->field_rejectedFrameControlField.is_bound()) {
ret_val.rejectedFrameControlField() = single_value->field_rejectedFrameControlField.valueof();
}
if (single_value->field_spare1.is_bound()) {
ret_val.spare1() = single_value->field_spare1.valueof();
}
if (single_value->field_vS.is_bound()) {
ret_val.vS() = single_value->field_vS.valueof();
}
if (single_value->field_spare2.is_bound()) {
ret_val.spare2() = single_value->field_spare2.valueof();
}
if (single_value->field_vR.is_bound()) {
ret_val.vR() = single_value->field_vR.valueof();
}
if (single_value->field_cR.is_bound()) {
ret_val.cR() = single_value->field_cR.valueof();
}
if (single_value->field_spare3.is_bound()) {
ret_val.spare3() = single_value->field_spare3.valueof();
}
if (single_value->field_w4.is_bound()) {
ret_val.w4() = single_value->field_w4.valueof();
}
if (single_value->field_w3.is_bound()) {
ret_val.w3() = single_value->field_w3.valueof();
}
if (single_value->field_w2.is_bound()) {
ret_val.w2() = single_value->field_w2.valueof();
}
if (single_value->field_w1.is_bound()) {
ret_val.w1() = single_value->field_w1.valueof();
}
return ret_val;
}

void FRMR__Information_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH)
TTCN_error("Setting an invalid list for a template of type @LLC_Types.FRMR_Information.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new FRMR__Information_template[list_length];
}

FRMR__Information_template& FRMR__Information_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH)
TTCN_error("Accessing a list element of a non-list template of type @LLC_Types.FRMR_Information.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LLC_Types.FRMR_Information.");
return value_list.list_value[list_index];
}

RejectedFrameControlField_template& FRMR__Information_template::rejectedFrameControlField()
{
set_specific();
return single_value->field_rejectedFrameControlField;
}

const RejectedFrameControlField_template& FRMR__Information_template::rejectedFrameControlField() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rejectedFrameControlField of a non-specific template of type @LLC_Types.FRMR_Information.");
return single_value->field_rejectedFrameControlField;
}

BITSTRING_template& FRMR__Information_template::spare1()
{
set_specific();
return single_value->field_spare1;
}

const BITSTRING_template& FRMR__Information_template::spare1() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare1 of a non-specific template of type @LLC_Types.FRMR_Information.");
return single_value->field_spare1;
}

BITSTRING_template& FRMR__Information_template::vS()
{
set_specific();
return single_value->field_vS;
}

const BITSTRING_template& FRMR__Information_template::vS() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field vS of a non-specific template of type @LLC_Types.FRMR_Information.");
return single_value->field_vS;
}

BITSTRING_template& FRMR__Information_template::spare2()
{
set_specific();
return single_value->field_spare2;
}

const BITSTRING_template& FRMR__Information_template::spare2() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare2 of a non-specific template of type @LLC_Types.FRMR_Information.");
return single_value->field_spare2;
}

BITSTRING_template& FRMR__Information_template::vR()
{
set_specific();
return single_value->field_vR;
}

const BITSTRING_template& FRMR__Information_template::vR() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field vR of a non-specific template of type @LLC_Types.FRMR_Information.");
return single_value->field_vR;
}

BITSTRING_template& FRMR__Information_template::cR()
{
set_specific();
return single_value->field_cR;
}

const BITSTRING_template& FRMR__Information_template::cR() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field cR of a non-specific template of type @LLC_Types.FRMR_Information.");
return single_value->field_cR;
}

BITSTRING_template& FRMR__Information_template::spare3()
{
set_specific();
return single_value->field_spare3;
}

const BITSTRING_template& FRMR__Information_template::spare3() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare3 of a non-specific template of type @LLC_Types.FRMR_Information.");
return single_value->field_spare3;
}

BITSTRING_template& FRMR__Information_template::w4()
{
set_specific();
return single_value->field_w4;
}

const BITSTRING_template& FRMR__Information_template::w4() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field w4 of a non-specific template of type @LLC_Types.FRMR_Information.");
return single_value->field_w4;
}

BITSTRING_template& FRMR__Information_template::w3()
{
set_specific();
return single_value->field_w3;
}

const BITSTRING_template& FRMR__Information_template::w3() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field w3 of a non-specific template of type @LLC_Types.FRMR_Information.");
return single_value->field_w3;
}

BITSTRING_template& FRMR__Information_template::w2()
{
set_specific();
return single_value->field_w2;
}

const BITSTRING_template& FRMR__Information_template::w2() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field w2 of a non-specific template of type @LLC_Types.FRMR_Information.");
return single_value->field_w2;
}

BITSTRING_template& FRMR__Information_template::w1()
{
set_specific();
return single_value->field_w1;
}

const BITSTRING_template& FRMR__Information_template::w1() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field w1 of a non-specific template of type @LLC_Types.FRMR_Information.");
return single_value->field_w1;
}

int FRMR__Information_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.FRMR_Information which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 11;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LLC_Types.FRMR_Information containing an empty list.");
      int item_size = value_list.list_value[0].size_of();
      for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++)
      {
        if (value_list.list_value[l_idx].size_of()!=item_size)
          TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.FRMR_Information containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.FRMR_Information containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.FRMR_Information containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.FRMR_Information containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.FRMR_Information containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.FRMR_Information containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.FRMR_Information containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LLC_Types.FRMR_Information.");
  }
  return 0;
}

void FRMR__Information_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ rejectedFrameControlField := ");
single_value->field_rejectedFrameControlField.log();
TTCN_Logger::log_event_str(", spare1 := ");
single_value->field_spare1.log();
TTCN_Logger::log_event_str(", vS := ");
single_value->field_vS.log();
TTCN_Logger::log_event_str(", spare2 := ");
single_value->field_spare2.log();
TTCN_Logger::log_event_str(", vR := ");
single_value->field_vR.log();
TTCN_Logger::log_event_str(", cR := ");
single_value->field_cR.log();
TTCN_Logger::log_event_str(", spare3 := ");
single_value->field_spare3.log();
TTCN_Logger::log_event_str(", w4 := ");
single_value->field_w4.log();
TTCN_Logger::log_event_str(", w3 := ");
single_value->field_w3.log();
TTCN_Logger::log_event_str(", w2 := ");
single_value->field_w2.log();
TTCN_Logger::log_event_str(", w1 := ");
single_value->field_w1.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void FRMR__Information_template::log_match(const FRMR__Information& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_rejectedFrameControlField.match(match_value.rejectedFrameControlField(), legacy)){
TTCN_Logger::log_logmatch_info(".rejectedFrameControlField");
single_value->field_rejectedFrameControlField.log_match(match_value.rejectedFrameControlField(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare1.match(match_value.spare1(), legacy)){
TTCN_Logger::log_logmatch_info(".spare1");
single_value->field_spare1.log_match(match_value.spare1(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_vS.match(match_value.vS(), legacy)){
TTCN_Logger::log_logmatch_info(".vS");
single_value->field_vS.log_match(match_value.vS(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare2.match(match_value.spare2(), legacy)){
TTCN_Logger::log_logmatch_info(".spare2");
single_value->field_spare2.log_match(match_value.spare2(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_vR.match(match_value.vR(), legacy)){
TTCN_Logger::log_logmatch_info(".vR");
single_value->field_vR.log_match(match_value.vR(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_cR.match(match_value.cR(), legacy)){
TTCN_Logger::log_logmatch_info(".cR");
single_value->field_cR.log_match(match_value.cR(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare3.match(match_value.spare3(), legacy)){
TTCN_Logger::log_logmatch_info(".spare3");
single_value->field_spare3.log_match(match_value.spare3(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_w4.match(match_value.w4(), legacy)){
TTCN_Logger::log_logmatch_info(".w4");
single_value->field_w4.log_match(match_value.w4(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_w3.match(match_value.w3(), legacy)){
TTCN_Logger::log_logmatch_info(".w3");
single_value->field_w3.log_match(match_value.w3(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_w2.match(match_value.w2(), legacy)){
TTCN_Logger::log_logmatch_info(".w2");
single_value->field_w2.log_match(match_value.w2(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_w1.match(match_value.w1(), legacy)){
TTCN_Logger::log_logmatch_info(".w1");
single_value->field_w1.log_match(match_value.w1(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ rejectedFrameControlField := ");
single_value->field_rejectedFrameControlField.log_match(match_value.rejectedFrameControlField(), legacy);
TTCN_Logger::log_event_str(", spare1 := ");
single_value->field_spare1.log_match(match_value.spare1(), legacy);
TTCN_Logger::log_event_str(", vS := ");
single_value->field_vS.log_match(match_value.vS(), legacy);
TTCN_Logger::log_event_str(", spare2 := ");
single_value->field_spare2.log_match(match_value.spare2(), legacy);
TTCN_Logger::log_event_str(", vR := ");
single_value->field_vR.log_match(match_value.vR(), legacy);
TTCN_Logger::log_event_str(", cR := ");
single_value->field_cR.log_match(match_value.cR(), legacy);
TTCN_Logger::log_event_str(", spare3 := ");
single_value->field_spare3.log_match(match_value.spare3(), legacy);
TTCN_Logger::log_event_str(", w4 := ");
single_value->field_w4.log_match(match_value.w4(), legacy);
TTCN_Logger::log_event_str(", w3 := ");
single_value->field_w3.log_match(match_value.w3(), legacy);
TTCN_Logger::log_event_str(", w2 := ");
single_value->field_w2.log_match(match_value.w2(), legacy);
TTCN_Logger::log_event_str(", w1 := ");
single_value->field_w1.log_match(match_value.w1(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void FRMR__Information_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (rejectedFrameControlField().is_bound()) rejectedFrameControlField().set_implicit_omit();
if (spare1().is_bound()) spare1().set_implicit_omit();
if (vS().is_bound()) vS().set_implicit_omit();
if (spare2().is_bound()) spare2().set_implicit_omit();
if (vR().is_bound()) vR().set_implicit_omit();
if (cR().is_bound()) cR().set_implicit_omit();
if (spare3().is_bound()) spare3().set_implicit_omit();
if (w4().is_bound()) w4().set_implicit_omit();
if (w3().is_bound()) w3().set_implicit_omit();
if (w2().is_bound()) w2().set_implicit_omit();
if (w1().is_bound()) w1().set_implicit_omit();
}

void FRMR__Information_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_rejectedFrameControlField.encode_text(text_buf);
single_value->field_spare1.encode_text(text_buf);
single_value->field_vS.encode_text(text_buf);
single_value->field_spare2.encode_text(text_buf);
single_value->field_vR.encode_text(text_buf);
single_value->field_cR.encode_text(text_buf);
single_value->field_spare3.encode_text(text_buf);
single_value->field_w4.encode_text(text_buf);
single_value->field_w3.encode_text(text_buf);
single_value->field_w2.encode_text(text_buf);
single_value->field_w1.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.FRMR_Information.");
}
}

void FRMR__Information_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_rejectedFrameControlField.decode_text(text_buf);
single_value->field_spare1.decode_text(text_buf);
single_value->field_vS.decode_text(text_buf);
single_value->field_spare2.decode_text(text_buf);
single_value->field_vR.decode_text(text_buf);
single_value->field_cR.decode_text(text_buf);
single_value->field_spare3.decode_text(text_buf);
single_value->field_w4.decode_text(text_buf);
single_value->field_w3.decode_text(text_buf);
single_value->field_w2.decode_text(text_buf);
single_value->field_w1.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new FRMR__Information_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @LLC_Types.FRMR_Information.");
}
}

void FRMR__Information_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    FRMR__Information_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (11<param.get_size()) {
      param.error("record template of type @LLC_Types.FRMR_Information has 11 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) rejectedFrameControlField().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare1().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) vS().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare2().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) vR().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) cR().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) spare3().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) w4().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) w3().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) w2().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) w1().set_param(*param.get_elem(10));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rejectedFrameControlField")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rejectedFrameControlField().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare1().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "vS")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          vS().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare2().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "vR")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          vR().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cR")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cR().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare3")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare3().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "w4")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          w4().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "w3")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          w3().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "w2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          w2().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "w1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          w1().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.FRMR_Information: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    FRMR__Information_template* precondition = new FRMR__Information_template;
    precondition->set_param(*param.get_elem(0));
    FRMR__Information_template* implied_template = new FRMR__Information_template;
    implied_template->set_param(*param.get_elem(1));
    *this = FRMR__Information_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LLC_Types.FRMR_Information");
  }
  is_ifpresent = param.get_ifpresent();
}

void FRMR__Information_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_rejectedFrameControlField.check_restriction(t_res, t_name ? t_name : "@LLC_Types.FRMR_Information");
single_value->field_spare1.check_restriction(t_res, t_name ? t_name : "@LLC_Types.FRMR_Information");
single_value->field_vS.check_restriction(t_res, t_name ? t_name : "@LLC_Types.FRMR_Information");
single_value->field_spare2.check_restriction(t_res, t_name ? t_name : "@LLC_Types.FRMR_Information");
single_value->field_vR.check_restriction(t_res, t_name ? t_name : "@LLC_Types.FRMR_Information");
single_value->field_cR.check_restriction(t_res, t_name ? t_name : "@LLC_Types.FRMR_Information");
single_value->field_spare3.check_restriction(t_res, t_name ? t_name : "@LLC_Types.FRMR_Information");
single_value->field_w4.check_restriction(t_res, t_name ? t_name : "@LLC_Types.FRMR_Information");
single_value->field_w3.check_restriction(t_res, t_name ? t_name : "@LLC_Types.FRMR_Information");
single_value->field_w2.check_restriction(t_res, t_name ? t_name : "@LLC_Types.FRMR_Information");
single_value->field_w1.check_restriction(t_res, t_name ? t_name : "@LLC_Types.FRMR_Information");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.FRMR_Information");
}

boolean FRMR__Information_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean FRMR__Information_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

Address__field::Address__field()
{
}

Address__field::Address__field(const BITSTRING& par_sAPI,
    const BITSTRING& par_spare,
    const BITSTRING& par_cR,
    const BITSTRING& par_pD)
  :   field_sAPI(par_sAPI),
  field_spare(par_spare),
  field_cR(par_cR),
  field_pD(par_pD)
{
}

Address__field::Address__field(const Address__field& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.Address_field.");
if (other_value.sAPI().is_bound()) field_sAPI = other_value.sAPI();
else field_sAPI.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.cR().is_bound()) field_cR = other_value.cR();
else field_cR.clean_up();
if (other_value.pD().is_bound()) field_pD = other_value.pD();
else field_pD.clean_up();
}

void Address__field::clean_up()
{
field_sAPI.clean_up();
field_spare.clean_up();
field_cR.clean_up();
field_pD.clean_up();
}

const TTCN_Typedescriptor_t* Address__field::get_descriptor() const { return &Address__field_descr_; }
Address__field& Address__field::operator=(const Address__field& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LLC_Types.Address_field.");
  if (other_value.sAPI().is_bound()) field_sAPI = other_value.sAPI();
  else field_sAPI.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.cR().is_bound()) field_cR = other_value.cR();
  else field_cR.clean_up();
  if (other_value.pD().is_bound()) field_pD = other_value.pD();
  else field_pD.clean_up();
}
return *this;
}

boolean Address__field::operator==(const Address__field& other_value) const
{
return field_sAPI==other_value.field_sAPI
  && field_spare==other_value.field_spare
  && field_cR==other_value.field_cR
  && field_pD==other_value.field_pD;
}

boolean Address__field::is_bound() const
{
return (field_sAPI.is_bound())
  || (field_spare.is_bound())
  || (field_cR.is_bound())
  || (field_pD.is_bound());
}
boolean Address__field::is_value() const
{
return field_sAPI.is_value()
  && field_spare.is_value()
  && field_cR.is_value()
  && field_pD.is_value();
}
void Address__field::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ sAPI := ");
field_sAPI.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(", cR := ");
field_cR.log();
TTCN_Logger::log_event_str(", pD := ");
field_pD.log();
TTCN_Logger::log_event_str(" }");
}

void Address__field::set_implicit_omit()
{
if (sAPI().is_bound()) sAPI().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (cR().is_bound()) cR().set_implicit_omit();
if (pD().is_bound()) pD().set_implicit_omit();
}

void Address__field::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (4<param.get_size()) {
      param.error("record value of type @LLC_Types.Address_field has 4 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) sAPI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) cR().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) pD().set_param(*param.get_elem(3));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "sAPI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sAPI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cR")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cR().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pD")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pD().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.Address_field: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LLC_Types.Address_field");
  }
}

void Address__field::encode_text(Text_Buf& text_buf) const
{
field_sAPI.encode_text(text_buf);
field_spare.encode_text(text_buf);
field_cR.encode_text(text_buf);
field_pD.encode_text(text_buf);
}

void Address__field::decode_text(Text_Buf& text_buf)
{
field_sAPI.decode_text(text_buf);
field_spare.decode_text(text_buf);
field_cR.decode_text(text_buf);
field_pD.decode_text(text_buf);
}

void Address__field::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void Address__field::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int Address__field::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::BIT4_descr_.raw->forceomit);
  decoded_field_length = field_sAPI.RAW_decode(General__Types::BIT4_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::BIT2_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(General__Types::BIT2_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_cR.RAW_decode(General__Types::BIT1_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_pD.RAW_decode(General__Types::BIT1_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Address__field::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 4;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(4);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::BIT4_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::BIT2_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT1_descr_.raw);
  encoded_length += field_sAPI.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_spare.RAW_encode(General__Types::BIT2_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_cR.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_pD.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[3]);
  return myleaf.length = encoded_length;
}

struct Address__field_template::single_value_struct {
BITSTRING_template field_sAPI;
BITSTRING_template field_spare;
BITSTRING_template field_cR;
BITSTRING_template field_pD;
};

void Address__field_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_sAPI = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
single_value->field_cR = ANY_VALUE;
single_value->field_pD = ANY_VALUE;
}
}
}

void Address__field_template::copy_value(const Address__field& other_value)
{
single_value = new single_value_struct;
if (other_value.sAPI().is_bound()) {
  single_value->field_sAPI = other_value.sAPI();
} else {
  single_value->field_sAPI.clean_up();
}
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
if (other_value.cR().is_bound()) {
  single_value->field_cR = other_value.cR();
} else {
  single_value->field_cR.clean_up();
}
if (other_value.pD().is_bound()) {
  single_value->field_pD = other_value.pD();
} else {
  single_value->field_pD.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Address__field_template::copy_template(const Address__field_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.sAPI().get_selection()) {
single_value->field_sAPI = other_value.sAPI();
} else {
single_value->field_sAPI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.cR().get_selection()) {
single_value->field_cR = other_value.cR();
} else {
single_value->field_cR.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pD().get_selection()) {
single_value->field_pD = other_value.pD();
} else {
single_value->field_pD.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new Address__field_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new Address__field_template(*other_value.implication_.precondition);
implication_.implied_template = new Address__field_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.Address_field.");
break;
}
set_selection(other_value);
}

Address__field_template::Address__field_template()
{
}

Address__field_template::Address__field_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

Address__field_template::Address__field_template(const Address__field& other_value)
{
copy_value(other_value);
}

Address__field_template::Address__field_template(const OPTIONAL<Address__field>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const Address__field&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.Address_field from an unbound optional field.");
}
}

Address__field_template::Address__field_template(Address__field_template* p_precondition, Address__field_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

Address__field_template::Address__field_template(Dynamic_Match_Interface<Address__field>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<Address__field>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

Address__field_template::Address__field_template(const Address__field_template& other_value)
: Base_Template()
{
copy_template(other_value);
}

Address__field_template::~Address__field_template()
{
clean_up();
}

Address__field_template& Address__field_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

Address__field_template& Address__field_template::operator=(const Address__field& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

Address__field_template& Address__field_template::operator=(const OPTIONAL<Address__field>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const Address__field&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.Address_field.");
}
return *this;
}

Address__field_template& Address__field_template::operator=(const Address__field_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean Address__field_template::match(const Address__field& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.sAPI().is_bound()) return FALSE;
if(!single_value->field_sAPI.match(other_value.sAPI(), legacy))return FALSE;
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
if(!other_value.cR().is_bound()) return FALSE;
if(!single_value->field_cR.match(other_value.cR(), legacy))return FALSE;
if(!other_value.pD().is_bound()) return FALSE;
if(!single_value->field_pD.match(other_value.pD(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @LLC_Types.Address_field.");
}
return FALSE;
}

boolean Address__field_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_sAPI.is_bound()
 || single_value->field_spare.is_bound()
 || single_value->field_cR.is_bound()
 || single_value->field_pD.is_bound();
}

boolean Address__field_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_sAPI.is_value()
 && single_value->field_spare.is_value()
 && single_value->field_cR.is_value()
 && single_value->field_pD.is_value();
}

void Address__field_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

Address__field Address__field_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.Address_field.");
Address__field ret_val;
if (single_value->field_sAPI.is_bound()) {
ret_val.sAPI() = single_value->field_sAPI.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_cR.is_bound()) {
ret_val.cR() = single_value->field_cR.valueof();
}
if (single_value->field_pD.is_bound()) {
ret_val.pD() = single_value->field_pD.valueof();
}
return ret_val;
}

void Address__field_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH)
TTCN_error("Setting an invalid list for a template of type @LLC_Types.Address_field.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Address__field_template[list_length];
}

Address__field_template& Address__field_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH)
TTCN_error("Accessing a list element of a non-list template of type @LLC_Types.Address_field.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LLC_Types.Address_field.");
return value_list.list_value[list_index];
}

BITSTRING_template& Address__field_template::sAPI()
{
set_specific();
return single_value->field_sAPI;
}

const BITSTRING_template& Address__field_template::sAPI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field sAPI of a non-specific template of type @LLC_Types.Address_field.");
return single_value->field_sAPI;
}

BITSTRING_template& Address__field_template::spare()
{
set_specific();
return single_value->field_spare;
}

const BITSTRING_template& Address__field_template::spare() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare of a non-specific template of type @LLC_Types.Address_field.");
return single_value->field_spare;
}

BITSTRING_template& Address__field_template::cR()
{
set_specific();
return single_value->field_cR;
}

const BITSTRING_template& Address__field_template::cR() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field cR of a non-specific template of type @LLC_Types.Address_field.");
return single_value->field_cR;
}

BITSTRING_template& Address__field_template::pD()
{
set_specific();
return single_value->field_pD;
}

const BITSTRING_template& Address__field_template::pD() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pD of a non-specific template of type @LLC_Types.Address_field.");
return single_value->field_pD;
}

int Address__field_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Address_field which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 4;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LLC_Types.Address_field containing an empty list.");
      int item_size = value_list.list_value[0].size_of();
      for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++)
      {
        if (value_list.list_value[l_idx].size_of()!=item_size)
          TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Address_field containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Address_field containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Address_field containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Address_field containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Address_field containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Address_field containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.Address_field containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LLC_Types.Address_field.");
  }
  return 0;
}

void Address__field_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ sAPI := ");
single_value->field_sAPI.log();
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(", cR := ");
single_value->field_cR.log();
TTCN_Logger::log_event_str(", pD := ");
single_value->field_pD.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void Address__field_template::log_match(const Address__field& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_sAPI.match(match_value.sAPI(), legacy)){
TTCN_Logger::log_logmatch_info(".sAPI");
single_value->field_sAPI.log_match(match_value.sAPI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_cR.match(match_value.cR(), legacy)){
TTCN_Logger::log_logmatch_info(".cR");
single_value->field_cR.log_match(match_value.cR(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pD.match(match_value.pD(), legacy)){
TTCN_Logger::log_logmatch_info(".pD");
single_value->field_pD.log_match(match_value.pD(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ sAPI := ");
single_value->field_sAPI.log_match(match_value.sAPI(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(", cR := ");
single_value->field_cR.log_match(match_value.cR(), legacy);
TTCN_Logger::log_event_str(", pD := ");
single_value->field_pD.log_match(match_value.pD(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void Address__field_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (sAPI().is_bound()) sAPI().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (cR().is_bound()) cR().set_implicit_omit();
if (pD().is_bound()) pD().set_implicit_omit();
}

void Address__field_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_sAPI.encode_text(text_buf);
single_value->field_spare.encode_text(text_buf);
single_value->field_cR.encode_text(text_buf);
single_value->field_pD.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.Address_field.");
}
}

void Address__field_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_sAPI.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
single_value->field_cR.decode_text(text_buf);
single_value->field_pD.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new Address__field_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @LLC_Types.Address_field.");
}
}

void Address__field_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    Address__field_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (4<param.get_size()) {
      param.error("record template of type @LLC_Types.Address_field has 4 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) sAPI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) cR().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) pD().set_param(*param.get_elem(3));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "sAPI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sAPI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cR")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cR().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pD")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pD().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.Address_field: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Address__field_template* precondition = new Address__field_template;
    precondition->set_param(*param.get_elem(0));
    Address__field_template* implied_template = new Address__field_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Address__field_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LLC_Types.Address_field");
  }
  is_ifpresent = param.get_ifpresent();
}

void Address__field_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_sAPI.check_restriction(t_res, t_name ? t_name : "@LLC_Types.Address_field");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@LLC_Types.Address_field");
single_value->field_cR.check_restriction(t_res, t_name ? t_name : "@LLC_Types.Address_field");
single_value->field_pD.check_restriction(t_res, t_name ? t_name : "@LLC_Types.Address_field");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.Address_field");
}

boolean Address__field_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean Address__field_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

void Information__field__U::copy_value(const Information__field__U& other_value)
{
switch (other_value.union_selection) {
case ALT_uA:
field_uA = new UA__Information(*other_value.field_uA);
break;
case ALT_sABM:
field_sABM = new SABM__Information(*other_value.field_sABM);
break;
case ALT_fRMR:
field_fRMR = new FRMR__Information(*other_value.field_fRMR);
break;
case ALT_dM:
field_dM = new OCTETSTRING(*other_value.field_dM);
break;
case ALT_xID:
field_xID = new XID__Information(*other_value.field_xID);
break;
case ALT_nULL:
field_nULL = new OCTETSTRING(*other_value.field_nULL);
break;
case ALT_dISC:
field_dISC = new OCTETSTRING(*other_value.field_dISC);
break;
default:
TTCN_error("Assignment of an unbound union value of type @LLC_Types.Information_field_U.");
}
union_selection = other_value.union_selection;
}

Information__field__U::Information__field__U()
{
union_selection = UNBOUND_VALUE;
}

Information__field__U::Information__field__U(const Information__field__U& other_value)
: Base_Type(){
copy_value(other_value);
}

Information__field__U::~Information__field__U()
{
clean_up();
}

Information__field__U& Information__field__U::operator=(const Information__field__U& other_value)
{
if (this != &other_value) {
clean_up();
copy_value(other_value);
}
return *this;
}

boolean Information__field__U::operator==(const Information__field__U& other_value) const
{
if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @LLC_Types.Information_field_U.");
if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @LLC_Types.Information_field_U.");
if (union_selection != other_value.union_selection) return FALSE;
switch (union_selection) {
case ALT_uA:
return *field_uA == *other_value.field_uA;
case ALT_sABM:
return *field_sABM == *other_value.field_sABM;
case ALT_fRMR:
return *field_fRMR == *other_value.field_fRMR;
case ALT_dM:
return *field_dM == *other_value.field_dM;
case ALT_xID:
return *field_xID == *other_value.field_xID;
case ALT_nULL:
return *field_nULL == *other_value.field_nULL;
case ALT_dISC:
return *field_dISC == *other_value.field_dISC;
default:
return FALSE;
}
}

UA__Information& Information__field__U::uA()
{
if (union_selection != ALT_uA) {
clean_up();
field_uA = new UA__Information;
union_selection = ALT_uA;
}
return *field_uA;
}

const UA__Information& Information__field__U::uA() const
{
if (union_selection != ALT_uA) TTCN_error("Using non-selected field uA in a value of union type @LLC_Types.Information_field_U.");
return *field_uA;
}

SABM__Information& Information__field__U::sABM()
{
if (union_selection != ALT_sABM) {
clean_up();
field_sABM = new SABM__Information;
union_selection = ALT_sABM;
}
return *field_sABM;
}

const SABM__Information& Information__field__U::sABM() const
{
if (union_selection != ALT_sABM) TTCN_error("Using non-selected field sABM in a value of union type @LLC_Types.Information_field_U.");
return *field_sABM;
}

FRMR__Information& Information__field__U::fRMR()
{
if (union_selection != ALT_fRMR) {
clean_up();
field_fRMR = new FRMR__Information;
union_selection = ALT_fRMR;
}
return *field_fRMR;
}

const FRMR__Information& Information__field__U::fRMR() const
{
if (union_selection != ALT_fRMR) TTCN_error("Using non-selected field fRMR in a value of union type @LLC_Types.Information_field_U.");
return *field_fRMR;
}

OCTETSTRING& Information__field__U::dM()
{
if (union_selection != ALT_dM) {
clean_up();
field_dM = new OCTETSTRING;
union_selection = ALT_dM;
}
return *field_dM;
}

const OCTETSTRING& Information__field__U::dM() const
{
if (union_selection != ALT_dM) TTCN_error("Using non-selected field dM in a value of union type @LLC_Types.Information_field_U.");
return *field_dM;
}

XID__Information& Information__field__U::xID()
{
if (union_selection != ALT_xID) {
clean_up();
field_xID = new XID__Information;
union_selection = ALT_xID;
}
return *field_xID;
}

const XID__Information& Information__field__U::xID() const
{
if (union_selection != ALT_xID) TTCN_error("Using non-selected field xID in a value of union type @LLC_Types.Information_field_U.");
return *field_xID;
}

OCTETSTRING& Information__field__U::nULL()
{
if (union_selection != ALT_nULL) {
clean_up();
field_nULL = new OCTETSTRING;
union_selection = ALT_nULL;
}
return *field_nULL;
}

const OCTETSTRING& Information__field__U::nULL() const
{
if (union_selection != ALT_nULL) TTCN_error("Using non-selected field nULL in a value of union type @LLC_Types.Information_field_U.");
return *field_nULL;
}

OCTETSTRING& Information__field__U::dISC()
{
if (union_selection != ALT_dISC) {
clean_up();
field_dISC = new OCTETSTRING;
union_selection = ALT_dISC;
}
return *field_dISC;
}

const OCTETSTRING& Information__field__U::dISC() const
{
if (union_selection != ALT_dISC) TTCN_error("Using non-selected field dISC in a value of union type @LLC_Types.Information_field_U.");
return *field_dISC;
}

boolean Information__field__U::ischosen(union_selection_type checked_selection) const
{
if (checked_selection == UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @LLC_Types.Information_field_U.");
return union_selection == checked_selection;
}

boolean Information__field__U::is_bound() const
{
  return union_selection != UNBOUND_VALUE;
}

boolean Information__field__U::is_value() const
{
switch (union_selection) {
case UNBOUND_VALUE: return FALSE;
case ALT_uA: return field_uA->is_value();
case ALT_sABM: return field_sABM->is_value();
case ALT_fRMR: return field_fRMR->is_value();
case ALT_dM: return field_dM->is_value();
case ALT_xID: return field_xID->is_value();
case ALT_nULL: return field_nULL->is_value();
case ALT_dISC: return field_dISC->is_value();
default: TTCN_error("Invalid selection in union is_bound");}
}

void Information__field__U::clean_up()
{
switch (union_selection) {
case ALT_uA:
  delete field_uA;
  break;
case ALT_sABM:
  delete field_sABM;
  break;
case ALT_fRMR:
  delete field_fRMR;
  break;
case ALT_dM:
  delete field_dM;
  break;
case ALT_xID:
  delete field_xID;
  break;
case ALT_nULL:
  delete field_nULL;
  break;
case ALT_dISC:
  delete field_dISC;
  break;
default:
  break;
}
union_selection = UNBOUND_VALUE;
}

void Information__field__U::log() const
{
switch (union_selection) {
case ALT_uA:
TTCN_Logger::log_event_str("{ uA := ");
field_uA->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_sABM:
TTCN_Logger::log_event_str("{ sABM := ");
field_sABM->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_fRMR:
TTCN_Logger::log_event_str("{ fRMR := ");
field_fRMR->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_dM:
TTCN_Logger::log_event_str("{ dM := ");
field_dM->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_xID:
TTCN_Logger::log_event_str("{ xID := ");
field_xID->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_nULL:
TTCN_Logger::log_event_str("{ nULL := ");
field_nULL->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_dISC:
TTCN_Logger::log_event_str("{ dISC := ");
field_dISC->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_unbound();
}
}

void Information__field__U::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "union value");
  Module_Param_Ptr m_p = &param;
  if (m_p->get_type()==Module_Param::MP_Value_List && m_p->get_size()==0) return;
  if (m_p->get_type()!=Module_Param::MP_Assignment_List) {
    param.error("union value with field name was expected");
  }
  Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1);
  char* last_name = mp_last->get_id()->get_name();
  if (!strcmp(last_name, "uA")) {
    uA().set_param(*mp_last);
    if (!uA().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "sABM")) {
    sABM().set_param(*mp_last);
    if (!sABM().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "fRMR")) {
    fRMR().set_param(*mp_last);
    if (!fRMR().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "dM")) {
    dM().set_param(*mp_last);
    if (!dM().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "xID")) {
    xID().set_param(*mp_last);
    if (!xID().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "nULL")) {
    nULL().set_param(*mp_last);
    if (!nULL().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "dISC")) {
    dISC().set_param(*mp_last);
    if (!dISC().is_bound()) clean_up();
    return;
  }
  mp_last->error("Field %s does not exist in type @LLC_Types.Information_field_U.", last_name);
}

void Information__field__U::set_implicit_omit()
{
switch (union_selection) {
case ALT_uA:
field_uA->set_implicit_omit(); break;
case ALT_sABM:
field_sABM->set_implicit_omit(); break;
case ALT_fRMR:
field_fRMR->set_implicit_omit(); break;
case ALT_dM:
field_dM->set_implicit_omit(); break;
case ALT_xID:
field_xID->set_implicit_omit(); break;
case ALT_nULL:
field_nULL->set_implicit_omit(); break;
case ALT_dISC:
field_dISC->set_implicit_omit(); break;
default: break;
}
}

void Information__field__U::encode_text(Text_Buf& text_buf) const
{
text_buf.push_int(union_selection);
switch (union_selection) {
case ALT_uA:
field_uA->encode_text(text_buf);
break;
case ALT_sABM:
field_sABM->encode_text(text_buf);
break;
case ALT_fRMR:
field_fRMR->encode_text(text_buf);
break;
case ALT_dM:
field_dM->encode_text(text_buf);
break;
case ALT_xID:
field_xID->encode_text(text_buf);
break;
case ALT_nULL:
field_nULL->encode_text(text_buf);
break;
case ALT_dISC:
field_dISC->encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an unbound value of union type @LLC_Types.Information_field_U.");
}
}

void Information__field__U::decode_text(Text_Buf& text_buf)
{
switch ((union_selection_type)text_buf.pull_int().get_val()) {
case ALT_uA:
uA().decode_text(text_buf);
break;
case ALT_sABM:
sABM().decode_text(text_buf);
break;
case ALT_fRMR:
fRMR().decode_text(text_buf);
break;
case ALT_dM:
dM().decode_text(text_buf);
break;
case ALT_xID:
xID().decode_text(text_buf);
break;
case ALT_nULL:
nULL().decode_text(text_buf);
break;
case ALT_dISC:
dISC().decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for type @LLC_Types.Information_field_U.");
}
}

void Information__field__U::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void Information__field__U::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int Information__field__U::RAW_decode(
const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, 
raw_order_t top_bit_ord, boolean no_err, int sel_field, boolean, const RAW_Force_Omit* force_omit)
{
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  int decoded_length=0;
  int starting_pos=p_buf.get_pos_bit();
  if(sel_field!=-1){
    switch(sel_field){
    case 0: {
      RAW_Force_Omit field_force_omit(0, force_omit, UA__Information_descr_.raw->forceomit);
      decoded_length = uA().RAW_decode(UA__Information_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 1: {
      RAW_Force_Omit field_force_omit(1, force_omit, SABM__Information_descr_.raw->forceomit);
      decoded_length = sABM().RAW_decode(SABM__Information_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 2: {
      RAW_Force_Omit field_force_omit(2, force_omit, FRMR__Information_descr_.raw->forceomit);
      decoded_length = fRMR().RAW_decode(FRMR__Information_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 3: {
      RAW_Force_Omit field_force_omit(3, force_omit, DM__Information_descr_.raw->forceomit);
      decoded_length = dM().RAW_decode(DM__Information_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 4: {
      RAW_Force_Omit field_force_omit(4, force_omit, XID__Information_descr_.raw->forceomit);
      decoded_length = xID().RAW_decode(XID__Information_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 5: {
      RAW_Force_Omit field_force_omit(5, force_omit, NULL__Information_descr_.raw->forceomit);
      decoded_length = nULL().RAW_decode(NULL__Information_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 6: {
      RAW_Force_Omit field_force_omit(6, force_omit, DISC__Information_descr_.raw->forceomit);
      decoded_length = dISC().RAW_decode(DISC__Information_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    default: break;
    }
    return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
  } else {
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_0_force_omit(0, force_omit, UA__Information_descr_.raw->forceomit);
      decoded_length = uA().RAW_decode(UA__Information_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_0_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_1_force_omit(1, force_omit, SABM__Information_descr_.raw->forceomit);
      decoded_length = sABM().RAW_decode(SABM__Information_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_1_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_2_force_omit(2, force_omit, FRMR__Information_descr_.raw->forceomit);
      decoded_length = fRMR().RAW_decode(FRMR__Information_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_2_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_3_force_omit(3, force_omit, DM__Information_descr_.raw->forceomit);
      decoded_length = dM().RAW_decode(DM__Information_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_3_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_4_force_omit(4, force_omit, XID__Information_descr_.raw->forceomit);
      decoded_length = xID().RAW_decode(XID__Information_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_4_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_5_force_omit(5, force_omit, NULL__Information_descr_.raw->forceomit);
      decoded_length = nULL().RAW_decode(NULL__Information_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_5_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_6_force_omit(6, force_omit, DISC__Information_descr_.raw->forceomit);
      decoded_length = dISC().RAW_decode(DISC__Information_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_6_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
 }
 clean_up();
 return -1;
}

int Information__field__U::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const
{
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 7;  myleaf.body.node.nodes = init_nodes_of_enc_tree(7);
  memset(myleaf.body.node.nodes, 0, 7 * sizeof(RAW_enc_tree *));
  switch (union_selection) {
  case ALT_uA:
    myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, UA__Information_descr_.raw);
    encoded_length = field_uA->RAW_encode(UA__Information_descr_, *myleaf.body.node.nodes[0]);
    myleaf.body.node.nodes[0]->coding_descr = &UA__Information_descr_;
    break;
  case ALT_sABM:
    myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, SABM__Information_descr_.raw);
    encoded_length = field_sABM->RAW_encode(SABM__Information_descr_, *myleaf.body.node.nodes[1]);
    myleaf.body.node.nodes[1]->coding_descr = &SABM__Information_descr_;
    break;
  case ALT_fRMR:
    myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 2, FRMR__Information_descr_.raw);
    encoded_length = field_fRMR->RAW_encode(FRMR__Information_descr_, *myleaf.body.node.nodes[2]);
    myleaf.body.node.nodes[2]->coding_descr = &FRMR__Information_descr_;
    break;
  case ALT_dM:
    myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 3, DM__Information_descr_.raw);
    encoded_length = field_dM->RAW_encode(DM__Information_descr_, *myleaf.body.node.nodes[3]);
    myleaf.body.node.nodes[3]->coding_descr = &DM__Information_descr_;
    break;
  case ALT_xID:
    myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 4, XID__Information_descr_.raw);
    encoded_length = field_xID->RAW_encode(XID__Information_descr_, *myleaf.body.node.nodes[4]);
    myleaf.body.node.nodes[4]->coding_descr = &XID__Information_descr_;
    break;
  case ALT_nULL:
    myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 5, NULL__Information_descr_.raw);
    encoded_length = field_nULL->RAW_encode(NULL__Information_descr_, *myleaf.body.node.nodes[5]);
    myleaf.body.node.nodes[5]->coding_descr = &NULL__Information_descr_;
    break;
  case ALT_dISC:
    myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 6, DISC__Information_descr_.raw);
    encoded_length = field_dISC->RAW_encode(DISC__Information_descr_, *myleaf.body.node.nodes[6]);
    myleaf.body.node.nodes[6]->coding_descr = &DISC__Information_descr_;
    break;
  default:
    TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  }
  return encoded_length;
}

void Information__field__U_template::copy_value(const Information__field__U& other_value)
{
single_value.union_selection = other_value.get_selection();
switch (single_value.union_selection) {
case Information__field__U::ALT_uA:
single_value.field_uA = new UA__Information_template(other_value.uA());
break;
case Information__field__U::ALT_sABM:
single_value.field_sABM = new SABM__Information_template(other_value.sABM());
break;
case Information__field__U::ALT_fRMR:
single_value.field_fRMR = new FRMR__Information_template(other_value.fRMR());
break;
case Information__field__U::ALT_dM:
single_value.field_dM = new OCTETSTRING_template(other_value.dM());
break;
case Information__field__U::ALT_xID:
single_value.field_xID = new XID__Information_template(other_value.xID());
break;
case Information__field__U::ALT_nULL:
single_value.field_nULL = new OCTETSTRING_template(other_value.nULL());
break;
case Information__field__U::ALT_dISC:
single_value.field_dISC = new OCTETSTRING_template(other_value.dISC());
break;
default:
TTCN_error("Initializing a template with an unbound value of type @LLC_Types.Information_field_U.");
}
set_selection(SPECIFIC_VALUE);
}

void Information__field__U_template::copy_template(const Information__field__U_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value.union_selection = other_value.single_value.union_selection;
switch (single_value.union_selection) {
case Information__field__U::ALT_uA:
single_value.field_uA = new UA__Information_template(*other_value.single_value.field_uA);
break;
case Information__field__U::ALT_sABM:
single_value.field_sABM = new SABM__Information_template(*other_value.single_value.field_sABM);
break;
case Information__field__U::ALT_fRMR:
single_value.field_fRMR = new FRMR__Information_template(*other_value.single_value.field_fRMR);
break;
case Information__field__U::ALT_dM:
single_value.field_dM = new OCTETSTRING_template(*other_value.single_value.field_dM);
break;
case Information__field__U::ALT_xID:
single_value.field_xID = new XID__Information_template(*other_value.single_value.field_xID);
break;
case Information__field__U::ALT_nULL:
single_value.field_nULL = new OCTETSTRING_template(*other_value.single_value.field_nULL);
break;
case Information__field__U::ALT_dISC:
single_value.field_dISC = new OCTETSTRING_template(*other_value.single_value.field_dISC);
break;
default:
TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @LLC_Types.Information_field_U.");
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new Information__field__U_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new Information__field__U_template(*other_value.implication_.precondition);
implication_.implied_template = new Information__field__U_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized template of union type @LLC_Types.Information_field_U.");
}
set_selection(other_value);
}

Information__field__U_template::Information__field__U_template()
{
}

Information__field__U_template::Information__field__U_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

Information__field__U_template::Information__field__U_template(const Information__field__U& other_value)
{
copy_value(other_value);
}

Information__field__U_template::Information__field__U_template(const OPTIONAL<Information__field__U>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const Information__field__U&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of union type @LLC_Types.Information_field_U from an unbound optional field.");
}
}

Information__field__U_template::Information__field__U_template(Information__field__U_template* p_precondition, Information__field__U_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

Information__field__U_template::Information__field__U_template(Dynamic_Match_Interface<Information__field__U>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<Information__field__U>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

Information__field__U_template::Information__field__U_template(const Information__field__U_template& other_value)
: Base_Template(){
copy_template(other_value);
}

Information__field__U_template::~Information__field__U_template()
{
clean_up();
}

void Information__field__U_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case Information__field__U::ALT_uA:
delete single_value.field_uA;
break;
case Information__field__U::ALT_sABM:
delete single_value.field_sABM;
break;
case Information__field__U::ALT_fRMR:
delete single_value.field_fRMR;
break;
case Information__field__U::ALT_dM:
delete single_value.field_dM;
break;
case Information__field__U::ALT_xID:
delete single_value.field_xID;
break;
case Information__field__U::ALT_nULL:
delete single_value.field_nULL;
break;
case Information__field__U::ALT_dISC:
delete single_value.field_dISC;
default:
break;
}
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

Information__field__U_template& Information__field__U_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

Information__field__U_template& Information__field__U_template::operator=(const Information__field__U& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

Information__field__U_template& Information__field__U_template::operator=(const OPTIONAL<Information__field__U>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const Information__field__U&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of union type @LLC_Types.Information_field_U.");
}
return *this;
}

Information__field__U_template& Information__field__U_template::operator=(const Information__field__U_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean Information__field__U_template::match(const Information__field__U& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
{
Information__field__U::union_selection_type value_selection = other_value.get_selection();
if (value_selection == Information__field__U::UNBOUND_VALUE) return FALSE;
if (value_selection != single_value.union_selection) return FALSE;
switch (value_selection) {
case Information__field__U::ALT_uA:
return single_value.field_uA->match(other_value.uA(), legacy);
case Information__field__U::ALT_sABM:
return single_value.field_sABM->match(other_value.sABM(), legacy);
case Information__field__U::ALT_fRMR:
return single_value.field_fRMR->match(other_value.fRMR(), legacy);
case Information__field__U::ALT_dM:
return single_value.field_dM->match(other_value.dM(), legacy);
case Information__field__U::ALT_xID:
return single_value.field_xID->match(other_value.xID(), legacy);
case Information__field__U::ALT_nULL:
return single_value.field_nULL->match(other_value.nULL(), legacy);
case Information__field__U::ALT_dISC:
return single_value.field_dISC->match(other_value.dISC(), legacy);
default:
TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @LLC_Types.Information_field_U.");
}
}
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error ("Matching an uninitialized template of union type @LLC_Types.Information_field_U.");
}
return FALSE;
}

boolean Information__field__U_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
switch (single_value.union_selection) {
case Information__field__U::ALT_uA:
return single_value.field_uA->is_value();
case Information__field__U::ALT_sABM:
return single_value.field_sABM->is_value();
case Information__field__U::ALT_fRMR:
return single_value.field_fRMR->is_value();
case Information__field__U::ALT_dM:
return single_value.field_dM->is_value();
case Information__field__U::ALT_xID:
return single_value.field_xID->is_value();
case Information__field__U::ALT_nULL:
return single_value.field_nULL->is_value();
case Information__field__U::ALT_dISC:
return single_value.field_dISC->is_value();
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @LLC_Types.Information_field_U.");
}
}

Information__field__U Information__field__U_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of union type @LLC_Types.Information_field_U.");
Information__field__U ret_val;
switch (single_value.union_selection) {
case Information__field__U::ALT_uA:
ret_val.uA() = single_value.field_uA->valueof();
break;
case Information__field__U::ALT_sABM:
ret_val.sABM() = single_value.field_sABM->valueof();
break;
case Information__field__U::ALT_fRMR:
ret_val.fRMR() = single_value.field_fRMR->valueof();
break;
case Information__field__U::ALT_dM:
ret_val.dM() = single_value.field_dM->valueof();
break;
case Information__field__U::ALT_xID:
ret_val.xID() = single_value.field_xID->valueof();
break;
case Information__field__U::ALT_nULL:
ret_val.nULL() = single_value.field_nULL->valueof();
break;
case Information__field__U::ALT_dISC:
ret_val.dISC() = single_value.field_dISC->valueof();
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @LLC_Types.Information_field_U.");
}
return ret_val;
}

Information__field__U_template& Information__field__U_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Internal error: Accessing a list element of a non-list template of union type @LLC_Types.Information_field_U.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @LLC_Types.Information_field_U.");
return value_list.list_value[list_index];
}
void Information__field__U_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error ("Internal error: Setting an invalid list for a template of union type @LLC_Types.Information_field_U.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Information__field__U_template[list_length];
}

UA__Information_template& Information__field__U_template::uA()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != Information__field__U::ALT_uA) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_uA = new UA__Information_template(ANY_VALUE);
else single_value.field_uA = new UA__Information_template;
single_value.union_selection = Information__field__U::ALT_uA;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_uA;
}

const UA__Information_template& Information__field__U_template::uA() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field uA in a non-specific template of union type @LLC_Types.Information_field_U.");
if (single_value.union_selection != Information__field__U::ALT_uA) TTCN_error("Accessing non-selected field uA in a template of union type @LLC_Types.Information_field_U.");
return *single_value.field_uA;
}

SABM__Information_template& Information__field__U_template::sABM()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != Information__field__U::ALT_sABM) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_sABM = new SABM__Information_template(ANY_VALUE);
else single_value.field_sABM = new SABM__Information_template;
single_value.union_selection = Information__field__U::ALT_sABM;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_sABM;
}

const SABM__Information_template& Information__field__U_template::sABM() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sABM in a non-specific template of union type @LLC_Types.Information_field_U.");
if (single_value.union_selection != Information__field__U::ALT_sABM) TTCN_error("Accessing non-selected field sABM in a template of union type @LLC_Types.Information_field_U.");
return *single_value.field_sABM;
}

FRMR__Information_template& Information__field__U_template::fRMR()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != Information__field__U::ALT_fRMR) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_fRMR = new FRMR__Information_template(ANY_VALUE);
else single_value.field_fRMR = new FRMR__Information_template;
single_value.union_selection = Information__field__U::ALT_fRMR;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_fRMR;
}

const FRMR__Information_template& Information__field__U_template::fRMR() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field fRMR in a non-specific template of union type @LLC_Types.Information_field_U.");
if (single_value.union_selection != Information__field__U::ALT_fRMR) TTCN_error("Accessing non-selected field fRMR in a template of union type @LLC_Types.Information_field_U.");
return *single_value.field_fRMR;
}

OCTETSTRING_template& Information__field__U_template::dM()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != Information__field__U::ALT_dM) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_dM = new OCTETSTRING_template(ANY_VALUE);
else single_value.field_dM = new OCTETSTRING_template;
single_value.union_selection = Information__field__U::ALT_dM;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_dM;
}

const OCTETSTRING_template& Information__field__U_template::dM() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field dM in a non-specific template of union type @LLC_Types.Information_field_U.");
if (single_value.union_selection != Information__field__U::ALT_dM) TTCN_error("Accessing non-selected field dM in a template of union type @LLC_Types.Information_field_U.");
return *single_value.field_dM;
}

XID__Information_template& Information__field__U_template::xID()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != Information__field__U::ALT_xID) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_xID = new XID__Information_template(ANY_VALUE);
else single_value.field_xID = new XID__Information_template;
single_value.union_selection = Information__field__U::ALT_xID;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_xID;
}

const XID__Information_template& Information__field__U_template::xID() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field xID in a non-specific template of union type @LLC_Types.Information_field_U.");
if (single_value.union_selection != Information__field__U::ALT_xID) TTCN_error("Accessing non-selected field xID in a template of union type @LLC_Types.Information_field_U.");
return *single_value.field_xID;
}

OCTETSTRING_template& Information__field__U_template::nULL()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != Information__field__U::ALT_nULL) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_nULL = new OCTETSTRING_template(ANY_VALUE);
else single_value.field_nULL = new OCTETSTRING_template;
single_value.union_selection = Information__field__U::ALT_nULL;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_nULL;
}

const OCTETSTRING_template& Information__field__U_template::nULL() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nULL in a non-specific template of union type @LLC_Types.Information_field_U.");
if (single_value.union_selection != Information__field__U::ALT_nULL) TTCN_error("Accessing non-selected field nULL in a template of union type @LLC_Types.Information_field_U.");
return *single_value.field_nULL;
}

OCTETSTRING_template& Information__field__U_template::dISC()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != Information__field__U::ALT_dISC) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_dISC = new OCTETSTRING_template(ANY_VALUE);
else single_value.field_dISC = new OCTETSTRING_template;
single_value.union_selection = Information__field__U::ALT_dISC;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_dISC;
}

const OCTETSTRING_template& Information__field__U_template::dISC() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field dISC in a non-specific template of union type @LLC_Types.Information_field_U.");
if (single_value.union_selection != Information__field__U::ALT_dISC) TTCN_error("Accessing non-selected field dISC in a template of union type @LLC_Types.Information_field_U.");
return *single_value.field_dISC;
}

boolean Information__field__U_template::ischosen(Information__field__U::union_selection_type checked_selection) const
{
if (checked_selection == Information__field__U::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @LLC_Types.Information_field_U.");
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.union_selection == Information__field__U::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @LLC_Types.Information_field_U.");
return single_value.union_selection == checked_selection;
case VALUE_LIST:
{
if (value_list.n_values < 1)
TTCN_error("Internal error: Performing ischosen() operation on a template of union type @LLC_Types.Information_field_U containing an empty list.");
boolean ret_val = value_list.list_value[0].ischosen(checked_selection);
for (unsigned int list_count = 1; ret_val == TRUE && list_count < value_list.n_values; list_count++) {
ret_val = value_list.list_value[list_count].ischosen(checked_selection);
}
return ret_val;
}
default:
return FALSE;
}
return FALSE;
}

void Information__field__U_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case Information__field__U::ALT_uA:
TTCN_Logger::log_event_str("{ uA := ");
single_value.field_uA->log();
TTCN_Logger::log_event_str(" }");
break;
case Information__field__U::ALT_sABM:
TTCN_Logger::log_event_str("{ sABM := ");
single_value.field_sABM->log();
TTCN_Logger::log_event_str(" }");
break;
case Information__field__U::ALT_fRMR:
TTCN_Logger::log_event_str("{ fRMR := ");
single_value.field_fRMR->log();
TTCN_Logger::log_event_str(" }");
break;
case Information__field__U::ALT_dM:
TTCN_Logger::log_event_str("{ dM := ");
single_value.field_dM->log();
TTCN_Logger::log_event_str(" }");
break;
case Information__field__U::ALT_xID:
TTCN_Logger::log_event_str("{ xID := ");
single_value.field_xID->log();
TTCN_Logger::log_event_str(" }");
break;
case Information__field__U::ALT_nULL:
TTCN_Logger::log_event_str("{ nULL := ");
single_value.field_nULL->log();
TTCN_Logger::log_event_str(" }");
break;
case Information__field__U::ALT_dISC:
TTCN_Logger::log_event_str("{ dISC := ");
single_value.field_dISC->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_str("<invalid selector>");
}
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void Information__field__U_template::log_match(const Information__field__U& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity() && match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
return;
}
if (template_selection == SPECIFIC_VALUE && single_value.union_selection == match_value.get_selection()) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
switch (single_value.union_selection) {
case Information__field__U::ALT_uA:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".uA");
single_value.field_uA->log_match(match_value.uA(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ uA := ");
single_value.field_uA->log_match(match_value.uA(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case Information__field__U::ALT_sABM:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".sABM");
single_value.field_sABM->log_match(match_value.sABM(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ sABM := ");
single_value.field_sABM->log_match(match_value.sABM(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case Information__field__U::ALT_fRMR:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".fRMR");
single_value.field_fRMR->log_match(match_value.fRMR(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ fRMR := ");
single_value.field_fRMR->log_match(match_value.fRMR(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case Information__field__U::ALT_dM:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".dM");
single_value.field_dM->log_match(match_value.dM(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ dM := ");
single_value.field_dM->log_match(match_value.dM(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case Information__field__U::ALT_xID:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".xID");
single_value.field_xID->log_match(match_value.xID(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ xID := ");
single_value.field_xID->log_match(match_value.xID(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case Information__field__U::ALT_nULL:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".nULL");
single_value.field_nULL->log_match(match_value.nULL(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ nULL := ");
single_value.field_nULL->log_match(match_value.nULL(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case Information__field__U::ALT_dISC:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".dISC");
single_value.field_dISC->log_match(match_value.dISC(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ dISC := ");
single_value.field_dISC->log_match(match_value.dISC(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
default:
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str("<invalid selector>");
}
} else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void Information__field__U_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
switch (single_value.union_selection) {
case Information__field__U::ALT_uA:
single_value.field_uA->set_implicit_omit(); break;
case Information__field__U::ALT_sABM:
single_value.field_sABM->set_implicit_omit(); break;
case Information__field__U::ALT_fRMR:
single_value.field_fRMR->set_implicit_omit(); break;
case Information__field__U::ALT_dM:
single_value.field_dM->set_implicit_omit(); break;
case Information__field__U::ALT_xID:
single_value.field_xID->set_implicit_omit(); break;
case Information__field__U::ALT_nULL:
single_value.field_nULL->set_implicit_omit(); break;
case Information__field__U::ALT_dISC:
single_value.field_dISC->set_implicit_omit(); break;
default: break;
}
}

void Information__field__U_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
text_buf.push_int(single_value.union_selection);
switch (single_value.union_selection) {
case Information__field__U::ALT_uA:
single_value.field_uA->encode_text(text_buf);
break;
case Information__field__U::ALT_sABM:
single_value.field_sABM->encode_text(text_buf);
break;
case Information__field__U::ALT_fRMR:
single_value.field_fRMR->encode_text(text_buf);
break;
case Information__field__U::ALT_dM:
single_value.field_dM->encode_text(text_buf);
break;
case Information__field__U::ALT_xID:
single_value.field_xID->encode_text(text_buf);
break;
case Information__field__U::ALT_nULL:
single_value.field_nULL->encode_text(text_buf);
break;
case Information__field__U::ALT_dISC:
single_value.field_dISC->encode_text(text_buf);
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @LLC_Types.Information_field_U.");
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized template of type @LLC_Types.Information_field_U.");
}
}

void Information__field__U_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
{
single_value.union_selection = Information__field__U::UNBOUND_VALUE;
Information__field__U::union_selection_type new_selection = (Information__field__U::union_selection_type)text_buf.pull_int().get_val();
switch (new_selection) {
case Information__field__U::ALT_uA:
single_value.field_uA = new UA__Information_template;
single_value.field_uA->decode_text(text_buf);
break;
case Information__field__U::ALT_sABM:
single_value.field_sABM = new SABM__Information_template;
single_value.field_sABM->decode_text(text_buf);
break;
case Information__field__U::ALT_fRMR:
single_value.field_fRMR = new FRMR__Information_template;
single_value.field_fRMR->decode_text(text_buf);
break;
case Information__field__U::ALT_dM:
single_value.field_dM = new OCTETSTRING_template;
single_value.field_dM->decode_text(text_buf);
break;
case Information__field__U::ALT_xID:
single_value.field_xID = new XID__Information_template;
single_value.field_xID->decode_text(text_buf);
break;
case Information__field__U::ALT_nULL:
single_value.field_nULL = new OCTETSTRING_template;
single_value.field_nULL->decode_text(text_buf);
break;
case Information__field__U::ALT_dISC:
single_value.field_dISC = new OCTETSTRING_template;
single_value.field_dISC->decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @LLC_Types.Information_field_U.");
}
single_value.union_selection = new_selection;
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new Information__field__U_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized selector was received in a template of type @LLC_Types.Information_field_U.");
}
}

boolean Information__field__U_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean Information__field__U_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int v_idx=0; v_idx<value_list.n_values; v_idx++)
if (value_list.list_value[v_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

void Information__field__U_template::set_param(Module_Param& param)
{
  if (dynamic_cast<Module_Param_Name*>(param.get_id()) != NULL &&
      param.get_id()->next_name()) {
    char* param_field = param.get_id()->get_current_name();
    if (param_field[0] >= '0' && param_field[0] <= '9') {
      param.error("Unexpected array index in module parameter, expected a valid field"
        " name for union template type `@LLC_Types.Information_field_U'");
    }
    if (strcmp("uA", param_field) == 0) {
      uA().set_param(param);
      return;
    } else if (strcmp("sABM", param_field) == 0) {
      sABM().set_param(param);
      return;
    } else if (strcmp("fRMR", param_field) == 0) {
      fRMR().set_param(param);
      return;
    } else if (strcmp("dM", param_field) == 0) {
      dM().set_param(param);
      return;
    } else if (strcmp("xID", param_field) == 0) {
      xID().set_param(param);
      return;
    } else if (strcmp("nULL", param_field) == 0) {
      nULL().set_param(param);
      return;
    } else if (strcmp("dISC", param_field) == 0) {
      dISC().set_param(param);
      return;
    } else param.error("Field `%s' not found in union template type `@LLC_Types.Information_field_U'", param_field);
  }
  param.basic_check(Module_Param::BC_TEMPLATE, "union template");
  Module_Param_Ptr m_p = &param;
  switch (m_p->get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    Information__field__U_template new_temp;
    new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size());
    for (size_t p_i=0; p_i<m_p->get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (m_p->get_size()==0) break;
    param.type_error("union template", "@LLC_Types.Information_field_U");
    break;
  case Module_Param::MP_Assignment_List: {
    Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1);
    char* last_name = mp_last->get_id()->get_name();
    if (!strcmp(last_name, "uA")) {
      uA().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "sABM")) {
      sABM().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "fRMR")) {
      fRMR().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "dM")) {
      dM().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "xID")) {
      xID().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "nULL")) {
      nULL().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "dISC")) {
      dISC().set_param(*mp_last);
      break;
    }
    mp_last->error("Field %s does not exist in type @LLC_Types.Information_field_U.", last_name);
  } break;
  case Module_Param::MP_Implication_Template: {
    Information__field__U_template* precondition = new Information__field__U_template;
    precondition->set_param(*m_p->get_elem(0));
    Information__field__U_template* implied_template = new Information__field__U_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = Information__field__U_template(precondition, implied_template);
  } break;
  default:
    param.type_error("union template", "@LLC_Types.Information_field_U");
  }
  is_ifpresent = param.get_ifpresent();
}

void Information__field__U_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
switch (single_value.union_selection) {
case Information__field__U::ALT_uA:
single_value.field_uA->check_restriction(t_res, t_name ? t_name : "@LLC_Types.Information_field_U");
return;
case Information__field__U::ALT_sABM:
single_value.field_sABM->check_restriction(t_res, t_name ? t_name : "@LLC_Types.Information_field_U");
return;
case Information__field__U::ALT_fRMR:
single_value.field_fRMR->check_restriction(t_res, t_name ? t_name : "@LLC_Types.Information_field_U");
return;
case Information__field__U::ALT_dM:
single_value.field_dM->check_restriction(t_res, t_name ? t_name : "@LLC_Types.Information_field_U");
return;
case Information__field__U::ALT_xID:
single_value.field_xID->check_restriction(t_res, t_name ? t_name : "@LLC_Types.Information_field_U");
return;
case Information__field__U::ALT_nULL:
single_value.field_nULL->check_restriction(t_res, t_name ? t_name : "@LLC_Types.Information_field_U");
return;
case Information__field__U::ALT_dISC:
single_value.field_dISC->check_restriction(t_res, t_name ? t_name : "@LLC_Types.Information_field_U");
return;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @LLC_Types.Information_field_U.");
}
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.Information_field_U");
}

PDU__LLC__UI::PDU__LLC__UI()
{
}

PDU__LLC__UI::PDU__LLC__UI(const Address__field& par_address__field,
    const Control__field__UI& par_control__field,
    const OCTETSTRING& par_information__field__UI,
    const OPTIONAL< OCTETSTRING >& par_fCS)
  :   field_address__field(par_address__field),
  field_control__field(par_control__field),
  field_information__field__UI(par_information__field__UI),
  field_fCS(par_fCS)
{
}

PDU__LLC__UI::PDU__LLC__UI(const PDU__LLC__UI& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.PDU_LLC_UI.");
if (other_value.address__field().is_bound()) field_address__field = other_value.address__field();
else field_address__field.clean_up();
if (other_value.control__field().is_bound()) field_control__field = other_value.control__field();
else field_control__field.clean_up();
if (other_value.information__field__UI().is_bound()) field_information__field__UI = other_value.information__field__UI();
else field_information__field__UI.clean_up();
if (other_value.fCS().is_bound()) field_fCS = other_value.fCS();
else field_fCS.clean_up();
}

void PDU__LLC__UI::clean_up()
{
field_address__field.clean_up();
field_control__field.clean_up();
field_information__field__UI.clean_up();
field_fCS.clean_up();
}

const TTCN_Typedescriptor_t* PDU__LLC__UI::get_descriptor() const { return &PDU__LLC__UI_descr_; }
PDU__LLC__UI& PDU__LLC__UI::operator=(const PDU__LLC__UI& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LLC_Types.PDU_LLC_UI.");
  if (other_value.address__field().is_bound()) field_address__field = other_value.address__field();
  else field_address__field.clean_up();
  if (other_value.control__field().is_bound()) field_control__field = other_value.control__field();
  else field_control__field.clean_up();
  if (other_value.information__field__UI().is_bound()) field_information__field__UI = other_value.information__field__UI();
  else field_information__field__UI.clean_up();
  if (other_value.fCS().is_bound()) field_fCS = other_value.fCS();
  else field_fCS.clean_up();
}
return *this;
}

boolean PDU__LLC__UI::operator==(const PDU__LLC__UI& other_value) const
{
return field_address__field==other_value.field_address__field
  && field_control__field==other_value.field_control__field
  && field_information__field__UI==other_value.field_information__field__UI
  && field_fCS==other_value.field_fCS;
}

boolean PDU__LLC__UI::is_bound() const
{
return (field_address__field.is_bound())
  || (field_control__field.is_bound())
  || (field_information__field__UI.is_bound())
  || (OPTIONAL_OMIT == field_fCS.get_selection() || field_fCS.is_bound());
}
boolean PDU__LLC__UI::is_value() const
{
return field_address__field.is_value()
  && field_control__field.is_value()
  && field_information__field__UI.is_value()
  && (OPTIONAL_OMIT == field_fCS.get_selection() || field_fCS.is_value());
}
int PDU__LLC__UI::size_of() const
{
  int ret_val = 3;
  if (field_fCS.ispresent()) ret_val++;
  return ret_val;
}

void PDU__LLC__UI::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ address_field := ");
field_address__field.log();
TTCN_Logger::log_event_str(", control_field := ");
field_control__field.log();
TTCN_Logger::log_event_str(", information_field_UI := ");
field_information__field__UI.log();
TTCN_Logger::log_event_str(", fCS := ");
field_fCS.log();
TTCN_Logger::log_event_str(" }");
}

void PDU__LLC__UI::set_implicit_omit()
{
if (address__field().is_bound()) address__field().set_implicit_omit();
if (control__field().is_bound()) control__field().set_implicit_omit();
if (information__field__UI().is_bound()) information__field__UI().set_implicit_omit();
if (!fCS().is_bound()) fCS() = OMIT_VALUE;
else fCS().set_implicit_omit();
}

void PDU__LLC__UI::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (4<param.get_size()) {
      param.error("record value of type @LLC_Types.PDU_LLC_UI has 4 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) address__field().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) control__field().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) information__field__UI().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) fCS().set_param(*param.get_elem(3));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "address_field")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          address__field().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "control_field")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          control__field().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "information_field_UI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          information__field__UI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "fCS")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fCS().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.PDU_LLC_UI: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LLC_Types.PDU_LLC_UI");
  }
}

void PDU__LLC__UI::encode_text(Text_Buf& text_buf) const
{
field_address__field.encode_text(text_buf);
field_control__field.encode_text(text_buf);
field_information__field__UI.encode_text(text_buf);
field_fCS.encode_text(text_buf);
}

void PDU__LLC__UI::decode_text(Text_Buf& text_buf)
{
field_address__field.decode_text(text_buf);
field_control__field.decode_text(text_buf);
field_information__field__UI.decode_text(text_buf);
field_fCS.decode_text(text_buf);
}

void PDU__LLC__UI::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void PDU__LLC__UI::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int PDU__LLC__UI::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, Address__field_descr_.raw->forceomit);
  decoded_field_length = field_address__field.RAW_decode(Address__field_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, Control__field__UI_descr_.raw->forceomit);
  decoded_field_length = field_control__field.RAW_decode(Control__field__UI_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_2_force_omit(2, force_omit, OCTETSTRING_descr_.raw->forceomit);
  decoded_field_length = field_information__field__UI.RAW_decode(OCTETSTRING_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (limit > 0){
  if (force_omit != NULL && (*force_omit)(3)) {
    field_fCS = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT3_descr_.raw->forceomit);
  decoded_field_length = field_fCS().RAW_decode(General__Types::OCT3_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 1) {
  field_fCS = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  }
  }
  }
  else field_fCS=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int PDU__LLC__UI::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 4;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(4);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, Address__field_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Control__field__UI_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, OCTETSTRING_descr_.raw);
  if (field_fCS.ispresent()) {
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT3_descr_.raw);
  }
  else myleaf.body.node.nodes[3] = NULL;
  encoded_length += field_address__field.RAW_encode(Address__field_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_control__field.RAW_encode(Control__field__UI_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_information__field__UI.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[2]);
  if (field_fCS.ispresent()) {
  encoded_length += field_fCS().RAW_encode(General__Types::OCT3_descr_, *myleaf.body.node.nodes[3]);
  }
  return myleaf.length = encoded_length;
}

struct PDU__LLC__UI_template::single_value_struct {
Address__field_template field_address__field;
Control__field__UI_template field_control__field;
OCTETSTRING_template field_information__field__UI;
OCTETSTRING_template field_fCS;
};

void PDU__LLC__UI_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_address__field = ANY_VALUE;
single_value->field_control__field = ANY_VALUE;
single_value->field_information__field__UI = ANY_VALUE;
single_value->field_fCS = ANY_OR_OMIT;
}
}
}

void PDU__LLC__UI_template::copy_value(const PDU__LLC__UI& other_value)
{
single_value = new single_value_struct;
if (other_value.address__field().is_bound()) {
  single_value->field_address__field = other_value.address__field();
} else {
  single_value->field_address__field.clean_up();
}
if (other_value.control__field().is_bound()) {
  single_value->field_control__field = other_value.control__field();
} else {
  single_value->field_control__field.clean_up();
}
if (other_value.information__field__UI().is_bound()) {
  single_value->field_information__field__UI = other_value.information__field__UI();
} else {
  single_value->field_information__field__UI.clean_up();
}
if (other_value.fCS().is_bound()) {
  if (other_value.fCS().ispresent()) single_value->field_fCS = other_value.fCS()();
  else single_value->field_fCS = OMIT_VALUE;
} else {
  single_value->field_fCS.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PDU__LLC__UI_template::copy_template(const PDU__LLC__UI_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.address__field().get_selection()) {
single_value->field_address__field = other_value.address__field();
} else {
single_value->field_address__field.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.control__field().get_selection()) {
single_value->field_control__field = other_value.control__field();
} else {
single_value->field_control__field.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.information__field__UI().get_selection()) {
single_value->field_information__field__UI = other_value.information__field__UI();
} else {
single_value->field_information__field__UI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.fCS().get_selection()) {
single_value->field_fCS = other_value.fCS();
} else {
single_value->field_fCS.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new PDU__LLC__UI_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new PDU__LLC__UI_template(*other_value.implication_.precondition);
implication_.implied_template = new PDU__LLC__UI_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.PDU_LLC_UI.");
break;
}
set_selection(other_value);
}

PDU__LLC__UI_template::PDU__LLC__UI_template()
{
}

PDU__LLC__UI_template::PDU__LLC__UI_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

PDU__LLC__UI_template::PDU__LLC__UI_template(const PDU__LLC__UI& other_value)
{
copy_value(other_value);
}

PDU__LLC__UI_template::PDU__LLC__UI_template(const OPTIONAL<PDU__LLC__UI>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const PDU__LLC__UI&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.PDU_LLC_UI from an unbound optional field.");
}
}

PDU__LLC__UI_template::PDU__LLC__UI_template(PDU__LLC__UI_template* p_precondition, PDU__LLC__UI_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

PDU__LLC__UI_template::PDU__LLC__UI_template(Dynamic_Match_Interface<PDU__LLC__UI>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<PDU__LLC__UI>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

PDU__LLC__UI_template::PDU__LLC__UI_template(const PDU__LLC__UI_template& other_value)
: Base_Template()
{
copy_template(other_value);
}

PDU__LLC__UI_template::~PDU__LLC__UI_template()
{
clean_up();
}

PDU__LLC__UI_template& PDU__LLC__UI_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

PDU__LLC__UI_template& PDU__LLC__UI_template::operator=(const PDU__LLC__UI& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

PDU__LLC__UI_template& PDU__LLC__UI_template::operator=(const OPTIONAL<PDU__LLC__UI>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const PDU__LLC__UI&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.PDU_LLC_UI.");
}
return *this;
}

PDU__LLC__UI_template& PDU__LLC__UI_template::operator=(const PDU__LLC__UI_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean PDU__LLC__UI_template::match(const PDU__LLC__UI& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.address__field().is_bound()) return FALSE;
if(!single_value->field_address__field.match(other_value.address__field(), legacy))return FALSE;
if(!other_value.control__field().is_bound()) return FALSE;
if(!single_value->field_control__field.match(other_value.control__field(), legacy))return FALSE;
if(!other_value.information__field__UI().is_bound()) return FALSE;
if(!single_value->field_information__field__UI.match(other_value.information__field__UI(), legacy))return FALSE;
if(!other_value.fCS().is_bound()) return FALSE;
if((other_value.fCS().ispresent() ? !single_value->field_fCS.match((const OCTETSTRING&)other_value.fCS(), legacy) : !single_value->field_fCS.match_omit(legacy)))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @LLC_Types.PDU_LLC_UI.");
}
return FALSE;
}

boolean PDU__LLC__UI_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_address__field.is_bound()
 || single_value->field_control__field.is_bound()
 || single_value->field_information__field__UI.is_bound()
 || (single_value->field_fCS.is_omit() || single_value->field_fCS.is_bound());
}

boolean PDU__LLC__UI_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_address__field.is_value()
 && single_value->field_control__field.is_value()
 && single_value->field_information__field__UI.is_value()
 && (single_value->field_fCS.is_omit() || single_value->field_fCS.is_value());
}

void PDU__LLC__UI_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

PDU__LLC__UI PDU__LLC__UI_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.PDU_LLC_UI.");
PDU__LLC__UI ret_val;
if (single_value->field_address__field.is_bound()) {
ret_val.address__field() = single_value->field_address__field.valueof();
}
if (single_value->field_control__field.is_bound()) {
ret_val.control__field() = single_value->field_control__field.valueof();
}
if (single_value->field_information__field__UI.is_bound()) {
ret_val.information__field__UI() = single_value->field_information__field__UI.valueof();
}
if (single_value->field_fCS.is_omit()) ret_val.fCS() = OMIT_VALUE;
else if (single_value->field_fCS.is_bound()) {
ret_val.fCS() = single_value->field_fCS.valueof();
}
return ret_val;
}

void PDU__LLC__UI_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH)
TTCN_error("Setting an invalid list for a template of type @LLC_Types.PDU_LLC_UI.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PDU__LLC__UI_template[list_length];
}

PDU__LLC__UI_template& PDU__LLC__UI_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH)
TTCN_error("Accessing a list element of a non-list template of type @LLC_Types.PDU_LLC_UI.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LLC_Types.PDU_LLC_UI.");
return value_list.list_value[list_index];
}

Address__field_template& PDU__LLC__UI_template::address__field()
{
set_specific();
return single_value->field_address__field;
}

const Address__field_template& PDU__LLC__UI_template::address__field() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field address_field of a non-specific template of type @LLC_Types.PDU_LLC_UI.");
return single_value->field_address__field;
}

Control__field__UI_template& PDU__LLC__UI_template::control__field()
{
set_specific();
return single_value->field_control__field;
}

const Control__field__UI_template& PDU__LLC__UI_template::control__field() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field control_field of a non-specific template of type @LLC_Types.PDU_LLC_UI.");
return single_value->field_control__field;
}

OCTETSTRING_template& PDU__LLC__UI_template::information__field__UI()
{
set_specific();
return single_value->field_information__field__UI;
}

const OCTETSTRING_template& PDU__LLC__UI_template::information__field__UI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field information_field_UI of a non-specific template of type @LLC_Types.PDU_LLC_UI.");
return single_value->field_information__field__UI;
}

OCTETSTRING_template& PDU__LLC__UI_template::fCS()
{
set_specific();
return single_value->field_fCS;
}

const OCTETSTRING_template& PDU__LLC__UI_template::fCS() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field fCS of a non-specific template of type @LLC_Types.PDU_LLC_UI.");
return single_value->field_fCS;
}

int PDU__LLC__UI_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.PDU_LLC_UI which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
  {    int ret_val = 3;
      if (single_value->field_fCS.is_present()) ret_val++;
      return ret_val;
    }
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LLC_Types.PDU_LLC_UI containing an empty list.");
      int item_size = value_list.list_value[0].size_of();
      for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++)
      {
        if (value_list.list_value[l_idx].size_of()!=item_size)
          TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.PDU_LLC_UI containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.PDU_LLC_UI containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.PDU_LLC_UI containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.PDU_LLC_UI containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.PDU_LLC_UI containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.PDU_LLC_UI containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.PDU_LLC_UI containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LLC_Types.PDU_LLC_UI.");
  }
  return 0;
}

void PDU__LLC__UI_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ address_field := ");
single_value->field_address__field.log();
TTCN_Logger::log_event_str(", control_field := ");
single_value->field_control__field.log();
TTCN_Logger::log_event_str(", information_field_UI := ");
single_value->field_information__field__UI.log();
TTCN_Logger::log_event_str(", fCS := ");
single_value->field_fCS.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void PDU__LLC__UI_template::log_match(const PDU__LLC__UI& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_address__field.match(match_value.address__field(), legacy)){
TTCN_Logger::log_logmatch_info(".address_field");
single_value->field_address__field.log_match(match_value.address__field(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_control__field.match(match_value.control__field(), legacy)){
TTCN_Logger::log_logmatch_info(".control_field");
single_value->field_control__field.log_match(match_value.control__field(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_information__field__UI.match(match_value.information__field__UI(), legacy)){
TTCN_Logger::log_logmatch_info(".information_field_UI");
single_value->field_information__field__UI.log_match(match_value.information__field__UI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.fCS().ispresent()){
if(!single_value->field_fCS.match(match_value.fCS(), legacy)){
TTCN_Logger::log_logmatch_info(".fCS");
single_value->field_fCS.log_match(match_value.fCS(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_fCS.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".fCS := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_fCS.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ address_field := ");
single_value->field_address__field.log_match(match_value.address__field(), legacy);
TTCN_Logger::log_event_str(", control_field := ");
single_value->field_control__field.log_match(match_value.control__field(), legacy);
TTCN_Logger::log_event_str(", information_field_UI := ");
single_value->field_information__field__UI.log_match(match_value.information__field__UI(), legacy);
TTCN_Logger::log_event_str(", fCS := ");
if (match_value.fCS().ispresent()) {
single_value->field_fCS.log_match(match_value.fCS(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_fCS.log();
if (single_value->field_fCS.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void PDU__LLC__UI_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (address__field().is_bound()) address__field().set_implicit_omit();
if (control__field().is_bound()) control__field().set_implicit_omit();
if (information__field__UI().is_bound()) information__field__UI().set_implicit_omit();
if (!fCS().is_bound()) fCS() = OMIT_VALUE;
else fCS().set_implicit_omit();
}

void PDU__LLC__UI_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_address__field.encode_text(text_buf);
single_value->field_control__field.encode_text(text_buf);
single_value->field_information__field__UI.encode_text(text_buf);
single_value->field_fCS.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.PDU_LLC_UI.");
}
}

void PDU__LLC__UI_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_address__field.decode_text(text_buf);
single_value->field_control__field.decode_text(text_buf);
single_value->field_information__field__UI.decode_text(text_buf);
single_value->field_fCS.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new PDU__LLC__UI_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @LLC_Types.PDU_LLC_UI.");
}
}

void PDU__LLC__UI_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    PDU__LLC__UI_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (4<param.get_size()) {
      param.error("record template of type @LLC_Types.PDU_LLC_UI has 4 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) address__field().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) control__field().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) information__field__UI().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) fCS().set_param(*param.get_elem(3));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "address_field")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          address__field().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "control_field")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          control__field().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "information_field_UI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          information__field__UI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "fCS")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fCS().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.PDU_LLC_UI: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PDU__LLC__UI_template* precondition = new PDU__LLC__UI_template;
    precondition->set_param(*param.get_elem(0));
    PDU__LLC__UI_template* implied_template = new PDU__LLC__UI_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PDU__LLC__UI_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LLC_Types.PDU_LLC_UI");
  }
  is_ifpresent = param.get_ifpresent();
}

void PDU__LLC__UI_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_address__field.check_restriction(t_res, t_name ? t_name : "@LLC_Types.PDU_LLC_UI");
single_value->field_control__field.check_restriction(t_res, t_name ? t_name : "@LLC_Types.PDU_LLC_UI");
single_value->field_information__field__UI.check_restriction(t_res, t_name ? t_name : "@LLC_Types.PDU_LLC_UI");
single_value->field_fCS.check_restriction(t_res, t_name ? t_name : "@LLC_Types.PDU_LLC_UI");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.PDU_LLC_UI");
}

boolean PDU__LLC__UI_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean PDU__LLC__UI_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

PDU__LLC__U::PDU__LLC__U()
{
}

PDU__LLC__U::PDU__LLC__U(const Address__field& par_address__field,
    const Control__field__U& par_control__field,
    const Information__field__U& par_information__field__U,
    const OPTIONAL< OCTETSTRING >& par_fCS)
  :   field_address__field(par_address__field),
  field_control__field(par_control__field),
  field_information__field__U(par_information__field__U),
  field_fCS(par_fCS)
{
}

PDU__LLC__U::PDU__LLC__U(const PDU__LLC__U& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LLC_Types.PDU_LLC_U.");
if (other_value.address__field().is_bound()) field_address__field = other_value.address__field();
else field_address__field.clean_up();
if (other_value.control__field().is_bound()) field_control__field = other_value.control__field();
else field_control__field.clean_up();
if (other_value.information__field__U().is_bound()) field_information__field__U = other_value.information__field__U();
else field_information__field__U.clean_up();
if (other_value.fCS().is_bound()) field_fCS = other_value.fCS();
else field_fCS.clean_up();
}

void PDU__LLC__U::clean_up()
{
field_address__field.clean_up();
field_control__field.clean_up();
field_information__field__U.clean_up();
field_fCS.clean_up();
}

const TTCN_Typedescriptor_t* PDU__LLC__U::get_descriptor() const { return &PDU__LLC__U_descr_; }
PDU__LLC__U& PDU__LLC__U::operator=(const PDU__LLC__U& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LLC_Types.PDU_LLC_U.");
  if (other_value.address__field().is_bound()) field_address__field = other_value.address__field();
  else field_address__field.clean_up();
  if (other_value.control__field().is_bound()) field_control__field = other_value.control__field();
  else field_control__field.clean_up();
  if (other_value.information__field__U().is_bound()) field_information__field__U = other_value.information__field__U();
  else field_information__field__U.clean_up();
  if (other_value.fCS().is_bound()) field_fCS = other_value.fCS();
  else field_fCS.clean_up();
}
return *this;
}

boolean PDU__LLC__U::operator==(const PDU__LLC__U& other_value) const
{
return field_address__field==other_value.field_address__field
  && field_control__field==other_value.field_control__field
  && field_information__field__U==other_value.field_information__field__U
  && field_fCS==other_value.field_fCS;
}

boolean PDU__LLC__U::is_bound() const
{
return (field_address__field.is_bound())
  || (field_control__field.is_bound())
  || (field_information__field__U.is_bound())
  || (OPTIONAL_OMIT == field_fCS.get_selection() || field_fCS.is_bound());
}
boolean PDU__LLC__U::is_value() const
{
return field_address__field.is_value()
  && field_control__field.is_value()
  && field_information__field__U.is_value()
  && (OPTIONAL_OMIT == field_fCS.get_selection() || field_fCS.is_value());
}
int PDU__LLC__U::size_of() const
{
  int ret_val = 3;
  if (field_fCS.ispresent()) ret_val++;
  return ret_val;
}

void PDU__LLC__U::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ address_field := ");
field_address__field.log();
TTCN_Logger::log_event_str(", control_field := ");
field_control__field.log();
TTCN_Logger::log_event_str(", information_field_U := ");
field_information__field__U.log();
TTCN_Logger::log_event_str(", fCS := ");
field_fCS.log();
TTCN_Logger::log_event_str(" }");
}

void PDU__LLC__U::set_implicit_omit()
{
if (address__field().is_bound()) address__field().set_implicit_omit();
if (control__field().is_bound()) control__field().set_implicit_omit();
if (information__field__U().is_bound()) information__field__U().set_implicit_omit();
if (!fCS().is_bound()) fCS() = OMIT_VALUE;
else fCS().set_implicit_omit();
}

void PDU__LLC__U::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (4<param.get_size()) {
      param.error("record value of type @LLC_Types.PDU_LLC_U has 4 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) address__field().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) control__field().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) information__field__U().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) fCS().set_param(*param.get_elem(3));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "address_field")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          address__field().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "control_field")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          control__field().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "information_field_U")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          information__field__U().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "fCS")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fCS().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.PDU_LLC_U: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LLC_Types.PDU_LLC_U");
  }
}

void PDU__LLC__U::encode_text(Text_Buf& text_buf) const
{
field_address__field.encode_text(text_buf);
field_control__field.encode_text(text_buf);
field_information__field__U.encode_text(text_buf);
field_fCS.encode_text(text_buf);
}

void PDU__LLC__U::decode_text(Text_Buf& text_buf)
{
field_address__field.decode_text(text_buf);
field_control__field.decode_text(text_buf);
field_information__field__U.decode_text(text_buf);
field_fCS.decode_text(text_buf);
}

void PDU__LLC__U::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void PDU__LLC__U::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int PDU__LLC__U::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  int selected_field = -1;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, Address__field_descr_.raw->forceomit);
  decoded_field_length = field_address__field.RAW_decode(Address__field_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, Control__field__U_descr_.raw->forceomit);
  decoded_field_length = field_control__field.RAW_decode(Control__field__U_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_control__field.mBits() ==  bs_17) selected_field = 0;
  else if (field_control__field.mBits() ==  bs_18) selected_field = 1;
  else if (field_control__field.mBits() ==  bs_19) selected_field = 2;
  else if (field_control__field.mBits() ==  bs_20) selected_field = 3;
  else if (field_control__field.mBits() ==  bs_21) selected_field = 4;
  else if (field_control__field.mBits() ==  bs_22) selected_field = 5;
  else if (field_control__field.mBits() ==  bs_23) selected_field = 6;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, PDU__LLC__U_information__field__U_descr_.raw->forceomit);
  decoded_field_length = field_information__field__U.RAW_decode(PDU__LLC__U_information__field__U_descr_, p_buf, limit, local_top_order, no_err, selected_field, TRUE, &field_2_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (limit > 0){
  if (force_omit != NULL && (*force_omit)(3)) {
    field_fCS = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT3_descr_.raw->forceomit);
  decoded_field_length = field_fCS().RAW_decode(General__Types::OCT3_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 1) {
  field_fCS = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  }
  }
  }
  else field_fCS=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int PDU__LLC__U::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 4;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(4);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, Address__field_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Control__field__U_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PDU__LLC__U_information__field__U_descr_.raw);
  if (field_fCS.ispresent()) {
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT3_descr_.raw);
  }
  else myleaf.body.node.nodes[3] = NULL;
  encoded_length += field_address__field.RAW_encode(Address__field_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_control__field.RAW_encode(Control__field__U_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_information__field__U.RAW_encode(PDU__LLC__U_information__field__U_descr_, *myleaf.body.node.nodes[2]);
  if (field_fCS.ispresent()) {
  encoded_length += field_fCS().RAW_encode(General__Types::OCT3_descr_, *myleaf.body.node.nodes[3]);
  }
  switch (field_information__field__U.get_selection()) {
  case Information__field__U::ALT_uA:
  if (field_control__field.mBits() !=  bs_17) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 2;
  int new_pos[] = { 1, 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 2, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_17.RAW_encode(General__Types::BIT4_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case Information__field__U::ALT_sABM:
  if (field_control__field.mBits() !=  bs_18) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 2;
  int new_pos[] = { 1, 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 2, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_18.RAW_encode(General__Types::BIT4_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case Information__field__U::ALT_fRMR:
  if (field_control__field.mBits() !=  bs_19) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 2;
  int new_pos[] = { 1, 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 2, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_19.RAW_encode(General__Types::BIT4_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case Information__field__U::ALT_dM:
  if (field_control__field.mBits() !=  bs_20) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 2;
  int new_pos[] = { 1, 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 2, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_20.RAW_encode(General__Types::BIT4_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case Information__field__U::ALT_xID:
  if (field_control__field.mBits() !=  bs_21) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 2;
  int new_pos[] = { 1, 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 2, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_21.RAW_encode(General__Types::BIT4_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case Information__field__U::ALT_nULL:
  if (field_control__field.mBits() !=  bs_22) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 2;
  int new_pos[] = { 1, 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 2, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_22.RAW_encode(General__Types::BIT4_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case Information__field__U::ALT_dISC:
  if (field_control__field.mBits() !=  bs_23) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 2;
  int new_pos[] = { 1, 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 2, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_23.RAW_encode(General__Types::BIT4_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  default:;
  }
  return myleaf.length = encoded_length;
}

struct PDU__LLC__U_template::single_value_struct {
Address__field_template field_address__field;
Control__field__U_template field_control__field;
Information__field__U_template field_information__field__U;
OCTETSTRING_template field_fCS;
};

void PDU__LLC__U_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_address__field = ANY_VALUE;
single_value->field_control__field = ANY_VALUE;
single_value->field_information__field__U = ANY_VALUE;
single_value->field_fCS = ANY_OR_OMIT;
}
}
}

void PDU__LLC__U_template::copy_value(const PDU__LLC__U& other_value)
{
single_value = new single_value_struct;
if (other_value.address__field().is_bound()) {
  single_value->field_address__field = other_value.address__field();
} else {
  single_value->field_address__field.clean_up();
}
if (other_value.control__field().is_bound()) {
  single_value->field_control__field = other_value.control__field();
} else {
  single_value->field_control__field.clean_up();
}
if (other_value.information__field__U().is_bound()) {
  single_value->field_information__field__U = other_value.information__field__U();
} else {
  single_value->field_information__field__U.clean_up();
}
if (other_value.fCS().is_bound()) {
  if (other_value.fCS().ispresent()) single_value->field_fCS = other_value.fCS()();
  else single_value->field_fCS = OMIT_VALUE;
} else {
  single_value->field_fCS.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PDU__LLC__U_template::copy_template(const PDU__LLC__U_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.address__field().get_selection()) {
single_value->field_address__field = other_value.address__field();
} else {
single_value->field_address__field.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.control__field().get_selection()) {
single_value->field_control__field = other_value.control__field();
} else {
single_value->field_control__field.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.information__field__U().get_selection()) {
single_value->field_information__field__U = other_value.information__field__U();
} else {
single_value->field_information__field__U.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.fCS().get_selection()) {
single_value->field_fCS = other_value.fCS();
} else {
single_value->field_fCS.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new PDU__LLC__U_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new PDU__LLC__U_template(*other_value.implication_.precondition);
implication_.implied_template = new PDU__LLC__U_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @LLC_Types.PDU_LLC_U.");
break;
}
set_selection(other_value);
}

PDU__LLC__U_template::PDU__LLC__U_template()
{
}

PDU__LLC__U_template::PDU__LLC__U_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

PDU__LLC__U_template::PDU__LLC__U_template(const PDU__LLC__U& other_value)
{
copy_value(other_value);
}

PDU__LLC__U_template::PDU__LLC__U_template(const OPTIONAL<PDU__LLC__U>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const PDU__LLC__U&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @LLC_Types.PDU_LLC_U from an unbound optional field.");
}
}

PDU__LLC__U_template::PDU__LLC__U_template(PDU__LLC__U_template* p_precondition, PDU__LLC__U_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

PDU__LLC__U_template::PDU__LLC__U_template(Dynamic_Match_Interface<PDU__LLC__U>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<PDU__LLC__U>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

PDU__LLC__U_template::PDU__LLC__U_template(const PDU__LLC__U_template& other_value)
: Base_Template()
{
copy_template(other_value);
}

PDU__LLC__U_template::~PDU__LLC__U_template()
{
clean_up();
}

PDU__LLC__U_template& PDU__LLC__U_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

PDU__LLC__U_template& PDU__LLC__U_template::operator=(const PDU__LLC__U& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

PDU__LLC__U_template& PDU__LLC__U_template::operator=(const OPTIONAL<PDU__LLC__U>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const PDU__LLC__U&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @LLC_Types.PDU_LLC_U.");
}
return *this;
}

PDU__LLC__U_template& PDU__LLC__U_template::operator=(const PDU__LLC__U_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean PDU__LLC__U_template::match(const PDU__LLC__U& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.address__field().is_bound()) return FALSE;
if(!single_value->field_address__field.match(other_value.address__field(), legacy))return FALSE;
if(!other_value.control__field().is_bound()) return FALSE;
if(!single_value->field_control__field.match(other_value.control__field(), legacy))return FALSE;
if(!other_value.information__field__U().is_bound()) return FALSE;
if(!single_value->field_information__field__U.match(other_value.information__field__U(), legacy))return FALSE;
if(!other_value.fCS().is_bound()) return FALSE;
if((other_value.fCS().ispresent() ? !single_value->field_fCS.match((const OCTETSTRING&)other_value.fCS(), legacy) : !single_value->field_fCS.match_omit(legacy)))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @LLC_Types.PDU_LLC_U.");
}
return FALSE;
}

boolean PDU__LLC__U_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_address__field.is_bound()
 || single_value->field_control__field.is_bound()
 || single_value->field_information__field__U.is_bound()
 || (single_value->field_fCS.is_omit() || single_value->field_fCS.is_bound());
}

boolean PDU__LLC__U_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_address__field.is_value()
 && single_value->field_control__field.is_value()
 && single_value->field_information__field__U.is_value()
 && (single_value->field_fCS.is_omit() || single_value->field_fCS.is_value());
}

void PDU__LLC__U_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

PDU__LLC__U PDU__LLC__U_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of type @LLC_Types.PDU_LLC_U.");
PDU__LLC__U ret_val;
if (single_value->field_address__field.is_bound()) {
ret_val.address__field() = single_value->field_address__field.valueof();
}
if (single_value->field_control__field.is_bound()) {
ret_val.control__field() = single_value->field_control__field.valueof();
}
if (single_value->field_information__field__U.is_bound()) {
ret_val.information__field__U() = single_value->field_information__field__U.valueof();
}
if (single_value->field_fCS.is_omit()) ret_val.fCS() = OMIT_VALUE;
else if (single_value->field_fCS.is_bound()) {
ret_val.fCS() = single_value->field_fCS.valueof();
}
return ret_val;
}

void PDU__LLC__U_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH)
TTCN_error("Setting an invalid list for a template of type @LLC_Types.PDU_LLC_U.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PDU__LLC__U_template[list_length];
}

PDU__LLC__U_template& PDU__LLC__U_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH)
TTCN_error("Accessing a list element of a non-list template of type @LLC_Types.PDU_LLC_U.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LLC_Types.PDU_LLC_U.");
return value_list.list_value[list_index];
}

Address__field_template& PDU__LLC__U_template::address__field()
{
set_specific();
return single_value->field_address__field;
}

const Address__field_template& PDU__LLC__U_template::address__field() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field address_field of a non-specific template of type @LLC_Types.PDU_LLC_U.");
return single_value->field_address__field;
}

Control__field__U_template& PDU__LLC__U_template::control__field()
{
set_specific();
return single_value->field_control__field;
}

const Control__field__U_template& PDU__LLC__U_template::control__field() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field control_field of a non-specific template of type @LLC_Types.PDU_LLC_U.");
return single_value->field_control__field;
}

Information__field__U_template& PDU__LLC__U_template::information__field__U()
{
set_specific();
return single_value->field_information__field__U;
}

const Information__field__U_template& PDU__LLC__U_template::information__field__U() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field information_field_U of a non-specific template of type @LLC_Types.PDU_LLC_U.");
return single_value->field_information__field__U;
}

OCTETSTRING_template& PDU__LLC__U_template::fCS()
{
set_specific();
return single_value->field_fCS;
}

const OCTETSTRING_template& PDU__LLC__U_template::fCS() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field fCS of a non-specific template of type @LLC_Types.PDU_LLC_U.");
return single_value->field_fCS;
}

int PDU__LLC__U_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.PDU_LLC_U which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
  {    int ret_val = 3;
      if (single_value->field_fCS.is_present()) ret_val++;
      return ret_val;
    }
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LLC_Types.PDU_LLC_U containing an empty list.");
      int item_size = value_list.list_value[0].size_of();
      for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++)
      {
        if (value_list.list_value[l_idx].size_of()!=item_size)
          TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.PDU_LLC_U containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.PDU_LLC_U containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.PDU_LLC_U containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.PDU_LLC_U containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.PDU_LLC_U containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.PDU_LLC_U containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LLC_Types.PDU_LLC_U containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LLC_Types.PDU_LLC_U.");
  }
  return 0;
}

void PDU__LLC__U_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ address_field := ");
single_value->field_address__field.log();
TTCN_Logger::log_event_str(", control_field := ");
single_value->field_control__field.log();
TTCN_Logger::log_event_str(", information_field_U := ");
single_value->field_information__field__U.log();
TTCN_Logger::log_event_str(", fCS := ");
single_value->field_fCS.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void PDU__LLC__U_template::log_match(const PDU__LLC__U& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_address__field.match(match_value.address__field(), legacy)){
TTCN_Logger::log_logmatch_info(".address_field");
single_value->field_address__field.log_match(match_value.address__field(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_control__field.match(match_value.control__field(), legacy)){
TTCN_Logger::log_logmatch_info(".control_field");
single_value->field_control__field.log_match(match_value.control__field(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_information__field__U.match(match_value.information__field__U(), legacy)){
TTCN_Logger::log_logmatch_info(".information_field_U");
single_value->field_information__field__U.log_match(match_value.information__field__U(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.fCS().ispresent()){
if(!single_value->field_fCS.match(match_value.fCS(), legacy)){
TTCN_Logger::log_logmatch_info(".fCS");
single_value->field_fCS.log_match(match_value.fCS(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_fCS.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".fCS := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_fCS.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ address_field := ");
single_value->field_address__field.log_match(match_value.address__field(), legacy);
TTCN_Logger::log_event_str(", control_field := ");
single_value->field_control__field.log_match(match_value.control__field(), legacy);
TTCN_Logger::log_event_str(", information_field_U := ");
single_value->field_information__field__U.log_match(match_value.information__field__U(), legacy);
TTCN_Logger::log_event_str(", fCS := ");
if (match_value.fCS().ispresent()) {
single_value->field_fCS.log_match(match_value.fCS(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_fCS.log();
if (single_value->field_fCS.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void PDU__LLC__U_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (address__field().is_bound()) address__field().set_implicit_omit();
if (control__field().is_bound()) control__field().set_implicit_omit();
if (information__field__U().is_bound()) information__field__U().set_implicit_omit();
if (!fCS().is_bound()) fCS() = OMIT_VALUE;
else fCS().set_implicit_omit();
}

void PDU__LLC__U_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_address__field.encode_text(text_buf);
single_value->field_control__field.encode_text(text_buf);
single_value->field_information__field__U.encode_text(text_buf);
single_value->field_fCS.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @LLC_Types.PDU_LLC_U.");
}
}

void PDU__LLC__U_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_address__field.decode_text(text_buf);
single_value->field_control__field.decode_text(text_buf);
single_value->field_information__field__U.decode_text(text_buf);
single_value->field_fCS.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new PDU__LLC__U_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @LLC_Types.PDU_LLC_U.");
}
}

void PDU__LLC__U_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    PDU__LLC__U_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (4<param.get_size()) {
      param.error("record template of type @LLC_Types.PDU_LLC_U has 4 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) address__field().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) control__field().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) information__field__U().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) fCS().set_param(*param.get_elem(3));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "address_field")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          address__field().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "control_field")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          control__field().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "information_field_U")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          information__field__U().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "fCS")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fCS().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @LLC_Types.PDU_LLC_U: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PDU__LLC__U_template* precondition = new PDU__LLC__U_template;
    precondition->set_param(*param.get_elem(0));
    PDU__LLC__U_template* implied_template = new PDU__LLC__U_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PDU__LLC__U_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LLC_Types.PDU_LLC_U");
  }
  is_ifpresent = param.get_ifpresent();
}

void PDU__LLC__U_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_address__field.check_restriction(t_res, t_name ? t_name : "@LLC_Types.PDU_LLC_U");
single_value->field_control__field.check_restriction(t_res, t_name ? t_name : "@LLC_Types.PDU_LLC_U");
single_value->field_information__field__U.check_restriction(t_res, t_name ? t_name : "@LLC_Types.PDU_LLC_U");
single_value->field_fCS.check_restriction(t_res, t_name ? t_name : "@LLC_Types.PDU_LLC_U");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.PDU_LLC_U");
}

boolean PDU__LLC__U_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean PDU__LLC__U_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

void PDU__LLC::copy_value(const PDU__LLC& other_value)
{
switch (other_value.union_selection) {
case ALT_pDU__LLC__UI:
field_pDU__LLC__UI = new PDU__LLC__UI(*other_value.field_pDU__LLC__UI);
break;
case ALT_pDU__LLC__U:
field_pDU__LLC__U = new PDU__LLC__U(*other_value.field_pDU__LLC__U);
break;
default:
TTCN_error("Assignment of an unbound union value of type @LLC_Types.PDU_LLC.");
}
union_selection = other_value.union_selection;
}

PDU__LLC::PDU__LLC()
{
union_selection = UNBOUND_VALUE;
}

PDU__LLC::PDU__LLC(const PDU__LLC& other_value)
: Base_Type(){
copy_value(other_value);
}

PDU__LLC::~PDU__LLC()
{
clean_up();
}

PDU__LLC& PDU__LLC::operator=(const PDU__LLC& other_value)
{
if (this != &other_value) {
clean_up();
copy_value(other_value);
}
return *this;
}

boolean PDU__LLC::operator==(const PDU__LLC& other_value) const
{
if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @LLC_Types.PDU_LLC.");
if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @LLC_Types.PDU_LLC.");
if (union_selection != other_value.union_selection) return FALSE;
switch (union_selection) {
case ALT_pDU__LLC__UI:
return *field_pDU__LLC__UI == *other_value.field_pDU__LLC__UI;
case ALT_pDU__LLC__U:
return *field_pDU__LLC__U == *other_value.field_pDU__LLC__U;
default:
return FALSE;
}
}

PDU__LLC__UI& PDU__LLC::pDU__LLC__UI()
{
if (union_selection != ALT_pDU__LLC__UI) {
clean_up();
field_pDU__LLC__UI = new PDU__LLC__UI;
union_selection = ALT_pDU__LLC__UI;
}
return *field_pDU__LLC__UI;
}

const PDU__LLC__UI& PDU__LLC::pDU__LLC__UI() const
{
if (union_selection != ALT_pDU__LLC__UI) TTCN_error("Using non-selected field pDU_LLC_UI in a value of union type @LLC_Types.PDU_LLC.");
return *field_pDU__LLC__UI;
}

PDU__LLC__U& PDU__LLC::pDU__LLC__U()
{
if (union_selection != ALT_pDU__LLC__U) {
clean_up();
field_pDU__LLC__U = new PDU__LLC__U;
union_selection = ALT_pDU__LLC__U;
}
return *field_pDU__LLC__U;
}

const PDU__LLC__U& PDU__LLC::pDU__LLC__U() const
{
if (union_selection != ALT_pDU__LLC__U) TTCN_error("Using non-selected field pDU_LLC_U in a value of union type @LLC_Types.PDU_LLC.");
return *field_pDU__LLC__U;
}

boolean PDU__LLC::ischosen(union_selection_type checked_selection) const
{
if (checked_selection == UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @LLC_Types.PDU_LLC.");
return union_selection == checked_selection;
}

boolean PDU__LLC::is_bound() const
{
  return union_selection != UNBOUND_VALUE;
}

boolean PDU__LLC::is_value() const
{
switch (union_selection) {
case UNBOUND_VALUE: return FALSE;
case ALT_pDU__LLC__UI: return field_pDU__LLC__UI->is_value();
case ALT_pDU__LLC__U: return field_pDU__LLC__U->is_value();
default: TTCN_error("Invalid selection in union is_bound");}
}

void PDU__LLC::clean_up()
{
switch (union_selection) {
case ALT_pDU__LLC__UI:
  delete field_pDU__LLC__UI;
  break;
case ALT_pDU__LLC__U:
  delete field_pDU__LLC__U;
  break;
default:
  break;
}
union_selection = UNBOUND_VALUE;
}

void PDU__LLC::log() const
{
switch (union_selection) {
case ALT_pDU__LLC__UI:
TTCN_Logger::log_event_str("{ pDU_LLC_UI := ");
field_pDU__LLC__UI->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_pDU__LLC__U:
TTCN_Logger::log_event_str("{ pDU_LLC_U := ");
field_pDU__LLC__U->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_unbound();
}
}

void PDU__LLC::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "union value");
  Module_Param_Ptr m_p = &param;
  if (m_p->get_type()==Module_Param::MP_Value_List && m_p->get_size()==0) return;
  if (m_p->get_type()!=Module_Param::MP_Assignment_List) {
    param.error("union value with field name was expected");
  }
  Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1);
  char* last_name = mp_last->get_id()->get_name();
  if (!strcmp(last_name, "pDU_LLC_UI")) {
    pDU__LLC__UI().set_param(*mp_last);
    if (!pDU__LLC__UI().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "pDU_LLC_U")) {
    pDU__LLC__U().set_param(*mp_last);
    if (!pDU__LLC__U().is_bound()) clean_up();
    return;
  }
  mp_last->error("Field %s does not exist in type @LLC_Types.PDU_LLC.", last_name);
}

void PDU__LLC::set_implicit_omit()
{
switch (union_selection) {
case ALT_pDU__LLC__UI:
field_pDU__LLC__UI->set_implicit_omit(); break;
case ALT_pDU__LLC__U:
field_pDU__LLC__U->set_implicit_omit(); break;
default: break;
}
}

void PDU__LLC::encode_text(Text_Buf& text_buf) const
{
text_buf.push_int(union_selection);
switch (union_selection) {
case ALT_pDU__LLC__UI:
field_pDU__LLC__UI->encode_text(text_buf);
break;
case ALT_pDU__LLC__U:
field_pDU__LLC__U->encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an unbound value of union type @LLC_Types.PDU_LLC.");
}
}

void PDU__LLC::decode_text(Text_Buf& text_buf)
{
switch ((union_selection_type)text_buf.pull_int().get_val()) {
case ALT_pDU__LLC__UI:
pDU__LLC__UI().decode_text(text_buf);
break;
case ALT_pDU__LLC__U:
pDU__LLC__U().decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for type @LLC_Types.PDU_LLC.");
}
}

void PDU__LLC::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name);
    unsigned BER_coding=va_arg(pvar, unsigned);
    BER_encode_chk_coding(BER_coding);
    ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding);
    tlv->put_in_buffer(p_buf);
    ASN_BER_TLV_t::destruct(tlv);
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    RAW_enc_tr_pos rp;
    rp.level=0;
    rp.pos=NULL;
    RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw);
    RAW_encode(p_td, root);
    root.put_to_buf(p_buf);
    break;}
  case TTCN_EncDec::CT_TEXT: {
    TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
      ("No TEXT descriptor available for type '%s'.", p_td.name);
    TEXT_encode(p_td,p_buf);
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0);
    p_buf.put_c('\n');
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok(va_arg(pvar, int) != 0);
    JSON_encode(p_td, tok, FALSE);
    p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
    OER_encode(p_td, p_buf);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name);
    if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    PER_encode(p_td, p_buf, opt);
    break; }
  default:
    TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name);
  }
  va_end(pvar);
}

void PDU__LLC::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...)
{
  va_list pvar;
  va_start(pvar, p_coding);
  switch(p_coding) {
  case TTCN_EncDec::CT_BER: {
    TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
    unsigned L_form=va_arg(pvar, unsigned);
    ASN_BER_TLV_t tlv;
    BER_decode_str2TLV(p_buf, tlv, L_form);
    BER_decode_TLV(p_td, tlv, L_form);
    if(tlv.isComplete) p_buf.increase_pos(tlv.get_len());
    break;}
  case TTCN_EncDec::CT_RAW: {
    TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
    if(!p_td.raw)
      TTCN_EncDec_ErrorContext::error_internal
        ("No RAW descriptor available for type '%s'.", p_td.name);
    raw_order_t r_order;
    switch(p_td.raw->top_bit_order) {
    case TOP_BIT_LEFT:
      r_order=ORDER_LSB;
      break;
    case TOP_BIT_RIGHT:
    default:
      r_order=ORDER_MSB;
    }
    int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order);
    if(rawr<0) switch (-rawr) {
    case TTCN_EncDec::ET_INCOMPL_MSG:
    case TTCN_EncDec::ET_LEN_ERR:
      ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name);
      break;
    case 1:
    default:
      ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name);
      break;
    }
    break;}
  case TTCN_EncDec::CT_TEXT: {
    Limit_Token_List limit;
    TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name);
    if(!p_td.text)
      TTCN_EncDec_ErrorContext::error_internal
        ("No TEXT descriptor available for type '%s'.", p_td.name);
    const unsigned char *b_data=p_buf.get_data();
    int null_added=0;
    if(b_data[p_buf.get_len()-1]!='\0'){
      null_added=1;
      p_buf.set_pos(p_buf.get_len());
      p_buf.put_zero(8,ORDER_LSB);
      p_buf.rewind();
    }
    if(TEXT_decode(p_td,p_buf,limit)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    if(null_added){
      size_t actpos=p_buf.get_pos();
      p_buf.set_pos(p_buf.get_len()-1);
      p_buf.cut_end();
      p_buf.set_pos(actpos);
    }
    break;}
  case TTCN_EncDec::CT_XER: {
    TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name);
    unsigned XER_coding=va_arg(pvar, unsigned);
    XER_encode_chk_coding(XER_coding, p_td);
    XmlReaderWrap reader(p_buf);
    for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) {
      if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break;
    }
    XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0);
    size_t bytes = reader.ByteConsumed();
    p_buf.set_pos(bytes);
    break;}
  case TTCN_EncDec::CT_JSON: {
    TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name);
    if(!p_td.json)
      TTCN_EncDec_ErrorContext::error_internal
        ("No JSON descriptor available for type '%s'.", p_td.name);
    JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len());
    if(JSON_decode(p_td, tok, FALSE, FALSE)<0)
      ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name);
    p_buf.set_pos(tok.get_buf_pos());
    break;}
  case TTCN_EncDec::CT_OER: {
    TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name);
    if(!p_td.oer)
      TTCN_EncDec_ErrorContext::error_internal
        ("No OER descriptor available for type '%s'.", p_td.name);
     OER_struct p_oer;
    OER_decode(p_td, p_buf, p_oer);
    break;}
  case TTCN_EncDec::CT_PER: {
    TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name);
    if(!p_td.per)  TTCN_EncDec_ErrorContext::error_internal(
      "No PER descriptor available for type '%s'.", p_td.name);
    int opt = va_arg(pvar, int);
    try {
      PER_decode(p_td, p_buf, opt);
      p_buf.PER_octet_align(FALSE);
    }
    catch (PER_Buffer_Exception) { }
    break; }
  default:
    TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name);
  }
  va_end(pvar);
}

int PDU__LLC::RAW_decode(
const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, 
raw_order_t top_bit_ord, boolean no_err, int sel_field, boolean, const RAW_Force_Omit* force_omit)
{
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  int decoded_length=0;
  int starting_pos=p_buf.get_pos_bit();
  if(sel_field!=-1){
    switch(sel_field){
    case 0: {
      RAW_Force_Omit field_force_omit(0, force_omit, PDU__LLC__UI_descr_.raw->forceomit);
      decoded_length = pDU__LLC__UI().RAW_decode(PDU__LLC__UI_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 1: {
      RAW_Force_Omit field_force_omit(1, force_omit, PDU__LLC__U_descr_.raw->forceomit);
      decoded_length = pDU__LLC__U().RAW_decode(PDU__LLC__U_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    default: break;
    }
    return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
  } else {
    boolean already_failed = FALSE;
    already_failed = FALSE;
    if (!already_failed) {
      BITSTRING temporal_0;
      int decoded_0_length;
      p_buf.set_pos_bit(starting_pos + 8);
      decoded_0_length = temporal_0.RAW_decode(Control__field__UI_format_descr_, p_buf, limit, top_bit_ord, TRUE);
      if (decoded_0_length > 0) {
        if (temporal_0 ==  bs_15) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(0, force_omit, PDU__LLC__UI_descr_.raw->forceomit);
          decoded_length = pDU__LLC__UI().RAW_decode(PDU__LLC__UI_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_pDU__LLC__UI).control__field().format() ==  bs_15) {
               return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
             }else already_failed = TRUE;
          }
        }
      }
    }
    already_failed = FALSE;
    if (!already_failed) {
      BITSTRING temporal_1;
      int decoded_1_length;
      p_buf.set_pos_bit(starting_pos + 13);
      decoded_1_length = temporal_1.RAW_decode(General__Types::BIT3_descr_, p_buf, limit, top_bit_ord, TRUE);
      if (decoded_1_length > 0) {
        if (temporal_1 ==  bs_16) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(1, force_omit, PDU__LLC__U_descr_.raw->forceomit);
          decoded_length = pDU__LLC__U().RAW_decode(PDU__LLC__U_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_pDU__LLC__U).control__field().format() ==  bs_16) {
               return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
             }else already_failed = TRUE;
          }
        }
      }
    }
 }
 clean_up();
 return -1;
}

int PDU__LLC::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const
{
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 2;  myleaf.body.node.nodes = init_nodes_of_enc_tree(2);
  memset(myleaf.body.node.nodes, 0, 2 * sizeof(RAW_enc_tree *));
  switch (union_selection) {
  case ALT_pDU__LLC__UI:
    myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, PDU__LLC__UI_descr_.raw);
    encoded_length = field_pDU__LLC__UI->RAW_encode(PDU__LLC__UI_descr_, *myleaf.body.node.nodes[0]);
    myleaf.body.node.nodes[0]->coding_descr = &PDU__LLC__UI_descr_;
    if ((*field_pDU__LLC__UI).control__field().format() !=  bs_15) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+3;
  int new_pos0[]={0,1,0};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,3,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
   bs_15.RAW_encode(Control__field__UI_format_descr_,*temp_leaf);
  } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  }
  free_tree_pos(pr_pos0.pos);
  }
    }
    break;
  case ALT_pDU__LLC__U:
    myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, PDU__LLC__U_descr_.raw);
    encoded_length = field_pDU__LLC__U->RAW_encode(PDU__LLC__U_descr_, *myleaf.body.node.nodes[1]);
    myleaf.body.node.nodes[1]->coding_descr = &PDU__LLC__U_descr_;
    if ((*field_pDU__LLC__U).control__field().format() !=  bs_16) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+3;
  int new_pos0[]={1,1,2};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,3,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
   bs_16.RAW_encode(General__Types::BIT3_descr_,*temp_leaf);
  } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  }
  free_tree_pos(pr_pos0.pos);
  }
    }
    break;
  default:
    TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  }
  return encoded_length;
}

void PDU__LLC_template::copy_value(const PDU__LLC& other_value)
{
single_value.union_selection = other_value.get_selection();
switch (single_value.union_selection) {
case PDU__LLC::ALT_pDU__LLC__UI:
single_value.field_pDU__LLC__UI = new PDU__LLC__UI_template(other_value.pDU__LLC__UI());
break;
case PDU__LLC::ALT_pDU__LLC__U:
single_value.field_pDU__LLC__U = new PDU__LLC__U_template(other_value.pDU__LLC__U());
break;
default:
TTCN_error("Initializing a template with an unbound value of type @LLC_Types.PDU_LLC.");
}
set_selection(SPECIFIC_VALUE);
}

void PDU__LLC_template::copy_template(const PDU__LLC_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value.union_selection = other_value.single_value.union_selection;
switch (single_value.union_selection) {
case PDU__LLC::ALT_pDU__LLC__UI:
single_value.field_pDU__LLC__UI = new PDU__LLC__UI_template(*other_value.single_value.field_pDU__LLC__UI);
break;
case PDU__LLC::ALT_pDU__LLC__U:
single_value.field_pDU__LLC__U = new PDU__LLC__U_template(*other_value.single_value.field_pDU__LLC__U);
break;
default:
TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @LLC_Types.PDU_LLC.");
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new PDU__LLC_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new PDU__LLC_template(*other_value.implication_.precondition);
implication_.implied_template = new PDU__LLC_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized template of union type @LLC_Types.PDU_LLC.");
}
set_selection(other_value);
}

PDU__LLC_template::PDU__LLC_template()
{
}

PDU__LLC_template::PDU__LLC_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

PDU__LLC_template::PDU__LLC_template(const PDU__LLC& other_value)
{
copy_value(other_value);
}

PDU__LLC_template::PDU__LLC_template(const OPTIONAL<PDU__LLC>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const PDU__LLC&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of union type @LLC_Types.PDU_LLC from an unbound optional field.");
}
}

PDU__LLC_template::PDU__LLC_template(PDU__LLC_template* p_precondition, PDU__LLC_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

PDU__LLC_template::PDU__LLC_template(Dynamic_Match_Interface<PDU__LLC>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<PDU__LLC>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

PDU__LLC_template::PDU__LLC_template(const PDU__LLC_template& other_value)
: Base_Template(){
copy_template(other_value);
}

PDU__LLC_template::~PDU__LLC_template()
{
clean_up();
}

void PDU__LLC_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case PDU__LLC::ALT_pDU__LLC__UI:
delete single_value.field_pDU__LLC__UI;
break;
case PDU__LLC::ALT_pDU__LLC__U:
delete single_value.field_pDU__LLC__U;
default:
break;
}
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

PDU__LLC_template& PDU__LLC_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

PDU__LLC_template& PDU__LLC_template::operator=(const PDU__LLC& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

PDU__LLC_template& PDU__LLC_template::operator=(const OPTIONAL<PDU__LLC>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const PDU__LLC&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of union type @LLC_Types.PDU_LLC.");
}
return *this;
}

PDU__LLC_template& PDU__LLC_template::operator=(const PDU__LLC_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean PDU__LLC_template::match(const PDU__LLC& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
{
PDU__LLC::union_selection_type value_selection = other_value.get_selection();
if (value_selection == PDU__LLC::UNBOUND_VALUE) return FALSE;
if (value_selection != single_value.union_selection) return FALSE;
switch (value_selection) {
case PDU__LLC::ALT_pDU__LLC__UI:
return single_value.field_pDU__LLC__UI->match(other_value.pDU__LLC__UI(), legacy);
case PDU__LLC::ALT_pDU__LLC__U:
return single_value.field_pDU__LLC__U->match(other_value.pDU__LLC__U(), legacy);
default:
TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @LLC_Types.PDU_LLC.");
}
}
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error ("Matching an uninitialized template of union type @LLC_Types.PDU_LLC.");
}
return FALSE;
}

boolean PDU__LLC_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
switch (single_value.union_selection) {
case PDU__LLC::ALT_pDU__LLC__UI:
return single_value.field_pDU__LLC__UI->is_value();
case PDU__LLC::ALT_pDU__LLC__U:
return single_value.field_pDU__LLC__U->is_value();
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @LLC_Types.PDU_LLC.");
}
}

PDU__LLC PDU__LLC_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of union type @LLC_Types.PDU_LLC.");
PDU__LLC ret_val;
switch (single_value.union_selection) {
case PDU__LLC::ALT_pDU__LLC__UI:
ret_val.pDU__LLC__UI() = single_value.field_pDU__LLC__UI->valueof();
break;
case PDU__LLC::ALT_pDU__LLC__U:
ret_val.pDU__LLC__U() = single_value.field_pDU__LLC__U->valueof();
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @LLC_Types.PDU_LLC.");
}
return ret_val;
}

PDU__LLC_template& PDU__LLC_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Internal error: Accessing a list element of a non-list template of union type @LLC_Types.PDU_LLC.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @LLC_Types.PDU_LLC.");
return value_list.list_value[list_index];
}
void PDU__LLC_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error ("Internal error: Setting an invalid list for a template of union type @LLC_Types.PDU_LLC.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PDU__LLC_template[list_length];
}

PDU__LLC__UI_template& PDU__LLC_template::pDU__LLC__UI()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__LLC::ALT_pDU__LLC__UI) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__LLC__UI = new PDU__LLC__UI_template(ANY_VALUE);
else single_value.field_pDU__LLC__UI = new PDU__LLC__UI_template;
single_value.union_selection = PDU__LLC::ALT_pDU__LLC__UI;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_pDU__LLC__UI;
}

const PDU__LLC__UI_template& PDU__LLC_template::pDU__LLC__UI() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_LLC_UI in a non-specific template of union type @LLC_Types.PDU_LLC.");
if (single_value.union_selection != PDU__LLC::ALT_pDU__LLC__UI) TTCN_error("Accessing non-selected field pDU_LLC_UI in a template of union type @LLC_Types.PDU_LLC.");
return *single_value.field_pDU__LLC__UI;
}

PDU__LLC__U_template& PDU__LLC_template::pDU__LLC__U()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__LLC::ALT_pDU__LLC__U) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__LLC__U = new PDU__LLC__U_template(ANY_VALUE);
else single_value.field_pDU__LLC__U = new PDU__LLC__U_template;
single_value.union_selection = PDU__LLC::ALT_pDU__LLC__U;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_pDU__LLC__U;
}

const PDU__LLC__U_template& PDU__LLC_template::pDU__LLC__U() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_LLC_U in a non-specific template of union type @LLC_Types.PDU_LLC.");
if (single_value.union_selection != PDU__LLC::ALT_pDU__LLC__U) TTCN_error("Accessing non-selected field pDU_LLC_U in a template of union type @LLC_Types.PDU_LLC.");
return *single_value.field_pDU__LLC__U;
}

boolean PDU__LLC_template::ischosen(PDU__LLC::union_selection_type checked_selection) const
{
if (checked_selection == PDU__LLC::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @LLC_Types.PDU_LLC.");
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.union_selection == PDU__LLC::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @LLC_Types.PDU_LLC.");
return single_value.union_selection == checked_selection;
case VALUE_LIST:
{
if (value_list.n_values < 1)
TTCN_error("Internal error: Performing ischosen() operation on a template of union type @LLC_Types.PDU_LLC containing an empty list.");
boolean ret_val = value_list.list_value[0].ischosen(checked_selection);
for (unsigned int list_count = 1; ret_val == TRUE && list_count < value_list.n_values; list_count++) {
ret_val = value_list.list_value[list_count].ischosen(checked_selection);
}
return ret_val;
}
default:
return FALSE;
}
return FALSE;
}

void PDU__LLC_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case PDU__LLC::ALT_pDU__LLC__UI:
TTCN_Logger::log_event_str("{ pDU_LLC_UI := ");
single_value.field_pDU__LLC__UI->log();
TTCN_Logger::log_event_str(" }");
break;
case PDU__LLC::ALT_pDU__LLC__U:
TTCN_Logger::log_event_str("{ pDU_LLC_U := ");
single_value.field_pDU__LLC__U->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_str("<invalid selector>");
}
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void PDU__LLC_template::log_match(const PDU__LLC& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity() && match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
return;
}
if (template_selection == SPECIFIC_VALUE && single_value.union_selection == match_value.get_selection()) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
switch (single_value.union_selection) {
case PDU__LLC::ALT_pDU__LLC__UI:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".pDU_LLC_UI");
single_value.field_pDU__LLC__UI->log_match(match_value.pDU__LLC__UI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ pDU_LLC_UI := ");
single_value.field_pDU__LLC__UI->log_match(match_value.pDU__LLC__UI(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case PDU__LLC::ALT_pDU__LLC__U:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".pDU_LLC_U");
single_value.field_pDU__LLC__U->log_match(match_value.pDU__LLC__U(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ pDU_LLC_U := ");
single_value.field_pDU__LLC__U->log_match(match_value.pDU__LLC__U(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
default:
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str("<invalid selector>");
}
} else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void PDU__LLC_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
switch (single_value.union_selection) {
case PDU__LLC::ALT_pDU__LLC__UI:
single_value.field_pDU__LLC__UI->set_implicit_omit(); break;
case PDU__LLC::ALT_pDU__LLC__U:
single_value.field_pDU__LLC__U->set_implicit_omit(); break;
default: break;
}
}

void PDU__LLC_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
text_buf.push_int(single_value.union_selection);
switch (single_value.union_selection) {
case PDU__LLC::ALT_pDU__LLC__UI:
single_value.field_pDU__LLC__UI->encode_text(text_buf);
break;
case PDU__LLC::ALT_pDU__LLC__U:
single_value.field_pDU__LLC__U->encode_text(text_buf);
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @LLC_Types.PDU_LLC.");
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized template of type @LLC_Types.PDU_LLC.");
}
}

void PDU__LLC_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
{
single_value.union_selection = PDU__LLC::UNBOUND_VALUE;
PDU__LLC::union_selection_type new_selection = (PDU__LLC::union_selection_type)text_buf.pull_int().get_val();
switch (new_selection) {
case PDU__LLC::ALT_pDU__LLC__UI:
single_value.field_pDU__LLC__UI = new PDU__LLC__UI_template;
single_value.field_pDU__LLC__UI->decode_text(text_buf);
break;
case PDU__LLC::ALT_pDU__LLC__U:
single_value.field_pDU__LLC__U = new PDU__LLC__U_template;
single_value.field_pDU__LLC__U->decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @LLC_Types.PDU_LLC.");
}
single_value.union_selection = new_selection;
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new PDU__LLC_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized selector was received in a template of type @LLC_Types.PDU_LLC.");
}
}

boolean PDU__LLC_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean PDU__LLC_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int v_idx=0; v_idx<value_list.n_values; v_idx++)
if (value_list.list_value[v_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

void PDU__LLC_template::set_param(Module_Param& param)
{
  if (dynamic_cast<Module_Param_Name*>(param.get_id()) != NULL &&
      param.get_id()->next_name()) {
    char* param_field = param.get_id()->get_current_name();
    if (param_field[0] >= '0' && param_field[0] <= '9') {
      param.error("Unexpected array index in module parameter, expected a valid field"
        " name for union template type `@LLC_Types.PDU_LLC'");
    }
    if (strcmp("pDU_LLC_UI", param_field) == 0) {
      pDU__LLC__UI().set_param(param);
      return;
    } else if (strcmp("pDU_LLC_U", param_field) == 0) {
      pDU__LLC__U().set_param(param);
      return;
    } else param.error("Field `%s' not found in union template type `@LLC_Types.PDU_LLC'", param_field);
  }
  param.basic_check(Module_Param::BC_TEMPLATE, "union template");
  Module_Param_Ptr m_p = &param;
  switch (m_p->get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    PDU__LLC_template new_temp;
    new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size());
    for (size_t p_i=0; p_i<m_p->get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (m_p->get_size()==0) break;
    param.type_error("union template", "@LLC_Types.PDU_LLC");
    break;
  case Module_Param::MP_Assignment_List: {
    Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1);
    char* last_name = mp_last->get_id()->get_name();
    if (!strcmp(last_name, "pDU_LLC_UI")) {
      pDU__LLC__UI().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "pDU_LLC_U")) {
      pDU__LLC__U().set_param(*mp_last);
      break;
    }
    mp_last->error("Field %s does not exist in type @LLC_Types.PDU_LLC.", last_name);
  } break;
  case Module_Param::MP_Implication_Template: {
    PDU__LLC_template* precondition = new PDU__LLC_template;
    precondition->set_param(*m_p->get_elem(0));
    PDU__LLC_template* implied_template = new PDU__LLC_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = PDU__LLC_template(precondition, implied_template);
  } break;
  default:
    param.type_error("union template", "@LLC_Types.PDU_LLC");
  }
  is_ifpresent = param.get_ifpresent();
}

void PDU__LLC_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
switch (single_value.union_selection) {
case PDU__LLC::ALT_pDU__LLC__UI:
single_value.field_pDU__LLC__UI->check_restriction(t_res, t_name ? t_name : "@LLC_Types.PDU_LLC");
return;
case PDU__LLC::ALT_pDU__LLC__U:
single_value.field_pDU__LLC__U->check_restriction(t_res, t_name ? t_name : "@LLC_Types.PDU_LLC");
return;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @LLC_Types.PDU_LLC.");
}
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@LLC_Types.PDU_LLC");
}


/* Bodies of functions, altsteps and testcases */

void Version_version__value_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(Version_version__value_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER Version_version__value_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(Version_version__value_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void Version_encoder(const Version& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.Version' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(Version_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER Version_decoder(OCTETSTRING& input_stream, Version& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.Version' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(Version_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void IOV__UI_encoder(const OCTETSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(IOV__UI_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER IOV__UI_decoder(OCTETSTRING& input_stream, OCTETSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(IOV__UI_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void IOV__I_encoder(const OCTETSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(IOV__I_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER IOV__I_decoder(OCTETSTRING& input_stream, OCTETSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(IOV__I_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void T200_spare_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(T200_spare_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER T200_spare_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(T200_spare_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void T200_t200Value_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(T200_t200Value_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER T200_t200Value_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(T200_t200Value_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void T200_encoder(const T200& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.T200' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(T200_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER T200_decoder(OCTETSTRING& input_stream, T200& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.T200' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(T200_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void N200_retransmissions_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(N200_retransmissions_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER N200_retransmissions_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(N200_retransmissions_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void N200_encoder(const N200& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.N200' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(N200_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER N200_decoder(OCTETSTRING& input_stream, N200& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.N200' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(N200_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void N201__U_spare_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(N201__U_spare_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER N201__U_spare_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(N201__U_spare_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void N201__U_n201UValue_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(N201__U_n201UValue_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER N201__U_n201UValue_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(N201__U_n201UValue_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void N201__U_encoder(const N201__U& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.N201_U' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(N201__U_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER N201__U_decoder(OCTETSTRING& input_stream, N201__U& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.N201_U' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(N201__U_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void N201__I_spare_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(N201__I_spare_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER N201__I_spare_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(N201__I_spare_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void N201__I_n201IValue_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(N201__I_n201IValue_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER N201__I_n201IValue_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(N201__I_n201IValue_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void N201__I_encoder(const N201__I& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.N201_I' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(N201__I_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER N201__I_decoder(OCTETSTRING& input_stream, N201__I& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.N201_I' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(N201__I_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void MD_spare_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(MD_spare_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER MD_spare_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(MD_spare_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void MD_mDValue_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(MD_mDValue_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER MD_mDValue_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(MD_mDValue_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void MD_encoder(const MD& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.MD' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(MD_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER MD_decoder(OCTETSTRING& input_stream, MD& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.MD' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(MD_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void MU_spare_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(MU_spare_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER MU_spare_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(MU_spare_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void MU_mUValue_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(MU_mUValue_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER MU_mUValue_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(MU_mUValue_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void MU_encoder(const MU& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.MU' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(MU_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER MU_decoder(OCTETSTRING& input_stream, MU& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.MU' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(MU_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void KD_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(KD_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER KD_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(KD_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void KU_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(KU_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER KU_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(KU_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void L3param_encoder(const OCTETSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(OCTETSTRING_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER L3param_decoder(OCTETSTRING& input_stream, OCTETSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(OCTETSTRING_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void Reset__LLC_encoder(const OCTETSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(Reset__LLC_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER Reset__LLC_decoder(OCTETSTRING& input_stream, OCTETSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(Reset__LLC_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void XID__Data_encoder(const XID__Data& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.XID_Data' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(XID__Data_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER XID__Data_decoder(OCTETSTRING& input_stream, XID__Data& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.XID_Data' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(XID__Data_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void XID__length_short__len_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(XID__length_short__len_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER XID__length_short__len_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(XID__length_short__len_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void XID__length_long__len_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(XID__length_long__len_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER XID__length_long__len_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(XID__length_long__len_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void XID__length_encoder(const XID__length& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.XID_length' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(XID__length_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER XID__length_decoder(OCTETSTRING& input_stream, XID__length& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.XID_length' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(XID__length_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void XID_xl_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(XID_xl_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER XID_xl_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(XID_xl_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void XID_typefield_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(XID_typefield_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER XID_typefield_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(XID_typefield_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void XID_xID__length_encoder(const XID__length& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.XID_length' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(XID_xID__length_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER XID_xID__length_decoder(OCTETSTRING& input_stream, XID__length& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.XID_length' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(XID_xID__length_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void XID_xID__Data_encoder(const XID__Data& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.XID_Data' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(XID_xID__Data_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER XID_xID__Data_decoder(OCTETSTRING& input_stream, XID__Data& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.XID_Data' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(XID_xID__Data_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void XID_encoder(const XID& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.XID' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(XID_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER XID_decoder(OCTETSTRING& input_stream, XID& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.XID' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(XID_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void Control__field__UI_format_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(Control__field__UI_format_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER Control__field__UI_format_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(Control__field__UI_format_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void Control__field__UI_spare_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(Control__field__UI_spare_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER Control__field__UI_spare_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(Control__field__UI_spare_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void Control__field__UI_nU_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(Control__field__UI_nU_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER Control__field__UI_nU_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(Control__field__UI_nU_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void Control__field__UI_e_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(Control__field__UI_e_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER Control__field__UI_e_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(Control__field__UI_e_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void Control__field__UI_pM_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(Control__field__UI_pM_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER Control__field__UI_pM_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(Control__field__UI_pM_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void Control__field__UI_encoder(const Control__field__UI& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.Control_field_UI' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(Control__field__UI_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER Control__field__UI_decoder(OCTETSTRING& input_stream, Control__field__UI& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.Control_field_UI' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(Control__field__UI_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void RejectedFrameControlField__UI_encoder(const RejectedFrameControlField__UI& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.RejectedFrameControlField_UI' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(RejectedFrameControlField__UI_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER RejectedFrameControlField__UI_decoder(OCTETSTRING& input_stream, RejectedFrameControlField__UI& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.RejectedFrameControlField_UI' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(RejectedFrameControlField__UI_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void Control__field__U_encoder(const Control__field__U& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.Control_field_U' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(Control__field__U_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER Control__field__U_decoder(OCTETSTRING& input_stream, Control__field__U& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.Control_field_U' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(Control__field__U_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void RejectedFrameControlField__U_encoder(const RejectedFrameControlField__U& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.RejectedFrameControlField_U' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(RejectedFrameControlField__U_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER RejectedFrameControlField__U_decoder(OCTETSTRING& input_stream, RejectedFrameControlField__U& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.RejectedFrameControlField_U' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(RejectedFrameControlField__U_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void RejectedFrameControlField_encoder(const RejectedFrameControlField& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.RejectedFrameControlField' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(RejectedFrameControlField_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER RejectedFrameControlField_decoder(OCTETSTRING& input_stream, RejectedFrameControlField& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.RejectedFrameControlField' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(RejectedFrameControlField_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

boolean operator==(null_type, const UA__Information& other_value)
{
if (other_value.val_ptr == NULL)
TTCN_error("The right operand of comparison is an unbound value of type @LLC_Types.UA_Information.");
return other_value.val_ptr->n_elements == 0;
}

void UA__Information_encoder(const UA__Information& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.UA_Information' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(UA__Information_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER UA__Information_decoder(OCTETSTRING& input_stream, UA__Information& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.UA_Information' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(UA__Information_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

boolean operator==(null_type, const SABM__Information& other_value)
{
if (other_value.val_ptr == NULL)
TTCN_error("The right operand of comparison is an unbound value of type @LLC_Types.SABM_Information.");
return other_value.val_ptr->n_elements == 0;
}

void SABM__Information_encoder(const SABM__Information& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.SABM_Information' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(SABM__Information_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER SABM__Information_decoder(OCTETSTRING& input_stream, SABM__Information& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.SABM_Information' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(SABM__Information_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

boolean operator==(null_type, const XID__Information& other_value)
{
if (other_value.val_ptr == NULL)
TTCN_error("The right operand of comparison is an unbound value of type @LLC_Types.XID_Information.");
return other_value.val_ptr->n_elements == 0;
}

void XID__Information_encoder(const XID__Information& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.XID_Information' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(XID__Information_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER XID__Information_decoder(OCTETSTRING& input_stream, XID__Information& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.XID_Information' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(XID__Information_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void DM__Information_encoder(const OCTETSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(DM__Information_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER DM__Information_decoder(OCTETSTRING& input_stream, OCTETSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(DM__Information_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void NULL__Information_encoder(const OCTETSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(NULL__Information_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER NULL__Information_decoder(OCTETSTRING& input_stream, OCTETSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(NULL__Information_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void DISC__Information_encoder(const OCTETSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(DISC__Information_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER DISC__Information_decoder(OCTETSTRING& input_stream, OCTETSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(DISC__Information_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void FRMR__Information_rejectedFrameControlField_encoder(const RejectedFrameControlField& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.RejectedFrameControlField' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(FRMR__Information_rejectedFrameControlField_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER FRMR__Information_rejectedFrameControlField_decoder(OCTETSTRING& input_stream, RejectedFrameControlField& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.RejectedFrameControlField' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(FRMR__Information_rejectedFrameControlField_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void FRMR__Information_spare1_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(FRMR__Information_spare1_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER FRMR__Information_spare1_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(FRMR__Information_spare1_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void FRMR__Information_vS_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(FRMR__Information_vS_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER FRMR__Information_vS_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(FRMR__Information_vS_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void FRMR__Information_spare2_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(FRMR__Information_spare2_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER FRMR__Information_spare2_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(FRMR__Information_spare2_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void FRMR__Information_vR_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(FRMR__Information_vR_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER FRMR__Information_vR_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(FRMR__Information_vR_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void FRMR__Information_cR_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(FRMR__Information_cR_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER FRMR__Information_cR_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(FRMR__Information_cR_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void FRMR__Information_spare3_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(FRMR__Information_spare3_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER FRMR__Information_spare3_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(FRMR__Information_spare3_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void FRMR__Information_w4_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(FRMR__Information_w4_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER FRMR__Information_w4_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(FRMR__Information_w4_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void FRMR__Information_w3_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(FRMR__Information_w3_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER FRMR__Information_w3_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(FRMR__Information_w3_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void FRMR__Information_w2_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(FRMR__Information_w2_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER FRMR__Information_w2_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(FRMR__Information_w2_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void FRMR__Information_w1_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(FRMR__Information_w1_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER FRMR__Information_w1_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(FRMR__Information_w1_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void FRMR__Information_encoder(const FRMR__Information& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.FRMR_Information' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(FRMR__Information_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER FRMR__Information_decoder(OCTETSTRING& input_stream, FRMR__Information& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.FRMR_Information' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(FRMR__Information_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void Address__field_encoder(const Address__field& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.Address_field' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(Address__field_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER Address__field_decoder(OCTETSTRING& input_stream, Address__field& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.Address_field' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(Address__field_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void Information__field__U_encoder(const Information__field__U& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.Information_field_U' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(Information__field__U_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER Information__field__U_decoder(OCTETSTRING& input_stream, Information__field__U& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.Information_field_U' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(Information__field__U_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void PDU__LLC__UI_information__field__UI_encoder(const OCTETSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(OCTETSTRING_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER PDU__LLC__UI_information__field__UI_decoder(OCTETSTRING& input_stream, OCTETSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(OCTETSTRING_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void PDU__LLC__UI_encoder(const PDU__LLC__UI& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.PDU_LLC_UI' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(PDU__LLC__UI_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER PDU__LLC__UI_decoder(OCTETSTRING& input_stream, PDU__LLC__UI& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.PDU_LLC_UI' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(PDU__LLC__UI_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void PDU__LLC__U_information__field__U_encoder(const Information__field__U& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.Information_field_U' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(PDU__LLC__U_information__field__U_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER PDU__LLC__U_information__field__U_decoder(OCTETSTRING& input_stream, Information__field__U& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.Information_field_U' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(PDU__LLC__U_information__field__U_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void PDU__LLC__U_encoder(const PDU__LLC__U& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.PDU_LLC_U' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(PDU__LLC__U_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER PDU__LLC__U_decoder(OCTETSTRING& input_stream, PDU__LLC__U& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.PDU_LLC_U' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(PDU__LLC__U_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void PDU__LLC_encoder(const PDU__LLC& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.PDU_LLC' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(PDU__LLC_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER PDU__LLC_decoder(OCTETSTRING& input_stream, PDU__LLC& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@LLC_Types.PDU_LLC' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(PDU__LLC_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}


/* Bodies of static functions */

void pre_init_module()
{
TTCN_Location current_location("LLC_Types.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "LLC_Types");
General__Types::module_object.pre_init_module();
module_object.add_function("enc_PDU_LLC", (genericfunc_t)&enc__PDU__LLC, NULL);
module_object.add_function("dec_PDU_LLC", (genericfunc_t)&dec__PDU__LLC, NULL);
}

void post_init_module()
{
TTCN_Location current_location("LLC_Types.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "LLC_Types");
General__Types::module_object.post_init_module();
current_location.update_lineno(26);
/* LLC_Types.ttcn, line 26 */
const_dec__PDU__LLC_checkFCS_defval = TRUE;
}


} /* end of namespace */
