// 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 "LAPDm_Types.hh"

namespace LAPDm__Types {

/* Literal string constants */

const unsigned char bs_2_bits[] = { 0 },
bs_3_bits[] = { 0 },
bs_6_bits[] = { 0 },
bs_5_bits[] = { 4 },
bs_1_bits[] = { 2 },
bs_7_bits[] = { 2 },
bs_8_bits[] = { 6 },
bs_4_bits[] = { 1 },
bs_0_bits[] = { 3 };
extern const BITSTRING bs_2(1, bs_2_bits),
bs_3(2, bs_3_bits),
bs_6(3, bs_6_bits),
bs_5(3, bs_5_bits),
bs_1(2, bs_1_bits),
bs_7(3, bs_7_bits),
bs_8(3, bs_8_bits),
bs_4(2, bs_4_bits),
bs_0(2, bs_0_bits);
extern const OCTETSTRING os_0(0, NULL);
const unsigned char module_checksum[] = { 0x4f, 0xad, 0x36, 0xd2, 0x56, 0x2b, 0x51, 0x4f, 0xf1, 0x2e, 0xaa, 0x79, 0xba, 0x90, 0x27, 0x43 };

/* Global variable definitions */

const XERdescriptor_t       LapdmSapi_xer_ = { {"LapdmSapi>\n", "LapdmSapi>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t LapdmSapi_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmSapi_descr_ = { "@LAPDm_Types.LapdmSapi", &INTEGER_ber_, &Osmocom__Types::uint3__t_raw_, &INTEGER_text_, &LapdmSapi_xer_, &INTEGER_json_, &LapdmSapi_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmSapi_default_coding("RAW");
const XERdescriptor_t       LapdmSBits_xer_ = { {"LapdmSBits>\n", "LapdmSBits>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t LapdmSBits_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmSBits_descr_ = { "@LAPDm_Types.LapdmSBits", &BITSTRING_ber_, &General__Types::BIT2_raw_, NULL, &LapdmSBits_xer_, &BITSTRING_json_, &LapdmSBits_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmSBits_default_coding("RAW");
const XERdescriptor_t       LapdmUBits_xer_ = { {"LapdmUBits>\n", "LapdmUBits>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t LapdmUBits_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmUBits_descr_ = { "@LAPDm_Types.LapdmUBits", &BITSTRING_ber_, &General__Types::BIT3_raw_, NULL, &LapdmUBits_xer_, &BITSTRING_json_, &LapdmUBits_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmUBits_default_coding("RAW");
const XERdescriptor_t       LapdmU2Bits_xer_ = { {"LapdmU2Bits>\n", "LapdmU2Bits>\n"}, {13, 13}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t LapdmU2Bits_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmU2Bits_descr_ = { "@LAPDm_Types.LapdmU2Bits", &BITSTRING_ber_, &General__Types::BIT2_raw_, NULL, &LapdmU2Bits_xer_, &BITSTRING_json_, &LapdmU2Bits_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmU2Bits_default_coding("RAW");
BOOLEAN const_cr__MO__CMD;
const BOOLEAN& cr__MO__CMD = const_cr__MO__CMD;
BOOLEAN const_cr__MO__RSP;
const BOOLEAN& cr__MO__RSP = const_cr__MO__RSP;
BOOLEAN const_cr__MT__CMD;
const BOOLEAN& cr__MT__CMD = const_cr__MT__CMD;
BOOLEAN const_cr__MT__RSP;
const BOOLEAN& cr__MT__RSP = const_cr__MT__RSP;
const TTCN_RAWdescriptor_t LapdmAddressField_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       LapdmAddressField_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 LapdmAddressField_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmAddressField_spare_descr_ = { "@LAPDm_Types.LapdmAddressField.spare", &BITSTRING_ber_, &LapdmAddressField_spare_raw_, NULL, &LapdmAddressField_spare_xer_, &BITSTRING_json_, &LapdmAddressField_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmAddressField_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmAddressField_lpd_raw_ = {2,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       LapdmAddressField_lpd_xer_ = { {"lpd>\n", "lpd>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t LapdmAddressField_lpd_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmAddressField_lpd_descr_ = { "@LAPDm_Types.LapdmAddressField.lpd", &INTEGER_ber_, &LapdmAddressField_lpd_raw_, &INTEGER_text_, &LapdmAddressField_lpd_xer_, &INTEGER_json_, &LapdmAddressField_lpd_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmAddressField_lpd_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmAddressField_sapi_raw_ = {3,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       LapdmAddressField_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 LapdmAddressField_sapi_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmAddressField_sapi_descr_ = { "@LAPDm_Types.LapdmAddressField.sapi", &INTEGER_ber_, &LapdmAddressField_sapi_raw_, &INTEGER_text_, &LapdmAddressField_sapi_xer_, &INTEGER_json_, &LapdmAddressField_sapi_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmAddressField_sapi_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmAddressField_c__r_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       LapdmAddressField_c__r_xer_ = { {"c_r>\n", "c_r>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int LapdmAddressField_c__r_oer_ext_arr_[0] = {};
const int LapdmAddressField_c__r_oer_p_[0] = {};
const TTCN_OERdescriptor_t LapdmAddressField_c__r_oer_ = { -1, TRUE, -1, FALSE, 0, 0, LapdmAddressField_c__r_oer_ext_arr_, 0, LapdmAddressField_c__r_oer_p_};
const TTCN_Typedescriptor_t LapdmAddressField_c__r_descr_ = { "@LAPDm_Types.LapdmAddressField.c_r", &BOOLEAN_ber_, &LapdmAddressField_c__r_raw_, &BOOLEAN_text_, &LapdmAddressField_c__r_xer_, &BOOLEAN_json_, &LapdmAddressField_c__r_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmAddressField_c__r_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmAddressField_ea_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       LapdmAddressField_ea_xer_ = { {"ea>\n", "ea>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int LapdmAddressField_ea_oer_ext_arr_[0] = {};
const int LapdmAddressField_ea_oer_p_[0] = {};
const TTCN_OERdescriptor_t LapdmAddressField_ea_oer_ = { -1, TRUE, -1, FALSE, 0, 0, LapdmAddressField_ea_oer_ext_arr_, 0, LapdmAddressField_ea_oer_p_};
const TTCN_Typedescriptor_t LapdmAddressField_ea_descr_ = { "@LAPDm_Types.LapdmAddressField.ea", &BOOLEAN_ber_, &LapdmAddressField_ea_raw_, &BOOLEAN_text_, &LapdmAddressField_ea_xer_, &BOOLEAN_json_, &LapdmAddressField_ea_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmAddressField_ea_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmAddressField_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 LapdmAddressField
const TTCN_Typedescriptor_t LapdmAddressField_descr_ = { "@LAPDm_Types.LapdmAddressField", NULL, &LapdmAddressField_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmAddressField_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmCtrlI_n__r_raw_ = {3,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       LapdmCtrlI_n__r_xer_ = { {"n_r>\n", "n_r>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t LapdmCtrlI_n__r_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmCtrlI_n__r_descr_ = { "@LAPDm_Types.LapdmCtrlI.n_r", &INTEGER_ber_, &LapdmCtrlI_n__r_raw_, &INTEGER_text_, &LapdmCtrlI_n__r_xer_, &INTEGER_json_, &LapdmCtrlI_n__r_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmCtrlI_n__r_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmCtrlI_p_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       LapdmCtrlI_p_xer_ = { {"p>\n", "p>\n"}, {3, 3}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int LapdmCtrlI_p_oer_ext_arr_[0] = {};
const int LapdmCtrlI_p_oer_p_[0] = {};
const TTCN_OERdescriptor_t LapdmCtrlI_p_oer_ = { -1, TRUE, -1, FALSE, 0, 0, LapdmCtrlI_p_oer_ext_arr_, 0, LapdmCtrlI_p_oer_p_};
const TTCN_Typedescriptor_t LapdmCtrlI_p_descr_ = { "@LAPDm_Types.LapdmCtrlI.p", &BOOLEAN_ber_, &LapdmCtrlI_p_raw_, &BOOLEAN_text_, &LapdmCtrlI_p_xer_, &BOOLEAN_json_, &LapdmCtrlI_p_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmCtrlI_p_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmCtrlI_n__s_raw_ = {3,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       LapdmCtrlI_n__s_xer_ = { {"n_s>\n", "n_s>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t LapdmCtrlI_n__s_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmCtrlI_n__s_descr_ = { "@LAPDm_Types.LapdmCtrlI.n_s", &INTEGER_ber_, &LapdmCtrlI_n__s_raw_, &INTEGER_text_, &LapdmCtrlI_n__s_xer_, &INTEGER_json_, &LapdmCtrlI_n__s_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmCtrlI_n__s_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmCtrlI_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       LapdmCtrlI_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 LapdmCtrlI_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmCtrlI_spare_descr_ = { "@LAPDm_Types.LapdmCtrlI.spare", &BITSTRING_ber_, &LapdmCtrlI_spare_raw_, NULL, &LapdmCtrlI_spare_xer_, &BITSTRING_json_, &LapdmCtrlI_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmCtrlI_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmCtrlI_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 LapdmCtrlI
const TTCN_Typedescriptor_t LapdmCtrlI_descr_ = { "@LAPDm_Types.LapdmCtrlI", NULL, &LapdmCtrlI_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmCtrlI_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmCtrlS_n__r_raw_ = {3,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       LapdmCtrlS_n__r_xer_ = { {"n_r>\n", "n_r>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t LapdmCtrlS_n__r_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmCtrlS_n__r_descr_ = { "@LAPDm_Types.LapdmCtrlS.n_r", &INTEGER_ber_, &LapdmCtrlS_n__r_raw_, &INTEGER_text_, &LapdmCtrlS_n__r_xer_, &INTEGER_json_, &LapdmCtrlS_n__r_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmCtrlS_n__r_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmCtrlS_p__f_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       LapdmCtrlS_p__f_xer_ = { {"p_f>\n", "p_f>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int LapdmCtrlS_p__f_oer_ext_arr_[0] = {};
const int LapdmCtrlS_p__f_oer_p_[0] = {};
const TTCN_OERdescriptor_t LapdmCtrlS_p__f_oer_ = { -1, TRUE, -1, FALSE, 0, 0, LapdmCtrlS_p__f_oer_ext_arr_, 0, LapdmCtrlS_p__f_oer_p_};
const TTCN_Typedescriptor_t LapdmCtrlS_p__f_descr_ = { "@LAPDm_Types.LapdmCtrlS.p_f", &BOOLEAN_ber_, &LapdmCtrlS_p__f_raw_, &BOOLEAN_text_, &LapdmCtrlS_p__f_xer_, &BOOLEAN_json_, &LapdmCtrlS_p__f_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmCtrlS_p__f_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmCtrlS_s_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       LapdmCtrlS_s_xer_ = { {"s>\n", "s>\n"}, {3, 3}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t LapdmCtrlS_s_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmCtrlS_s_descr_ = { "@LAPDm_Types.LapdmCtrlS.s", &BITSTRING_ber_, &LapdmCtrlS_s_raw_, NULL, &LapdmCtrlS_s_xer_, &BITSTRING_json_, &LapdmCtrlS_s_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmCtrlS_s_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmCtrlS_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       LapdmCtrlS_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 LapdmCtrlS_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmCtrlS_spare_descr_ = { "@LAPDm_Types.LapdmCtrlS.spare", &BITSTRING_ber_, &LapdmCtrlS_spare_raw_, NULL, &LapdmCtrlS_spare_xer_, &BITSTRING_json_, &LapdmCtrlS_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmCtrlS_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmCtrlS_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 LapdmCtrlS
const TTCN_Typedescriptor_t LapdmCtrlS_descr_ = { "@LAPDm_Types.LapdmCtrlS", NULL, &LapdmCtrlS_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmCtrlS_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmCtrlU_u_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       LapdmCtrlU_u_xer_ = { {"u>\n", "u>\n"}, {3, 3}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t LapdmCtrlU_u_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmCtrlU_u_descr_ = { "@LAPDm_Types.LapdmCtrlU.u", &BITSTRING_ber_, &LapdmCtrlU_u_raw_, NULL, &LapdmCtrlU_u_xer_, &BITSTRING_json_, &LapdmCtrlU_u_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmCtrlU_u_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmCtrlU_p__f_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       LapdmCtrlU_p__f_xer_ = { {"p_f>\n", "p_f>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int LapdmCtrlU_p__f_oer_ext_arr_[0] = {};
const int LapdmCtrlU_p__f_oer_p_[0] = {};
const TTCN_OERdescriptor_t LapdmCtrlU_p__f_oer_ = { -1, TRUE, -1, FALSE, 0, 0, LapdmCtrlU_p__f_oer_ext_arr_, 0, LapdmCtrlU_p__f_oer_p_};
const TTCN_Typedescriptor_t LapdmCtrlU_p__f_descr_ = { "@LAPDm_Types.LapdmCtrlU.p_f", &BOOLEAN_ber_, &LapdmCtrlU_p__f_raw_, &BOOLEAN_text_, &LapdmCtrlU_p__f_xer_, &BOOLEAN_json_, &LapdmCtrlU_p__f_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmCtrlU_p__f_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmCtrlU_u2_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       LapdmCtrlU_u2_xer_ = { {"u2>\n", "u2>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t LapdmCtrlU_u2_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmCtrlU_u2_descr_ = { "@LAPDm_Types.LapdmCtrlU.u2", &BITSTRING_ber_, &LapdmCtrlU_u2_raw_, NULL, &LapdmCtrlU_u2_xer_, &BITSTRING_json_, &LapdmCtrlU_u2_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmCtrlU_u2_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmCtrlU_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       LapdmCtrlU_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 LapdmCtrlU_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmCtrlU_spare_descr_ = { "@LAPDm_Types.LapdmCtrlU.spare", &BITSTRING_ber_, &LapdmCtrlU_spare_raw_, NULL, &LapdmCtrlU_spare_xer_, &BITSTRING_json_, &LapdmCtrlU_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmCtrlU_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmCtrlU_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 LapdmCtrlU
const TTCN_Typedescriptor_t LapdmCtrlU_descr_ = { "@LAPDm_Types.LapdmCtrlU", NULL, &LapdmCtrlU_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmCtrlU_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmCtrl_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 LapdmCtrl
const TTCN_Typedescriptor_t LapdmCtrl_descr_ = { "@LAPDm_Types.LapdmCtrl", NULL, &LapdmCtrl_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmCtrl_s_default_coding("RAW");
UNIVERSAL_CHARSTRING LapdmCtrl_u_default_coding("RAW");
UNIVERSAL_CHARSTRING LapdmCtrl_i_default_coding("RAW");
const XERdescriptor_t       LapdmCtrl_other_xer_ = { {"other>\n", "other>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t LapdmCtrl_other_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmCtrl_other_descr_ = { "@LAPDm_Types.LapdmCtrl.other", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &LapdmCtrl_other_xer_, &INTEGER_json_, &LapdmCtrl_other_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmCtrl_other_default_coding("RAW");
UNIVERSAL_CHARSTRING LapdmCtrl_default_coding("RAW");
LapdmCtrl_template template_tr__LapdmCtrlS;
const LapdmCtrl_template& tr__LapdmCtrlS = template_tr__LapdmCtrlS;
LapdmCtrl_template template_tr__LapdmCtrlU;
const LapdmCtrl_template& tr__LapdmCtrlU = template_tr__LapdmCtrlU;
BOOLEAN_template template_tr__LapdmCtrlUI_p_defval;
const BOOLEAN_template& tr__LapdmCtrlUI_p_defval = template_tr__LapdmCtrlUI_p_defval;
BOOLEAN const_ts__LapdmCtrlUI_p_defval;
const BOOLEAN& ts__LapdmCtrlUI_p_defval = const_ts__LapdmCtrlUI_p_defval;
const TTCN_RAWdescriptor_t LapdmFrameAB_addr_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 LapdmFrameAB_addr
const TTCN_Typedescriptor_t LapdmFrameAB_addr_descr_ = { "@LAPDm_Types.LapdmFrameAB.addr", NULL, &LapdmFrameAB_addr_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmFrameAB_addr_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmFrameAB_ctrl_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 LapdmFrameAB_ctrl
const TTCN_Typedescriptor_t LapdmFrameAB_ctrl_descr_ = { "@LAPDm_Types.LapdmFrameAB.ctrl", NULL, &LapdmFrameAB_ctrl_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmFrameAB_ctrl_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmFrameAB_len_raw_ = {6,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       LapdmFrameAB_len_xer_ = { {"len>\n", "len>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t LapdmFrameAB_len_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmFrameAB_len_descr_ = { "@LAPDm_Types.LapdmFrameAB.len", &INTEGER_ber_, &LapdmFrameAB_len_raw_, &INTEGER_text_, &LapdmFrameAB_len_xer_, &INTEGER_json_, &LapdmFrameAB_len_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmFrameAB_len_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmFrameAB_m_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       LapdmFrameAB_m_xer_ = { {"m>\n", "m>\n"}, {3, 3}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int LapdmFrameAB_m_oer_ext_arr_[0] = {};
const int LapdmFrameAB_m_oer_p_[0] = {};
const TTCN_OERdescriptor_t LapdmFrameAB_m_oer_ = { -1, TRUE, -1, FALSE, 0, 0, LapdmFrameAB_m_oer_ext_arr_, 0, LapdmFrameAB_m_oer_p_};
const TTCN_Typedescriptor_t LapdmFrameAB_m_descr_ = { "@LAPDm_Types.LapdmFrameAB.m", &BOOLEAN_ber_, &LapdmFrameAB_m_raw_, &BOOLEAN_text_, &LapdmFrameAB_m_xer_, &BOOLEAN_json_, &LapdmFrameAB_m_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmFrameAB_m_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmFrameAB_el_raw_ = {1,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       LapdmFrameAB_el_xer_ = { {"el>\n", "el>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t LapdmFrameAB_el_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LapdmFrameAB_el_descr_ = { "@LAPDm_Types.LapdmFrameAB.el", &INTEGER_ber_, &LapdmFrameAB_el_raw_, &INTEGER_text_, &LapdmFrameAB_el_xer_, &INTEGER_json_, &LapdmFrameAB_el_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmFrameAB_el_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmFrameAB_payload_raw_ = {0,SG_NO,ORDER_LSB,ORDER_MSB,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       LapdmFrameAB_payload_xer_ = { {"payload>\n", "payload>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int LapdmFrameAB_payload_oer_ext_arr_[0] = {};
const int LapdmFrameAB_payload_oer_p_[0] = {};
const TTCN_OERdescriptor_t LapdmFrameAB_payload_oer_ = { -1, TRUE, -1, FALSE, 0, 0, LapdmFrameAB_payload_oer_ext_arr_, 0, LapdmFrameAB_payload_oer_p_};
const TTCN_Typedescriptor_t LapdmFrameAB_payload_descr_ = { "@LAPDm_Types.LapdmFrameAB.payload", &OCTETSTRING_ber_, &LapdmFrameAB_payload_raw_, &OCTETSTRING_text_, &LapdmFrameAB_payload_xer_, &OCTETSTRING_json_, &LapdmFrameAB_payload_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmFrameAB_payload_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmFrameAB_padding_raw_ = {0,SG_NO,ORDER_LSB,ORDER_MSB,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       LapdmFrameAB_padding_xer_ = { {"padding>\n", "padding>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int LapdmFrameAB_padding_oer_ext_arr_[0] = {};
const int LapdmFrameAB_padding_oer_p_[0] = {};
const TTCN_OERdescriptor_t LapdmFrameAB_padding_oer_ = { -1, TRUE, -1, FALSE, 0, 0, LapdmFrameAB_padding_oer_ext_arr_, 0, LapdmFrameAB_padding_oer_p_};
const TTCN_Typedescriptor_t LapdmFrameAB_padding_descr_ = { "@LAPDm_Types.LapdmFrameAB.padding", &OCTETSTRING_ber_, &LapdmFrameAB_padding_raw_, &OCTETSTRING_text_, &LapdmFrameAB_padding_xer_, &OCTETSTRING_json_, &LapdmFrameAB_padding_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmFrameAB_padding_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmFrameAB_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 LapdmFrameAB
const TTCN_Typedescriptor_t LapdmFrameAB_descr_ = { "@LAPDm_Types.LapdmFrameAB", NULL, &LapdmFrameAB_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmFrameAB_default_coding("RAW");
UNIVERSAL_CHARSTRING LapdmFrameB4_addr_default_coding("RAW");
UNIVERSAL_CHARSTRING LapdmFrameB4_ctrl_default_coding("RAW");
const XERdescriptor_t       LapdmFrameB4_payload_xer_ = { {"payload>\n", "payload>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int LapdmFrameB4_payload_oer_ext_arr_[0] = {};
const int LapdmFrameB4_payload_oer_p_[0] = {};
const TTCN_OERdescriptor_t LapdmFrameB4_payload_oer_ = { -1, TRUE, -1, FALSE, 0, 0, LapdmFrameB4_payload_oer_ext_arr_, 0, LapdmFrameB4_payload_oer_p_};
const TTCN_Typedescriptor_t LapdmFrameB4_payload_descr_ = { "@LAPDm_Types.LapdmFrameB4.payload", &OCTETSTRING_ber_, &OCTETSTRING_raw_, &OCTETSTRING_text_, &LapdmFrameB4_payload_xer_, &OCTETSTRING_json_, &LapdmFrameB4_payload_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmFrameB4_payload_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmFrameB4_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 LapdmFrameB4
const TTCN_Typedescriptor_t LapdmFrameB4_descr_ = { "@LAPDm_Types.LapdmFrameB4", NULL, &LapdmFrameB4_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmFrameB4_default_coding("RAW");
const XERdescriptor_t       LapdmFrameBbis_payload_xer_ = { {"payload>\n", "payload>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int LapdmFrameBbis_payload_oer_ext_arr_[0] = {};
const int LapdmFrameBbis_payload_oer_p_[0] = {};
const TTCN_OERdescriptor_t LapdmFrameBbis_payload_oer_ = { -1, TRUE, -1, FALSE, 0, 0, LapdmFrameBbis_payload_oer_ext_arr_, 0, LapdmFrameBbis_payload_oer_p_};
const TTCN_Typedescriptor_t LapdmFrameBbis_payload_descr_ = { "@LAPDm_Types.LapdmFrameBbis.payload", &OCTETSTRING_ber_, &OCTETSTRING_raw_, &OCTETSTRING_text_, &LapdmFrameBbis_payload_xer_, &OCTETSTRING_json_, &LapdmFrameBbis_payload_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmFrameBbis_payload_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmFrameBbis_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 LapdmFrameBbis
const TTCN_Typedescriptor_t LapdmFrameBbis_descr_ = { "@LAPDm_Types.LapdmFrameBbis", NULL, &LapdmFrameBbis_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmFrameBbis_default_coding("RAW");
const XERdescriptor_t       LapdmFrameBter_payload_xer_ = { {"payload>\n", "payload>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int LapdmFrameBter_payload_oer_ext_arr_[0] = {};
const int LapdmFrameBter_payload_oer_p_[0] = {};
const TTCN_OERdescriptor_t LapdmFrameBter_payload_oer_ = { -1, TRUE, -1, FALSE, 0, 0, LapdmFrameBter_payload_oer_ext_arr_, 0, LapdmFrameBter_payload_oer_p_};
const TTCN_Typedescriptor_t LapdmFrameBter_payload_descr_ = { "@LAPDm_Types.LapdmFrameBter.payload", &OCTETSTRING_ber_, &OCTETSTRING_raw_, &OCTETSTRING_text_, &LapdmFrameBter_payload_xer_, &OCTETSTRING_json_, &LapdmFrameBter_payload_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmFrameBter_payload_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmFrameBter_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 LapdmFrameBter
const TTCN_Typedescriptor_t LapdmFrameBter_descr_ = { "@LAPDm_Types.LapdmFrameBter", NULL, &LapdmFrameBter_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmFrameBter_default_coding("RAW");
const TTCN_RAWdescriptor_t LapdmFrame_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 LapdmFrame
const TTCN_Typedescriptor_t LapdmFrame_descr_ = { "@LAPDm_Types.LapdmFrame", NULL, &LapdmFrame_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LapdmFrame_ab_default_coding("RAW");
UNIVERSAL_CHARSTRING LapdmFrame_bbis_default_coding("RAW");
UNIVERSAL_CHARSTRING LapdmFrame_b4_default_coding("RAW");
UNIVERSAL_CHARSTRING LapdmFrame_bter_default_coding("RAW");
UNIVERSAL_CHARSTRING LapdmFrame_default_coding("RAW");
BOOLEAN const_tr__LAPDm__I_m_defval;
const BOOLEAN& tr__LAPDm__I_m_defval = const_tr__LAPDm__I_m_defval;
BOOLEAN const_ts__LAPDm__I_m_defval;
const BOOLEAN& ts__LAPDm__I_m_defval = const_ts__LAPDm__I_m_defval;
TTCN_Module module_object("LAPDm_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 */

LapdmAddressField::LapdmAddressField()
{
}

LapdmAddressField::LapdmAddressField(const BITSTRING& par_spare,
    const INTEGER& par_lpd,
    const INTEGER& par_sapi,
    const BOOLEAN& par_c__r,
    const BOOLEAN& par_ea)
  :   field_spare(par_spare),
  field_lpd(par_lpd),
  field_sapi(par_sapi),
  field_c__r(par_c__r),
  field_ea(par_ea)
{
}

LapdmAddressField::LapdmAddressField(const LapdmAddressField& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LAPDm_Types.LapdmAddressField.");
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.lpd().is_bound()) field_lpd = other_value.lpd();
else field_lpd.clean_up();
if (other_value.sapi().is_bound()) field_sapi = other_value.sapi();
else field_sapi.clean_up();
if (other_value.c__r().is_bound()) field_c__r = other_value.c__r();
else field_c__r.clean_up();
if (other_value.ea().is_bound()) field_ea = other_value.ea();
else field_ea.clean_up();
}

void LapdmAddressField::clean_up()
{
field_spare.clean_up();
field_lpd.clean_up();
field_sapi.clean_up();
field_c__r.clean_up();
field_ea.clean_up();
}

const TTCN_Typedescriptor_t* LapdmAddressField::get_descriptor() const { return &LapdmAddressField_descr_; }
LapdmAddressField& LapdmAddressField::operator=(const LapdmAddressField& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LAPDm_Types.LapdmAddressField.");
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.lpd().is_bound()) field_lpd = other_value.lpd();
  else field_lpd.clean_up();
  if (other_value.sapi().is_bound()) field_sapi = other_value.sapi();
  else field_sapi.clean_up();
  if (other_value.c__r().is_bound()) field_c__r = other_value.c__r();
  else field_c__r.clean_up();
  if (other_value.ea().is_bound()) field_ea = other_value.ea();
  else field_ea.clean_up();
}
return *this;
}

boolean LapdmAddressField::operator==(const LapdmAddressField& other_value) const
{
return field_spare==other_value.field_spare
  && field_lpd==other_value.field_lpd
  && field_sapi==other_value.field_sapi
  && field_c__r==other_value.field_c__r
  && field_ea==other_value.field_ea;
}

boolean LapdmAddressField::is_bound() const
{
return (field_spare.is_bound())
  || (field_lpd.is_bound())
  || (field_sapi.is_bound())
  || (field_c__r.is_bound())
  || (field_ea.is_bound());
}
boolean LapdmAddressField::is_value() const
{
return field_spare.is_value()
  && field_lpd.is_value()
  && field_sapi.is_value()
  && field_c__r.is_value()
  && field_ea.is_value();
}
void LapdmAddressField::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(", lpd := ");
field_lpd.log();
TTCN_Logger::log_event_str(", sapi := ");
field_sapi.log();
TTCN_Logger::log_event_str(", c_r := ");
field_c__r.log();
TTCN_Logger::log_event_str(", ea := ");
field_ea.log();
TTCN_Logger::log_event_str(" }");
}

void LapdmAddressField::set_implicit_omit()
{
if (spare().is_bound()) spare().set_implicit_omit();
if (lpd().is_bound()) lpd().set_implicit_omit();
if (sapi().is_bound()) sapi().set_implicit_omit();
if (c__r().is_bound()) c__r().set_implicit_omit();
if (ea().is_bound()) ea().set_implicit_omit();
}

void LapdmAddressField::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 @LAPDm_Types.LapdmAddressField 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) spare().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lpd().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) sapi().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) c__r().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) ea().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(), "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(), "lpd")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lpd().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(), "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(), "c_r")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          c__r().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(), "ea")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ea().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 @LAPDm_Types.LapdmAddressField: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LAPDm_Types.LapdmAddressField");
  }
}

void LapdmAddressField::encode_text(Text_Buf& text_buf) const
{
field_spare.encode_text(text_buf);
field_lpd.encode_text(text_buf);
field_sapi.encode_text(text_buf);
field_c__r.encode_text(text_buf);
field_ea.encode_text(text_buf);
}

void LapdmAddressField::decode_text(Text_Buf& text_buf)
{
field_spare.decode_text(text_buf);
field_lpd.decode_text(text_buf);
field_sapi.decode_text(text_buf);
field_c__r.decode_text(text_buf);
field_ea.decode_text(text_buf);
}

void LapdmAddressField::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 LapdmAddressField::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 LapdmAddressField::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, LapdmAddressField_spare_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(LapdmAddressField_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, LapdmAddressField_lpd_descr_.raw->forceomit);
  decoded_field_length = field_lpd.RAW_decode(LapdmAddressField_lpd_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, LapdmAddressField_sapi_descr_.raw->forceomit);
  decoded_field_length = field_sapi.RAW_decode(LapdmAddressField_sapi_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, LapdmAddressField_c__r_descr_.raw->forceomit);
  decoded_field_length = field_c__r.RAW_decode(LapdmAddressField_c__r_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, LapdmAddressField_ea_descr_.raw->forceomit);
  decoded_field_length = field_ea.RAW_decode(LapdmAddressField_ea_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 LapdmAddressField::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, LapdmAddressField_spare_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, LapdmAddressField_lpd_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, LapdmAddressField_sapi_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, LapdmAddressField_c__r_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, LapdmAddressField_ea_descr_.raw);
  encoded_length += field_spare.RAW_encode(LapdmAddressField_spare_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_lpd.RAW_encode(LapdmAddressField_lpd_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_sapi.RAW_encode(LapdmAddressField_sapi_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_c__r.RAW_encode(LapdmAddressField_c__r_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_ea.RAW_encode(LapdmAddressField_ea_descr_, *myleaf.body.node.nodes[4]);
  return myleaf.length = encoded_length;
}

struct LapdmAddressField_template::single_value_struct {
BITSTRING_template field_spare;
INTEGER_template field_lpd;
INTEGER_template field_sapi;
BOOLEAN_template field_c__r;
BOOLEAN_template field_ea;
};

void LapdmAddressField_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_lpd = ANY_VALUE;
single_value->field_sapi = ANY_VALUE;
single_value->field_c__r = ANY_VALUE;
single_value->field_ea = ANY_VALUE;
}
}
}

void LapdmAddressField_template::copy_value(const LapdmAddressField& 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.lpd().is_bound()) {
  single_value->field_lpd = other_value.lpd();
} else {
  single_value->field_lpd.clean_up();
}
if (other_value.sapi().is_bound()) {
  single_value->field_sapi = other_value.sapi();
} else {
  single_value->field_sapi.clean_up();
}
if (other_value.c__r().is_bound()) {
  single_value->field_c__r = other_value.c__r();
} else {
  single_value->field_c__r.clean_up();
}
if (other_value.ea().is_bound()) {
  single_value->field_ea = other_value.ea();
} else {
  single_value->field_ea.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void LapdmAddressField_template::copy_template(const LapdmAddressField_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.lpd().get_selection()) {
single_value->field_lpd = other_value.lpd();
} else {
single_value->field_lpd.clean_up();
}
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.c__r().get_selection()) {
single_value->field_c__r = other_value.c__r();
} else {
single_value->field_c__r.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ea().get_selection()) {
single_value->field_ea = other_value.ea();
} else {
single_value->field_ea.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 LapdmAddressField_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 LapdmAddressField_template(*other_value.implication_.precondition);
implication_.implied_template = new LapdmAddressField_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 @LAPDm_Types.LapdmAddressField.");
break;
}
set_selection(other_value);
}

LapdmAddressField_template::LapdmAddressField_template()
{
}

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

LapdmAddressField_template::LapdmAddressField_template(const LapdmAddressField& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

LapdmAddressField_template& LapdmAddressField_template::operator=(const OPTIONAL<LapdmAddressField>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const LapdmAddressField&)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 @LAPDm_Types.LapdmAddressField.");
}
return *this;
}

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

boolean LapdmAddressField_template::match(const LapdmAddressField& 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.lpd().is_bound()) return FALSE;
if(!single_value->field_lpd.match(other_value.lpd(), legacy))return FALSE;
if(!other_value.sapi().is_bound()) return FALSE;
if(!single_value->field_sapi.match(other_value.sapi(), legacy))return FALSE;
if(!other_value.c__r().is_bound()) return FALSE;
if(!single_value->field_c__r.match(other_value.c__r(), legacy))return FALSE;
if(!other_value.ea().is_bound()) return FALSE;
if(!single_value->field_ea.match(other_value.ea(), 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 @LAPDm_Types.LapdmAddressField.");
}
return FALSE;
}

boolean LapdmAddressField_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_lpd.is_bound()
 || single_value->field_sapi.is_bound()
 || single_value->field_c__r.is_bound()
 || single_value->field_ea.is_bound();
}

boolean LapdmAddressField_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_spare.is_value()
 && single_value->field_lpd.is_value()
 && single_value->field_sapi.is_value()
 && single_value->field_c__r.is_value()
 && single_value->field_ea.is_value();
}

void LapdmAddressField_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;
}

LapdmAddressField LapdmAddressField_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 @LAPDm_Types.LapdmAddressField.");
LapdmAddressField ret_val;
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_lpd.is_bound()) {
ret_val.lpd() = single_value->field_lpd.valueof();
}
if (single_value->field_sapi.is_bound()) {
ret_val.sapi() = single_value->field_sapi.valueof();
}
if (single_value->field_c__r.is_bound()) {
ret_val.c__r() = single_value->field_c__r.valueof();
}
if (single_value->field_ea.is_bound()) {
ret_val.ea() = single_value->field_ea.valueof();
}
return ret_val;
}

void LapdmAddressField_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 @LAPDm_Types.LapdmAddressField.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new LapdmAddressField_template[list_length];
}

LapdmAddressField_template& LapdmAddressField_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 @LAPDm_Types.LapdmAddressField.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LAPDm_Types.LapdmAddressField.");
return value_list.list_value[list_index];
}

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

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

INTEGER_template& LapdmAddressField_template::lpd()
{
set_specific();
return single_value->field_lpd;
}

const INTEGER_template& LapdmAddressField_template::lpd() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lpd of a non-specific template of type @LAPDm_Types.LapdmAddressField.");
return single_value->field_lpd;
}

INTEGER_template& LapdmAddressField_template::sapi()
{
set_specific();
return single_value->field_sapi;
}

const INTEGER_template& LapdmAddressField_template::sapi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field sapi of a non-specific template of type @LAPDm_Types.LapdmAddressField.");
return single_value->field_sapi;
}

BOOLEAN_template& LapdmAddressField_template::c__r()
{
set_specific();
return single_value->field_c__r;
}

const BOOLEAN_template& LapdmAddressField_template::c__r() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field c_r of a non-specific template of type @LAPDm_Types.LapdmAddressField.");
return single_value->field_c__r;
}

BOOLEAN_template& LapdmAddressField_template::ea()
{
set_specific();
return single_value->field_ea;
}

const BOOLEAN_template& LapdmAddressField_template::ea() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ea of a non-specific template of type @LAPDm_Types.LapdmAddressField.");
return single_value->field_ea;
}

int LapdmAddressField_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmAddressField 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 @LAPDm_Types.LapdmAddressField 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 @LAPDm_Types.LapdmAddressField containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmAddressField containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmAddressField containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmAddressField containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmAddressField containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmAddressField containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmAddressField containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LAPDm_Types.LapdmAddressField.");
  }
  return 0;
}

void LapdmAddressField_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(", lpd := ");
single_value->field_lpd.log();
TTCN_Logger::log_event_str(", sapi := ");
single_value->field_sapi.log();
TTCN_Logger::log_event_str(", c_r := ");
single_value->field_c__r.log();
TTCN_Logger::log_event_str(", ea := ");
single_value->field_ea.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 LapdmAddressField_template::log_match(const LapdmAddressField& 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_lpd.match(match_value.lpd(), legacy)){
TTCN_Logger::log_logmatch_info(".lpd");
single_value->field_lpd.log_match(match_value.lpd(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
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_c__r.match(match_value.c__r(), legacy)){
TTCN_Logger::log_logmatch_info(".c_r");
single_value->field_c__r.log_match(match_value.c__r(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ea.match(match_value.ea(), legacy)){
TTCN_Logger::log_logmatch_info(".ea");
single_value->field_ea.log_match(match_value.ea(), 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(", lpd := ");
single_value->field_lpd.log_match(match_value.lpd(), legacy);
TTCN_Logger::log_event_str(", sapi := ");
single_value->field_sapi.log_match(match_value.sapi(), legacy);
TTCN_Logger::log_event_str(", c_r := ");
single_value->field_c__r.log_match(match_value.c__r(), legacy);
TTCN_Logger::log_event_str(", ea := ");
single_value->field_ea.log_match(match_value.ea(), 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 LapdmAddressField_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (spare().is_bound()) spare().set_implicit_omit();
if (lpd().is_bound()) lpd().set_implicit_omit();
if (sapi().is_bound()) sapi().set_implicit_omit();
if (c__r().is_bound()) c__r().set_implicit_omit();
if (ea().is_bound()) ea().set_implicit_omit();
}

void LapdmAddressField_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_lpd.encode_text(text_buf);
single_value->field_sapi.encode_text(text_buf);
single_value->field_c__r.encode_text(text_buf);
single_value->field_ea.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 @LAPDm_Types.LapdmAddressField.");
}
}

void LapdmAddressField_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_lpd.decode_text(text_buf);
single_value->field_sapi.decode_text(text_buf);
single_value->field_c__r.decode_text(text_buf);
single_value->field_ea.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 LapdmAddressField_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 @LAPDm_Types.LapdmAddressField.");
}
}

void LapdmAddressField_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: {
    LapdmAddressField_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 @LAPDm_Types.LapdmAddressField 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) spare().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lpd().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) sapi().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) c__r().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) ea().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(), "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(), "lpd")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lpd().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(), "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(), "c_r")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          c__r().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(), "ea")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ea().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 @LAPDm_Types.LapdmAddressField: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    LapdmAddressField_template* precondition = new LapdmAddressField_template;
    precondition->set_param(*param.get_elem(0));
    LapdmAddressField_template* implied_template = new LapdmAddressField_template;
    implied_template->set_param(*param.get_elem(1));
    *this = LapdmAddressField_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LAPDm_Types.LapdmAddressField");
  }
  is_ifpresent = param.get_ifpresent();
}

void LapdmAddressField_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 : "@LAPDm_Types.LapdmAddressField");
single_value->field_lpd.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmAddressField");
single_value->field_sapi.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmAddressField");
single_value->field_c__r.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmAddressField");
single_value->field_ea.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmAddressField");
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 : "@LAPDm_Types.LapdmAddressField");
}

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

boolean LapdmAddressField_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;
}

LapdmCtrlI::LapdmCtrlI()
{
}

LapdmCtrlI::LapdmCtrlI(const INTEGER& par_n__r,
    const BOOLEAN& par_p,
    const INTEGER& par_n__s,
    const BITSTRING& par_spare)
  :   field_n__r(par_n__r),
  field_p(par_p),
  field_n__s(par_n__s),
  field_spare(par_spare)
{
}

LapdmCtrlI::LapdmCtrlI(const LapdmCtrlI& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LAPDm_Types.LapdmCtrlI.");
if (other_value.n__r().is_bound()) field_n__r = other_value.n__r();
else field_n__r.clean_up();
if (other_value.p().is_bound()) field_p = other_value.p();
else field_p.clean_up();
if (other_value.n__s().is_bound()) field_n__s = other_value.n__s();
else field_n__s.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
}

void LapdmCtrlI::clean_up()
{
field_n__r.clean_up();
field_p.clean_up();
field_n__s.clean_up();
field_spare.clean_up();
}

const TTCN_Typedescriptor_t* LapdmCtrlI::get_descriptor() const { return &LapdmCtrlI_descr_; }
LapdmCtrlI& LapdmCtrlI::operator=(const LapdmCtrlI& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LAPDm_Types.LapdmCtrlI.");
  if (other_value.n__r().is_bound()) field_n__r = other_value.n__r();
  else field_n__r.clean_up();
  if (other_value.p().is_bound()) field_p = other_value.p();
  else field_p.clean_up();
  if (other_value.n__s().is_bound()) field_n__s = other_value.n__s();
  else field_n__s.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
}
return *this;
}

boolean LapdmCtrlI::operator==(const LapdmCtrlI& other_value) const
{
return field_n__r==other_value.field_n__r
  && field_p==other_value.field_p
  && field_n__s==other_value.field_n__s
  && field_spare==other_value.field_spare;
}

boolean LapdmCtrlI::is_bound() const
{
return (field_n__r.is_bound())
  || (field_p.is_bound())
  || (field_n__s.is_bound())
  || (field_spare.is_bound());
}
boolean LapdmCtrlI::is_value() const
{
return field_n__r.is_value()
  && field_p.is_value()
  && field_n__s.is_value()
  && field_spare.is_value();
}
void LapdmCtrlI::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ n_r := ");
field_n__r.log();
TTCN_Logger::log_event_str(", p := ");
field_p.log();
TTCN_Logger::log_event_str(", n_s := ");
field_n__s.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(" }");
}

void LapdmCtrlI::set_implicit_omit()
{
if (n__r().is_bound()) n__r().set_implicit_omit();
if (p().is_bound()) p().set_implicit_omit();
if (n__s().is_bound()) n__s().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void LapdmCtrlI::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 @LAPDm_Types.LapdmCtrlI 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) n__r().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) p().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) n__s().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "n_r")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          n__r().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(), "p")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          p().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(), "n_s")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          n__s().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 @LAPDm_Types.LapdmCtrlI: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LAPDm_Types.LapdmCtrlI");
  }
}

void LapdmCtrlI::encode_text(Text_Buf& text_buf) const
{
field_n__r.encode_text(text_buf);
field_p.encode_text(text_buf);
field_n__s.encode_text(text_buf);
field_spare.encode_text(text_buf);
}

void LapdmCtrlI::decode_text(Text_Buf& text_buf)
{
field_n__r.decode_text(text_buf);
field_p.decode_text(text_buf);
field_n__s.decode_text(text_buf);
field_spare.decode_text(text_buf);
}

void LapdmCtrlI::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 LapdmCtrlI::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 LapdmCtrlI::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, LapdmCtrlI_n__r_descr_.raw->forceomit);
  decoded_field_length = field_n__r.RAW_decode(LapdmCtrlI_n__r_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, LapdmCtrlI_p_descr_.raw->forceomit);
  decoded_field_length = field_p.RAW_decode(LapdmCtrlI_p_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, LapdmCtrlI_n__s_descr_.raw->forceomit);
  decoded_field_length = field_n__s.RAW_decode(LapdmCtrlI_n__s_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, LapdmCtrlI_spare_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(LapdmCtrlI_spare_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 LapdmCtrlI::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, LapdmCtrlI_n__r_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, LapdmCtrlI_p_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, LapdmCtrlI_n__s_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, LapdmCtrlI_spare_descr_.raw);
  encoded_length += field_n__r.RAW_encode(LapdmCtrlI_n__r_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_p.RAW_encode(LapdmCtrlI_p_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_n__s.RAW_encode(LapdmCtrlI_n__s_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_spare.RAW_encode(LapdmCtrlI_spare_descr_, *myleaf.body.node.nodes[3]);
  return myleaf.length = encoded_length;
}

struct LapdmCtrlI_template::single_value_struct {
INTEGER_template field_n__r;
BOOLEAN_template field_p;
INTEGER_template field_n__s;
BITSTRING_template field_spare;
};

void LapdmCtrlI_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_n__r = ANY_VALUE;
single_value->field_p = ANY_VALUE;
single_value->field_n__s = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
}
}
}

void LapdmCtrlI_template::copy_value(const LapdmCtrlI& other_value)
{
single_value = new single_value_struct;
if (other_value.n__r().is_bound()) {
  single_value->field_n__r = other_value.n__r();
} else {
  single_value->field_n__r.clean_up();
}
if (other_value.p().is_bound()) {
  single_value->field_p = other_value.p();
} else {
  single_value->field_p.clean_up();
}
if (other_value.n__s().is_bound()) {
  single_value->field_n__s = other_value.n__s();
} else {
  single_value->field_n__s.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 LapdmCtrlI_template::copy_template(const LapdmCtrlI_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.n__r().get_selection()) {
single_value->field_n__r = other_value.n__r();
} else {
single_value->field_n__r.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.p().get_selection()) {
single_value->field_p = other_value.p();
} else {
single_value->field_p.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.n__s().get_selection()) {
single_value->field_n__s = other_value.n__s();
} else {
single_value->field_n__s.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 LapdmCtrlI_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 LapdmCtrlI_template(*other_value.implication_.precondition);
implication_.implied_template = new LapdmCtrlI_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 @LAPDm_Types.LapdmCtrlI.");
break;
}
set_selection(other_value);
}

LapdmCtrlI_template::LapdmCtrlI_template()
{
}

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

LapdmCtrlI_template::LapdmCtrlI_template(const LapdmCtrlI& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

LapdmCtrlI_template& LapdmCtrlI_template::operator=(const OPTIONAL<LapdmCtrlI>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const LapdmCtrlI&)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 @LAPDm_Types.LapdmCtrlI.");
}
return *this;
}

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

boolean LapdmCtrlI_template::match(const LapdmCtrlI& 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.n__r().is_bound()) return FALSE;
if(!single_value->field_n__r.match(other_value.n__r(), legacy))return FALSE;
if(!other_value.p().is_bound()) return FALSE;
if(!single_value->field_p.match(other_value.p(), legacy))return FALSE;
if(!other_value.n__s().is_bound()) return FALSE;
if(!single_value->field_n__s.match(other_value.n__s(), 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 @LAPDm_Types.LapdmCtrlI.");
}
return FALSE;
}

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

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

void LapdmCtrlI_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;
}

LapdmCtrlI LapdmCtrlI_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 @LAPDm_Types.LapdmCtrlI.");
LapdmCtrlI ret_val;
if (single_value->field_n__r.is_bound()) {
ret_val.n__r() = single_value->field_n__r.valueof();
}
if (single_value->field_p.is_bound()) {
ret_val.p() = single_value->field_p.valueof();
}
if (single_value->field_n__s.is_bound()) {
ret_val.n__s() = single_value->field_n__s.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
return ret_val;
}

void LapdmCtrlI_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 @LAPDm_Types.LapdmCtrlI.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new LapdmCtrlI_template[list_length];
}

LapdmCtrlI_template& LapdmCtrlI_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 @LAPDm_Types.LapdmCtrlI.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LAPDm_Types.LapdmCtrlI.");
return value_list.list_value[list_index];
}

INTEGER_template& LapdmCtrlI_template::n__r()
{
set_specific();
return single_value->field_n__r;
}

const INTEGER_template& LapdmCtrlI_template::n__r() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field n_r of a non-specific template of type @LAPDm_Types.LapdmCtrlI.");
return single_value->field_n__r;
}

BOOLEAN_template& LapdmCtrlI_template::p()
{
set_specific();
return single_value->field_p;
}

const BOOLEAN_template& LapdmCtrlI_template::p() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field p of a non-specific template of type @LAPDm_Types.LapdmCtrlI.");
return single_value->field_p;
}

INTEGER_template& LapdmCtrlI_template::n__s()
{
set_specific();
return single_value->field_n__s;
}

const INTEGER_template& LapdmCtrlI_template::n__s() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field n_s of a non-specific template of type @LAPDm_Types.LapdmCtrlI.");
return single_value->field_n__s;
}

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

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

int LapdmCtrlI_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlI 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 @LAPDm_Types.LapdmCtrlI 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 @LAPDm_Types.LapdmCtrlI containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlI containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlI containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlI containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlI containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlI containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlI containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LAPDm_Types.LapdmCtrlI.");
  }
  return 0;
}

void LapdmCtrlI_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ n_r := ");
single_value->field_n__r.log();
TTCN_Logger::log_event_str(", p := ");
single_value->field_p.log();
TTCN_Logger::log_event_str(", n_s := ");
single_value->field_n__s.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 LapdmCtrlI_template::log_match(const LapdmCtrlI& 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_n__r.match(match_value.n__r(), legacy)){
TTCN_Logger::log_logmatch_info(".n_r");
single_value->field_n__r.log_match(match_value.n__r(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_p.match(match_value.p(), legacy)){
TTCN_Logger::log_logmatch_info(".p");
single_value->field_p.log_match(match_value.p(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_n__s.match(match_value.n__s(), legacy)){
TTCN_Logger::log_logmatch_info(".n_s");
single_value->field_n__s.log_match(match_value.n__s(), 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("{ n_r := ");
single_value->field_n__r.log_match(match_value.n__r(), legacy);
TTCN_Logger::log_event_str(", p := ");
single_value->field_p.log_match(match_value.p(), legacy);
TTCN_Logger::log_event_str(", n_s := ");
single_value->field_n__s.log_match(match_value.n__s(), 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 LapdmCtrlI_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (n__r().is_bound()) n__r().set_implicit_omit();
if (p().is_bound()) p().set_implicit_omit();
if (n__s().is_bound()) n__s().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void LapdmCtrlI_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_n__r.encode_text(text_buf);
single_value->field_p.encode_text(text_buf);
single_value->field_n__s.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 @LAPDm_Types.LapdmCtrlI.");
}
}

void LapdmCtrlI_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_n__r.decode_text(text_buf);
single_value->field_p.decode_text(text_buf);
single_value->field_n__s.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 LapdmCtrlI_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 @LAPDm_Types.LapdmCtrlI.");
}
}

void LapdmCtrlI_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: {
    LapdmCtrlI_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 @LAPDm_Types.LapdmCtrlI 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) n__r().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) p().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) n__s().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "n_r")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          n__r().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(), "p")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          p().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(), "n_s")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          n__s().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 @LAPDm_Types.LapdmCtrlI: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    LapdmCtrlI_template* precondition = new LapdmCtrlI_template;
    precondition->set_param(*param.get_elem(0));
    LapdmCtrlI_template* implied_template = new LapdmCtrlI_template;
    implied_template->set_param(*param.get_elem(1));
    *this = LapdmCtrlI_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LAPDm_Types.LapdmCtrlI");
  }
  is_ifpresent = param.get_ifpresent();
}

void LapdmCtrlI_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_n__r.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmCtrlI");
single_value->field_p.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmCtrlI");
single_value->field_n__s.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmCtrlI");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmCtrlI");
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 : "@LAPDm_Types.LapdmCtrlI");
}

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

boolean LapdmCtrlI_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;
}

LapdmCtrlS::LapdmCtrlS()
{
}

LapdmCtrlS::LapdmCtrlS(const INTEGER& par_n__r,
    const BOOLEAN& par_p__f,
    const BITSTRING& par_s,
    const BITSTRING& par_spare)
  :   field_n__r(par_n__r),
  field_p__f(par_p__f),
  field_s(par_s),
  field_spare(par_spare)
{
}

LapdmCtrlS::LapdmCtrlS(const LapdmCtrlS& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LAPDm_Types.LapdmCtrlS.");
if (other_value.n__r().is_bound()) field_n__r = other_value.n__r();
else field_n__r.clean_up();
if (other_value.p__f().is_bound()) field_p__f = other_value.p__f();
else field_p__f.clean_up();
if (other_value.s().is_bound()) field_s = other_value.s();
else field_s.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
}

void LapdmCtrlS::clean_up()
{
field_n__r.clean_up();
field_p__f.clean_up();
field_s.clean_up();
field_spare.clean_up();
}

const TTCN_Typedescriptor_t* LapdmCtrlS::get_descriptor() const { return &LapdmCtrlS_descr_; }
LapdmCtrlS& LapdmCtrlS::operator=(const LapdmCtrlS& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LAPDm_Types.LapdmCtrlS.");
  if (other_value.n__r().is_bound()) field_n__r = other_value.n__r();
  else field_n__r.clean_up();
  if (other_value.p__f().is_bound()) field_p__f = other_value.p__f();
  else field_p__f.clean_up();
  if (other_value.s().is_bound()) field_s = other_value.s();
  else field_s.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
}
return *this;
}

boolean LapdmCtrlS::operator==(const LapdmCtrlS& other_value) const
{
return field_n__r==other_value.field_n__r
  && field_p__f==other_value.field_p__f
  && field_s==other_value.field_s
  && field_spare==other_value.field_spare;
}

boolean LapdmCtrlS::is_bound() const
{
return (field_n__r.is_bound())
  || (field_p__f.is_bound())
  || (field_s.is_bound())
  || (field_spare.is_bound());
}
boolean LapdmCtrlS::is_value() const
{
return field_n__r.is_value()
  && field_p__f.is_value()
  && field_s.is_value()
  && field_spare.is_value();
}
void LapdmCtrlS::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ n_r := ");
field_n__r.log();
TTCN_Logger::log_event_str(", p_f := ");
field_p__f.log();
TTCN_Logger::log_event_str(", s := ");
field_s.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(" }");
}

void LapdmCtrlS::set_implicit_omit()
{
if (n__r().is_bound()) n__r().set_implicit_omit();
if (p__f().is_bound()) p__f().set_implicit_omit();
if (s().is_bound()) s().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void LapdmCtrlS::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 @LAPDm_Types.LapdmCtrlS 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) n__r().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) p__f().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) s().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "n_r")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          n__r().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(), "p_f")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          p__f().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(), "s")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          s().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 @LAPDm_Types.LapdmCtrlS: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LAPDm_Types.LapdmCtrlS");
  }
}

void LapdmCtrlS::encode_text(Text_Buf& text_buf) const
{
field_n__r.encode_text(text_buf);
field_p__f.encode_text(text_buf);
field_s.encode_text(text_buf);
field_spare.encode_text(text_buf);
}

void LapdmCtrlS::decode_text(Text_Buf& text_buf)
{
field_n__r.decode_text(text_buf);
field_p__f.decode_text(text_buf);
field_s.decode_text(text_buf);
field_spare.decode_text(text_buf);
}

void LapdmCtrlS::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 LapdmCtrlS::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 LapdmCtrlS::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, LapdmCtrlS_n__r_descr_.raw->forceomit);
  decoded_field_length = field_n__r.RAW_decode(LapdmCtrlS_n__r_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, LapdmCtrlS_p__f_descr_.raw->forceomit);
  decoded_field_length = field_p__f.RAW_decode(LapdmCtrlS_p__f_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, LapdmCtrlS_s_descr_.raw->forceomit);
  decoded_field_length = field_s.RAW_decode(LapdmCtrlS_s_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, LapdmCtrlS_spare_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(LapdmCtrlS_spare_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 LapdmCtrlS::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, LapdmCtrlS_n__r_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, LapdmCtrlS_p__f_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, LapdmCtrlS_s_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, LapdmCtrlS_spare_descr_.raw);
  encoded_length += field_n__r.RAW_encode(LapdmCtrlS_n__r_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_p__f.RAW_encode(LapdmCtrlS_p__f_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_s.RAW_encode(LapdmCtrlS_s_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_spare.RAW_encode(LapdmCtrlS_spare_descr_, *myleaf.body.node.nodes[3]);
  return myleaf.length = encoded_length;
}

struct LapdmCtrlS_template::single_value_struct {
INTEGER_template field_n__r;
BOOLEAN_template field_p__f;
BITSTRING_template field_s;
BITSTRING_template field_spare;
};

void LapdmCtrlS_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_n__r = ANY_VALUE;
single_value->field_p__f = ANY_VALUE;
single_value->field_s = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
}
}
}

void LapdmCtrlS_template::copy_value(const LapdmCtrlS& other_value)
{
single_value = new single_value_struct;
if (other_value.n__r().is_bound()) {
  single_value->field_n__r = other_value.n__r();
} else {
  single_value->field_n__r.clean_up();
}
if (other_value.p__f().is_bound()) {
  single_value->field_p__f = other_value.p__f();
} else {
  single_value->field_p__f.clean_up();
}
if (other_value.s().is_bound()) {
  single_value->field_s = other_value.s();
} else {
  single_value->field_s.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 LapdmCtrlS_template::copy_template(const LapdmCtrlS_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.n__r().get_selection()) {
single_value->field_n__r = other_value.n__r();
} else {
single_value->field_n__r.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.p__f().get_selection()) {
single_value->field_p__f = other_value.p__f();
} else {
single_value->field_p__f.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.s().get_selection()) {
single_value->field_s = other_value.s();
} else {
single_value->field_s.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 LapdmCtrlS_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 LapdmCtrlS_template(*other_value.implication_.precondition);
implication_.implied_template = new LapdmCtrlS_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 @LAPDm_Types.LapdmCtrlS.");
break;
}
set_selection(other_value);
}

LapdmCtrlS_template::LapdmCtrlS_template()
{
}

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

LapdmCtrlS_template::LapdmCtrlS_template(const LapdmCtrlS& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

LapdmCtrlS_template& LapdmCtrlS_template::operator=(const OPTIONAL<LapdmCtrlS>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const LapdmCtrlS&)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 @LAPDm_Types.LapdmCtrlS.");
}
return *this;
}

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

boolean LapdmCtrlS_template::match(const LapdmCtrlS& 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.n__r().is_bound()) return FALSE;
if(!single_value->field_n__r.match(other_value.n__r(), legacy))return FALSE;
if(!other_value.p__f().is_bound()) return FALSE;
if(!single_value->field_p__f.match(other_value.p__f(), legacy))return FALSE;
if(!other_value.s().is_bound()) return FALSE;
if(!single_value->field_s.match(other_value.s(), 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 @LAPDm_Types.LapdmCtrlS.");
}
return FALSE;
}

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

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

void LapdmCtrlS_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;
}

LapdmCtrlS LapdmCtrlS_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 @LAPDm_Types.LapdmCtrlS.");
LapdmCtrlS ret_val;
if (single_value->field_n__r.is_bound()) {
ret_val.n__r() = single_value->field_n__r.valueof();
}
if (single_value->field_p__f.is_bound()) {
ret_val.p__f() = single_value->field_p__f.valueof();
}
if (single_value->field_s.is_bound()) {
ret_val.s() = single_value->field_s.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
return ret_val;
}

void LapdmCtrlS_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 @LAPDm_Types.LapdmCtrlS.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new LapdmCtrlS_template[list_length];
}

LapdmCtrlS_template& LapdmCtrlS_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 @LAPDm_Types.LapdmCtrlS.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LAPDm_Types.LapdmCtrlS.");
return value_list.list_value[list_index];
}

INTEGER_template& LapdmCtrlS_template::n__r()
{
set_specific();
return single_value->field_n__r;
}

const INTEGER_template& LapdmCtrlS_template::n__r() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field n_r of a non-specific template of type @LAPDm_Types.LapdmCtrlS.");
return single_value->field_n__r;
}

BOOLEAN_template& LapdmCtrlS_template::p__f()
{
set_specific();
return single_value->field_p__f;
}

const BOOLEAN_template& LapdmCtrlS_template::p__f() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field p_f of a non-specific template of type @LAPDm_Types.LapdmCtrlS.");
return single_value->field_p__f;
}

BITSTRING_template& LapdmCtrlS_template::s()
{
set_specific();
return single_value->field_s;
}

const BITSTRING_template& LapdmCtrlS_template::s() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field s of a non-specific template of type @LAPDm_Types.LapdmCtrlS.");
return single_value->field_s;
}

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

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

int LapdmCtrlS_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlS 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 @LAPDm_Types.LapdmCtrlS 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 @LAPDm_Types.LapdmCtrlS containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlS containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlS containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlS containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlS containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlS containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlS containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LAPDm_Types.LapdmCtrlS.");
  }
  return 0;
}

void LapdmCtrlS_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ n_r := ");
single_value->field_n__r.log();
TTCN_Logger::log_event_str(", p_f := ");
single_value->field_p__f.log();
TTCN_Logger::log_event_str(", s := ");
single_value->field_s.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 LapdmCtrlS_template::log_match(const LapdmCtrlS& 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_n__r.match(match_value.n__r(), legacy)){
TTCN_Logger::log_logmatch_info(".n_r");
single_value->field_n__r.log_match(match_value.n__r(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_p__f.match(match_value.p__f(), legacy)){
TTCN_Logger::log_logmatch_info(".p_f");
single_value->field_p__f.log_match(match_value.p__f(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_s.match(match_value.s(), legacy)){
TTCN_Logger::log_logmatch_info(".s");
single_value->field_s.log_match(match_value.s(), 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("{ n_r := ");
single_value->field_n__r.log_match(match_value.n__r(), legacy);
TTCN_Logger::log_event_str(", p_f := ");
single_value->field_p__f.log_match(match_value.p__f(), legacy);
TTCN_Logger::log_event_str(", s := ");
single_value->field_s.log_match(match_value.s(), 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 LapdmCtrlS_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (n__r().is_bound()) n__r().set_implicit_omit();
if (p__f().is_bound()) p__f().set_implicit_omit();
if (s().is_bound()) s().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void LapdmCtrlS_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_n__r.encode_text(text_buf);
single_value->field_p__f.encode_text(text_buf);
single_value->field_s.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 @LAPDm_Types.LapdmCtrlS.");
}
}

void LapdmCtrlS_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_n__r.decode_text(text_buf);
single_value->field_p__f.decode_text(text_buf);
single_value->field_s.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 LapdmCtrlS_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 @LAPDm_Types.LapdmCtrlS.");
}
}

void LapdmCtrlS_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: {
    LapdmCtrlS_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 @LAPDm_Types.LapdmCtrlS 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) n__r().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) p__f().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) s().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "n_r")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          n__r().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(), "p_f")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          p__f().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(), "s")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          s().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 @LAPDm_Types.LapdmCtrlS: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    LapdmCtrlS_template* precondition = new LapdmCtrlS_template;
    precondition->set_param(*param.get_elem(0));
    LapdmCtrlS_template* implied_template = new LapdmCtrlS_template;
    implied_template->set_param(*param.get_elem(1));
    *this = LapdmCtrlS_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LAPDm_Types.LapdmCtrlS");
  }
  is_ifpresent = param.get_ifpresent();
}

void LapdmCtrlS_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_n__r.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmCtrlS");
single_value->field_p__f.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmCtrlS");
single_value->field_s.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmCtrlS");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmCtrlS");
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 : "@LAPDm_Types.LapdmCtrlS");
}

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

boolean LapdmCtrlS_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;
}

LapdmCtrlU::LapdmCtrlU()
{
}

LapdmCtrlU::LapdmCtrlU(const BITSTRING& par_u,
    const BOOLEAN& par_p__f,
    const BITSTRING& par_u2,
    const BITSTRING& par_spare)
  :   field_u(par_u),
  field_p__f(par_p__f),
  field_u2(par_u2),
  field_spare(par_spare)
{
}

LapdmCtrlU::LapdmCtrlU(const LapdmCtrlU& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LAPDm_Types.LapdmCtrlU.");
if (other_value.u().is_bound()) field_u = other_value.u();
else field_u.clean_up();
if (other_value.p__f().is_bound()) field_p__f = other_value.p__f();
else field_p__f.clean_up();
if (other_value.u2().is_bound()) field_u2 = other_value.u2();
else field_u2.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
}

void LapdmCtrlU::clean_up()
{
field_u.clean_up();
field_p__f.clean_up();
field_u2.clean_up();
field_spare.clean_up();
}

const TTCN_Typedescriptor_t* LapdmCtrlU::get_descriptor() const { return &LapdmCtrlU_descr_; }
LapdmCtrlU& LapdmCtrlU::operator=(const LapdmCtrlU& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LAPDm_Types.LapdmCtrlU.");
  if (other_value.u().is_bound()) field_u = other_value.u();
  else field_u.clean_up();
  if (other_value.p__f().is_bound()) field_p__f = other_value.p__f();
  else field_p__f.clean_up();
  if (other_value.u2().is_bound()) field_u2 = other_value.u2();
  else field_u2.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
}
return *this;
}

boolean LapdmCtrlU::operator==(const LapdmCtrlU& other_value) const
{
return field_u==other_value.field_u
  && field_p__f==other_value.field_p__f
  && field_u2==other_value.field_u2
  && field_spare==other_value.field_spare;
}

boolean LapdmCtrlU::is_bound() const
{
return (field_u.is_bound())
  || (field_p__f.is_bound())
  || (field_u2.is_bound())
  || (field_spare.is_bound());
}
boolean LapdmCtrlU::is_value() const
{
return field_u.is_value()
  && field_p__f.is_value()
  && field_u2.is_value()
  && field_spare.is_value();
}
void LapdmCtrlU::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ u := ");
field_u.log();
TTCN_Logger::log_event_str(", p_f := ");
field_p__f.log();
TTCN_Logger::log_event_str(", u2 := ");
field_u2.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(" }");
}

void LapdmCtrlU::set_implicit_omit()
{
if (u().is_bound()) u().set_implicit_omit();
if (p__f().is_bound()) p__f().set_implicit_omit();
if (u2().is_bound()) u2().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void LapdmCtrlU::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 @LAPDm_Types.LapdmCtrlU 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) u().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) p__f().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) u2().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "u")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          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(), "p_f")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          p__f().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(), "u2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          u2().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 @LAPDm_Types.LapdmCtrlU: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LAPDm_Types.LapdmCtrlU");
  }
}

void LapdmCtrlU::encode_text(Text_Buf& text_buf) const
{
field_u.encode_text(text_buf);
field_p__f.encode_text(text_buf);
field_u2.encode_text(text_buf);
field_spare.encode_text(text_buf);
}

void LapdmCtrlU::decode_text(Text_Buf& text_buf)
{
field_u.decode_text(text_buf);
field_p__f.decode_text(text_buf);
field_u2.decode_text(text_buf);
field_spare.decode_text(text_buf);
}

void LapdmCtrlU::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 LapdmCtrlU::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 LapdmCtrlU::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, LapdmCtrlU_u_descr_.raw->forceomit);
  decoded_field_length = field_u.RAW_decode(LapdmCtrlU_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, LapdmCtrlU_p__f_descr_.raw->forceomit);
  decoded_field_length = field_p__f.RAW_decode(LapdmCtrlU_p__f_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, LapdmCtrlU_u2_descr_.raw->forceomit);
  decoded_field_length = field_u2.RAW_decode(LapdmCtrlU_u2_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, LapdmCtrlU_spare_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(LapdmCtrlU_spare_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 LapdmCtrlU::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, LapdmCtrlU_u_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, LapdmCtrlU_p__f_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, LapdmCtrlU_u2_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, LapdmCtrlU_spare_descr_.raw);
  encoded_length += field_u.RAW_encode(LapdmCtrlU_u_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_p__f.RAW_encode(LapdmCtrlU_p__f_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_u2.RAW_encode(LapdmCtrlU_u2_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_spare.RAW_encode(LapdmCtrlU_spare_descr_, *myleaf.body.node.nodes[3]);
  return myleaf.length = encoded_length;
}

struct LapdmCtrlU_template::single_value_struct {
BITSTRING_template field_u;
BOOLEAN_template field_p__f;
BITSTRING_template field_u2;
BITSTRING_template field_spare;
};

void LapdmCtrlU_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_u = ANY_VALUE;
single_value->field_p__f = ANY_VALUE;
single_value->field_u2 = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
}
}
}

void LapdmCtrlU_template::copy_value(const LapdmCtrlU& other_value)
{
single_value = new single_value_struct;
if (other_value.u().is_bound()) {
  single_value->field_u = other_value.u();
} else {
  single_value->field_u.clean_up();
}
if (other_value.p__f().is_bound()) {
  single_value->field_p__f = other_value.p__f();
} else {
  single_value->field_p__f.clean_up();
}
if (other_value.u2().is_bound()) {
  single_value->field_u2 = other_value.u2();
} else {
  single_value->field_u2.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 LapdmCtrlU_template::copy_template(const LapdmCtrlU_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.u().get_selection()) {
single_value->field_u = other_value.u();
} else {
single_value->field_u.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.p__f().get_selection()) {
single_value->field_p__f = other_value.p__f();
} else {
single_value->field_p__f.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.u2().get_selection()) {
single_value->field_u2 = other_value.u2();
} else {
single_value->field_u2.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 LapdmCtrlU_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 LapdmCtrlU_template(*other_value.implication_.precondition);
implication_.implied_template = new LapdmCtrlU_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 @LAPDm_Types.LapdmCtrlU.");
break;
}
set_selection(other_value);
}

LapdmCtrlU_template::LapdmCtrlU_template()
{
}

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

LapdmCtrlU_template::LapdmCtrlU_template(const LapdmCtrlU& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

LapdmCtrlU_template& LapdmCtrlU_template::operator=(const OPTIONAL<LapdmCtrlU>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const LapdmCtrlU&)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 @LAPDm_Types.LapdmCtrlU.");
}
return *this;
}

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

boolean LapdmCtrlU_template::match(const LapdmCtrlU& 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.u().is_bound()) return FALSE;
if(!single_value->field_u.match(other_value.u(), legacy))return FALSE;
if(!other_value.p__f().is_bound()) return FALSE;
if(!single_value->field_p__f.match(other_value.p__f(), legacy))return FALSE;
if(!other_value.u2().is_bound()) return FALSE;
if(!single_value->field_u2.match(other_value.u2(), 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 @LAPDm_Types.LapdmCtrlU.");
}
return FALSE;
}

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

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

void LapdmCtrlU_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;
}

LapdmCtrlU LapdmCtrlU_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 @LAPDm_Types.LapdmCtrlU.");
LapdmCtrlU ret_val;
if (single_value->field_u.is_bound()) {
ret_val.u() = single_value->field_u.valueof();
}
if (single_value->field_p__f.is_bound()) {
ret_val.p__f() = single_value->field_p__f.valueof();
}
if (single_value->field_u2.is_bound()) {
ret_val.u2() = single_value->field_u2.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
return ret_val;
}

void LapdmCtrlU_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 @LAPDm_Types.LapdmCtrlU.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new LapdmCtrlU_template[list_length];
}

LapdmCtrlU_template& LapdmCtrlU_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 @LAPDm_Types.LapdmCtrlU.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LAPDm_Types.LapdmCtrlU.");
return value_list.list_value[list_index];
}

BITSTRING_template& LapdmCtrlU_template::u()
{
set_specific();
return single_value->field_u;
}

const BITSTRING_template& LapdmCtrlU_template::u() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field u of a non-specific template of type @LAPDm_Types.LapdmCtrlU.");
return single_value->field_u;
}

BOOLEAN_template& LapdmCtrlU_template::p__f()
{
set_specific();
return single_value->field_p__f;
}

const BOOLEAN_template& LapdmCtrlU_template::p__f() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field p_f of a non-specific template of type @LAPDm_Types.LapdmCtrlU.");
return single_value->field_p__f;
}

BITSTRING_template& LapdmCtrlU_template::u2()
{
set_specific();
return single_value->field_u2;
}

const BITSTRING_template& LapdmCtrlU_template::u2() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field u2 of a non-specific template of type @LAPDm_Types.LapdmCtrlU.");
return single_value->field_u2;
}

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

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

int LapdmCtrlU_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlU 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 @LAPDm_Types.LapdmCtrlU 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 @LAPDm_Types.LapdmCtrlU containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlU containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlU containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlU containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlU containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlU containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmCtrlU containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LAPDm_Types.LapdmCtrlU.");
  }
  return 0;
}

void LapdmCtrlU_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ u := ");
single_value->field_u.log();
TTCN_Logger::log_event_str(", p_f := ");
single_value->field_p__f.log();
TTCN_Logger::log_event_str(", u2 := ");
single_value->field_u2.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 LapdmCtrlU_template::log_match(const LapdmCtrlU& 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_u.match(match_value.u(), legacy)){
TTCN_Logger::log_logmatch_info(".u");
single_value->field_u.log_match(match_value.u(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_p__f.match(match_value.p__f(), legacy)){
TTCN_Logger::log_logmatch_info(".p_f");
single_value->field_p__f.log_match(match_value.p__f(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_u2.match(match_value.u2(), legacy)){
TTCN_Logger::log_logmatch_info(".u2");
single_value->field_u2.log_match(match_value.u2(), 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("{ u := ");
single_value->field_u.log_match(match_value.u(), legacy);
TTCN_Logger::log_event_str(", p_f := ");
single_value->field_p__f.log_match(match_value.p__f(), legacy);
TTCN_Logger::log_event_str(", u2 := ");
single_value->field_u2.log_match(match_value.u2(), 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 LapdmCtrlU_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (u().is_bound()) u().set_implicit_omit();
if (p__f().is_bound()) p__f().set_implicit_omit();
if (u2().is_bound()) u2().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void LapdmCtrlU_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_u.encode_text(text_buf);
single_value->field_p__f.encode_text(text_buf);
single_value->field_u2.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 @LAPDm_Types.LapdmCtrlU.");
}
}

void LapdmCtrlU_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_u.decode_text(text_buf);
single_value->field_p__f.decode_text(text_buf);
single_value->field_u2.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 LapdmCtrlU_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 @LAPDm_Types.LapdmCtrlU.");
}
}

void LapdmCtrlU_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: {
    LapdmCtrlU_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 @LAPDm_Types.LapdmCtrlU 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) u().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) p__f().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) u2().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "u")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          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(), "p_f")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          p__f().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(), "u2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          u2().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 @LAPDm_Types.LapdmCtrlU: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    LapdmCtrlU_template* precondition = new LapdmCtrlU_template;
    precondition->set_param(*param.get_elem(0));
    LapdmCtrlU_template* implied_template = new LapdmCtrlU_template;
    implied_template->set_param(*param.get_elem(1));
    *this = LapdmCtrlU_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LAPDm_Types.LapdmCtrlU");
  }
  is_ifpresent = param.get_ifpresent();
}

void LapdmCtrlU_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_u.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmCtrlU");
single_value->field_p__f.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmCtrlU");
single_value->field_u2.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmCtrlU");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmCtrlU");
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 : "@LAPDm_Types.LapdmCtrlU");
}

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

boolean LapdmCtrlU_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 LapdmCtrl::copy_value(const LapdmCtrl& other_value)
{
switch (other_value.union_selection) {
case ALT_s:
field_s = new LapdmCtrlS(*other_value.field_s);
break;
case ALT_u:
field_u = new LapdmCtrlU(*other_value.field_u);
break;
case ALT_i:
field_i = new LapdmCtrlI(*other_value.field_i);
break;
case ALT_other:
field_other = new INTEGER(*other_value.field_other);
break;
default:
TTCN_error("Assignment of an unbound union value of type @LAPDm_Types.LapdmCtrl.");
}
union_selection = other_value.union_selection;
}

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

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

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

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

boolean LapdmCtrl::operator==(const LapdmCtrl& other_value) const
{
if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @LAPDm_Types.LapdmCtrl.");
if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @LAPDm_Types.LapdmCtrl.");
if (union_selection != other_value.union_selection) return FALSE;
switch (union_selection) {
case ALT_s:
return *field_s == *other_value.field_s;
case ALT_u:
return *field_u == *other_value.field_u;
case ALT_i:
return *field_i == *other_value.field_i;
case ALT_other:
return *field_other == *other_value.field_other;
default:
return FALSE;
}
}

LapdmCtrlS& LapdmCtrl::s()
{
if (union_selection != ALT_s) {
clean_up();
field_s = new LapdmCtrlS;
union_selection = ALT_s;
}
return *field_s;
}

const LapdmCtrlS& LapdmCtrl::s() const
{
if (union_selection != ALT_s) TTCN_error("Using non-selected field s in a value of union type @LAPDm_Types.LapdmCtrl.");
return *field_s;
}

LapdmCtrlU& LapdmCtrl::u()
{
if (union_selection != ALT_u) {
clean_up();
field_u = new LapdmCtrlU;
union_selection = ALT_u;
}
return *field_u;
}

const LapdmCtrlU& LapdmCtrl::u() const
{
if (union_selection != ALT_u) TTCN_error("Using non-selected field u in a value of union type @LAPDm_Types.LapdmCtrl.");
return *field_u;
}

LapdmCtrlI& LapdmCtrl::i()
{
if (union_selection != ALT_i) {
clean_up();
field_i = new LapdmCtrlI;
union_selection = ALT_i;
}
return *field_i;
}

const LapdmCtrlI& LapdmCtrl::i() const
{
if (union_selection != ALT_i) TTCN_error("Using non-selected field i in a value of union type @LAPDm_Types.LapdmCtrl.");
return *field_i;
}

INTEGER& LapdmCtrl::other()
{
if (union_selection != ALT_other) {
clean_up();
field_other = new INTEGER;
union_selection = ALT_other;
}
return *field_other;
}

const INTEGER& LapdmCtrl::other() const
{
if (union_selection != ALT_other) TTCN_error("Using non-selected field other in a value of union type @LAPDm_Types.LapdmCtrl.");
return *field_other;
}

boolean LapdmCtrl::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 @LAPDm_Types.LapdmCtrl.");
return union_selection == checked_selection;
}

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

boolean LapdmCtrl::is_value() const
{
switch (union_selection) {
case UNBOUND_VALUE: return FALSE;
case ALT_s: return field_s->is_value();
case ALT_u: return field_u->is_value();
case ALT_i: return field_i->is_value();
case ALT_other: return field_other->is_value();
default: TTCN_error("Invalid selection in union is_bound");}
}

void LapdmCtrl::clean_up()
{
switch (union_selection) {
case ALT_s:
  delete field_s;
  break;
case ALT_u:
  delete field_u;
  break;
case ALT_i:
  delete field_i;
  break;
case ALT_other:
  delete field_other;
  break;
default:
  break;
}
union_selection = UNBOUND_VALUE;
}

void LapdmCtrl::log() const
{
switch (union_selection) {
case ALT_s:
TTCN_Logger::log_event_str("{ s := ");
field_s->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_u:
TTCN_Logger::log_event_str("{ u := ");
field_u->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_i:
TTCN_Logger::log_event_str("{ i := ");
field_i->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_other:
TTCN_Logger::log_event_str("{ other := ");
field_other->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_unbound();
}
}

void LapdmCtrl::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, "s")) {
    s().set_param(*mp_last);
    if (!s().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "u")) {
    u().set_param(*mp_last);
    if (!u().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "i")) {
    i().set_param(*mp_last);
    if (!i().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "other")) {
    other().set_param(*mp_last);
    if (!other().is_bound()) clean_up();
    return;
  }
  mp_last->error("Field %s does not exist in type @LAPDm_Types.LapdmCtrl.", last_name);
}

void LapdmCtrl::set_implicit_omit()
{
switch (union_selection) {
case ALT_s:
field_s->set_implicit_omit(); break;
case ALT_u:
field_u->set_implicit_omit(); break;
case ALT_i:
field_i->set_implicit_omit(); break;
case ALT_other:
field_other->set_implicit_omit(); break;
default: break;
}
}

void LapdmCtrl::encode_text(Text_Buf& text_buf) const
{
text_buf.push_int(union_selection);
switch (union_selection) {
case ALT_s:
field_s->encode_text(text_buf);
break;
case ALT_u:
field_u->encode_text(text_buf);
break;
case ALT_i:
field_i->encode_text(text_buf);
break;
case ALT_other:
field_other->encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an unbound value of union type @LAPDm_Types.LapdmCtrl.");
}
}

void LapdmCtrl::decode_text(Text_Buf& text_buf)
{
switch ((union_selection_type)text_buf.pull_int().get_val()) {
case ALT_s:
s().decode_text(text_buf);
break;
case ALT_u:
u().decode_text(text_buf);
break;
case ALT_i:
i().decode_text(text_buf);
break;
case ALT_other:
other().decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for type @LAPDm_Types.LapdmCtrl.");
}
}

void LapdmCtrl::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 LapdmCtrl::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 LapdmCtrl::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, LapdmCtrlS_descr_.raw->forceomit);
      decoded_length = s().RAW_decode(LapdmCtrlS_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, LapdmCtrlU_descr_.raw->forceomit);
      decoded_length = u().RAW_decode(LapdmCtrlU_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, LapdmCtrlI_descr_.raw->forceomit);
      decoded_length = i().RAW_decode(LapdmCtrlI_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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
      decoded_length = other().RAW_decode(Osmocom__Types::uint8__t_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 + 6);
      decoded_0_length = temporal_0.RAW_decode(LapdmCtrlS_spare_descr_, p_buf, limit, top_bit_ord, TRUE);
      if (decoded_0_length > 0) {
        if (temporal_0 ==  bs_1) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(0, force_omit, LapdmCtrlS_descr_.raw->forceomit);
          decoded_length = s().RAW_decode(LapdmCtrlS_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_s).spare() ==  bs_1) {
               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 + 6);
      decoded_1_length = temporal_1.RAW_decode(LapdmCtrlU_spare_descr_, p_buf, limit, top_bit_ord, TRUE);
      if (decoded_1_length > 0) {
        if (temporal_1 ==  bs_0) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(1, force_omit, LapdmCtrlU_descr_.raw->forceomit);
          decoded_length = u().RAW_decode(LapdmCtrlU_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_u).spare() ==  bs_0) {
               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_2;
      int decoded_2_length;
      p_buf.set_pos_bit(starting_pos + 7);
      decoded_2_length = temporal_2.RAW_decode(LapdmCtrlI_spare_descr_, p_buf, limit, top_bit_ord, TRUE);
      if (decoded_2_length > 0) {
        if (temporal_2 ==  bs_2) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(2, force_omit, LapdmCtrlI_descr_.raw->forceomit);
          decoded_length = i().RAW_decode(LapdmCtrlI_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_i).spare() ==  bs_2) {
               return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
             }else already_failed = TRUE;
          }
        }
      }
    }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_3_force_omit(3, force_omit, Osmocom__Types::uint8__t_descr_.raw->forceomit);
      decoded_length = other().RAW_decode(Osmocom__Types::uint8__t_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;
       }
 }
 clean_up();
 return -1;
}

int LapdmCtrl::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const
{
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 4;  myleaf.body.node.nodes = init_nodes_of_enc_tree(4);
  memset(myleaf.body.node.nodes, 0, 4 * sizeof(RAW_enc_tree *));
  switch (union_selection) {
  case ALT_s:
    myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, LapdmCtrlS_descr_.raw);
    encoded_length = field_s->RAW_encode(LapdmCtrlS_descr_, *myleaf.body.node.nodes[0]);
    myleaf.body.node.nodes[0]->coding_descr = &LapdmCtrlS_descr_;
    if ((*field_s).spare() !=  bs_1) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+2;
  int new_pos0[]={0,3};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,2,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
   bs_1.RAW_encode(LapdmCtrlS_spare_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_u:
    myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, LapdmCtrlU_descr_.raw);
    encoded_length = field_u->RAW_encode(LapdmCtrlU_descr_, *myleaf.body.node.nodes[1]);
    myleaf.body.node.nodes[1]->coding_descr = &LapdmCtrlU_descr_;
    if ((*field_u).spare() !=  bs_0) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+2;
  int new_pos0[]={1,3};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,2,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
   bs_0.RAW_encode(LapdmCtrlU_spare_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_i:
    myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 2, LapdmCtrlI_descr_.raw);
    encoded_length = field_i->RAW_encode(LapdmCtrlI_descr_, *myleaf.body.node.nodes[2]);
    myleaf.body.node.nodes[2]->coding_descr = &LapdmCtrlI_descr_;
    if ((*field_i).spare() !=  bs_2) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+2;
  int new_pos0[]={2,3};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,2,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
   bs_2.RAW_encode(LapdmCtrlI_spare_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_other:
    myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 3, Osmocom__Types::uint8__t_descr_.raw);
    encoded_length = field_other->RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[3]);
    myleaf.body.node.nodes[3]->coding_descr = &Osmocom__Types::uint8__t_descr_;
    break;
  default:
    TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  }
  return encoded_length;
}

void LapdmCtrl_template::copy_value(const LapdmCtrl& other_value)
{
single_value.union_selection = other_value.get_selection();
switch (single_value.union_selection) {
case LapdmCtrl::ALT_s:
single_value.field_s = new LapdmCtrlS_template(other_value.s());
break;
case LapdmCtrl::ALT_u:
single_value.field_u = new LapdmCtrlU_template(other_value.u());
break;
case LapdmCtrl::ALT_i:
single_value.field_i = new LapdmCtrlI_template(other_value.i());
break;
case LapdmCtrl::ALT_other:
single_value.field_other = new INTEGER_template(other_value.other());
break;
default:
TTCN_error("Initializing a template with an unbound value of type @LAPDm_Types.LapdmCtrl.");
}
set_selection(SPECIFIC_VALUE);
}

void LapdmCtrl_template::copy_template(const LapdmCtrl_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 LapdmCtrl::ALT_s:
single_value.field_s = new LapdmCtrlS_template(*other_value.single_value.field_s);
break;
case LapdmCtrl::ALT_u:
single_value.field_u = new LapdmCtrlU_template(*other_value.single_value.field_u);
break;
case LapdmCtrl::ALT_i:
single_value.field_i = new LapdmCtrlI_template(*other_value.single_value.field_i);
break;
case LapdmCtrl::ALT_other:
single_value.field_other = new INTEGER_template(*other_value.single_value.field_other);
break;
default:
TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @LAPDm_Types.LapdmCtrl.");
}
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 LapdmCtrl_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 LapdmCtrl_template(*other_value.implication_.precondition);
implication_.implied_template = new LapdmCtrl_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 @LAPDm_Types.LapdmCtrl.");
}
set_selection(other_value);
}

LapdmCtrl_template::LapdmCtrl_template()
{
}

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

LapdmCtrl_template::LapdmCtrl_template(const LapdmCtrl& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

void LapdmCtrl_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case LapdmCtrl::ALT_s:
delete single_value.field_s;
break;
case LapdmCtrl::ALT_u:
delete single_value.field_u;
break;
case LapdmCtrl::ALT_i:
delete single_value.field_i;
break;
case LapdmCtrl::ALT_other:
delete single_value.field_other;
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;
}

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

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

LapdmCtrl_template& LapdmCtrl_template::operator=(const OPTIONAL<LapdmCtrl>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const LapdmCtrl&)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 @LAPDm_Types.LapdmCtrl.");
}
return *this;
}

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

boolean LapdmCtrl_template::match(const LapdmCtrl& 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:
{
LapdmCtrl::union_selection_type value_selection = other_value.get_selection();
if (value_selection == LapdmCtrl::UNBOUND_VALUE) return FALSE;
if (value_selection != single_value.union_selection) return FALSE;
switch (value_selection) {
case LapdmCtrl::ALT_s:
return single_value.field_s->match(other_value.s(), legacy);
case LapdmCtrl::ALT_u:
return single_value.field_u->match(other_value.u(), legacy);
case LapdmCtrl::ALT_i:
return single_value.field_i->match(other_value.i(), legacy);
case LapdmCtrl::ALT_other:
return single_value.field_other->match(other_value.other(), legacy);
default:
TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @LAPDm_Types.LapdmCtrl.");
}
}
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 @LAPDm_Types.LapdmCtrl.");
}
return FALSE;
}

boolean LapdmCtrl_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
switch (single_value.union_selection) {
case LapdmCtrl::ALT_s:
return single_value.field_s->is_value();
case LapdmCtrl::ALT_u:
return single_value.field_u->is_value();
case LapdmCtrl::ALT_i:
return single_value.field_i->is_value();
case LapdmCtrl::ALT_other:
return single_value.field_other->is_value();
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @LAPDm_Types.LapdmCtrl.");
}
}

LapdmCtrl LapdmCtrl_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 @LAPDm_Types.LapdmCtrl.");
LapdmCtrl ret_val;
switch (single_value.union_selection) {
case LapdmCtrl::ALT_s:
ret_val.s() = single_value.field_s->valueof();
break;
case LapdmCtrl::ALT_u:
ret_val.u() = single_value.field_u->valueof();
break;
case LapdmCtrl::ALT_i:
ret_val.i() = single_value.field_i->valueof();
break;
case LapdmCtrl::ALT_other:
ret_val.other() = single_value.field_other->valueof();
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @LAPDm_Types.LapdmCtrl.");
}
return ret_val;
}

LapdmCtrl_template& LapdmCtrl_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 @LAPDm_Types.LapdmCtrl.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @LAPDm_Types.LapdmCtrl.");
return value_list.list_value[list_index];
}
void LapdmCtrl_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 @LAPDm_Types.LapdmCtrl.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new LapdmCtrl_template[list_length];
}

LapdmCtrlS_template& LapdmCtrl_template::s()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != LapdmCtrl::ALT_s) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_s = new LapdmCtrlS_template(ANY_VALUE);
else single_value.field_s = new LapdmCtrlS_template;
single_value.union_selection = LapdmCtrl::ALT_s;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_s;
}

const LapdmCtrlS_template& LapdmCtrl_template::s() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field s in a non-specific template of union type @LAPDm_Types.LapdmCtrl.");
if (single_value.union_selection != LapdmCtrl::ALT_s) TTCN_error("Accessing non-selected field s in a template of union type @LAPDm_Types.LapdmCtrl.");
return *single_value.field_s;
}

LapdmCtrlU_template& LapdmCtrl_template::u()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != LapdmCtrl::ALT_u) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_u = new LapdmCtrlU_template(ANY_VALUE);
else single_value.field_u = new LapdmCtrlU_template;
single_value.union_selection = LapdmCtrl::ALT_u;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_u;
}

const LapdmCtrlU_template& LapdmCtrl_template::u() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field u in a non-specific template of union type @LAPDm_Types.LapdmCtrl.");
if (single_value.union_selection != LapdmCtrl::ALT_u) TTCN_error("Accessing non-selected field u in a template of union type @LAPDm_Types.LapdmCtrl.");
return *single_value.field_u;
}

LapdmCtrlI_template& LapdmCtrl_template::i()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != LapdmCtrl::ALT_i) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_i = new LapdmCtrlI_template(ANY_VALUE);
else single_value.field_i = new LapdmCtrlI_template;
single_value.union_selection = LapdmCtrl::ALT_i;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_i;
}

const LapdmCtrlI_template& LapdmCtrl_template::i() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field i in a non-specific template of union type @LAPDm_Types.LapdmCtrl.");
if (single_value.union_selection != LapdmCtrl::ALT_i) TTCN_error("Accessing non-selected field i in a template of union type @LAPDm_Types.LapdmCtrl.");
return *single_value.field_i;
}

INTEGER_template& LapdmCtrl_template::other()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != LapdmCtrl::ALT_other) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_other = new INTEGER_template(ANY_VALUE);
else single_value.field_other = new INTEGER_template;
single_value.union_selection = LapdmCtrl::ALT_other;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_other;
}

const INTEGER_template& LapdmCtrl_template::other() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field other in a non-specific template of union type @LAPDm_Types.LapdmCtrl.");
if (single_value.union_selection != LapdmCtrl::ALT_other) TTCN_error("Accessing non-selected field other in a template of union type @LAPDm_Types.LapdmCtrl.");
return *single_value.field_other;
}

boolean LapdmCtrl_template::ischosen(LapdmCtrl::union_selection_type checked_selection) const
{
if (checked_selection == LapdmCtrl::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @LAPDm_Types.LapdmCtrl.");
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.union_selection == LapdmCtrl::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @LAPDm_Types.LapdmCtrl.");
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 @LAPDm_Types.LapdmCtrl 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 LapdmCtrl_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case LapdmCtrl::ALT_s:
TTCN_Logger::log_event_str("{ s := ");
single_value.field_s->log();
TTCN_Logger::log_event_str(" }");
break;
case LapdmCtrl::ALT_u:
TTCN_Logger::log_event_str("{ u := ");
single_value.field_u->log();
TTCN_Logger::log_event_str(" }");
break;
case LapdmCtrl::ALT_i:
TTCN_Logger::log_event_str("{ i := ");
single_value.field_i->log();
TTCN_Logger::log_event_str(" }");
break;
case LapdmCtrl::ALT_other:
TTCN_Logger::log_event_str("{ other := ");
single_value.field_other->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 LapdmCtrl_template::log_match(const LapdmCtrl& 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 LapdmCtrl::ALT_s:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".s");
single_value.field_s->log_match(match_value.s(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ s := ");
single_value.field_s->log_match(match_value.s(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case LapdmCtrl::ALT_u:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".u");
single_value.field_u->log_match(match_value.u(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ u := ");
single_value.field_u->log_match(match_value.u(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case LapdmCtrl::ALT_i:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".i");
single_value.field_i->log_match(match_value.i(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ i := ");
single_value.field_i->log_match(match_value.i(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case LapdmCtrl::ALT_other:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".other");
single_value.field_other->log_match(match_value.other(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ other := ");
single_value.field_other->log_match(match_value.other(), 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 LapdmCtrl_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
switch (single_value.union_selection) {
case LapdmCtrl::ALT_s:
single_value.field_s->set_implicit_omit(); break;
case LapdmCtrl::ALT_u:
single_value.field_u->set_implicit_omit(); break;
case LapdmCtrl::ALT_i:
single_value.field_i->set_implicit_omit(); break;
case LapdmCtrl::ALT_other:
single_value.field_other->set_implicit_omit(); break;
default: break;
}
}

void LapdmCtrl_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 LapdmCtrl::ALT_s:
single_value.field_s->encode_text(text_buf);
break;
case LapdmCtrl::ALT_u:
single_value.field_u->encode_text(text_buf);
break;
case LapdmCtrl::ALT_i:
single_value.field_i->encode_text(text_buf);
break;
case LapdmCtrl::ALT_other:
single_value.field_other->encode_text(text_buf);
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @LAPDm_Types.LapdmCtrl.");
}
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 @LAPDm_Types.LapdmCtrl.");
}
}

void LapdmCtrl_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
{
single_value.union_selection = LapdmCtrl::UNBOUND_VALUE;
LapdmCtrl::union_selection_type new_selection = (LapdmCtrl::union_selection_type)text_buf.pull_int().get_val();
switch (new_selection) {
case LapdmCtrl::ALT_s:
single_value.field_s = new LapdmCtrlS_template;
single_value.field_s->decode_text(text_buf);
break;
case LapdmCtrl::ALT_u:
single_value.field_u = new LapdmCtrlU_template;
single_value.field_u->decode_text(text_buf);
break;
case LapdmCtrl::ALT_i:
single_value.field_i = new LapdmCtrlI_template;
single_value.field_i->decode_text(text_buf);
break;
case LapdmCtrl::ALT_other:
single_value.field_other = new INTEGER_template;
single_value.field_other->decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @LAPDm_Types.LapdmCtrl.");
}
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 LapdmCtrl_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 @LAPDm_Types.LapdmCtrl.");
}
}

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

boolean LapdmCtrl_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 LapdmCtrl_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 `@LAPDm_Types.LapdmCtrl'");
    }
    if (strcmp("s", param_field) == 0) {
      s().set_param(param);
      return;
    } else if (strcmp("u", param_field) == 0) {
      u().set_param(param);
      return;
    } else if (strcmp("i", param_field) == 0) {
      i().set_param(param);
      return;
    } else if (strcmp("other", param_field) == 0) {
      other().set_param(param);
      return;
    } else param.error("Field `%s' not found in union template type `@LAPDm_Types.LapdmCtrl'", 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: {
    LapdmCtrl_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", "@LAPDm_Types.LapdmCtrl");
    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, "s")) {
      s().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "u")) {
      u().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "i")) {
      i().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "other")) {
      other().set_param(*mp_last);
      break;
    }
    mp_last->error("Field %s does not exist in type @LAPDm_Types.LapdmCtrl.", last_name);
  } break;
  case Module_Param::MP_Implication_Template: {
    LapdmCtrl_template* precondition = new LapdmCtrl_template;
    precondition->set_param(*m_p->get_elem(0));
    LapdmCtrl_template* implied_template = new LapdmCtrl_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = LapdmCtrl_template(precondition, implied_template);
  } break;
  default:
    param.type_error("union template", "@LAPDm_Types.LapdmCtrl");
  }
  is_ifpresent = param.get_ifpresent();
}

void LapdmCtrl_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 LapdmCtrl::ALT_s:
single_value.field_s->check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmCtrl");
return;
case LapdmCtrl::ALT_u:
single_value.field_u->check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmCtrl");
return;
case LapdmCtrl::ALT_i:
single_value.field_i->check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmCtrl");
return;
case LapdmCtrl::ALT_other:
single_value.field_other->check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmCtrl");
return;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @LAPDm_Types.LapdmCtrl.");
}
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 : "@LAPDm_Types.LapdmCtrl");
}

LapdmFrameAB::LapdmFrameAB()
{
}

LapdmFrameAB::LapdmFrameAB(const LapdmAddressField& par_addr,
    const LapdmCtrl& par_ctrl,
    const INTEGER& par_len,
    const BOOLEAN& par_m,
    const INTEGER& par_el,
    const OCTETSTRING& par_payload,
    const OCTETSTRING& par_padding)
  :   field_addr(par_addr),
  field_ctrl(par_ctrl),
  field_len(par_len),
  field_m(par_m),
  field_el(par_el),
  field_payload(par_payload),
  field_padding(par_padding)
{
}

LapdmFrameAB::LapdmFrameAB(const LapdmFrameAB& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LAPDm_Types.LapdmFrameAB.");
if (other_value.addr().is_bound()) field_addr = other_value.addr();
else field_addr.clean_up();
if (other_value.ctrl().is_bound()) field_ctrl = other_value.ctrl();
else field_ctrl.clean_up();
if (other_value.len().is_bound()) field_len = other_value.len();
else field_len.clean_up();
if (other_value.m().is_bound()) field_m = other_value.m();
else field_m.clean_up();
if (other_value.el().is_bound()) field_el = other_value.el();
else field_el.clean_up();
if (other_value.payload().is_bound()) field_payload = other_value.payload();
else field_payload.clean_up();
if (other_value.padding().is_bound()) field_padding = other_value.padding();
else field_padding.clean_up();
}

void LapdmFrameAB::clean_up()
{
field_addr.clean_up();
field_ctrl.clean_up();
field_len.clean_up();
field_m.clean_up();
field_el.clean_up();
field_payload.clean_up();
field_padding.clean_up();
}

const TTCN_Typedescriptor_t* LapdmFrameAB::get_descriptor() const { return &LapdmFrameAB_descr_; }
LapdmFrameAB& LapdmFrameAB::operator=(const LapdmFrameAB& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LAPDm_Types.LapdmFrameAB.");
  if (other_value.addr().is_bound()) field_addr = other_value.addr();
  else field_addr.clean_up();
  if (other_value.ctrl().is_bound()) field_ctrl = other_value.ctrl();
  else field_ctrl.clean_up();
  if (other_value.len().is_bound()) field_len = other_value.len();
  else field_len.clean_up();
  if (other_value.m().is_bound()) field_m = other_value.m();
  else field_m.clean_up();
  if (other_value.el().is_bound()) field_el = other_value.el();
  else field_el.clean_up();
  if (other_value.payload().is_bound()) field_payload = other_value.payload();
  else field_payload.clean_up();
  if (other_value.padding().is_bound()) field_padding = other_value.padding();
  else field_padding.clean_up();
}
return *this;
}

boolean LapdmFrameAB::operator==(const LapdmFrameAB& other_value) const
{
return field_addr==other_value.field_addr
  && field_ctrl==other_value.field_ctrl
  && field_len==other_value.field_len
  && field_m==other_value.field_m
  && field_el==other_value.field_el
  && field_payload==other_value.field_payload
  && field_padding==other_value.field_padding;
}

boolean LapdmFrameAB::is_bound() const
{
return (field_addr.is_bound())
  || (field_ctrl.is_bound())
  || (field_len.is_bound())
  || (field_m.is_bound())
  || (field_el.is_bound())
  || (field_payload.is_bound())
  || (field_padding.is_bound());
}
boolean LapdmFrameAB::is_value() const
{
return field_addr.is_value()
  && field_ctrl.is_value()
  && field_len.is_value()
  && field_m.is_value()
  && field_el.is_value()
  && field_payload.is_value()
  && field_padding.is_value();
}
void LapdmFrameAB::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ addr := ");
field_addr.log();
TTCN_Logger::log_event_str(", ctrl := ");
field_ctrl.log();
TTCN_Logger::log_event_str(", len := ");
field_len.log();
TTCN_Logger::log_event_str(", m := ");
field_m.log();
TTCN_Logger::log_event_str(", el := ");
field_el.log();
TTCN_Logger::log_event_str(", payload := ");
field_payload.log();
TTCN_Logger::log_event_str(", padding := ");
field_padding.log();
TTCN_Logger::log_event_str(" }");
}

void LapdmFrameAB::set_implicit_omit()
{
if (addr().is_bound()) addr().set_implicit_omit();
if (ctrl().is_bound()) ctrl().set_implicit_omit();
if (len().is_bound()) len().set_implicit_omit();
if (m().is_bound()) m().set_implicit_omit();
if (el().is_bound()) el().set_implicit_omit();
if (payload().is_bound()) payload().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

void LapdmFrameAB::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 (7<param.get_size()) {
      param.error("record value of type @LAPDm_Types.LapdmFrameAB has 7 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) addr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ctrl().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) len().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) m().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) el().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) payload().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) padding().set_param(*param.get_elem(6));
    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(), "addr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          addr().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(), "ctrl")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ctrl().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(), "len")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          len().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(), "m")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          m().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(), "el")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          el().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(), "payload")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          payload().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(), "padding")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          padding().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 @LAPDm_Types.LapdmFrameAB: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LAPDm_Types.LapdmFrameAB");
  }
}

void LapdmFrameAB::encode_text(Text_Buf& text_buf) const
{
field_addr.encode_text(text_buf);
field_ctrl.encode_text(text_buf);
field_len.encode_text(text_buf);
field_m.encode_text(text_buf);
field_el.encode_text(text_buf);
field_payload.encode_text(text_buf);
field_padding.encode_text(text_buf);
}

void LapdmFrameAB::decode_text(Text_Buf& text_buf)
{
field_addr.decode_text(text_buf);
field_ctrl.decode_text(text_buf);
field_len.decode_text(text_buf);
field_m.decode_text(text_buf);
field_el.decode_text(text_buf);
field_payload.decode_text(text_buf);
field_padding.decode_text(text_buf);
}

void LapdmFrameAB::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 LapdmFrameAB::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 LapdmFrameAB::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, LapdmFrameAB_addr_descr_.raw->forceomit);
  decoded_field_length = field_addr.RAW_decode(LapdmFrameAB_addr_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, LapdmFrameAB_ctrl_descr_.raw->forceomit);
  decoded_field_length = field_ctrl.RAW_decode(LapdmFrameAB_ctrl_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, LapdmFrameAB_len_descr_.raw->forceomit);
  decoded_field_length = field_len.RAW_decode(LapdmFrameAB_len_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());
  INTEGER tmp2 = field_len.convert_to_Integer(LapdmFrameAB_len_descr_);
  field_len = tmp2;
  value_of_length_field2 += tmp2.get_long_long_val() * 8;
  RAW_Force_Omit field_3_force_omit(3, force_omit, LapdmFrameAB_m_descr_.raw->forceomit);
  decoded_field_length = field_m.RAW_decode(LapdmFrameAB_m_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, LapdmFrameAB_el_descr_.raw->forceomit);
  decoded_field_length = field_el.RAW_decode(LapdmFrameAB_el_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, LapdmFrameAB_payload_descr_.raw->forceomit);
  decoded_field_length = field_payload.RAW_decode(LapdmFrameAB_payload_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_6_force_omit(6, force_omit, LapdmFrameAB_padding_descr_.raw->forceomit);
  decoded_field_length = field_padding.RAW_decode(LapdmFrameAB_padding_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());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int LapdmFrameAB::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 = 7;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(7);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, LapdmFrameAB_addr_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, LapdmFrameAB_ctrl_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, LapdmFrameAB_len_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, LapdmFrameAB_m_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, LapdmFrameAB_el_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, LapdmFrameAB_payload_descr_.raw);
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, LapdmFrameAB_padding_descr_.raw);
  encoded_length += field_addr.RAW_encode(LapdmFrameAB_addr_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ctrl.RAW_encode(LapdmFrameAB_ctrl_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += 6;
  myleaf.body.node.nodes[2]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->coding_descr = &LapdmFrameAB_len_descr_;
  myleaf.body.node.nodes[2]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->length = 6;
  myleaf.body.node.nodes[2]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[5]->curr_pos.level;
  myleaf.body.node.nodes[2]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[5]->curr_pos.pos;
  encoded_length += field_m.RAW_encode(LapdmFrameAB_m_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_el.RAW_encode(LapdmFrameAB_el_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_payload.RAW_encode(LapdmFrameAB_payload_descr_, *myleaf.body.node.nodes[5]);
  encoded_length += field_padding.RAW_encode(LapdmFrameAB_padding_descr_, *myleaf.body.node.nodes[6]);
  return myleaf.length = encoded_length;
}

struct LapdmFrameAB_template::single_value_struct {
LapdmAddressField_template field_addr;
LapdmCtrl_template field_ctrl;
INTEGER_template field_len;
BOOLEAN_template field_m;
INTEGER_template field_el;
OCTETSTRING_template field_payload;
OCTETSTRING_template field_padding;
};

void LapdmFrameAB_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_addr = ANY_VALUE;
single_value->field_ctrl = ANY_VALUE;
single_value->field_len = ANY_VALUE;
single_value->field_m = ANY_VALUE;
single_value->field_el = ANY_VALUE;
single_value->field_payload = ANY_VALUE;
single_value->field_padding = ANY_VALUE;
}
}
}

void LapdmFrameAB_template::copy_value(const LapdmFrameAB& other_value)
{
single_value = new single_value_struct;
if (other_value.addr().is_bound()) {
  single_value->field_addr = other_value.addr();
} else {
  single_value->field_addr.clean_up();
}
if (other_value.ctrl().is_bound()) {
  single_value->field_ctrl = other_value.ctrl();
} else {
  single_value->field_ctrl.clean_up();
}
if (other_value.len().is_bound()) {
  single_value->field_len = other_value.len();
} else {
  single_value->field_len.clean_up();
}
if (other_value.m().is_bound()) {
  single_value->field_m = other_value.m();
} else {
  single_value->field_m.clean_up();
}
if (other_value.el().is_bound()) {
  single_value->field_el = other_value.el();
} else {
  single_value->field_el.clean_up();
}
if (other_value.payload().is_bound()) {
  single_value->field_payload = other_value.payload();
} else {
  single_value->field_payload.clean_up();
}
if (other_value.padding().is_bound()) {
  single_value->field_padding = other_value.padding();
} else {
  single_value->field_padding.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void LapdmFrameAB_template::copy_template(const LapdmFrameAB_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.addr().get_selection()) {
single_value->field_addr = other_value.addr();
} else {
single_value->field_addr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ctrl().get_selection()) {
single_value->field_ctrl = other_value.ctrl();
} else {
single_value->field_ctrl.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.len().get_selection()) {
single_value->field_len = other_value.len();
} else {
single_value->field_len.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.m().get_selection()) {
single_value->field_m = other_value.m();
} else {
single_value->field_m.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.el().get_selection()) {
single_value->field_el = other_value.el();
} else {
single_value->field_el.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.payload().get_selection()) {
single_value->field_payload = other_value.payload();
} else {
single_value->field_payload.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.padding().get_selection()) {
single_value->field_padding = other_value.padding();
} else {
single_value->field_padding.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 LapdmFrameAB_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 LapdmFrameAB_template(*other_value.implication_.precondition);
implication_.implied_template = new LapdmFrameAB_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 @LAPDm_Types.LapdmFrameAB.");
break;
}
set_selection(other_value);
}

LapdmFrameAB_template::LapdmFrameAB_template()
{
}

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

LapdmFrameAB_template::LapdmFrameAB_template(const LapdmFrameAB& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

LapdmFrameAB_template& LapdmFrameAB_template::operator=(const OPTIONAL<LapdmFrameAB>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const LapdmFrameAB&)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 @LAPDm_Types.LapdmFrameAB.");
}
return *this;
}

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

boolean LapdmFrameAB_template::match(const LapdmFrameAB& 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.addr().is_bound()) return FALSE;
if(!single_value->field_addr.match(other_value.addr(), legacy))return FALSE;
if(!other_value.ctrl().is_bound()) return FALSE;
if(!single_value->field_ctrl.match(other_value.ctrl(), legacy))return FALSE;
if(!other_value.len().is_bound()) return FALSE;
if(!single_value->field_len.match(other_value.len(), legacy))return FALSE;
if(!other_value.m().is_bound()) return FALSE;
if(!single_value->field_m.match(other_value.m(), legacy))return FALSE;
if(!other_value.el().is_bound()) return FALSE;
if(!single_value->field_el.match(other_value.el(), legacy))return FALSE;
if(!other_value.payload().is_bound()) return FALSE;
if(!single_value->field_payload.match(other_value.payload(), legacy))return FALSE;
if(!other_value.padding().is_bound()) return FALSE;
if(!single_value->field_padding.match(other_value.padding(), 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 @LAPDm_Types.LapdmFrameAB.");
}
return FALSE;
}

boolean LapdmFrameAB_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_addr.is_bound()
 || single_value->field_ctrl.is_bound()
 || single_value->field_len.is_bound()
 || single_value->field_m.is_bound()
 || single_value->field_el.is_bound()
 || single_value->field_payload.is_bound()
 || single_value->field_padding.is_bound();
}

boolean LapdmFrameAB_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_addr.is_value()
 && single_value->field_ctrl.is_value()
 && single_value->field_len.is_value()
 && single_value->field_m.is_value()
 && single_value->field_el.is_value()
 && single_value->field_payload.is_value()
 && single_value->field_padding.is_value();
}

void LapdmFrameAB_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;
}

LapdmFrameAB LapdmFrameAB_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 @LAPDm_Types.LapdmFrameAB.");
LapdmFrameAB ret_val;
if (single_value->field_addr.is_bound()) {
ret_val.addr() = single_value->field_addr.valueof();
}
if (single_value->field_ctrl.is_bound()) {
ret_val.ctrl() = single_value->field_ctrl.valueof();
}
if (single_value->field_len.is_bound()) {
ret_val.len() = single_value->field_len.valueof();
}
if (single_value->field_m.is_bound()) {
ret_val.m() = single_value->field_m.valueof();
}
if (single_value->field_el.is_bound()) {
ret_val.el() = single_value->field_el.valueof();
}
if (single_value->field_payload.is_bound()) {
ret_val.payload() = single_value->field_payload.valueof();
}
if (single_value->field_padding.is_bound()) {
ret_val.padding() = single_value->field_padding.valueof();
}
return ret_val;
}

void LapdmFrameAB_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 @LAPDm_Types.LapdmFrameAB.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new LapdmFrameAB_template[list_length];
}

LapdmFrameAB_template& LapdmFrameAB_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 @LAPDm_Types.LapdmFrameAB.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LAPDm_Types.LapdmFrameAB.");
return value_list.list_value[list_index];
}

LapdmAddressField_template& LapdmFrameAB_template::addr()
{
set_specific();
return single_value->field_addr;
}

const LapdmAddressField_template& LapdmFrameAB_template::addr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field addr of a non-specific template of type @LAPDm_Types.LapdmFrameAB.");
return single_value->field_addr;
}

LapdmCtrl_template& LapdmFrameAB_template::ctrl()
{
set_specific();
return single_value->field_ctrl;
}

const LapdmCtrl_template& LapdmFrameAB_template::ctrl() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ctrl of a non-specific template of type @LAPDm_Types.LapdmFrameAB.");
return single_value->field_ctrl;
}

INTEGER_template& LapdmFrameAB_template::len()
{
set_specific();
return single_value->field_len;
}

const INTEGER_template& LapdmFrameAB_template::len() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field len of a non-specific template of type @LAPDm_Types.LapdmFrameAB.");
return single_value->field_len;
}

BOOLEAN_template& LapdmFrameAB_template::m()
{
set_specific();
return single_value->field_m;
}

const BOOLEAN_template& LapdmFrameAB_template::m() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field m of a non-specific template of type @LAPDm_Types.LapdmFrameAB.");
return single_value->field_m;
}

INTEGER_template& LapdmFrameAB_template::el()
{
set_specific();
return single_value->field_el;
}

const INTEGER_template& LapdmFrameAB_template::el() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field el of a non-specific template of type @LAPDm_Types.LapdmFrameAB.");
return single_value->field_el;
}

OCTETSTRING_template& LapdmFrameAB_template::payload()
{
set_specific();
return single_value->field_payload;
}

const OCTETSTRING_template& LapdmFrameAB_template::payload() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field payload of a non-specific template of type @LAPDm_Types.LapdmFrameAB.");
return single_value->field_payload;
}

OCTETSTRING_template& LapdmFrameAB_template::padding()
{
set_specific();
return single_value->field_padding;
}

const OCTETSTRING_template& LapdmFrameAB_template::padding() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field padding of a non-specific template of type @LAPDm_Types.LapdmFrameAB.");
return single_value->field_padding;
}

int LapdmFrameAB_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameAB which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 7;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameAB 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 @LAPDm_Types.LapdmFrameAB containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameAB containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameAB containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameAB containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameAB containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameAB containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameAB containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LAPDm_Types.LapdmFrameAB.");
  }
  return 0;
}

void LapdmFrameAB_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ addr := ");
single_value->field_addr.log();
TTCN_Logger::log_event_str(", ctrl := ");
single_value->field_ctrl.log();
TTCN_Logger::log_event_str(", len := ");
single_value->field_len.log();
TTCN_Logger::log_event_str(", m := ");
single_value->field_m.log();
TTCN_Logger::log_event_str(", el := ");
single_value->field_el.log();
TTCN_Logger::log_event_str(", payload := ");
single_value->field_payload.log();
TTCN_Logger::log_event_str(", padding := ");
single_value->field_padding.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 LapdmFrameAB_template::log_match(const LapdmFrameAB& 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_addr.match(match_value.addr(), legacy)){
TTCN_Logger::log_logmatch_info(".addr");
single_value->field_addr.log_match(match_value.addr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ctrl.match(match_value.ctrl(), legacy)){
TTCN_Logger::log_logmatch_info(".ctrl");
single_value->field_ctrl.log_match(match_value.ctrl(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_len.match(match_value.len(), legacy)){
TTCN_Logger::log_logmatch_info(".len");
single_value->field_len.log_match(match_value.len(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_m.match(match_value.m(), legacy)){
TTCN_Logger::log_logmatch_info(".m");
single_value->field_m.log_match(match_value.m(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_el.match(match_value.el(), legacy)){
TTCN_Logger::log_logmatch_info(".el");
single_value->field_el.log_match(match_value.el(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_payload.match(match_value.payload(), legacy)){
TTCN_Logger::log_logmatch_info(".payload");
single_value->field_payload.log_match(match_value.payload(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_padding.match(match_value.padding(), legacy)){
TTCN_Logger::log_logmatch_info(".padding");
single_value->field_padding.log_match(match_value.padding(), 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("{ addr := ");
single_value->field_addr.log_match(match_value.addr(), legacy);
TTCN_Logger::log_event_str(", ctrl := ");
single_value->field_ctrl.log_match(match_value.ctrl(), legacy);
TTCN_Logger::log_event_str(", len := ");
single_value->field_len.log_match(match_value.len(), legacy);
TTCN_Logger::log_event_str(", m := ");
single_value->field_m.log_match(match_value.m(), legacy);
TTCN_Logger::log_event_str(", el := ");
single_value->field_el.log_match(match_value.el(), legacy);
TTCN_Logger::log_event_str(", payload := ");
single_value->field_payload.log_match(match_value.payload(), legacy);
TTCN_Logger::log_event_str(", padding := ");
single_value->field_padding.log_match(match_value.padding(), 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 LapdmFrameAB_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (addr().is_bound()) addr().set_implicit_omit();
if (ctrl().is_bound()) ctrl().set_implicit_omit();
if (len().is_bound()) len().set_implicit_omit();
if (m().is_bound()) m().set_implicit_omit();
if (el().is_bound()) el().set_implicit_omit();
if (payload().is_bound()) payload().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

void LapdmFrameAB_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_addr.encode_text(text_buf);
single_value->field_ctrl.encode_text(text_buf);
single_value->field_len.encode_text(text_buf);
single_value->field_m.encode_text(text_buf);
single_value->field_el.encode_text(text_buf);
single_value->field_payload.encode_text(text_buf);
single_value->field_padding.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 @LAPDm_Types.LapdmFrameAB.");
}
}

void LapdmFrameAB_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_addr.decode_text(text_buf);
single_value->field_ctrl.decode_text(text_buf);
single_value->field_len.decode_text(text_buf);
single_value->field_m.decode_text(text_buf);
single_value->field_el.decode_text(text_buf);
single_value->field_payload.decode_text(text_buf);
single_value->field_padding.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 LapdmFrameAB_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 @LAPDm_Types.LapdmFrameAB.");
}
}

void LapdmFrameAB_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: {
    LapdmFrameAB_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 (7<param.get_size()) {
      param.error("record template of type @LAPDm_Types.LapdmFrameAB has 7 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) addr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ctrl().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) len().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) m().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) el().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) payload().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) padding().set_param(*param.get_elem(6));
    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(), "addr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          addr().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(), "ctrl")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ctrl().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(), "len")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          len().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(), "m")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          m().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(), "el")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          el().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(), "payload")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          payload().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(), "padding")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          padding().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 @LAPDm_Types.LapdmFrameAB: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    LapdmFrameAB_template* precondition = new LapdmFrameAB_template;
    precondition->set_param(*param.get_elem(0));
    LapdmFrameAB_template* implied_template = new LapdmFrameAB_template;
    implied_template->set_param(*param.get_elem(1));
    *this = LapdmFrameAB_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LAPDm_Types.LapdmFrameAB");
  }
  is_ifpresent = param.get_ifpresent();
}

void LapdmFrameAB_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_addr.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmFrameAB");
single_value->field_ctrl.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmFrameAB");
single_value->field_len.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmFrameAB");
single_value->field_m.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmFrameAB");
single_value->field_el.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmFrameAB");
single_value->field_payload.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmFrameAB");
single_value->field_padding.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmFrameAB");
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 : "@LAPDm_Types.LapdmFrameAB");
}

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

boolean LapdmFrameAB_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;
}

LapdmFrameB4::LapdmFrameB4()
{
}

LapdmFrameB4::LapdmFrameB4(const LapdmAddressField& par_addr,
    const LapdmCtrl& par_ctrl,
    const OCTETSTRING& par_payload)
  :   field_addr(par_addr),
  field_ctrl(par_ctrl),
  field_payload(par_payload)
{
}

LapdmFrameB4::LapdmFrameB4(const LapdmFrameB4& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LAPDm_Types.LapdmFrameB4.");
if (other_value.addr().is_bound()) field_addr = other_value.addr();
else field_addr.clean_up();
if (other_value.ctrl().is_bound()) field_ctrl = other_value.ctrl();
else field_ctrl.clean_up();
if (other_value.payload().is_bound()) field_payload = other_value.payload();
else field_payload.clean_up();
}

void LapdmFrameB4::clean_up()
{
field_addr.clean_up();
field_ctrl.clean_up();
field_payload.clean_up();
}

const TTCN_Typedescriptor_t* LapdmFrameB4::get_descriptor() const { return &LapdmFrameB4_descr_; }
LapdmFrameB4& LapdmFrameB4::operator=(const LapdmFrameB4& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LAPDm_Types.LapdmFrameB4.");
  if (other_value.addr().is_bound()) field_addr = other_value.addr();
  else field_addr.clean_up();
  if (other_value.ctrl().is_bound()) field_ctrl = other_value.ctrl();
  else field_ctrl.clean_up();
  if (other_value.payload().is_bound()) field_payload = other_value.payload();
  else field_payload.clean_up();
}
return *this;
}

boolean LapdmFrameB4::operator==(const LapdmFrameB4& other_value) const
{
return field_addr==other_value.field_addr
  && field_ctrl==other_value.field_ctrl
  && field_payload==other_value.field_payload;
}

boolean LapdmFrameB4::is_bound() const
{
return (field_addr.is_bound())
  || (field_ctrl.is_bound())
  || (field_payload.is_bound());
}
boolean LapdmFrameB4::is_value() const
{
return field_addr.is_value()
  && field_ctrl.is_value()
  && field_payload.is_value();
}
void LapdmFrameB4::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ addr := ");
field_addr.log();
TTCN_Logger::log_event_str(", ctrl := ");
field_ctrl.log();
TTCN_Logger::log_event_str(", payload := ");
field_payload.log();
TTCN_Logger::log_event_str(" }");
}

void LapdmFrameB4::set_implicit_omit()
{
if (addr().is_bound()) addr().set_implicit_omit();
if (ctrl().is_bound()) ctrl().set_implicit_omit();
if (payload().is_bound()) payload().set_implicit_omit();
}

void LapdmFrameB4::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 @LAPDm_Types.LapdmFrameB4 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) addr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ctrl().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) payload().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(), "addr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          addr().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(), "ctrl")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ctrl().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(), "payload")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          payload().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 @LAPDm_Types.LapdmFrameB4: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LAPDm_Types.LapdmFrameB4");
  }
}

void LapdmFrameB4::encode_text(Text_Buf& text_buf) const
{
field_addr.encode_text(text_buf);
field_ctrl.encode_text(text_buf);
field_payload.encode_text(text_buf);
}

void LapdmFrameB4::decode_text(Text_Buf& text_buf)
{
field_addr.decode_text(text_buf);
field_ctrl.decode_text(text_buf);
field_payload.decode_text(text_buf);
}

void LapdmFrameB4::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 LapdmFrameB4::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 LapdmFrameB4::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, LapdmAddressField_descr_.raw->forceomit);
  decoded_field_length = field_addr.RAW_decode(LapdmAddressField_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, LapdmCtrl_descr_.raw->forceomit);
  decoded_field_length = field_ctrl.RAW_decode(LapdmCtrl_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_payload.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());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int LapdmFrameB4::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, LapdmAddressField_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, LapdmCtrl_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, OCTETSTRING_descr_.raw);
  encoded_length += field_addr.RAW_encode(LapdmAddressField_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ctrl.RAW_encode(LapdmCtrl_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_payload.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct LapdmFrameB4_template::single_value_struct {
LapdmAddressField_template field_addr;
LapdmCtrl_template field_ctrl;
OCTETSTRING_template field_payload;
};

void LapdmFrameB4_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_addr = ANY_VALUE;
single_value->field_ctrl = ANY_VALUE;
single_value->field_payload = ANY_VALUE;
}
}
}

void LapdmFrameB4_template::copy_value(const LapdmFrameB4& other_value)
{
single_value = new single_value_struct;
if (other_value.addr().is_bound()) {
  single_value->field_addr = other_value.addr();
} else {
  single_value->field_addr.clean_up();
}
if (other_value.ctrl().is_bound()) {
  single_value->field_ctrl = other_value.ctrl();
} else {
  single_value->field_ctrl.clean_up();
}
if (other_value.payload().is_bound()) {
  single_value->field_payload = other_value.payload();
} else {
  single_value->field_payload.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void LapdmFrameB4_template::copy_template(const LapdmFrameB4_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.addr().get_selection()) {
single_value->field_addr = other_value.addr();
} else {
single_value->field_addr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ctrl().get_selection()) {
single_value->field_ctrl = other_value.ctrl();
} else {
single_value->field_ctrl.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.payload().get_selection()) {
single_value->field_payload = other_value.payload();
} else {
single_value->field_payload.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 LapdmFrameB4_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 LapdmFrameB4_template(*other_value.implication_.precondition);
implication_.implied_template = new LapdmFrameB4_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 @LAPDm_Types.LapdmFrameB4.");
break;
}
set_selection(other_value);
}

LapdmFrameB4_template::LapdmFrameB4_template()
{
}

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

LapdmFrameB4_template::LapdmFrameB4_template(const LapdmFrameB4& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

LapdmFrameB4_template& LapdmFrameB4_template::operator=(const OPTIONAL<LapdmFrameB4>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const LapdmFrameB4&)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 @LAPDm_Types.LapdmFrameB4.");
}
return *this;
}

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

boolean LapdmFrameB4_template::match(const LapdmFrameB4& 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.addr().is_bound()) return FALSE;
if(!single_value->field_addr.match(other_value.addr(), legacy))return FALSE;
if(!other_value.ctrl().is_bound()) return FALSE;
if(!single_value->field_ctrl.match(other_value.ctrl(), legacy))return FALSE;
if(!other_value.payload().is_bound()) return FALSE;
if(!single_value->field_payload.match(other_value.payload(), 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 @LAPDm_Types.LapdmFrameB4.");
}
return FALSE;
}

boolean LapdmFrameB4_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_addr.is_bound()
 || single_value->field_ctrl.is_bound()
 || single_value->field_payload.is_bound();
}

boolean LapdmFrameB4_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_addr.is_value()
 && single_value->field_ctrl.is_value()
 && single_value->field_payload.is_value();
}

void LapdmFrameB4_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;
}

LapdmFrameB4 LapdmFrameB4_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 @LAPDm_Types.LapdmFrameB4.");
LapdmFrameB4 ret_val;
if (single_value->field_addr.is_bound()) {
ret_val.addr() = single_value->field_addr.valueof();
}
if (single_value->field_ctrl.is_bound()) {
ret_val.ctrl() = single_value->field_ctrl.valueof();
}
if (single_value->field_payload.is_bound()) {
ret_val.payload() = single_value->field_payload.valueof();
}
return ret_val;
}

void LapdmFrameB4_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 @LAPDm_Types.LapdmFrameB4.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new LapdmFrameB4_template[list_length];
}

LapdmFrameB4_template& LapdmFrameB4_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 @LAPDm_Types.LapdmFrameB4.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LAPDm_Types.LapdmFrameB4.");
return value_list.list_value[list_index];
}

LapdmAddressField_template& LapdmFrameB4_template::addr()
{
set_specific();
return single_value->field_addr;
}

const LapdmAddressField_template& LapdmFrameB4_template::addr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field addr of a non-specific template of type @LAPDm_Types.LapdmFrameB4.");
return single_value->field_addr;
}

LapdmCtrl_template& LapdmFrameB4_template::ctrl()
{
set_specific();
return single_value->field_ctrl;
}

const LapdmCtrl_template& LapdmFrameB4_template::ctrl() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ctrl of a non-specific template of type @LAPDm_Types.LapdmFrameB4.");
return single_value->field_ctrl;
}

OCTETSTRING_template& LapdmFrameB4_template::payload()
{
set_specific();
return single_value->field_payload;
}

const OCTETSTRING_template& LapdmFrameB4_template::payload() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field payload of a non-specific template of type @LAPDm_Types.LapdmFrameB4.");
return single_value->field_payload;
}

int LapdmFrameB4_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameB4 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 @LAPDm_Types.LapdmFrameB4 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 @LAPDm_Types.LapdmFrameB4 containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameB4 containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameB4 containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameB4 containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameB4 containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameB4 containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameB4 containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LAPDm_Types.LapdmFrameB4.");
  }
  return 0;
}

void LapdmFrameB4_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ addr := ");
single_value->field_addr.log();
TTCN_Logger::log_event_str(", ctrl := ");
single_value->field_ctrl.log();
TTCN_Logger::log_event_str(", payload := ");
single_value->field_payload.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 LapdmFrameB4_template::log_match(const LapdmFrameB4& 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_addr.match(match_value.addr(), legacy)){
TTCN_Logger::log_logmatch_info(".addr");
single_value->field_addr.log_match(match_value.addr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ctrl.match(match_value.ctrl(), legacy)){
TTCN_Logger::log_logmatch_info(".ctrl");
single_value->field_ctrl.log_match(match_value.ctrl(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_payload.match(match_value.payload(), legacy)){
TTCN_Logger::log_logmatch_info(".payload");
single_value->field_payload.log_match(match_value.payload(), 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("{ addr := ");
single_value->field_addr.log_match(match_value.addr(), legacy);
TTCN_Logger::log_event_str(", ctrl := ");
single_value->field_ctrl.log_match(match_value.ctrl(), legacy);
TTCN_Logger::log_event_str(", payload := ");
single_value->field_payload.log_match(match_value.payload(), 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 LapdmFrameB4_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (addr().is_bound()) addr().set_implicit_omit();
if (ctrl().is_bound()) ctrl().set_implicit_omit();
if (payload().is_bound()) payload().set_implicit_omit();
}

void LapdmFrameB4_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_addr.encode_text(text_buf);
single_value->field_ctrl.encode_text(text_buf);
single_value->field_payload.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 @LAPDm_Types.LapdmFrameB4.");
}
}

void LapdmFrameB4_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_addr.decode_text(text_buf);
single_value->field_ctrl.decode_text(text_buf);
single_value->field_payload.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 LapdmFrameB4_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 @LAPDm_Types.LapdmFrameB4.");
}
}

void LapdmFrameB4_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: {
    LapdmFrameB4_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 @LAPDm_Types.LapdmFrameB4 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) addr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ctrl().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) payload().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(), "addr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          addr().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(), "ctrl")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ctrl().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(), "payload")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          payload().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 @LAPDm_Types.LapdmFrameB4: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    LapdmFrameB4_template* precondition = new LapdmFrameB4_template;
    precondition->set_param(*param.get_elem(0));
    LapdmFrameB4_template* implied_template = new LapdmFrameB4_template;
    implied_template->set_param(*param.get_elem(1));
    *this = LapdmFrameB4_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LAPDm_Types.LapdmFrameB4");
  }
  is_ifpresent = param.get_ifpresent();
}

void LapdmFrameB4_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_addr.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmFrameB4");
single_value->field_ctrl.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmFrameB4");
single_value->field_payload.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmFrameB4");
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 : "@LAPDm_Types.LapdmFrameB4");
}

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

boolean LapdmFrameB4_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;
}

LapdmFrameBbis::LapdmFrameBbis()
{
}

LapdmFrameBbis::LapdmFrameBbis(const OCTETSTRING& par_payload)
  :   field_payload(par_payload)
{
}

LapdmFrameBbis::LapdmFrameBbis(const LapdmFrameBbis& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LAPDm_Types.LapdmFrameBbis.");
if (other_value.payload().is_bound()) field_payload = other_value.payload();
else field_payload.clean_up();
}

void LapdmFrameBbis::clean_up()
{
field_payload.clean_up();
}

const TTCN_Typedescriptor_t* LapdmFrameBbis::get_descriptor() const { return &LapdmFrameBbis_descr_; }
LapdmFrameBbis& LapdmFrameBbis::operator=(const LapdmFrameBbis& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LAPDm_Types.LapdmFrameBbis.");
  if (other_value.payload().is_bound()) field_payload = other_value.payload();
  else field_payload.clean_up();
}
return *this;
}

boolean LapdmFrameBbis::operator==(const LapdmFrameBbis& other_value) const
{
return field_payload==other_value.field_payload;
}

boolean LapdmFrameBbis::is_bound() const
{
return (field_payload.is_bound());
}
boolean LapdmFrameBbis::is_value() const
{
return field_payload.is_value();
}
void LapdmFrameBbis::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ payload := ");
field_payload.log();
TTCN_Logger::log_event_str(" }");
}

void LapdmFrameBbis::set_implicit_omit()
{
if (payload().is_bound()) payload().set_implicit_omit();
}

void LapdmFrameBbis::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 (1<param.get_size()) {
      param.error("record value of type @LAPDm_Types.LapdmFrameBbis has 1 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) payload().set_param(*param.get_elem(0));
    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(), "payload")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          payload().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 @LAPDm_Types.LapdmFrameBbis: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LAPDm_Types.LapdmFrameBbis");
  }
}

void LapdmFrameBbis::encode_text(Text_Buf& text_buf) const
{
field_payload.encode_text(text_buf);
}

void LapdmFrameBbis::decode_text(Text_Buf& text_buf)
{
field_payload.decode_text(text_buf);
}

void LapdmFrameBbis::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 LapdmFrameBbis::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 LapdmFrameBbis::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, OCTETSTRING_descr_.raw->forceomit);
  decoded_field_length = field_payload.RAW_decode(OCTETSTRING_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());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int LapdmFrameBbis::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 = 1;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(1);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, OCTETSTRING_descr_.raw);
  encoded_length += field_payload.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[0]);
  return myleaf.length = encoded_length;
}

struct LapdmFrameBbis_template::single_value_struct {
OCTETSTRING_template field_payload;
};

void LapdmFrameBbis_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_payload = ANY_VALUE;
}
}
}

void LapdmFrameBbis_template::copy_value(const LapdmFrameBbis& other_value)
{
single_value = new single_value_struct;
if (other_value.payload().is_bound()) {
  single_value->field_payload = other_value.payload();
} else {
  single_value->field_payload.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void LapdmFrameBbis_template::copy_template(const LapdmFrameBbis_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.payload().get_selection()) {
single_value->field_payload = other_value.payload();
} else {
single_value->field_payload.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 LapdmFrameBbis_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 LapdmFrameBbis_template(*other_value.implication_.precondition);
implication_.implied_template = new LapdmFrameBbis_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 @LAPDm_Types.LapdmFrameBbis.");
break;
}
set_selection(other_value);
}

LapdmFrameBbis_template::LapdmFrameBbis_template()
{
}

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

LapdmFrameBbis_template::LapdmFrameBbis_template(const LapdmFrameBbis& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

LapdmFrameBbis_template& LapdmFrameBbis_template::operator=(const OPTIONAL<LapdmFrameBbis>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const LapdmFrameBbis&)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 @LAPDm_Types.LapdmFrameBbis.");
}
return *this;
}

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

boolean LapdmFrameBbis_template::match(const LapdmFrameBbis& 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.payload().is_bound()) return FALSE;
if(!single_value->field_payload.match(other_value.payload(), 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 @LAPDm_Types.LapdmFrameBbis.");
}
return FALSE;
}

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

boolean LapdmFrameBbis_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_payload.is_value();
}

void LapdmFrameBbis_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;
}

LapdmFrameBbis LapdmFrameBbis_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 @LAPDm_Types.LapdmFrameBbis.");
LapdmFrameBbis ret_val;
if (single_value->field_payload.is_bound()) {
ret_val.payload() = single_value->field_payload.valueof();
}
return ret_val;
}

void LapdmFrameBbis_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 @LAPDm_Types.LapdmFrameBbis.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new LapdmFrameBbis_template[list_length];
}

LapdmFrameBbis_template& LapdmFrameBbis_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 @LAPDm_Types.LapdmFrameBbis.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LAPDm_Types.LapdmFrameBbis.");
return value_list.list_value[list_index];
}

OCTETSTRING_template& LapdmFrameBbis_template::payload()
{
set_specific();
return single_value->field_payload;
}

const OCTETSTRING_template& LapdmFrameBbis_template::payload() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field payload of a non-specific template of type @LAPDm_Types.LapdmFrameBbis.");
return single_value->field_payload;
}

int LapdmFrameBbis_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameBbis which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 1;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameBbis 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 @LAPDm_Types.LapdmFrameBbis containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameBbis containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameBbis containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameBbis containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameBbis containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameBbis containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameBbis containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LAPDm_Types.LapdmFrameBbis.");
  }
  return 0;
}

void LapdmFrameBbis_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ payload := ");
single_value->field_payload.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 LapdmFrameBbis_template::log_match(const LapdmFrameBbis& 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_payload.match(match_value.payload(), legacy)){
TTCN_Logger::log_logmatch_info(".payload");
single_value->field_payload.log_match(match_value.payload(), 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("{ payload := ");
single_value->field_payload.log_match(match_value.payload(), 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 LapdmFrameBbis_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (payload().is_bound()) payload().set_implicit_omit();
}

void LapdmFrameBbis_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_payload.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 @LAPDm_Types.LapdmFrameBbis.");
}
}

void LapdmFrameBbis_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_payload.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 LapdmFrameBbis_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 @LAPDm_Types.LapdmFrameBbis.");
}
}

void LapdmFrameBbis_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: {
    LapdmFrameBbis_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 (1<param.get_size()) {
      param.error("record template of type @LAPDm_Types.LapdmFrameBbis has 1 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) payload().set_param(*param.get_elem(0));
    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(), "payload")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          payload().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 @LAPDm_Types.LapdmFrameBbis: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    LapdmFrameBbis_template* precondition = new LapdmFrameBbis_template;
    precondition->set_param(*param.get_elem(0));
    LapdmFrameBbis_template* implied_template = new LapdmFrameBbis_template;
    implied_template->set_param(*param.get_elem(1));
    *this = LapdmFrameBbis_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LAPDm_Types.LapdmFrameBbis");
  }
  is_ifpresent = param.get_ifpresent();
}

void LapdmFrameBbis_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_payload.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmFrameBbis");
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 : "@LAPDm_Types.LapdmFrameBbis");
}

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

boolean LapdmFrameBbis_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;
}

LapdmFrameBter::LapdmFrameBter()
{
}

LapdmFrameBter::LapdmFrameBter(const OCTETSTRING& par_payload)
  :   field_payload(par_payload)
{
}

LapdmFrameBter::LapdmFrameBter(const LapdmFrameBter& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @LAPDm_Types.LapdmFrameBter.");
if (other_value.payload().is_bound()) field_payload = other_value.payload();
else field_payload.clean_up();
}

void LapdmFrameBter::clean_up()
{
field_payload.clean_up();
}

const TTCN_Typedescriptor_t* LapdmFrameBter::get_descriptor() const { return &LapdmFrameBter_descr_; }
LapdmFrameBter& LapdmFrameBter::operator=(const LapdmFrameBter& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @LAPDm_Types.LapdmFrameBter.");
  if (other_value.payload().is_bound()) field_payload = other_value.payload();
  else field_payload.clean_up();
}
return *this;
}

boolean LapdmFrameBter::operator==(const LapdmFrameBter& other_value) const
{
return field_payload==other_value.field_payload;
}

boolean LapdmFrameBter::is_bound() const
{
return (field_payload.is_bound());
}
boolean LapdmFrameBter::is_value() const
{
return field_payload.is_value();
}
void LapdmFrameBter::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ payload := ");
field_payload.log();
TTCN_Logger::log_event_str(" }");
}

void LapdmFrameBter::set_implicit_omit()
{
if (payload().is_bound()) payload().set_implicit_omit();
}

void LapdmFrameBter::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 (1<param.get_size()) {
      param.error("record value of type @LAPDm_Types.LapdmFrameBter has 1 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) payload().set_param(*param.get_elem(0));
    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(), "payload")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          payload().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 @LAPDm_Types.LapdmFrameBter: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@LAPDm_Types.LapdmFrameBter");
  }
}

void LapdmFrameBter::encode_text(Text_Buf& text_buf) const
{
field_payload.encode_text(text_buf);
}

void LapdmFrameBter::decode_text(Text_Buf& text_buf)
{
field_payload.decode_text(text_buf);
}

void LapdmFrameBter::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 LapdmFrameBter::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 LapdmFrameBter::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, OCTETSTRING_descr_.raw->forceomit);
  decoded_field_length = field_payload.RAW_decode(OCTETSTRING_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());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int LapdmFrameBter::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 = 1;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(1);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, OCTETSTRING_descr_.raw);
  encoded_length += field_payload.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[0]);
  return myleaf.length = encoded_length;
}

struct LapdmFrameBter_template::single_value_struct {
OCTETSTRING_template field_payload;
};

void LapdmFrameBter_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_payload = ANY_VALUE;
}
}
}

void LapdmFrameBter_template::copy_value(const LapdmFrameBter& other_value)
{
single_value = new single_value_struct;
if (other_value.payload().is_bound()) {
  single_value->field_payload = other_value.payload();
} else {
  single_value->field_payload.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void LapdmFrameBter_template::copy_template(const LapdmFrameBter_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.payload().get_selection()) {
single_value->field_payload = other_value.payload();
} else {
single_value->field_payload.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 LapdmFrameBter_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 LapdmFrameBter_template(*other_value.implication_.precondition);
implication_.implied_template = new LapdmFrameBter_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 @LAPDm_Types.LapdmFrameBter.");
break;
}
set_selection(other_value);
}

LapdmFrameBter_template::LapdmFrameBter_template()
{
}

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

LapdmFrameBter_template::LapdmFrameBter_template(const LapdmFrameBter& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

LapdmFrameBter_template& LapdmFrameBter_template::operator=(const OPTIONAL<LapdmFrameBter>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const LapdmFrameBter&)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 @LAPDm_Types.LapdmFrameBter.");
}
return *this;
}

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

boolean LapdmFrameBter_template::match(const LapdmFrameBter& 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.payload().is_bound()) return FALSE;
if(!single_value->field_payload.match(other_value.payload(), 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 @LAPDm_Types.LapdmFrameBter.");
}
return FALSE;
}

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

boolean LapdmFrameBter_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_payload.is_value();
}

void LapdmFrameBter_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;
}

LapdmFrameBter LapdmFrameBter_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 @LAPDm_Types.LapdmFrameBter.");
LapdmFrameBter ret_val;
if (single_value->field_payload.is_bound()) {
ret_val.payload() = single_value->field_payload.valueof();
}
return ret_val;
}

void LapdmFrameBter_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 @LAPDm_Types.LapdmFrameBter.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new LapdmFrameBter_template[list_length];
}

LapdmFrameBter_template& LapdmFrameBter_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 @LAPDm_Types.LapdmFrameBter.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @LAPDm_Types.LapdmFrameBter.");
return value_list.list_value[list_index];
}

OCTETSTRING_template& LapdmFrameBter_template::payload()
{
set_specific();
return single_value->field_payload;
}

const OCTETSTRING_template& LapdmFrameBter_template::payload() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field payload of a non-specific template of type @LAPDm_Types.LapdmFrameBter.");
return single_value->field_payload;
}

int LapdmFrameBter_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameBter which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 1;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameBter 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 @LAPDm_Types.LapdmFrameBter containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameBter containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameBter containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameBter containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameBter containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameBter containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @LAPDm_Types.LapdmFrameBter containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @LAPDm_Types.LapdmFrameBter.");
  }
  return 0;
}

void LapdmFrameBter_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ payload := ");
single_value->field_payload.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 LapdmFrameBter_template::log_match(const LapdmFrameBter& 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_payload.match(match_value.payload(), legacy)){
TTCN_Logger::log_logmatch_info(".payload");
single_value->field_payload.log_match(match_value.payload(), 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("{ payload := ");
single_value->field_payload.log_match(match_value.payload(), 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 LapdmFrameBter_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (payload().is_bound()) payload().set_implicit_omit();
}

void LapdmFrameBter_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_payload.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 @LAPDm_Types.LapdmFrameBter.");
}
}

void LapdmFrameBter_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_payload.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 LapdmFrameBter_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 @LAPDm_Types.LapdmFrameBter.");
}
}

void LapdmFrameBter_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: {
    LapdmFrameBter_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 (1<param.get_size()) {
      param.error("record template of type @LAPDm_Types.LapdmFrameBter has 1 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) payload().set_param(*param.get_elem(0));
    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(), "payload")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          payload().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 @LAPDm_Types.LapdmFrameBter: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    LapdmFrameBter_template* precondition = new LapdmFrameBter_template;
    precondition->set_param(*param.get_elem(0));
    LapdmFrameBter_template* implied_template = new LapdmFrameBter_template;
    implied_template->set_param(*param.get_elem(1));
    *this = LapdmFrameBter_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@LAPDm_Types.LapdmFrameBter");
  }
  is_ifpresent = param.get_ifpresent();
}

void LapdmFrameBter_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_payload.check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmFrameBter");
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 : "@LAPDm_Types.LapdmFrameBter");
}

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

boolean LapdmFrameBter_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 LapdmFrame::copy_value(const LapdmFrame& other_value)
{
switch (other_value.union_selection) {
case ALT_ab:
field_ab = new LapdmFrameAB(*other_value.field_ab);
break;
case ALT_bbis:
field_bbis = new LapdmFrameBbis(*other_value.field_bbis);
break;
case ALT_b4:
field_b4 = new LapdmFrameB4(*other_value.field_b4);
break;
case ALT_bter:
field_bter = new LapdmFrameBter(*other_value.field_bter);
break;
default:
TTCN_error("Assignment of an unbound union value of type @LAPDm_Types.LapdmFrame.");
}
union_selection = other_value.union_selection;
}

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

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

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

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

boolean LapdmFrame::operator==(const LapdmFrame& other_value) const
{
if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @LAPDm_Types.LapdmFrame.");
if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @LAPDm_Types.LapdmFrame.");
if (union_selection != other_value.union_selection) return FALSE;
switch (union_selection) {
case ALT_ab:
return *field_ab == *other_value.field_ab;
case ALT_bbis:
return *field_bbis == *other_value.field_bbis;
case ALT_b4:
return *field_b4 == *other_value.field_b4;
case ALT_bter:
return *field_bter == *other_value.field_bter;
default:
return FALSE;
}
}

LapdmFrameAB& LapdmFrame::ab()
{
if (union_selection != ALT_ab) {
clean_up();
field_ab = new LapdmFrameAB;
union_selection = ALT_ab;
}
return *field_ab;
}

const LapdmFrameAB& LapdmFrame::ab() const
{
if (union_selection != ALT_ab) TTCN_error("Using non-selected field ab in a value of union type @LAPDm_Types.LapdmFrame.");
return *field_ab;
}

LapdmFrameBbis& LapdmFrame::bbis()
{
if (union_selection != ALT_bbis) {
clean_up();
field_bbis = new LapdmFrameBbis;
union_selection = ALT_bbis;
}
return *field_bbis;
}

const LapdmFrameBbis& LapdmFrame::bbis() const
{
if (union_selection != ALT_bbis) TTCN_error("Using non-selected field bbis in a value of union type @LAPDm_Types.LapdmFrame.");
return *field_bbis;
}

LapdmFrameB4& LapdmFrame::b4()
{
if (union_selection != ALT_b4) {
clean_up();
field_b4 = new LapdmFrameB4;
union_selection = ALT_b4;
}
return *field_b4;
}

const LapdmFrameB4& LapdmFrame::b4() const
{
if (union_selection != ALT_b4) TTCN_error("Using non-selected field b4 in a value of union type @LAPDm_Types.LapdmFrame.");
return *field_b4;
}

LapdmFrameBter& LapdmFrame::bter()
{
if (union_selection != ALT_bter) {
clean_up();
field_bter = new LapdmFrameBter;
union_selection = ALT_bter;
}
return *field_bter;
}

const LapdmFrameBter& LapdmFrame::bter() const
{
if (union_selection != ALT_bter) TTCN_error("Using non-selected field bter in a value of union type @LAPDm_Types.LapdmFrame.");
return *field_bter;
}

boolean LapdmFrame::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 @LAPDm_Types.LapdmFrame.");
return union_selection == checked_selection;
}

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

boolean LapdmFrame::is_value() const
{
switch (union_selection) {
case UNBOUND_VALUE: return FALSE;
case ALT_ab: return field_ab->is_value();
case ALT_bbis: return field_bbis->is_value();
case ALT_b4: return field_b4->is_value();
case ALT_bter: return field_bter->is_value();
default: TTCN_error("Invalid selection in union is_bound");}
}

void LapdmFrame::clean_up()
{
switch (union_selection) {
case ALT_ab:
  delete field_ab;
  break;
case ALT_bbis:
  delete field_bbis;
  break;
case ALT_b4:
  delete field_b4;
  break;
case ALT_bter:
  delete field_bter;
  break;
default:
  break;
}
union_selection = UNBOUND_VALUE;
}

void LapdmFrame::log() const
{
switch (union_selection) {
case ALT_ab:
TTCN_Logger::log_event_str("{ ab := ");
field_ab->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_bbis:
TTCN_Logger::log_event_str("{ bbis := ");
field_bbis->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_b4:
TTCN_Logger::log_event_str("{ b4 := ");
field_b4->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_bter:
TTCN_Logger::log_event_str("{ bter := ");
field_bter->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_unbound();
}
}

void LapdmFrame::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, "ab")) {
    ab().set_param(*mp_last);
    if (!ab().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "bbis")) {
    bbis().set_param(*mp_last);
    if (!bbis().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "b4")) {
    b4().set_param(*mp_last);
    if (!b4().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "bter")) {
    bter().set_param(*mp_last);
    if (!bter().is_bound()) clean_up();
    return;
  }
  mp_last->error("Field %s does not exist in type @LAPDm_Types.LapdmFrame.", last_name);
}

void LapdmFrame::set_implicit_omit()
{
switch (union_selection) {
case ALT_ab:
field_ab->set_implicit_omit(); break;
case ALT_bbis:
field_bbis->set_implicit_omit(); break;
case ALT_b4:
field_b4->set_implicit_omit(); break;
case ALT_bter:
field_bter->set_implicit_omit(); break;
default: break;
}
}

void LapdmFrame::encode_text(Text_Buf& text_buf) const
{
text_buf.push_int(union_selection);
switch (union_selection) {
case ALT_ab:
field_ab->encode_text(text_buf);
break;
case ALT_bbis:
field_bbis->encode_text(text_buf);
break;
case ALT_b4:
field_b4->encode_text(text_buf);
break;
case ALT_bter:
field_bter->encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an unbound value of union type @LAPDm_Types.LapdmFrame.");
}
}

void LapdmFrame::decode_text(Text_Buf& text_buf)
{
switch ((union_selection_type)text_buf.pull_int().get_val()) {
case ALT_ab:
ab().decode_text(text_buf);
break;
case ALT_bbis:
bbis().decode_text(text_buf);
break;
case ALT_b4:
b4().decode_text(text_buf);
break;
case ALT_bter:
bter().decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for type @LAPDm_Types.LapdmFrame.");
}
}

void LapdmFrame::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 LapdmFrame::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 LapdmFrame::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, LapdmFrameAB_descr_.raw->forceomit);
      decoded_length = ab().RAW_decode(LapdmFrameAB_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, LapdmFrameBbis_descr_.raw->forceomit);
      decoded_length = bbis().RAW_decode(LapdmFrameBbis_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, LapdmFrameB4_descr_.raw->forceomit);
      decoded_length = b4().RAW_decode(LapdmFrameB4_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, LapdmFrameBter_descr_.raw->forceomit);
      decoded_length = bter().RAW_decode(LapdmFrameBter_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, LapdmFrameAB_descr_.raw->forceomit);
      decoded_length = ab().RAW_decode(LapdmFrameAB_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, LapdmFrameBbis_descr_.raw->forceomit);
      decoded_length = bbis().RAW_decode(LapdmFrameBbis_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, LapdmFrameB4_descr_.raw->forceomit);
      decoded_length = b4().RAW_decode(LapdmFrameB4_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, LapdmFrameBter_descr_.raw->forceomit);
      decoded_length = bter().RAW_decode(LapdmFrameBter_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;
       }
 }
 clean_up();
 return -1;
}

int LapdmFrame::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const
{
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 4;  myleaf.body.node.nodes = init_nodes_of_enc_tree(4);
  memset(myleaf.body.node.nodes, 0, 4 * sizeof(RAW_enc_tree *));
  switch (union_selection) {
  case ALT_ab:
    myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, LapdmFrameAB_descr_.raw);
    encoded_length = field_ab->RAW_encode(LapdmFrameAB_descr_, *myleaf.body.node.nodes[0]);
    myleaf.body.node.nodes[0]->coding_descr = &LapdmFrameAB_descr_;
    break;
  case ALT_bbis:
    myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, LapdmFrameBbis_descr_.raw);
    encoded_length = field_bbis->RAW_encode(LapdmFrameBbis_descr_, *myleaf.body.node.nodes[1]);
    myleaf.body.node.nodes[1]->coding_descr = &LapdmFrameBbis_descr_;
    break;
  case ALT_b4:
    myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 2, LapdmFrameB4_descr_.raw);
    encoded_length = field_b4->RAW_encode(LapdmFrameB4_descr_, *myleaf.body.node.nodes[2]);
    myleaf.body.node.nodes[2]->coding_descr = &LapdmFrameB4_descr_;
    break;
  case ALT_bter:
    myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 3, LapdmFrameBter_descr_.raw);
    encoded_length = field_bter->RAW_encode(LapdmFrameBter_descr_, *myleaf.body.node.nodes[3]);
    myleaf.body.node.nodes[3]->coding_descr = &LapdmFrameBter_descr_;
    break;
  default:
    TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  }
  return encoded_length;
}

void LapdmFrame_template::copy_value(const LapdmFrame& other_value)
{
single_value.union_selection = other_value.get_selection();
switch (single_value.union_selection) {
case LapdmFrame::ALT_ab:
single_value.field_ab = new LapdmFrameAB_template(other_value.ab());
break;
case LapdmFrame::ALT_bbis:
single_value.field_bbis = new LapdmFrameBbis_template(other_value.bbis());
break;
case LapdmFrame::ALT_b4:
single_value.field_b4 = new LapdmFrameB4_template(other_value.b4());
break;
case LapdmFrame::ALT_bter:
single_value.field_bter = new LapdmFrameBter_template(other_value.bter());
break;
default:
TTCN_error("Initializing a template with an unbound value of type @LAPDm_Types.LapdmFrame.");
}
set_selection(SPECIFIC_VALUE);
}

void LapdmFrame_template::copy_template(const LapdmFrame_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 LapdmFrame::ALT_ab:
single_value.field_ab = new LapdmFrameAB_template(*other_value.single_value.field_ab);
break;
case LapdmFrame::ALT_bbis:
single_value.field_bbis = new LapdmFrameBbis_template(*other_value.single_value.field_bbis);
break;
case LapdmFrame::ALT_b4:
single_value.field_b4 = new LapdmFrameB4_template(*other_value.single_value.field_b4);
break;
case LapdmFrame::ALT_bter:
single_value.field_bter = new LapdmFrameBter_template(*other_value.single_value.field_bter);
break;
default:
TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @LAPDm_Types.LapdmFrame.");
}
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 LapdmFrame_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 LapdmFrame_template(*other_value.implication_.precondition);
implication_.implied_template = new LapdmFrame_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 @LAPDm_Types.LapdmFrame.");
}
set_selection(other_value);
}

LapdmFrame_template::LapdmFrame_template()
{
}

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

LapdmFrame_template::LapdmFrame_template(const LapdmFrame& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

void LapdmFrame_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case LapdmFrame::ALT_ab:
delete single_value.field_ab;
break;
case LapdmFrame::ALT_bbis:
delete single_value.field_bbis;
break;
case LapdmFrame::ALT_b4:
delete single_value.field_b4;
break;
case LapdmFrame::ALT_bter:
delete single_value.field_bter;
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;
}

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

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

LapdmFrame_template& LapdmFrame_template::operator=(const OPTIONAL<LapdmFrame>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const LapdmFrame&)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 @LAPDm_Types.LapdmFrame.");
}
return *this;
}

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

boolean LapdmFrame_template::match(const LapdmFrame& 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:
{
LapdmFrame::union_selection_type value_selection = other_value.get_selection();
if (value_selection == LapdmFrame::UNBOUND_VALUE) return FALSE;
if (value_selection != single_value.union_selection) return FALSE;
switch (value_selection) {
case LapdmFrame::ALT_ab:
return single_value.field_ab->match(other_value.ab(), legacy);
case LapdmFrame::ALT_bbis:
return single_value.field_bbis->match(other_value.bbis(), legacy);
case LapdmFrame::ALT_b4:
return single_value.field_b4->match(other_value.b4(), legacy);
case LapdmFrame::ALT_bter:
return single_value.field_bter->match(other_value.bter(), legacy);
default:
TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @LAPDm_Types.LapdmFrame.");
}
}
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 @LAPDm_Types.LapdmFrame.");
}
return FALSE;
}

boolean LapdmFrame_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
switch (single_value.union_selection) {
case LapdmFrame::ALT_ab:
return single_value.field_ab->is_value();
case LapdmFrame::ALT_bbis:
return single_value.field_bbis->is_value();
case LapdmFrame::ALT_b4:
return single_value.field_b4->is_value();
case LapdmFrame::ALT_bter:
return single_value.field_bter->is_value();
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @LAPDm_Types.LapdmFrame.");
}
}

LapdmFrame LapdmFrame_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 @LAPDm_Types.LapdmFrame.");
LapdmFrame ret_val;
switch (single_value.union_selection) {
case LapdmFrame::ALT_ab:
ret_val.ab() = single_value.field_ab->valueof();
break;
case LapdmFrame::ALT_bbis:
ret_val.bbis() = single_value.field_bbis->valueof();
break;
case LapdmFrame::ALT_b4:
ret_val.b4() = single_value.field_b4->valueof();
break;
case LapdmFrame::ALT_bter:
ret_val.bter() = single_value.field_bter->valueof();
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @LAPDm_Types.LapdmFrame.");
}
return ret_val;
}

LapdmFrame_template& LapdmFrame_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 @LAPDm_Types.LapdmFrame.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @LAPDm_Types.LapdmFrame.");
return value_list.list_value[list_index];
}
void LapdmFrame_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 @LAPDm_Types.LapdmFrame.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new LapdmFrame_template[list_length];
}

LapdmFrameAB_template& LapdmFrame_template::ab()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != LapdmFrame::ALT_ab) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_ab = new LapdmFrameAB_template(ANY_VALUE);
else single_value.field_ab = new LapdmFrameAB_template;
single_value.union_selection = LapdmFrame::ALT_ab;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_ab;
}

const LapdmFrameAB_template& LapdmFrame_template::ab() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ab in a non-specific template of union type @LAPDm_Types.LapdmFrame.");
if (single_value.union_selection != LapdmFrame::ALT_ab) TTCN_error("Accessing non-selected field ab in a template of union type @LAPDm_Types.LapdmFrame.");
return *single_value.field_ab;
}

LapdmFrameBbis_template& LapdmFrame_template::bbis()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != LapdmFrame::ALT_bbis) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_bbis = new LapdmFrameBbis_template(ANY_VALUE);
else single_value.field_bbis = new LapdmFrameBbis_template;
single_value.union_selection = LapdmFrame::ALT_bbis;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_bbis;
}

const LapdmFrameBbis_template& LapdmFrame_template::bbis() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field bbis in a non-specific template of union type @LAPDm_Types.LapdmFrame.");
if (single_value.union_selection != LapdmFrame::ALT_bbis) TTCN_error("Accessing non-selected field bbis in a template of union type @LAPDm_Types.LapdmFrame.");
return *single_value.field_bbis;
}

LapdmFrameB4_template& LapdmFrame_template::b4()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != LapdmFrame::ALT_b4) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_b4 = new LapdmFrameB4_template(ANY_VALUE);
else single_value.field_b4 = new LapdmFrameB4_template;
single_value.union_selection = LapdmFrame::ALT_b4;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_b4;
}

const LapdmFrameB4_template& LapdmFrame_template::b4() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field b4 in a non-specific template of union type @LAPDm_Types.LapdmFrame.");
if (single_value.union_selection != LapdmFrame::ALT_b4) TTCN_error("Accessing non-selected field b4 in a template of union type @LAPDm_Types.LapdmFrame.");
return *single_value.field_b4;
}

LapdmFrameBter_template& LapdmFrame_template::bter()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != LapdmFrame::ALT_bter) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_bter = new LapdmFrameBter_template(ANY_VALUE);
else single_value.field_bter = new LapdmFrameBter_template;
single_value.union_selection = LapdmFrame::ALT_bter;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_bter;
}

const LapdmFrameBter_template& LapdmFrame_template::bter() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field bter in a non-specific template of union type @LAPDm_Types.LapdmFrame.");
if (single_value.union_selection != LapdmFrame::ALT_bter) TTCN_error("Accessing non-selected field bter in a template of union type @LAPDm_Types.LapdmFrame.");
return *single_value.field_bter;
}

boolean LapdmFrame_template::ischosen(LapdmFrame::union_selection_type checked_selection) const
{
if (checked_selection == LapdmFrame::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @LAPDm_Types.LapdmFrame.");
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.union_selection == LapdmFrame::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @LAPDm_Types.LapdmFrame.");
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 @LAPDm_Types.LapdmFrame 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 LapdmFrame_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case LapdmFrame::ALT_ab:
TTCN_Logger::log_event_str("{ ab := ");
single_value.field_ab->log();
TTCN_Logger::log_event_str(" }");
break;
case LapdmFrame::ALT_bbis:
TTCN_Logger::log_event_str("{ bbis := ");
single_value.field_bbis->log();
TTCN_Logger::log_event_str(" }");
break;
case LapdmFrame::ALT_b4:
TTCN_Logger::log_event_str("{ b4 := ");
single_value.field_b4->log();
TTCN_Logger::log_event_str(" }");
break;
case LapdmFrame::ALT_bter:
TTCN_Logger::log_event_str("{ bter := ");
single_value.field_bter->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 LapdmFrame_template::log_match(const LapdmFrame& 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 LapdmFrame::ALT_ab:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".ab");
single_value.field_ab->log_match(match_value.ab(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ ab := ");
single_value.field_ab->log_match(match_value.ab(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case LapdmFrame::ALT_bbis:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".bbis");
single_value.field_bbis->log_match(match_value.bbis(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ bbis := ");
single_value.field_bbis->log_match(match_value.bbis(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case LapdmFrame::ALT_b4:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".b4");
single_value.field_b4->log_match(match_value.b4(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ b4 := ");
single_value.field_b4->log_match(match_value.b4(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case LapdmFrame::ALT_bter:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".bter");
single_value.field_bter->log_match(match_value.bter(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ bter := ");
single_value.field_bter->log_match(match_value.bter(), 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 LapdmFrame_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
switch (single_value.union_selection) {
case LapdmFrame::ALT_ab:
single_value.field_ab->set_implicit_omit(); break;
case LapdmFrame::ALT_bbis:
single_value.field_bbis->set_implicit_omit(); break;
case LapdmFrame::ALT_b4:
single_value.field_b4->set_implicit_omit(); break;
case LapdmFrame::ALT_bter:
single_value.field_bter->set_implicit_omit(); break;
default: break;
}
}

void LapdmFrame_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 LapdmFrame::ALT_ab:
single_value.field_ab->encode_text(text_buf);
break;
case LapdmFrame::ALT_bbis:
single_value.field_bbis->encode_text(text_buf);
break;
case LapdmFrame::ALT_b4:
single_value.field_b4->encode_text(text_buf);
break;
case LapdmFrame::ALT_bter:
single_value.field_bter->encode_text(text_buf);
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @LAPDm_Types.LapdmFrame.");
}
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 @LAPDm_Types.LapdmFrame.");
}
}

void LapdmFrame_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
{
single_value.union_selection = LapdmFrame::UNBOUND_VALUE;
LapdmFrame::union_selection_type new_selection = (LapdmFrame::union_selection_type)text_buf.pull_int().get_val();
switch (new_selection) {
case LapdmFrame::ALT_ab:
single_value.field_ab = new LapdmFrameAB_template;
single_value.field_ab->decode_text(text_buf);
break;
case LapdmFrame::ALT_bbis:
single_value.field_bbis = new LapdmFrameBbis_template;
single_value.field_bbis->decode_text(text_buf);
break;
case LapdmFrame::ALT_b4:
single_value.field_b4 = new LapdmFrameB4_template;
single_value.field_b4->decode_text(text_buf);
break;
case LapdmFrame::ALT_bter:
single_value.field_bter = new LapdmFrameBter_template;
single_value.field_bter->decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @LAPDm_Types.LapdmFrame.");
}
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 LapdmFrame_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 @LAPDm_Types.LapdmFrame.");
}
}

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

boolean LapdmFrame_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 LapdmFrame_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 `@LAPDm_Types.LapdmFrame'");
    }
    if (strcmp("ab", param_field) == 0) {
      ab().set_param(param);
      return;
    } else if (strcmp("bbis", param_field) == 0) {
      bbis().set_param(param);
      return;
    } else if (strcmp("b4", param_field) == 0) {
      b4().set_param(param);
      return;
    } else if (strcmp("bter", param_field) == 0) {
      bter().set_param(param);
      return;
    } else param.error("Field `%s' not found in union template type `@LAPDm_Types.LapdmFrame'", 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: {
    LapdmFrame_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", "@LAPDm_Types.LapdmFrame");
    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, "ab")) {
      ab().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "bbis")) {
      bbis().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "b4")) {
      b4().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "bter")) {
      bter().set_param(*mp_last);
      break;
    }
    mp_last->error("Field %s does not exist in type @LAPDm_Types.LapdmFrame.", last_name);
  } break;
  case Module_Param::MP_Implication_Template: {
    LapdmFrame_template* precondition = new LapdmFrame_template;
    precondition->set_param(*m_p->get_elem(0));
    LapdmFrame_template* implied_template = new LapdmFrame_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = LapdmFrame_template(precondition, implied_template);
  } break;
  default:
    param.type_error("union template", "@LAPDm_Types.LapdmFrame");
  }
  is_ifpresent = param.get_ifpresent();
}

void LapdmFrame_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 LapdmFrame::ALT_ab:
single_value.field_ab->check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmFrame");
return;
case LapdmFrame::ALT_bbis:
single_value.field_bbis->check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmFrame");
return;
case LapdmFrame::ALT_b4:
single_value.field_b4->check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmFrame");
return;
case LapdmFrame::ALT_bter:
single_value.field_bter->check_restriction(t_res, t_name ? t_name : "@LAPDm_Types.LapdmFrame");
return;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @LAPDm_Types.LapdmFrame.");
}
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 : "@LAPDm_Types.LapdmFrame");
}


/* Bodies of functions, altsteps and testcases */

void LapdmAddressField_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(LapdmAddressField_spare_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmAddressField_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(LapdmAddressField_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 LapdmAddressField_lpd_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(LapdmAddressField_lpd_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmAddressField_lpd_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(LapdmAddressField_lpd_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 LapdmAddressField_sapi_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(LapdmAddressField_sapi_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmAddressField_sapi_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(LapdmAddressField_sapi_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 LapdmAddressField_c__r_encoder(const BOOLEAN& 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 `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(LapdmAddressField_c__r_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmAddressField_c__r_decoder(OCTETSTRING& input_stream, BOOLEAN& 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 `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(LapdmAddressField_c__r_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 LapdmAddressField_ea_encoder(const BOOLEAN& 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 `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(LapdmAddressField_ea_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmAddressField_ea_decoder(OCTETSTRING& input_stream, BOOLEAN& 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 `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(LapdmAddressField_ea_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 LapdmAddressField_encoder(const LapdmAddressField& 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 `@LAPDm_Types.LapdmAddressField' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(LapdmAddressField_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmAddressField_decoder(OCTETSTRING& input_stream, LapdmAddressField& 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 `@LAPDm_Types.LapdmAddressField' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(LapdmAddressField_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;
}
}

LapdmAddressField_template tr__LapdmAddr(const INTEGER_template& sapi, const BOOLEAN_template& c__r)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 36, TTCN_Location::LOCATION_TEMPLATE, "tr_LapdmAddr");
LapdmAddressField_template ret_val;
ret_val.spare() = bs_2;
ret_val.lpd() = 0;
ret_val.sapi() = sapi;
ret_val.c__r() = c__r;
ret_val.ea() = TRUE;
return ret_val;
}

LapdmAddressField_template ts__LapdmAddr(const INTEGER& sapi, const BOOLEAN& c__r)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 44, TTCN_Location::LOCATION_TEMPLATE, "ts_LapdmAddr");
LapdmAddressField_template ret_val;
ret_val.spare() = bs_2;
ret_val.lpd() = 0;
ret_val.sapi() = sapi;
ret_val.c__r() = c__r;
ret_val.ea() = TRUE;
return ret_val;
}

void LapdmCtrlI_n__r_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(LapdmCtrlI_n__r_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmCtrlI_n__r_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(LapdmCtrlI_n__r_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 LapdmCtrlI_p_encoder(const BOOLEAN& 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 `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(LapdmCtrlI_p_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmCtrlI_p_decoder(OCTETSTRING& input_stream, BOOLEAN& 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 `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(LapdmCtrlI_p_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 LapdmCtrlI_n__s_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(LapdmCtrlI_n__s_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmCtrlI_n__s_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(LapdmCtrlI_n__s_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 LapdmCtrlI_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(LapdmCtrlI_spare_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmCtrlI_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(LapdmCtrlI_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 LapdmCtrlI_encoder(const LapdmCtrlI& 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 `@LAPDm_Types.LapdmCtrlI' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(LapdmCtrlI_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmCtrlI_decoder(OCTETSTRING& input_stream, LapdmCtrlI& 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 `@LAPDm_Types.LapdmCtrlI' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(LapdmCtrlI_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 LapdmCtrlS_n__r_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(LapdmCtrlS_n__r_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmCtrlS_n__r_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(LapdmCtrlS_n__r_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 LapdmCtrlS_p__f_encoder(const BOOLEAN& 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 `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(LapdmCtrlS_p__f_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmCtrlS_p__f_decoder(OCTETSTRING& input_stream, BOOLEAN& 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 `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(LapdmCtrlS_p__f_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 LapdmCtrlS_s_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(LapdmCtrlS_s_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmCtrlS_s_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(LapdmCtrlS_s_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 LapdmCtrlS_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(LapdmCtrlS_spare_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmCtrlS_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(LapdmCtrlS_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 LapdmCtrlS_encoder(const LapdmCtrlS& 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 `@LAPDm_Types.LapdmCtrlS' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(LapdmCtrlS_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmCtrlS_decoder(OCTETSTRING& input_stream, LapdmCtrlS& 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 `@LAPDm_Types.LapdmCtrlS' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(LapdmCtrlS_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 LapdmCtrlU_u_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(LapdmCtrlU_u_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmCtrlU_u_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(LapdmCtrlU_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 LapdmCtrlU_p__f_encoder(const BOOLEAN& 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 `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(LapdmCtrlU_p__f_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmCtrlU_p__f_decoder(OCTETSTRING& input_stream, BOOLEAN& 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 `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(LapdmCtrlU_p__f_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 LapdmCtrlU_u2_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(LapdmCtrlU_u2_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmCtrlU_u2_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(LapdmCtrlU_u2_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 LapdmCtrlU_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(LapdmCtrlU_spare_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmCtrlU_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(LapdmCtrlU_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 LapdmCtrlU_encoder(const LapdmCtrlU& 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 `@LAPDm_Types.LapdmCtrlU' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(LapdmCtrlU_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmCtrlU_decoder(OCTETSTRING& input_stream, LapdmCtrlU& 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 `@LAPDm_Types.LapdmCtrlU' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(LapdmCtrlU_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 LapdmCtrl_encoder(const LapdmCtrl& 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 `@LAPDm_Types.LapdmCtrl' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(LapdmCtrl_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmCtrl_decoder(OCTETSTRING& input_stream, LapdmCtrl& 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 `@LAPDm_Types.LapdmCtrl' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(LapdmCtrl_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;
}
}

LapdmCtrl_template tr__LapdmCtrlI(const INTEGER_template& nr, const INTEGER_template& ns, const BOOLEAN_template& p)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 96, TTCN_Location::LOCATION_TEMPLATE, "tr_LapdmCtrlI");
LapdmCtrl_template ret_val;
{
LapdmCtrlI_template& tmp_2 = ret_val.i();
tmp_2.n__r() = nr;
tmp_2.p() = p;
tmp_2.n__s() = ns;
tmp_2.spare() = bs_2;
}
return ret_val;
}

LapdmCtrl_template ts__LapdmCtrlI(const INTEGER& nr, const INTEGER& ns, const BOOLEAN& p)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 99, TTCN_Location::LOCATION_TEMPLATE, "ts_LapdmCtrlI");
LapdmCtrl_template ret_val;
{
LapdmCtrlI_template& tmp_3 = ret_val.i();
tmp_3.n__r() = nr;
tmp_3.p() = p;
tmp_3.n__s() = ns;
tmp_3.spare() = bs_2;
}
return ret_val;
}

LapdmCtrl_template tr__LapdmCtrlRR(const INTEGER_template& nr, const BOOLEAN_template& pf)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 104, TTCN_Location::LOCATION_TEMPLATE, "tr_LapdmCtrlRR");
LapdmCtrl_template ret_val(tr__LapdmCtrlS);
{
LapdmCtrlS_template& tmp_4 = ret_val.s();
tmp_4.n__r() = nr;
tmp_4.p__f() = pf;
tmp_4.s() = bs_3;
}
return ret_val;
}

LapdmCtrl_template ts__LapdmCtrlRR(const INTEGER& nr, const BOOLEAN& pf)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 107, TTCN_Location::LOCATION_TEMPLATE, "ts_LapdmCtrlRR");
LapdmCtrl_template ret_val;
{
LapdmCtrlS_template& tmp_5 = ret_val.s();
tmp_5.n__r() = nr;
tmp_5.p__f() = pf;
tmp_5.s() = bs_3;
tmp_5.spare() = bs_1;
}
return ret_val;
}

LapdmCtrl_template tr__LapdmCtrlRNR(const INTEGER_template& nr, const BOOLEAN_template& pf)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 111, TTCN_Location::LOCATION_TEMPLATE, "tr_LapdmCtrlRNR");
LapdmCtrl_template ret_val(tr__LapdmCtrlS);
{
LapdmCtrlS_template& tmp_6 = ret_val.s();
tmp_6.n__r() = nr;
tmp_6.p__f() = pf;
tmp_6.s() = bs_1;
}
return ret_val;
}

LapdmCtrl_template tr__LapdmCtrlREJ(const INTEGER_template& nr, const BOOLEAN_template& pf)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 115, TTCN_Location::LOCATION_TEMPLATE, "tr_LapdmCtrlREJ");
LapdmCtrl_template ret_val(tr__LapdmCtrlS);
{
LapdmCtrlS_template& tmp_7 = ret_val.s();
tmp_7.n__r() = nr;
tmp_7.p__f() = pf;
tmp_7.s() = bs_4;
}
return ret_val;
}

LapdmCtrl_template ts__LapdmCtrlREJ(const INTEGER& nr, const BOOLEAN& pf)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 118, TTCN_Location::LOCATION_TEMPLATE, "ts_LapdmCtrlREJ");
LapdmCtrl_template ret_val;
{
LapdmCtrlS_template& tmp_8 = ret_val.s();
tmp_8.n__r() = nr;
tmp_8.p__f() = pf;
tmp_8.s() = bs_4;
tmp_8.spare() = bs_1;
}
return ret_val;
}

LapdmCtrl_template tr__LapdmCtrlSABM(const BOOLEAN_template& p)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 123, TTCN_Location::LOCATION_TEMPLATE, "tr_LapdmCtrlSABM");
LapdmCtrl_template ret_val;
{
LapdmCtrlU_template& tmp_9 = ret_val.u();
tmp_9.u() = bs_5;
tmp_9.p__f() = p;
tmp_9.u2() = bs_0;
tmp_9.spare() = bs_0;
}
return ret_val;
}

LapdmCtrl_template ts__LapdmCtrlSABM(const BOOLEAN& p)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 126, TTCN_Location::LOCATION_TEMPLATE, "ts_LapdmCtrlSABM");
LapdmCtrl_template ret_val;
{
LapdmCtrlU_template& tmp_10 = ret_val.u();
tmp_10.u() = bs_5;
tmp_10.p__f() = p;
tmp_10.u2() = bs_0;
tmp_10.spare() = bs_0;
}
return ret_val;
}

LapdmCtrl_template tr__LapdmCtrlDM(const BOOLEAN_template& f)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 130, TTCN_Location::LOCATION_TEMPLATE, "tr_LapdmCtrlDM");
LapdmCtrl_template ret_val;
{
LapdmCtrlU_template& tmp_11 = ret_val.u();
tmp_11.u() = bs_6;
tmp_11.p__f() = f;
tmp_11.u2() = bs_0;
tmp_11.spare() = bs_0;
}
return ret_val;
}

LapdmCtrl_template ts__LapdmCtrlDM(const BOOLEAN& f)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 133, TTCN_Location::LOCATION_TEMPLATE, "ts_LapdmCtrlDM");
LapdmCtrl_template ret_val;
{
LapdmCtrlU_template& tmp_12 = ret_val.u();
tmp_12.u() = bs_6;
tmp_12.p__f() = f;
tmp_12.u2() = bs_0;
tmp_12.spare() = bs_0;
}
return ret_val;
}

LapdmCtrl_template tr__LapdmCtrlUI(const BOOLEAN_template& p)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 137, TTCN_Location::LOCATION_TEMPLATE, "tr_LapdmCtrlUI");
LapdmCtrl_template ret_val;
{
LapdmCtrlU_template& tmp_13 = ret_val.u();
tmp_13.u() = bs_6;
tmp_13.p__f() = p;
tmp_13.u2() = bs_3;
tmp_13.spare() = bs_0;
}
return ret_val;
}

LapdmCtrl_template ts__LapdmCtrlUI(const BOOLEAN& p)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 140, TTCN_Location::LOCATION_TEMPLATE, "ts_LapdmCtrlUI");
LapdmCtrl_template ret_val;
{
LapdmCtrlU_template& tmp_14 = ret_val.u();
tmp_14.u() = bs_6;
tmp_14.p__f() = p;
tmp_14.u2() = bs_3;
tmp_14.spare() = bs_0;
}
return ret_val;
}

LapdmCtrl_template tr__LapdmCtrlDISC(const BOOLEAN_template& p)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 144, TTCN_Location::LOCATION_TEMPLATE, "tr_LapdmCtrlDISC");
LapdmCtrl_template ret_val;
{
LapdmCtrlU_template& tmp_15 = ret_val.u();
tmp_15.u() = bs_7;
tmp_15.p__f() = p;
tmp_15.u2() = bs_3;
tmp_15.spare() = bs_0;
}
return ret_val;
}

LapdmCtrl_template ts__LapdmCtrlDISC(const BOOLEAN& p)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 147, TTCN_Location::LOCATION_TEMPLATE, "ts_LapdmCtrlDISC");
LapdmCtrl_template ret_val;
{
LapdmCtrlU_template& tmp_16 = ret_val.u();
tmp_16.u() = bs_7;
tmp_16.p__f() = p;
tmp_16.u2() = bs_3;
tmp_16.spare() = bs_0;
}
return ret_val;
}

LapdmCtrl_template tr__LapdmCtrlUA(const BOOLEAN_template& f)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 151, TTCN_Location::LOCATION_TEMPLATE, "tr_LapdmCtrlUA");
LapdmCtrl_template ret_val(tr__LapdmCtrlU);
{
LapdmCtrlU_template& tmp_17 = ret_val.u();
tmp_17.u() = bs_8;
tmp_17.p__f() = f;
tmp_17.u2() = bs_3;
tmp_17.spare() = bs_0;
}
return ret_val;
}

LapdmCtrl_template ts__LapdmCtrlUA(const BOOLEAN& f)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 154, TTCN_Location::LOCATION_TEMPLATE, "ts_LapdmCtrlUA");
LapdmCtrl_template ret_val;
{
LapdmCtrlU_template& tmp_18 = ret_val.u();
tmp_18.u() = bs_8;
tmp_18.p__f() = f;
tmp_18.u2() = bs_3;
tmp_18.spare() = bs_0;
}
return ret_val;
}

LapdmAddressField dec__LapdmAddressField(const OCTETSTRING& stream)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("dec_LapdmAddressField(): Stream before decoding: ");
stream.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_EncDec::clear_error();
TTCN_Buffer ttcn_buffer(stream);
LapdmAddressField ret_val;
ret_val.decode(LapdmAddressField_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("dec_LapdmAddressField(): Decoded @LAPDm_Types.LapdmAddressField: ");
ret_val.log();
TTCN_Logger::end_event();
}
if (TTCN_EncDec::get_last_error_type() == TTCN_EncDec::ET_NONE) {
if (ttcn_buffer.get_pos() < ttcn_buffer.get_len()) {
ttcn_buffer.cut();
OCTETSTRING tmp_os;
ttcn_buffer.get_string(tmp_os);
TTCN_Logger::begin_event_log2str();
tmp_os.log();
CHARSTRING remaining_stream = TTCN_Logger::end_event_log2str();
TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_EXTRA_DATA, "dec_LapdmAddressField(): Data remained at the end of the stream after successful decoding: %s", (const char*) remaining_stream);
}
}
return ret_val;
}

LapdmCtrl dec__LapdmCtrl(const OCTETSTRING& stream)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("dec_LapdmCtrl(): Stream before decoding: ");
stream.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_EncDec::clear_error();
TTCN_Buffer ttcn_buffer(stream);
LapdmCtrl ret_val;
ret_val.decode(LapdmCtrl_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("dec_LapdmCtrl(): Decoded @LAPDm_Types.LapdmCtrl: ");
ret_val.log();
TTCN_Logger::end_event();
}
if (TTCN_EncDec::get_last_error_type() == TTCN_EncDec::ET_NONE) {
if (ttcn_buffer.get_pos() < ttcn_buffer.get_len()) {
ttcn_buffer.cut();
OCTETSTRING tmp_os;
ttcn_buffer.get_string(tmp_os);
TTCN_Logger::begin_event_log2str();
tmp_os.log();
CHARSTRING remaining_stream = TTCN_Logger::end_event_log2str();
TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_EXTRA_DATA, "dec_LapdmCtrl(): Data remained at the end of the stream after successful decoding: %s", (const char*) remaining_stream);
}
}
return ret_val;
}

LapdmCtrlU dec__LapdmCtrlU(const OCTETSTRING& stream)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("dec_LapdmCtrlU(): Stream before decoding: ");
stream.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_EncDec::clear_error();
TTCN_Buffer ttcn_buffer(stream);
LapdmCtrlU ret_val;
ret_val.decode(LapdmCtrlU_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("dec_LapdmCtrlU(): Decoded @LAPDm_Types.LapdmCtrlU: ");
ret_val.log();
TTCN_Logger::end_event();
}
if (TTCN_EncDec::get_last_error_type() == TTCN_EncDec::ET_NONE) {
if (ttcn_buffer.get_pos() < ttcn_buffer.get_len()) {
ttcn_buffer.cut();
OCTETSTRING tmp_os;
ttcn_buffer.get_string(tmp_os);
TTCN_Logger::begin_event_log2str();
tmp_os.log();
CHARSTRING remaining_stream = TTCN_Logger::end_event_log2str();
TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_EXTRA_DATA, "dec_LapdmCtrlU(): Data remained at the end of the stream after successful decoding: %s", (const char*) remaining_stream);
}
}
return ret_val;
}

void LapdmFrameAB_addr_encoder(const LapdmAddressField& 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 `@LAPDm_Types.LapdmAddressField' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(LapdmFrameAB_addr_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmFrameAB_addr_decoder(OCTETSTRING& input_stream, LapdmAddressField& 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 `@LAPDm_Types.LapdmAddressField' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(LapdmFrameAB_addr_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 LapdmFrameAB_ctrl_encoder(const LapdmCtrl& 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 `@LAPDm_Types.LapdmCtrl' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(LapdmFrameAB_ctrl_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmFrameAB_ctrl_decoder(OCTETSTRING& input_stream, LapdmCtrl& 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 `@LAPDm_Types.LapdmCtrl' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(LapdmFrameAB_ctrl_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 LapdmFrameAB_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(LapdmFrameAB_len_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmFrameAB_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(LapdmFrameAB_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 LapdmFrameAB_m_encoder(const BOOLEAN& 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 `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(LapdmFrameAB_m_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmFrameAB_m_decoder(OCTETSTRING& input_stream, BOOLEAN& 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 `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(LapdmFrameAB_m_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 LapdmFrameAB_el_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(LapdmFrameAB_el_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmFrameAB_el_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(LapdmFrameAB_el_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 LapdmFrameAB_payload_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(LapdmFrameAB_payload_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmFrameAB_payload_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(LapdmFrameAB_payload_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 LapdmFrameAB_padding_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(LapdmFrameAB_padding_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmFrameAB_padding_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(LapdmFrameAB_padding_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 LapdmFrameAB_encoder(const LapdmFrameAB& 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 `@LAPDm_Types.LapdmFrameAB' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(LapdmFrameAB_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmFrameAB_decoder(OCTETSTRING& input_stream, LapdmFrameAB& 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 `@LAPDm_Types.LapdmFrameAB' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(LapdmFrameAB_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;
}
}

OCTETSTRING enc__LapdmFrameAB(const LapdmFrameAB& si)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("enc_LapdmFrameAB(): Encoding @LAPDm_Types.LapdmFrameAB: ");
si.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_Buffer ttcn_buffer;
si.encode(LapdmFrameAB_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW, 0);
OCTETSTRING ret_val;
ttcn_buffer.get_string(ret_val);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("enc_LapdmFrameAB(): Stream after encoding: ");
ret_val.log();
TTCN_Logger::end_event();
}
return ret_val;
}

LapdmFrameAB dec__LapdmFrameAB(const OCTETSTRING& stream)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("dec_LapdmFrameAB(): Stream before decoding: ");
stream.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_EncDec::clear_error();
TTCN_Buffer ttcn_buffer(stream);
LapdmFrameAB ret_val;
ret_val.decode(LapdmFrameAB_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("dec_LapdmFrameAB(): Decoded @LAPDm_Types.LapdmFrameAB: ");
ret_val.log();
TTCN_Logger::end_event();
}
if (TTCN_EncDec::get_last_error_type() == TTCN_EncDec::ET_NONE) {
if (ttcn_buffer.get_pos() < ttcn_buffer.get_len()) {
ttcn_buffer.cut();
OCTETSTRING tmp_os;
ttcn_buffer.get_string(tmp_os);
TTCN_Logger::begin_event_log2str();
tmp_os.log();
CHARSTRING remaining_stream = TTCN_Logger::end_event_log2str();
TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_EXTRA_DATA, "dec_LapdmFrameAB(): Data remained at the end of the stream after successful decoding: %s", (const char*) remaining_stream);
}
}
return ret_val;
}

void LapdmFrameB4_payload_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 LapdmFrameB4_payload_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 LapdmFrameB4_encoder(const LapdmFrameB4& 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 `@LAPDm_Types.LapdmFrameB4' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(LapdmFrameB4_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmFrameB4_decoder(OCTETSTRING& input_stream, LapdmFrameB4& 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 `@LAPDm_Types.LapdmFrameB4' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(LapdmFrameB4_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;
}
}

OCTETSTRING enc__LapdmFrameB4(const LapdmFrameB4& si)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("enc_LapdmFrameB4(): Encoding @LAPDm_Types.LapdmFrameB4: ");
si.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_Buffer ttcn_buffer;
si.encode(LapdmFrameB4_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW, 0);
OCTETSTRING ret_val;
ttcn_buffer.get_string(ret_val);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("enc_LapdmFrameB4(): Stream after encoding: ");
ret_val.log();
TTCN_Logger::end_event();
}
return ret_val;
}

LapdmFrameB4 dec__LapdmFrameB4(const OCTETSTRING& stream)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("dec_LapdmFrameB4(): Stream before decoding: ");
stream.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_EncDec::clear_error();
TTCN_Buffer ttcn_buffer(stream);
LapdmFrameB4 ret_val;
ret_val.decode(LapdmFrameB4_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("dec_LapdmFrameB4(): Decoded @LAPDm_Types.LapdmFrameB4: ");
ret_val.log();
TTCN_Logger::end_event();
}
if (TTCN_EncDec::get_last_error_type() == TTCN_EncDec::ET_NONE) {
if (ttcn_buffer.get_pos() < ttcn_buffer.get_len()) {
ttcn_buffer.cut();
OCTETSTRING tmp_os;
ttcn_buffer.get_string(tmp_os);
TTCN_Logger::begin_event_log2str();
tmp_os.log();
CHARSTRING remaining_stream = TTCN_Logger::end_event_log2str();
TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_EXTRA_DATA, "dec_LapdmFrameB4(): Data remained at the end of the stream after successful decoding: %s", (const char*) remaining_stream);
}
}
return ret_val;
}

void LapdmFrameBbis_payload_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 LapdmFrameBbis_payload_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 LapdmFrameBbis_encoder(const LapdmFrameBbis& 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 `@LAPDm_Types.LapdmFrameBbis' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(LapdmFrameBbis_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmFrameBbis_decoder(OCTETSTRING& input_stream, LapdmFrameBbis& 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 `@LAPDm_Types.LapdmFrameBbis' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(LapdmFrameBbis_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;
}
}

OCTETSTRING enc__LapdmFrameBbis(const LapdmFrameBbis& si)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("enc_LapdmFrameBbis(): Encoding @LAPDm_Types.LapdmFrameBbis: ");
si.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_Buffer ttcn_buffer;
si.encode(LapdmFrameBbis_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW, 0);
OCTETSTRING ret_val;
ttcn_buffer.get_string(ret_val);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("enc_LapdmFrameBbis(): Stream after encoding: ");
ret_val.log();
TTCN_Logger::end_event();
}
return ret_val;
}

LapdmFrameBbis dec__LapdmFrameBbis(const OCTETSTRING& stream)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("dec_LapdmFrameBbis(): Stream before decoding: ");
stream.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_EncDec::clear_error();
TTCN_Buffer ttcn_buffer(stream);
LapdmFrameBbis ret_val;
ret_val.decode(LapdmFrameBbis_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("dec_LapdmFrameBbis(): Decoded @LAPDm_Types.LapdmFrameBbis: ");
ret_val.log();
TTCN_Logger::end_event();
}
if (TTCN_EncDec::get_last_error_type() == TTCN_EncDec::ET_NONE) {
if (ttcn_buffer.get_pos() < ttcn_buffer.get_len()) {
ttcn_buffer.cut();
OCTETSTRING tmp_os;
ttcn_buffer.get_string(tmp_os);
TTCN_Logger::begin_event_log2str();
tmp_os.log();
CHARSTRING remaining_stream = TTCN_Logger::end_event_log2str();
TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_EXTRA_DATA, "dec_LapdmFrameBbis(): Data remained at the end of the stream after successful decoding: %s", (const char*) remaining_stream);
}
}
return ret_val;
}

void LapdmFrameBter_payload_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 LapdmFrameBter_payload_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 LapdmFrameBter_encoder(const LapdmFrameBter& 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 `@LAPDm_Types.LapdmFrameBter' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(LapdmFrameBter_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmFrameBter_decoder(OCTETSTRING& input_stream, LapdmFrameBter& 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 `@LAPDm_Types.LapdmFrameBter' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(LapdmFrameBter_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;
}
}

OCTETSTRING enc__LapdmFrameBter(const LapdmFrameBter& si)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("enc_LapdmFrameBter(): Encoding @LAPDm_Types.LapdmFrameBter: ");
si.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_Buffer ttcn_buffer;
si.encode(LapdmFrameBter_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW, 0);
OCTETSTRING ret_val;
ttcn_buffer.get_string(ret_val);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("enc_LapdmFrameBter(): Stream after encoding: ");
ret_val.log();
TTCN_Logger::end_event();
}
return ret_val;
}

LapdmFrameBter dec__LapdmFrameBter(const OCTETSTRING& stream)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("dec_LapdmFrameBter(): Stream before decoding: ");
stream.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_EncDec::clear_error();
TTCN_Buffer ttcn_buffer(stream);
LapdmFrameBter ret_val;
ret_val.decode(LapdmFrameBter_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("dec_LapdmFrameBter(): Decoded @LAPDm_Types.LapdmFrameBter: ");
ret_val.log();
TTCN_Logger::end_event();
}
if (TTCN_EncDec::get_last_error_type() == TTCN_EncDec::ET_NONE) {
if (ttcn_buffer.get_pos() < ttcn_buffer.get_len()) {
ttcn_buffer.cut();
OCTETSTRING tmp_os;
ttcn_buffer.get_string(tmp_os);
TTCN_Logger::begin_event_log2str();
tmp_os.log();
CHARSTRING remaining_stream = TTCN_Logger::end_event_log2str();
TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_EXTRA_DATA, "dec_LapdmFrameBter(): Data remained at the end of the stream after successful decoding: %s", (const char*) remaining_stream);
}
}
return ret_val;
}

void LapdmFrame_encoder(const LapdmFrame& 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 `@LAPDm_Types.LapdmFrame' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(LapdmFrame_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER LapdmFrame_decoder(OCTETSTRING& input_stream, LapdmFrame& 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 `@LAPDm_Types.LapdmFrame' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(LapdmFrame_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;
}
}

OCTETSTRING enc__LapdmFrame(const LapdmFrame& si)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("enc_LapdmFrame(): Encoding @LAPDm_Types.LapdmFrame: ");
si.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_Buffer ttcn_buffer;
si.encode(LapdmFrame_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW, 0);
OCTETSTRING ret_val;
ttcn_buffer.get_string(ret_val);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("enc_LapdmFrame(): Stream after encoding: ");
ret_val.log();
TTCN_Logger::end_event();
}
return ret_val;
}

LapdmFrame_template ts__LAPDm__SABM(const INTEGER& sapi, const BOOLEAN& c__r, const BOOLEAN& p, const OCTETSTRING& l3)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 236, TTCN_Location::LOCATION_TEMPLATE, "ts_LAPDm_SABM");
LapdmFrame_template ret_val;
{
LapdmFrameAB_template& tmp_19 = ret_val.ab();
tmp_19.addr() = ts__LapdmAddr(sapi, c__r);
tmp_19.ctrl() = ts__LapdmCtrlSABM(p);
tmp_19.len() = 0;
tmp_19.m() = FALSE;
tmp_19.el() = 1;
tmp_19.payload() = l3;
tmp_19.padding() = os_0;
}
return ret_val;
}

LapdmFrame_template tr__LAPDm__SABM(const INTEGER_template& sapi, const BOOLEAN_template& c__r, const BOOLEAN_template& p, const OCTETSTRING_template& l3)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 248, TTCN_Location::LOCATION_TEMPLATE, "tr_LAPDm_SABM");
LapdmFrame_template ret_val;
{
LapdmFrameAB_template& tmp_20 = ret_val.ab();
tmp_20.addr() = tr__LapdmAddr(sapi, c__r);
tmp_20.ctrl() = tr__LapdmCtrlSABM(p);
tmp_20.len() = ANY_VALUE;
tmp_20.m() = FALSE;
tmp_20.el() = 1;
tmp_20.payload() = l3;
tmp_20.padding() = ANY_VALUE;
}
return ret_val;
}

LapdmFrame_template ts__LAPDm__UA(const INTEGER& sapi, const BOOLEAN& c__r, const BOOLEAN& f, const OCTETSTRING& l3)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 261, TTCN_Location::LOCATION_TEMPLATE, "ts_LAPDm_UA");
LapdmFrame_template ret_val;
{
LapdmFrameAB_template& tmp_21 = ret_val.ab();
tmp_21.addr() = ts__LapdmAddr(sapi, c__r);
tmp_21.ctrl() = ts__LapdmCtrlUA(f);
tmp_21.len() = 0;
tmp_21.m() = FALSE;
tmp_21.el() = 1;
tmp_21.payload() = l3;
tmp_21.padding() = os_0;
}
return ret_val;
}

LapdmFrame_template tr__LAPDm__UA(const INTEGER_template& sapi, const BOOLEAN_template& c__r, const BOOLEAN_template& f, const OCTETSTRING_template& l3)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 273, TTCN_Location::LOCATION_TEMPLATE, "tr_LAPDm_UA");
LapdmFrame_template ret_val;
{
LapdmFrameAB_template& tmp_22 = ret_val.ab();
tmp_22.addr() = tr__LapdmAddr(sapi, c__r);
tmp_22.ctrl() = tr__LapdmCtrlUA(f);
tmp_22.len() = ANY_VALUE;
tmp_22.m() = FALSE;
tmp_22.el() = 1;
tmp_22.payload() = l3;
tmp_22.padding() = ANY_VALUE;
}
return ret_val;
}

LapdmFrame_template ts__LAPDm__DM(const INTEGER& sapi, const BOOLEAN& c__r, const BOOLEAN& f)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 286, TTCN_Location::LOCATION_TEMPLATE, "ts_LAPDm_DM");
LapdmFrame_template ret_val;
{
LapdmFrameAB_template& tmp_23 = ret_val.ab();
tmp_23.addr() = ts__LapdmAddr(sapi, c__r);
tmp_23.ctrl() = ts__LapdmCtrlDM(f);
tmp_23.len() = 0;
tmp_23.m() = FALSE;
tmp_23.el() = 1;
tmp_23.payload() = os_0;
tmp_23.padding() = os_0;
}
return ret_val;
}

LapdmFrame_template tr__LAPDm__DM(const INTEGER_template& sapi, const BOOLEAN_template& c__r, const BOOLEAN_template& f)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 297, TTCN_Location::LOCATION_TEMPLATE, "tr_LAPDm_DM");
LapdmFrame_template ret_val;
{
LapdmFrameAB_template& tmp_24 = ret_val.ab();
tmp_24.addr() = tr__LapdmAddr(sapi, c__r);
tmp_24.ctrl() = tr__LapdmCtrlDM(f);
tmp_24.len() = ANY_VALUE;
tmp_24.m() = FALSE;
tmp_24.el() = 1;
tmp_24.payload() = os_0;
tmp_24.padding() = ANY_VALUE;
}
return ret_val;
}

LapdmFrame_template ts__LAPDm__DISC(const INTEGER& sapi, const BOOLEAN& c__r, const BOOLEAN& p)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 310, TTCN_Location::LOCATION_TEMPLATE, "ts_LAPDm_DISC");
LapdmFrame_template ret_val;
{
LapdmFrameAB_template& tmp_25 = ret_val.ab();
tmp_25.addr() = ts__LapdmAddr(sapi, c__r);
tmp_25.ctrl() = ts__LapdmCtrlDISC(p);
tmp_25.len() = 0;
tmp_25.m() = FALSE;
tmp_25.el() = 1;
tmp_25.payload() = os_0;
tmp_25.padding() = os_0;
}
return ret_val;
}

LapdmFrame_template tr__LAPDm__DISC(const INTEGER_template& sapi, const BOOLEAN_template& c__r, const BOOLEAN_template& p)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 321, TTCN_Location::LOCATION_TEMPLATE, "tr_LAPDm_DISC");
LapdmFrame_template ret_val;
{
LapdmFrameAB_template& tmp_26 = ret_val.ab();
tmp_26.addr() = tr__LapdmAddr(sapi, c__r);
tmp_26.ctrl() = tr__LapdmCtrlDISC(p);
tmp_26.len() = ANY_VALUE;
tmp_26.m() = FALSE;
tmp_26.el() = 1;
tmp_26.payload() = os_0;
tmp_26.padding() = ANY_VALUE;
}
return ret_val;
}

LapdmFrame_template ts__LAPDm__UI(const INTEGER& sapi, const BOOLEAN& c__r, const OCTETSTRING& l3)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 334, TTCN_Location::LOCATION_TEMPLATE, "ts_LAPDm_UI");
LapdmFrame_template ret_val;
{
LapdmFrameAB_template& tmp_27 = ret_val.ab();
tmp_27.addr() = ts__LapdmAddr(sapi, c__r);
tmp_27.ctrl() = ts__LapdmCtrlUI(ts__LapdmCtrlUI_p_defval);
tmp_27.len() = 0;
tmp_27.m() = FALSE;
tmp_27.el() = 1;
tmp_27.payload() = l3;
tmp_27.padding() = os_0;
}
return ret_val;
}

LapdmFrame_template tr__LAPDm__UI(const INTEGER_template& sapi, const BOOLEAN_template& c__r, const OCTETSTRING_template& l3)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 345, TTCN_Location::LOCATION_TEMPLATE, "tr_LAPDm_UI");
LapdmFrame_template ret_val;
{
LapdmFrameAB_template& tmp_28 = ret_val.ab();
tmp_28.addr() = tr__LapdmAddr(sapi, c__r);
tmp_28.ctrl() = tr__LapdmCtrlUI(tr__LapdmCtrlUI_p_defval);
tmp_28.len() = ANY_VALUE;
tmp_28.m() = FALSE;
tmp_28.el() = 1;
tmp_28.payload() = l3;
tmp_28.padding() = ANY_VALUE;
}
return ret_val;
}

LapdmFrame_template ts__LAPDm__B4__UI(const INTEGER& sapi, const BOOLEAN& c__r, const OCTETSTRING& l3)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 358, TTCN_Location::LOCATION_TEMPLATE, "ts_LAPDm_B4_UI");
LapdmFrame_template ret_val;
{
LapdmFrameB4_template& tmp_29 = ret_val.b4();
tmp_29.addr() = ts__LapdmAddr(sapi, c__r);
tmp_29.ctrl() = ts__LapdmCtrlUI(ts__LapdmCtrlUI_p_defval);
tmp_29.payload() = l3;
}
return ret_val;
}

LapdmFrame_template tr__LAPDm__B4__UI(const INTEGER_template& sapi, const BOOLEAN_template& c__r, const OCTETSTRING_template& l3)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 365, TTCN_Location::LOCATION_TEMPLATE, "tr_LAPDm_B4_UI");
LapdmFrame_template ret_val;
{
LapdmFrameB4_template& tmp_30 = ret_val.b4();
tmp_30.addr() = tr__LapdmAddr(sapi, c__r);
tmp_30.ctrl() = tr__LapdmCtrlUI(tr__LapdmCtrlUI_p_defval);
tmp_30.payload() = l3;
}
return ret_val;
}

LapdmFrame_template ts__LAPDm__Bter__UI(const OCTETSTRING& l3)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 374, TTCN_Location::LOCATION_TEMPLATE, "ts_LAPDm_Bter_UI");
LapdmFrame_template ret_val;
ret_val.bter().payload() = l3;
return ret_val;
}

LapdmFrame_template tr__LAPDm__Bter__UI(const OCTETSTRING_template& l3)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 379, TTCN_Location::LOCATION_TEMPLATE, "tr_LAPDm_Bter_UI");
LapdmFrame_template ret_val;
ret_val.bter().payload() = l3;
return ret_val;
}

LapdmFrame_template tr__LAPDm__I(const INTEGER_template& sapi, const BOOLEAN_template& c__r, const BOOLEAN_template& p, const INTEGER_template& nr, const INTEGER_template& ns, const OCTETSTRING_template& l3, const BOOLEAN& m)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 385, TTCN_Location::LOCATION_TEMPLATE, "tr_LAPDm_I");
LapdmFrame_template ret_val;
{
LapdmFrameAB_template& tmp_31 = ret_val.ab();
tmp_31.addr() = tr__LapdmAddr(sapi, c__r);
tmp_31.ctrl() = tr__LapdmCtrlI(nr, ns, p);
tmp_31.len() = ANY_VALUE;
tmp_31.m() = m;
tmp_31.el() = 1;
tmp_31.payload() = l3;
tmp_31.padding() = ANY_VALUE;
}
return ret_val;
}

LapdmFrame_template ts__LAPDm__I(const INTEGER& sapi, const BOOLEAN& c__r, const BOOLEAN& p, const INTEGER& nr, const INTEGER& ns, const OCTETSTRING& l3, const BOOLEAN& m)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 399, TTCN_Location::LOCATION_TEMPLATE, "ts_LAPDm_I");
LapdmFrame_template ret_val;
{
LapdmFrameAB_template& tmp_32 = ret_val.ab();
tmp_32.addr() = ts__LapdmAddr(sapi, c__r);
tmp_32.ctrl() = ts__LapdmCtrlI(nr, ns, p);
tmp_32.len() = 0;
tmp_32.m() = m;
tmp_32.el() = 1;
tmp_32.payload() = l3;
tmp_32.padding() = os_0;
}
return ret_val;
}

LapdmFrame_template tr__LAPDm__RR(const INTEGER_template& sapi, const BOOLEAN_template& c__r, const BOOLEAN_template& p, const INTEGER_template& nr)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 412, TTCN_Location::LOCATION_TEMPLATE, "tr_LAPDm_RR");
LapdmFrame_template ret_val;
{
LapdmFrameAB_template& tmp_33 = ret_val.ab();
tmp_33.addr() = tr__LapdmAddr(sapi, c__r);
tmp_33.ctrl() = tr__LapdmCtrlRR(nr, p);
tmp_33.len() = 0;
tmp_33.m() = FALSE;
tmp_33.el() = 1;
tmp_33.payload() = os_0;
tmp_33.padding() = ANY_VALUE;
}
return ret_val;
}

LapdmFrame_template ts__LAPDm__RR(const INTEGER& sapi, const BOOLEAN& c__r, const BOOLEAN& p, const INTEGER& nr)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 424, TTCN_Location::LOCATION_TEMPLATE, "ts_LAPDm_RR");
LapdmFrame_template ret_val;
{
LapdmFrameAB_template& tmp_34 = ret_val.ab();
tmp_34.addr() = ts__LapdmAddr(sapi, c__r);
tmp_34.ctrl() = ts__LapdmCtrlRR(nr, p);
tmp_34.len() = 0;
tmp_34.m() = FALSE;
tmp_34.el() = 1;
tmp_34.payload() = os_0;
tmp_34.padding() = os_0;
}
return ret_val;
}

LapdmFrame_template tr__LAPDm__REJ(const INTEGER_template& sapi, const BOOLEAN_template& c__r, const BOOLEAN_template& p, const INTEGER_template& nr)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 437, TTCN_Location::LOCATION_TEMPLATE, "tr_LAPDm_REJ");
LapdmFrame_template ret_val;
{
LapdmFrameAB_template& tmp_35 = ret_val.ab();
tmp_35.addr() = tr__LapdmAddr(sapi, c__r);
tmp_35.ctrl() = tr__LapdmCtrlREJ(nr, p);
tmp_35.len() = 0;
tmp_35.m() = FALSE;
tmp_35.el() = 1;
tmp_35.payload() = os_0;
tmp_35.padding() = ANY_VALUE;
}
return ret_val;
}

LapdmFrame_template ts__LAPDm__REJ(const INTEGER& sapi, const BOOLEAN& c__r, const BOOLEAN& p, const INTEGER& nr)
{
TTCN_Location current_location("LAPDm_Types.ttcn", 449, TTCN_Location::LOCATION_TEMPLATE, "ts_LAPDm_REJ");
LapdmFrame_template ret_val;
{
LapdmFrameAB_template& tmp_36 = ret_val.ab();
tmp_36.addr() = ts__LapdmAddr(sapi, c__r);
tmp_36.ctrl() = ts__LapdmCtrlREJ(nr, p);
tmp_36.len() = 0;
tmp_36.m() = FALSE;
tmp_36.el() = 1;
tmp_36.payload() = os_0;
tmp_36.padding() = os_0;
}
return ret_val;
}


/* Bodies of static functions */

void pre_init_module()
{
TTCN_Location current_location("LAPDm_Types.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "LAPDm_Types");
Osmocom__Types::module_object.pre_init_module();
current_location.update_lineno(22);
/* LAPDm_Types.ttcn, line 22 */
const_cr__MO__CMD = FALSE;
current_location.update_lineno(23);
/* LAPDm_Types.ttcn, line 23 */
const_cr__MO__RSP = TRUE;
current_location.update_lineno(24);
/* LAPDm_Types.ttcn, line 24 */
const_cr__MT__CMD = TRUE;
current_location.update_lineno(25);
/* LAPDm_Types.ttcn, line 25 */
const_cr__MT__RSP = FALSE;
module_object.add_function("dec_LapdmAddressField", (genericfunc_t)&dec__LapdmAddressField, NULL);
module_object.add_function("dec_LapdmCtrl", (genericfunc_t)&dec__LapdmCtrl, NULL);
module_object.add_function("dec_LapdmCtrlU", (genericfunc_t)&dec__LapdmCtrlU, NULL);
module_object.add_function("enc_LapdmFrameAB", (genericfunc_t)&enc__LapdmFrameAB, NULL);
module_object.add_function("dec_LapdmFrameAB", (genericfunc_t)&dec__LapdmFrameAB, NULL);
module_object.add_function("enc_LapdmFrameB4", (genericfunc_t)&enc__LapdmFrameB4, NULL);
module_object.add_function("dec_LapdmFrameB4", (genericfunc_t)&dec__LapdmFrameB4, NULL);
module_object.add_function("enc_LapdmFrameBbis", (genericfunc_t)&enc__LapdmFrameBbis, NULL);
module_object.add_function("dec_LapdmFrameBbis", (genericfunc_t)&dec__LapdmFrameBbis, NULL);
module_object.add_function("enc_LapdmFrameBter", (genericfunc_t)&enc__LapdmFrameBter, NULL);
module_object.add_function("dec_LapdmFrameBter", (genericfunc_t)&dec__LapdmFrameBter, NULL);
module_object.add_function("enc_LapdmFrame", (genericfunc_t)&enc__LapdmFrame, NULL);
}

void post_init_module()
{
TTCN_Location current_location("LAPDm_Types.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "LAPDm_Types");
Osmocom__Types::module_object.post_init_module();
current_location.update_lineno(87);
/* LAPDm_Types.ttcn, line 87 */
{
LapdmCtrlS_template& tmp_0 = template_tr__LapdmCtrlS.s();
tmp_0.n__r() = ANY_VALUE;
tmp_0.p__f() = ANY_VALUE;
tmp_0.s() = ANY_VALUE;
tmp_0.spare() = bs_1;
}
current_location.update_lineno(91);
/* LAPDm_Types.ttcn, line 91 */
{
LapdmCtrlU_template& tmp_1 = template_tr__LapdmCtrlU.u();
tmp_1.u() = ANY_VALUE;
tmp_1.p__f() = ANY_VALUE;
tmp_1.u2() = ANY_VALUE;
tmp_1.spare() = bs_0;
}
current_location.update_lineno(137);
/* LAPDm_Types.ttcn, line 137 */
template_tr__LapdmCtrlUI_p_defval = FALSE;
current_location.update_lineno(140);
/* LAPDm_Types.ttcn, line 140 */
const_ts__LapdmCtrlUI_p_defval = FALSE;
current_location.update_lineno(388);
/* LAPDm_Types.ttcn, line 388 */
const_tr__LAPDm__I_m_defval = FALSE;
current_location.update_lineno(400);
/* LAPDm_Types.ttcn, line 400 */
const_ts__LAPDm__I_m_defval = FALSE;
}


} /* end of namespace */
