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

namespace L1CTL__Types {

/* Literal string constants */

const unsigned char bs_1_bits[] = { 0 },
bs_2_bits[] = { 0 },
bs_0_bits[] = { 0 },
bs_3_bits[] = { 0 };
extern const BITSTRING bs_1(4, bs_1_bits),
bs_2(5, bs_2_bits),
bs_0(7, bs_0_bits),
bs_3(8, bs_3_bits);
const unsigned char os_3_octets[] = { 0 },
os_0_octets[] = { 0, 0 },
os_1_octets[] = { 0, 0, 0 },
os_4_octets[] = { 3, 3, 1, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43 };
extern const OCTETSTRING os_2(0, NULL),
os_3(1, os_3_octets),
os_0(2, os_0_octets),
os_1(3, os_1_octets),
os_4(23, os_4_octets);
const unsigned char module_checksum[] = { 0x57, 0xab, 0xc2, 0x9b, 0xc2, 0x76, 0x75, 0xc9, 0x2a, 0x76, 0x7f, 0x0c, 0x3e, 0x76, 0xd9, 0x33 };

/* Global variable definitions */

const TTCN_RAWdescriptor_t L1ctlMsgType_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for L1ctlMsgType
const TTCN_Typedescriptor_t L1ctlMsgType_descr_ = { "@L1CTL_Types.L1ctlMsgType", NULL, &L1ctlMsgType_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlMsgType_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlCcchMode_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for L1ctlCcchMode
const TTCN_Typedescriptor_t L1ctlCcchMode_descr_ = { "@L1CTL_Types.L1ctlCcchMode", NULL, &L1ctlCcchMode_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlCcchMode_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlNeighMode_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for L1ctlNeighMode
const TTCN_Typedescriptor_t L1ctlNeighMode_descr_ = { "@L1CTL_Types.L1ctlNeighMode", NULL, &L1ctlNeighMode_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlNeighMode_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlResetType_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for L1ctlResetType
const TTCN_Typedescriptor_t L1ctlResetType_descr_ = { "@L1CTL_Types.L1ctlResetType", NULL, &L1ctlResetType_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlResetType_default_coding("RAW");
const XERdescriptor_t       L1ctlHdrFlags_padding_xer_ = { {"padding>\n", "padding>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlHdrFlags_padding_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlHdrFlags_padding_descr_ = { "@L1CTL_Types.L1ctlHdrFlags.padding", &BITSTRING_ber_, &General__Types::BIT7_raw_, NULL, &L1ctlHdrFlags_padding_xer_, &BITSTRING_json_, &L1ctlHdrFlags_padding_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlHdrFlags_padding_default_coding("RAW");
const XERdescriptor_t       L1ctlHdrFlags_f__done_xer_ = { {"f_done>\n", "f_done>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1ctlHdrFlags_f__done_oer_ext_arr_[0] = {};
const int L1ctlHdrFlags_f__done_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlHdrFlags_f__done_oer_ = { -1, TRUE, -1, FALSE, 0, 0, L1ctlHdrFlags_f__done_oer_ext_arr_, 0, L1ctlHdrFlags_f__done_oer_p_};
const TTCN_Typedescriptor_t L1ctlHdrFlags_f__done_descr_ = { "@L1CTL_Types.L1ctlHdrFlags.f_done", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &L1ctlHdrFlags_f__done_xer_, &BOOLEAN_json_, &L1ctlHdrFlags_f__done_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlHdrFlags_f__done_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlHdrFlags_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 L1ctlHdrFlags
const TTCN_Typedescriptor_t L1ctlHdrFlags_descr_ = { "@L1CTL_Types.L1ctlHdrFlags", NULL, &L1ctlHdrFlags_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlHdrFlags_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlHeader_msg__type_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlHeader_flags_default_coding("RAW");
const XERdescriptor_t       L1ctlHeader_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 L1ctlHeader_padding_oer_ext_arr_[0] = {};
const int L1ctlHeader_padding_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlHeader_padding_oer_ = { -1, TRUE, 2, FALSE, 0, 0, L1ctlHeader_padding_oer_ext_arr_, 0, L1ctlHeader_padding_oer_p_};
const TTCN_Typedescriptor_t L1ctlHeader_padding_descr_ = { "@L1CTL_Types.L1ctlHeader.padding", &OCTETSTRING_ber_, &General__Types::OCT2_raw_, &OCTETSTRING_text_, &L1ctlHeader_padding_xer_, &OCTETSTRING_json_, &L1ctlHeader_padding_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlHeader_padding_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlHeader_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 L1ctlHeader
const TTCN_Typedescriptor_t L1ctlHeader_descr_ = { "@L1CTL_Types.L1ctlHeader", NULL, &L1ctlHeader_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlHeader_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlDlInfo_chan__nr_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlDlInfo_link__id_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlDlInfo_arfcn_default_coding("RAW");
const XERdescriptor_t       L1ctlDlInfo_frame__nr_xer_ = { {"frame_nr>\n", "frame_nr>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlDlInfo_frame__nr_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlDlInfo_frame__nr_descr_ = { "@L1CTL_Types.L1ctlDlInfo.frame_nr", &INTEGER_ber_, &Osmocom__Types::uint32__t_raw_, &INTEGER_text_, &L1ctlDlInfo_frame__nr_xer_, &INTEGER_json_, &L1ctlDlInfo_frame__nr_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlDlInfo_frame__nr_default_coding("RAW");
const XERdescriptor_t       L1ctlDlInfo_rx__level_xer_ = { {"rx_level>\n", "rx_level>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlDlInfo_rx__level_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlDlInfo_rx__level_descr_ = { "@L1CTL_Types.L1ctlDlInfo.rx_level", &INTEGER_ber_, &GSM__Types::GsmRxLev_raw_, &INTEGER_text_, &L1ctlDlInfo_rx__level_xer_, &INTEGER_json_, &L1ctlDlInfo_rx__level_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlDlInfo_rx__level_default_coding("RAW");
const XERdescriptor_t       L1ctlDlInfo_snr_xer_ = { {"snr>\n", "snr>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlDlInfo_snr_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlDlInfo_snr_descr_ = { "@L1CTL_Types.L1ctlDlInfo.snr", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlDlInfo_snr_xer_, &INTEGER_json_, &L1ctlDlInfo_snr_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlDlInfo_snr_default_coding("RAW");
const XERdescriptor_t       L1ctlDlInfo_num__biterr_xer_ = { {"num_biterr>\n", "num_biterr>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlDlInfo_num__biterr_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlDlInfo_num__biterr_descr_ = { "@L1CTL_Types.L1ctlDlInfo.num_biterr", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlDlInfo_num__biterr_xer_, &INTEGER_json_, &L1ctlDlInfo_num__biterr_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlDlInfo_num__biterr_default_coding("RAW");
const XERdescriptor_t       L1ctlDlInfo_fire__crc_xer_ = { {"fire_crc>\n", "fire_crc>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlDlInfo_fire__crc_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlDlInfo_fire__crc_descr_ = { "@L1CTL_Types.L1ctlDlInfo.fire_crc", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlDlInfo_fire__crc_xer_, &INTEGER_json_, &L1ctlDlInfo_fire__crc_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlDlInfo_fire__crc_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlDlInfo_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 L1ctlDlInfo
const TTCN_Typedescriptor_t L1ctlDlInfo_descr_ = { "@L1CTL_Types.L1ctlDlInfo", NULL, &L1ctlDlInfo_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlDlInfo_default_coding("RAW");
const XERdescriptor_t       L1ctlFbsbConf_initial__freq__err_xer_ = { {"initial_freq_err>\n", "initial_freq_err>\n"}, {18, 18}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlFbsbConf_initial__freq__err_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlFbsbConf_initial__freq__err_descr_ = { "@L1CTL_Types.L1ctlFbsbConf.initial_freq_err", &INTEGER_ber_, &Osmocom__Types::int16__t_raw_, &INTEGER_text_, &L1ctlFbsbConf_initial__freq__err_xer_, &INTEGER_json_, &L1ctlFbsbConf_initial__freq__err_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlFbsbConf_initial__freq__err_default_coding("RAW");
const XERdescriptor_t       L1ctlFbsbConf_result_xer_ = { {"result>\n", "result>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlFbsbConf_result_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlFbsbConf_result_descr_ = { "@L1CTL_Types.L1ctlFbsbConf.result", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlFbsbConf_result_xer_, &INTEGER_json_, &L1ctlFbsbConf_result_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlFbsbConf_result_default_coding("RAW");
const XERdescriptor_t       L1ctlFbsbConf_bsic_xer_ = { {"bsic>\n", "bsic>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlFbsbConf_bsic_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlFbsbConf_bsic_descr_ = { "@L1CTL_Types.L1ctlFbsbConf.bsic", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlFbsbConf_bsic_xer_, &INTEGER_json_, &L1ctlFbsbConf_bsic_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlFbsbConf_bsic_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlFbsbConf_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 L1ctlFbsbConf
const TTCN_Typedescriptor_t L1ctlFbsbConf_descr_ = { "@L1CTL_Types.L1ctlFbsbConf", NULL, &L1ctlFbsbConf_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlFbsbConf_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlCcchModeConf_ccch__mode_default_coding("RAW");
const XERdescriptor_t       L1ctlCcchModeConf_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 L1ctlCcchModeConf_padding_oer_ext_arr_[0] = {};
const int L1ctlCcchModeConf_padding_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlCcchModeConf_padding_oer_ = { -1, TRUE, 3, FALSE, 0, 0, L1ctlCcchModeConf_padding_oer_ext_arr_, 0, L1ctlCcchModeConf_padding_oer_p_};
const TTCN_Typedescriptor_t L1ctlCcchModeConf_padding_descr_ = { "@L1CTL_Types.L1ctlCcchModeConf.padding", &OCTETSTRING_ber_, &General__Types::OCT3_raw_, &OCTETSTRING_text_, &L1ctlCcchModeConf_padding_xer_, &OCTETSTRING_json_, &L1ctlCcchModeConf_padding_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlCcchModeConf_padding_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlCcchModeConf_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 L1ctlCcchModeConf
const TTCN_Typedescriptor_t L1ctlCcchModeConf_descr_ = { "@L1CTL_Types.L1ctlCcchModeConf", NULL, &L1ctlCcchModeConf_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlCcchModeConf_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlTchMode_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for L1ctlTchMode
const TTCN_Typedescriptor_t L1ctlTchMode_descr_ = { "@L1CTL_Types.L1ctlTchMode", NULL, &L1ctlTchMode_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlTchMode_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlLoopMode_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for L1ctlLoopMode
const TTCN_Typedescriptor_t L1ctlLoopMode_descr_ = { "@L1CTL_Types.L1ctlLoopMode", NULL, &L1ctlLoopMode_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlLoopMode_default_coding("RAW");
const XERdescriptor_t       L1ctlAudioMode_padding_xer_ = { {"padding>\n", "padding>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlAudioMode_padding_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlAudioMode_padding_descr_ = { "@L1CTL_Types.L1ctlAudioMode.padding", &BITSTRING_ber_, &General__Types::BIT4_raw_, NULL, &L1ctlAudioMode_padding_xer_, &BITSTRING_json_, &L1ctlAudioMode_padding_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlAudioMode_padding_default_coding("RAW");
const XERdescriptor_t       L1ctlAudioMode_tx__microphone_xer_ = { {"tx_microphone>\n", "tx_microphone>\n"}, {15, 15}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1ctlAudioMode_tx__microphone_oer_ext_arr_[0] = {};
const int L1ctlAudioMode_tx__microphone_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlAudioMode_tx__microphone_oer_ = { -1, TRUE, -1, FALSE, 0, 0, L1ctlAudioMode_tx__microphone_oer_ext_arr_, 0, L1ctlAudioMode_tx__microphone_oer_p_};
const TTCN_Typedescriptor_t L1ctlAudioMode_tx__microphone_descr_ = { "@L1CTL_Types.L1ctlAudioMode.tx_microphone", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &L1ctlAudioMode_tx__microphone_xer_, &BOOLEAN_json_, &L1ctlAudioMode_tx__microphone_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlAudioMode_tx__microphone_default_coding("RAW");
const XERdescriptor_t       L1ctlAudioMode_tx__traffic__req_xer_ = { {"tx_traffic_req>\n", "tx_traffic_req>\n"}, {16, 16}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1ctlAudioMode_tx__traffic__req_oer_ext_arr_[0] = {};
const int L1ctlAudioMode_tx__traffic__req_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlAudioMode_tx__traffic__req_oer_ = { -1, TRUE, -1, FALSE, 0, 0, L1ctlAudioMode_tx__traffic__req_oer_ext_arr_, 0, L1ctlAudioMode_tx__traffic__req_oer_p_};
const TTCN_Typedescriptor_t L1ctlAudioMode_tx__traffic__req_descr_ = { "@L1CTL_Types.L1ctlAudioMode.tx_traffic_req", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &L1ctlAudioMode_tx__traffic__req_xer_, &BOOLEAN_json_, &L1ctlAudioMode_tx__traffic__req_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlAudioMode_tx__traffic__req_default_coding("RAW");
const XERdescriptor_t       L1ctlAudioMode_rx__speaker_xer_ = { {"rx_speaker>\n", "rx_speaker>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1ctlAudioMode_rx__speaker_oer_ext_arr_[0] = {};
const int L1ctlAudioMode_rx__speaker_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlAudioMode_rx__speaker_oer_ = { -1, TRUE, -1, FALSE, 0, 0, L1ctlAudioMode_rx__speaker_oer_ext_arr_, 0, L1ctlAudioMode_rx__speaker_oer_p_};
const TTCN_Typedescriptor_t L1ctlAudioMode_rx__speaker_descr_ = { "@L1CTL_Types.L1ctlAudioMode.rx_speaker", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &L1ctlAudioMode_rx__speaker_xer_, &BOOLEAN_json_, &L1ctlAudioMode_rx__speaker_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlAudioMode_rx__speaker_default_coding("RAW");
const XERdescriptor_t       L1ctlAudioMode_rx__traffic__ind_xer_ = { {"rx_traffic_ind>\n", "rx_traffic_ind>\n"}, {16, 16}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1ctlAudioMode_rx__traffic__ind_oer_ext_arr_[0] = {};
const int L1ctlAudioMode_rx__traffic__ind_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlAudioMode_rx__traffic__ind_oer_ = { -1, TRUE, -1, FALSE, 0, 0, L1ctlAudioMode_rx__traffic__ind_oer_ext_arr_, 0, L1ctlAudioMode_rx__traffic__ind_oer_p_};
const TTCN_Typedescriptor_t L1ctlAudioMode_rx__traffic__ind_descr_ = { "@L1CTL_Types.L1ctlAudioMode.rx_traffic_ind", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &L1ctlAudioMode_rx__traffic__ind_xer_, &BOOLEAN_json_, &L1ctlAudioMode_rx__traffic__ind_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlAudioMode_rx__traffic__ind_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlAudioMode_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 L1ctlAudioMode
const TTCN_Typedescriptor_t L1ctlAudioMode_descr_ = { "@L1CTL_Types.L1ctlAudioMode", NULL, &L1ctlAudioMode_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlAudioMode_default_coding("RAW");
L1ctlAudioMode_template template_t__L1CTL__AudioModeNone;
const L1ctlAudioMode_template& t__L1CTL__AudioModeNone = template_t__L1CTL__AudioModeNone;
L1ctlAudioMode_template template_t__L1CTL__AudioModeFwd;
const L1ctlAudioMode_template& t__L1CTL__AudioModeFwd = template_t__L1CTL__AudioModeFwd;
UNIVERSAL_CHARSTRING L1ctlTchModeConf_tch__mode_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlTchModeConf_audio__mode_default_coding("RAW");
const XERdescriptor_t       L1ctlTchModeConf_amr_start__codec_xer_ = { {"start_codec>\n", "start_codec>\n"}, {13, 13}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlTchModeConf_amr_start__codec_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlTchModeConf_amr_start__codec_descr_ = { "@L1CTL_Types.L1ctlTchModeConf.amr.start_codec", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlTchModeConf_amr_start__codec_xer_, &INTEGER_json_, &L1ctlTchModeConf_amr_start__codec_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlTchModeConf_amr_start__codec_default_coding("RAW");
const XERdescriptor_t       L1ctlTchModeConf_amr_codecs__bitmask_xer_ = { {"codecs_bitmask>\n", "codecs_bitmask>\n"}, {16, 16}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlTchModeConf_amr_codecs__bitmask_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlTchModeConf_amr_codecs__bitmask_descr_ = { "@L1CTL_Types.L1ctlTchModeConf.amr.codecs_bitmask", &BITSTRING_ber_, &General__Types::BIT8_raw_, NULL, &L1ctlTchModeConf_amr_codecs__bitmask_xer_, &BITSTRING_json_, &L1ctlTchModeConf_amr_codecs__bitmask_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlTchModeConf_amr_codecs__bitmask_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlTchModeConf_amr_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 L1ctlTchModeConf_amr
const TTCN_Typedescriptor_t L1ctlTchModeConf_amr_descr_ = { "@L1CTL_Types.L1ctlTchModeConf.amr", NULL, &L1ctlTchModeConf_amr_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlTchModeConf_amr_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlTchModeConf_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 L1ctlTchModeConf
const TTCN_Typedescriptor_t L1ctlTchModeConf_descr_ = { "@L1CTL_Types.L1ctlTchModeConf", NULL, &L1ctlTchModeConf_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlTchModeConf_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlDataInd_payload_raw_ = {0,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       L1ctlDataInd_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 L1ctlDataInd_payload_oer_ext_arr_[0] = {};
const int L1ctlDataInd_payload_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlDataInd_payload_oer_ = { -1, TRUE, -1, FALSE, 0, 0, L1ctlDataInd_payload_oer_ext_arr_, 0, L1ctlDataInd_payload_oer_p_};
const TTCN_Typedescriptor_t L1ctlDataInd_payload_descr_ = { "@L1CTL_Types.L1ctlDataInd.payload", &OCTETSTRING_ber_, &L1ctlDataInd_payload_raw_, &OCTETSTRING_text_, &L1ctlDataInd_payload_xer_, &OCTETSTRING_json_, &L1ctlDataInd_payload_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlDataInd_payload_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlDataInd_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 L1ctlDataInd
const TTCN_Typedescriptor_t L1ctlDataInd_descr_ = { "@L1CTL_Types.L1ctlDataInd", NULL, &L1ctlDataInd_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlDataInd_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlUlInfo_chan__nr_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlUlInfo_link__id_default_coding("RAW");
const XERdescriptor_t       L1ctlUlInfo_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 L1ctlUlInfo_padding_oer_ext_arr_[0] = {};
const int L1ctlUlInfo_padding_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlUlInfo_padding_oer_ = { -1, TRUE, 2, FALSE, 0, 0, L1ctlUlInfo_padding_oer_ext_arr_, 0, L1ctlUlInfo_padding_oer_p_};
const TTCN_Typedescriptor_t L1ctlUlInfo_padding_descr_ = { "@L1CTL_Types.L1ctlUlInfo.padding", &OCTETSTRING_ber_, &General__Types::OCT2_raw_, &OCTETSTRING_text_, &L1ctlUlInfo_padding_xer_, &OCTETSTRING_json_, &L1ctlUlInfo_padding_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlUlInfo_padding_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlUlInfo_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 L1ctlUlInfo
const TTCN_Typedescriptor_t L1ctlUlInfo_descr_ = { "@L1CTL_Types.L1ctlUlInfo", NULL, &L1ctlUlInfo_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlUlInfo_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlFbsbFlags_padding_raw_ = {5,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,5,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       L1ctlFbsbFlags_padding_xer_ = { {"padding>\n", "padding>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlFbsbFlags_padding_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlFbsbFlags_padding_descr_ = { "@L1CTL_Types.L1ctlFbsbFlags.padding", &BITSTRING_ber_, &L1ctlFbsbFlags_padding_raw_, NULL, &L1ctlFbsbFlags_padding_xer_, &BITSTRING_json_, &L1ctlFbsbFlags_padding_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlFbsbFlags_padding_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlFbsbFlags_sb_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       L1ctlFbsbFlags_sb_xer_ = { {"sb>\n", "sb>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1ctlFbsbFlags_sb_oer_ext_arr_[0] = {};
const int L1ctlFbsbFlags_sb_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlFbsbFlags_sb_oer_ = { -1, TRUE, -1, FALSE, 0, 0, L1ctlFbsbFlags_sb_oer_ext_arr_, 0, L1ctlFbsbFlags_sb_oer_p_};
const TTCN_Typedescriptor_t L1ctlFbsbFlags_sb_descr_ = { "@L1CTL_Types.L1ctlFbsbFlags.sb", &BOOLEAN_ber_, &L1ctlFbsbFlags_sb_raw_, &BOOLEAN_text_, &L1ctlFbsbFlags_sb_xer_, &BOOLEAN_json_, &L1ctlFbsbFlags_sb_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlFbsbFlags_sb_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlFbsbFlags_fb1_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       L1ctlFbsbFlags_fb1_xer_ = { {"fb1>\n", "fb1>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1ctlFbsbFlags_fb1_oer_ext_arr_[0] = {};
const int L1ctlFbsbFlags_fb1_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlFbsbFlags_fb1_oer_ = { -1, TRUE, -1, FALSE, 0, 0, L1ctlFbsbFlags_fb1_oer_ext_arr_, 0, L1ctlFbsbFlags_fb1_oer_p_};
const TTCN_Typedescriptor_t L1ctlFbsbFlags_fb1_descr_ = { "@L1CTL_Types.L1ctlFbsbFlags.fb1", &BOOLEAN_ber_, &L1ctlFbsbFlags_fb1_raw_, &BOOLEAN_text_, &L1ctlFbsbFlags_fb1_xer_, &BOOLEAN_json_, &L1ctlFbsbFlags_fb1_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlFbsbFlags_fb1_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlFbsbFlags_fb0_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       L1ctlFbsbFlags_fb0_xer_ = { {"fb0>\n", "fb0>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1ctlFbsbFlags_fb0_oer_ext_arr_[0] = {};
const int L1ctlFbsbFlags_fb0_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlFbsbFlags_fb0_oer_ = { -1, TRUE, -1, FALSE, 0, 0, L1ctlFbsbFlags_fb0_oer_ext_arr_, 0, L1ctlFbsbFlags_fb0_oer_p_};
const TTCN_Typedescriptor_t L1ctlFbsbFlags_fb0_descr_ = { "@L1CTL_Types.L1ctlFbsbFlags.fb0", &BOOLEAN_ber_, &L1ctlFbsbFlags_fb0_raw_, &BOOLEAN_text_, &L1ctlFbsbFlags_fb0_xer_, &BOOLEAN_json_, &L1ctlFbsbFlags_fb0_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlFbsbFlags_fb0_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlFbsbFlags_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 L1ctlFbsbFlags
const TTCN_Typedescriptor_t L1ctlFbsbFlags_descr_ = { "@L1CTL_Types.L1ctlFbsbFlags", NULL, &L1ctlFbsbFlags_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlFbsbFlags_default_coding("RAW");
L1ctlFbsbFlags_template template_t__L1CTL__FBSB__F__ALL;
const L1ctlFbsbFlags_template& t__L1CTL__FBSB__F__ALL = template_t__L1CTL__FBSB__F__ALL;
UNIVERSAL_CHARSTRING L1ctlFbsbReq_arfcn_default_coding("RAW");
const XERdescriptor_t       L1ctlFbsbReq_timeout__tdma__frames_xer_ = { {"timeout_tdma_frames>\n", "timeout_tdma_frames>\n"}, {21, 21}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlFbsbReq_timeout__tdma__frames_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlFbsbReq_timeout__tdma__frames_descr_ = { "@L1CTL_Types.L1ctlFbsbReq.timeout_tdma_frames", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &L1ctlFbsbReq_timeout__tdma__frames_xer_, &INTEGER_json_, &L1ctlFbsbReq_timeout__tdma__frames_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlFbsbReq_timeout__tdma__frames_default_coding("RAW");
const XERdescriptor_t       L1ctlFbsbReq_freq__err__thresh1_xer_ = { {"freq_err_thresh1>\n", "freq_err_thresh1>\n"}, {18, 18}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlFbsbReq_freq__err__thresh1_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlFbsbReq_freq__err__thresh1_descr_ = { "@L1CTL_Types.L1ctlFbsbReq.freq_err_thresh1", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &L1ctlFbsbReq_freq__err__thresh1_xer_, &INTEGER_json_, &L1ctlFbsbReq_freq__err__thresh1_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlFbsbReq_freq__err__thresh1_default_coding("RAW");
const XERdescriptor_t       L1ctlFbsbReq_freq__err__thresh2_xer_ = { {"freq_err_thresh2>\n", "freq_err_thresh2>\n"}, {18, 18}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlFbsbReq_freq__err__thresh2_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlFbsbReq_freq__err__thresh2_descr_ = { "@L1CTL_Types.L1ctlFbsbReq.freq_err_thresh2", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &L1ctlFbsbReq_freq__err__thresh2_xer_, &INTEGER_json_, &L1ctlFbsbReq_freq__err__thresh2_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlFbsbReq_freq__err__thresh2_default_coding("RAW");
const XERdescriptor_t       L1ctlFbsbReq_num__freqerr__avg_xer_ = { {"num_freqerr_avg>\n", "num_freqerr_avg>\n"}, {17, 17}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlFbsbReq_num__freqerr__avg_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlFbsbReq_num__freqerr__avg_descr_ = { "@L1CTL_Types.L1ctlFbsbReq.num_freqerr_avg", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlFbsbReq_num__freqerr__avg_xer_, &INTEGER_json_, &L1ctlFbsbReq_num__freqerr__avg_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlFbsbReq_num__freqerr__avg_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlFbsbReq_flags_default_coding("RAW");
const XERdescriptor_t       L1ctlFbsbReq_sync__info__idx_xer_ = { {"sync_info_idx>\n", "sync_info_idx>\n"}, {15, 15}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlFbsbReq_sync__info__idx_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlFbsbReq_sync__info__idx_descr_ = { "@L1CTL_Types.L1ctlFbsbReq.sync_info_idx", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlFbsbReq_sync__info__idx_xer_, &INTEGER_json_, &L1ctlFbsbReq_sync__info__idx_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlFbsbReq_sync__info__idx_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlFbsbReq_ccch__mode_default_coding("RAW");
const XERdescriptor_t       L1ctlFbsbReq_rxlev__exp_xer_ = { {"rxlev_exp>\n", "rxlev_exp>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlFbsbReq_rxlev__exp_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlFbsbReq_rxlev__exp_descr_ = { "@L1CTL_Types.L1ctlFbsbReq.rxlev_exp", &INTEGER_ber_, &GSM__Types::GsmRxLev_raw_, &INTEGER_text_, &L1ctlFbsbReq_rxlev__exp_xer_, &INTEGER_json_, &L1ctlFbsbReq_rxlev__exp_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlFbsbReq_rxlev__exp_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlFbsbReq_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 L1ctlFbsbReq
const TTCN_Typedescriptor_t L1ctlFbsbReq_descr_ = { "@L1CTL_Types.L1ctlFbsbReq", NULL, &L1ctlFbsbReq_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlFbsbReq_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlCcchModeReq_ccch__mode_default_coding("RAW");
const XERdescriptor_t       L1ctlCcchModeReq_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 L1ctlCcchModeReq_padding_oer_ext_arr_[0] = {};
const int L1ctlCcchModeReq_padding_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlCcchModeReq_padding_oer_ = { -1, TRUE, 3, FALSE, 0, 0, L1ctlCcchModeReq_padding_oer_ext_arr_, 0, L1ctlCcchModeReq_padding_oer_p_};
const TTCN_Typedescriptor_t L1ctlCcchModeReq_padding_descr_ = { "@L1CTL_Types.L1ctlCcchModeReq.padding", &OCTETSTRING_ber_, &General__Types::OCT3_raw_, &OCTETSTRING_text_, &L1ctlCcchModeReq_padding_xer_, &OCTETSTRING_json_, &L1ctlCcchModeReq_padding_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlCcchModeReq_padding_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlCcchModeReq_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 L1ctlCcchModeReq
const TTCN_Typedescriptor_t L1ctlCcchModeReq_descr_ = { "@L1CTL_Types.L1ctlCcchModeReq", NULL, &L1ctlCcchModeReq_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlCcchModeReq_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlTchModeReq_tch__mode_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlTchModeReq_audio__mode_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlTchModeReq_loop__mode_default_coding("RAW");
const XERdescriptor_t       L1ctlTchModeReq_amr_start__codec_xer_ = { {"start_codec>\n", "start_codec>\n"}, {13, 13}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlTchModeReq_amr_start__codec_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlTchModeReq_amr_start__codec_descr_ = { "@L1CTL_Types.L1ctlTchModeReq.amr.start_codec", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlTchModeReq_amr_start__codec_xer_, &INTEGER_json_, &L1ctlTchModeReq_amr_start__codec_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlTchModeReq_amr_start__codec_default_coding("RAW");
const XERdescriptor_t       L1ctlTchModeReq_amr_codecs__bitmask_xer_ = { {"codecs_bitmask>\n", "codecs_bitmask>\n"}, {16, 16}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlTchModeReq_amr_codecs__bitmask_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlTchModeReq_amr_codecs__bitmask_descr_ = { "@L1CTL_Types.L1ctlTchModeReq.amr.codecs_bitmask", &BITSTRING_ber_, &General__Types::BIT8_raw_, NULL, &L1ctlTchModeReq_amr_codecs__bitmask_xer_, &BITSTRING_json_, &L1ctlTchModeReq_amr_codecs__bitmask_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlTchModeReq_amr_codecs__bitmask_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlTchModeReq_amr_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 L1ctlTchModeReq_amr
const TTCN_Typedescriptor_t L1ctlTchModeReq_amr_descr_ = { "@L1CTL_Types.L1ctlTchModeReq.amr", NULL, &L1ctlTchModeReq_amr_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlTchModeReq_amr_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlTchModeReq_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 L1ctlTchModeReq
const TTCN_Typedescriptor_t L1ctlTchModeReq_descr_ = { "@L1CTL_Types.L1ctlTchModeReq", NULL, &L1ctlTchModeReq_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlTchModeReq_default_coding("RAW");
const XERdescriptor_t       L1ctlRachReq_ra_xer_ = { {"ra>\n", "ra>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlRachReq_ra_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlRachReq_ra_descr_ = { "@L1CTL_Types.L1ctlRachReq.ra", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlRachReq_ra_xer_, &INTEGER_json_, &L1ctlRachReq_ra_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlRachReq_ra_default_coding("RAW");
const XERdescriptor_t       L1ctlRachReq_combined_xer_ = { {"combined>\n", "combined>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlRachReq_combined_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlRachReq_combined_descr_ = { "@L1CTL_Types.L1ctlRachReq.combined", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlRachReq_combined_xer_, &INTEGER_json_, &L1ctlRachReq_combined_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlRachReq_combined_default_coding("RAW");
const XERdescriptor_t       L1ctlRachReq_offset_xer_ = { {"offset>\n", "offset>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlRachReq_offset_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlRachReq_offset_descr_ = { "@L1CTL_Types.L1ctlRachReq.offset", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &L1ctlRachReq_offset_xer_, &INTEGER_json_, &L1ctlRachReq_offset_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlRachReq_offset_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlRachReq_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 L1ctlRachReq
const TTCN_Typedescriptor_t L1ctlRachReq_descr_ = { "@L1CTL_Types.L1ctlRachReq", NULL, &L1ctlRachReq_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlRachReq_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlRachSynchSeq_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for L1ctlRachSynchSeq
const TTCN_Typedescriptor_t L1ctlRachSynchSeq_descr_ = { "@L1CTL_Types.L1ctlRachSynchSeq", NULL, &L1ctlRachSynchSeq_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlRachSynchSeq_default_coding("RAW");
const XERdescriptor_t       L1ctlExtRachReq_ra11_xer_ = { {"ra11>\n", "ra11>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlExtRachReq_ra11_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlExtRachReq_ra11_descr_ = { "@L1CTL_Types.L1ctlExtRachReq.ra11", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &L1ctlExtRachReq_ra11_xer_, &INTEGER_json_, &L1ctlExtRachReq_ra11_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlExtRachReq_ra11_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlExtRachReq_synch__seq_default_coding("RAW");
const XERdescriptor_t       L1ctlExtRachReq_combined_xer_ = { {"combined>\n", "combined>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlExtRachReq_combined_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlExtRachReq_combined_descr_ = { "@L1CTL_Types.L1ctlExtRachReq.combined", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlExtRachReq_combined_xer_, &INTEGER_json_, &L1ctlExtRachReq_combined_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlExtRachReq_combined_default_coding("RAW");
const XERdescriptor_t       L1ctlExtRachReq_offset_xer_ = { {"offset>\n", "offset>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlExtRachReq_offset_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlExtRachReq_offset_descr_ = { "@L1CTL_Types.L1ctlExtRachReq.offset", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &L1ctlExtRachReq_offset_xer_, &INTEGER_json_, &L1ctlExtRachReq_offset_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlExtRachReq_offset_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlExtRachReq_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 L1ctlExtRachReq
const TTCN_Typedescriptor_t L1ctlExtRachReq_descr_ = { "@L1CTL_Types.L1ctlExtRachReq", NULL, &L1ctlExtRachReq_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlExtRachReq_default_coding("RAW");
const XERdescriptor_t       L1ctlParReq_ta_xer_ = { {"ta>\n", "ta>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t L1ctlParReq_ta_descr_ = { "@L1CTL_Types.L1ctlParReq.ta", &INTEGER_ber_, &Osmocom__Types::int8__t_raw_, &INTEGER_text_, &L1ctlParReq_ta_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlParReq_ta_default_coding("RAW");
const XERdescriptor_t       L1ctlParReq_tx__power_xer_ = { {"tx_power>\n", "tx_power>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlParReq_tx__power_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlParReq_tx__power_descr_ = { "@L1CTL_Types.L1ctlParReq.tx_power", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlParReq_tx__power_xer_, &INTEGER_json_, &L1ctlParReq_tx__power_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlParReq_tx__power_default_coding("RAW");
const XERdescriptor_t       L1ctlParReq_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 L1ctlParReq_padding_oer_ext_arr_[0] = {};
const int L1ctlParReq_padding_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlParReq_padding_oer_ = { -1, TRUE, 2, FALSE, 0, 0, L1ctlParReq_padding_oer_ext_arr_, 0, L1ctlParReq_padding_oer_p_};
const TTCN_Typedescriptor_t L1ctlParReq_padding_descr_ = { "@L1CTL_Types.L1ctlParReq.padding", &OCTETSTRING_ber_, &General__Types::OCT2_raw_, &OCTETSTRING_text_, &L1ctlParReq_padding_xer_, &OCTETSTRING_json_, &L1ctlParReq_padding_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlParReq_padding_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlParReq_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 L1ctlParReq
const TTCN_Typedescriptor_t L1ctlParReq_descr_ = { "@L1CTL_Types.L1ctlParReq", NULL, &L1ctlParReq_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlParReq_default_coding("RAW");
const XERdescriptor_t       L1ctlDataReq_l2__payload_xer_ = { {"l2_payload>\n", "l2_payload>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1ctlDataReq_l2__payload_oer_ext_arr_[0] = {};
const int L1ctlDataReq_l2__payload_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlDataReq_l2__payload_oer_ = { -1, TRUE, -1, FALSE, 0, 0, L1ctlDataReq_l2__payload_oer_ext_arr_, 0, L1ctlDataReq_l2__payload_oer_p_};
const TTCN_Typedescriptor_t L1ctlDataReq_l2__payload_descr_ = { "@L1CTL_Types.L1ctlDataReq.l2_payload", &OCTETSTRING_ber_, &OCTETSTRING_raw_, &OCTETSTRING_text_, &L1ctlDataReq_l2__payload_xer_, &OCTETSTRING_json_, &L1ctlDataReq_l2__payload_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlDataReq_l2__payload_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlDataReq_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 L1ctlDataReq
const TTCN_Typedescriptor_t L1ctlDataReq_descr_ = { "@L1CTL_Types.L1ctlDataReq", NULL, &L1ctlDataReq_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlDataReq_l1header_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlDataReq_default_coding("RAW");
const XERdescriptor_t       L1ctlH0_h_xer_ = { {"h>\n", "h>\n"}, {3, 3}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlH0_h_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlH0_h_descr_ = { "@L1CTL_Types.L1ctlH0.h", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlH0_h_xer_, &INTEGER_json_, &L1ctlH0_h_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlH0_h_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlH0_arfcn_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlH0_padding_raw_ = {1040,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       L1ctlH0_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 L1ctlH0_padding_oer_ext_arr_[0] = {};
const int L1ctlH0_padding_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlH0_padding_oer_ = { -1, TRUE, 130, FALSE, 0, 0, L1ctlH0_padding_oer_ext_arr_, 0, L1ctlH0_padding_oer_p_};
const TTCN_Typedescriptor_t L1ctlH0_padding_descr_ = { "@L1CTL_Types.L1ctlH0.padding", &OCTETSTRING_ber_, &L1ctlH0_padding_raw_, &OCTETSTRING_text_, &L1ctlH0_padding_xer_, &OCTETSTRING_json_, &L1ctlH0_padding_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlH0_padding_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlH0_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 L1ctlH0
const TTCN_Typedescriptor_t L1ctlH0_descr_ = { "@L1CTL_Types.L1ctlH0", NULL, &L1ctlH0_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlH0_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlMA_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 L1ctlMA
const TTCN_Typedescriptor_t L1ctlMA_descr_ = { "@L1CTL_Types.L1ctlMA", NULL, &L1ctlMA_raw_, NULL, NULL, NULL, NULL, NULL, &GSM__Types::GsmBandArfcn_descr_, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlMA_0_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMA_default_coding("RAW");
const XERdescriptor_t       L1ctlH1_h_xer_ = { {"h>\n", "h>\n"}, {3, 3}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlH1_h_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlH1_h_descr_ = { "@L1CTL_Types.L1ctlH1.h", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlH1_h_xer_, &INTEGER_json_, &L1ctlH1_h_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlH1_h_default_coding("RAW");
const XERdescriptor_t       L1ctlH1_hsn_xer_ = { {"hsn>\n", "hsn>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlH1_hsn_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlH1_hsn_descr_ = { "@L1CTL_Types.L1ctlH1.hsn", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlH1_hsn_xer_, &INTEGER_json_, &L1ctlH1_hsn_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlH1_hsn_default_coding("RAW");
const XERdescriptor_t       L1ctlH1_maio_xer_ = { {"maio>\n", "maio>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlH1_maio_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlH1_maio_descr_ = { "@L1CTL_Types.L1ctlH1.maio", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlH1_maio_xer_, &INTEGER_json_, &L1ctlH1_maio_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlH1_maio_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlH1_n_raw_ = {8,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,-1,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       L1ctlH1_n_xer_ = { {"n>\n", "n>\n"}, {3, 3}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlH1_n_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlH1_n_descr_ = { "@L1CTL_Types.L1ctlH1.n", &INTEGER_ber_, &L1ctlH1_n_raw_, &INTEGER_text_, &L1ctlH1_n_xer_, &INTEGER_json_, &L1ctlH1_n_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlH1_n_default_coding("RAW");
const XERdescriptor_t       L1ctlH1_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1ctlH1_spare_oer_ext_arr_[0] = {};
const int L1ctlH1_spare_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlH1_spare_oer_ = { -1, TRUE, 1, FALSE, 0, 0, L1ctlH1_spare_oer_ext_arr_, 0, L1ctlH1_spare_oer_p_};
const TTCN_Typedescriptor_t L1ctlH1_spare_descr_ = { "@L1CTL_Types.L1ctlH1.spare", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &L1ctlH1_spare_xer_, &OCTETSTRING_json_, &L1ctlH1_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlH1_spare_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlH1_ma_default_coding("RAW");
const XERdescriptor_t       L1ctlH1_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 L1ctlH1_padding_oer_ext_arr_[0] = {};
const int L1ctlH1_padding_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlH1_padding_oer_ = { -1, TRUE, -1, FALSE, 0, 0, L1ctlH1_padding_oer_ext_arr_, 0, L1ctlH1_padding_oer_p_};
const TTCN_Typedescriptor_t L1ctlH1_padding_descr_ = { "@L1CTL_Types.L1ctlH1.padding", &OCTETSTRING_ber_, &OCTETSTRING_raw_, &OCTETSTRING_text_, &L1ctlH1_padding_xer_, &OCTETSTRING_json_, &L1ctlH1_padding_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlH1_padding_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlH1_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 L1ctlH1
const TTCN_Typedescriptor_t L1ctlH1_descr_ = { "@L1CTL_Types.L1ctlH1", NULL, &L1ctlH1_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlH1_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlH0H1_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 L1ctlH0H1
const TTCN_Typedescriptor_t L1ctlH0H1_descr_ = { "@L1CTL_Types.L1ctlH0H1", NULL, &L1ctlH0H1_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlH0H1_h0_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlH0H1_h1_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlH0H1_default_coding("RAW");
const XERdescriptor_t       L1ctlDmEstReq_tsc_xer_ = { {"tsc>\n", "tsc>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlDmEstReq_tsc_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlDmEstReq_tsc_descr_ = { "@L1CTL_Types.L1ctlDmEstReq.tsc", &INTEGER_ber_, &GSM__Types::GsmTsc_raw_, &INTEGER_text_, &L1ctlDmEstReq_tsc_xer_, &INTEGER_json_, &L1ctlDmEstReq_tsc_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlDmEstReq_tsc_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlDmEstReq_h0h1_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlDmEstReq_tch__mode_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlDmEstReq_audio__mode_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlDmEstReq_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 L1ctlDmEstReq
const TTCN_Typedescriptor_t L1ctlDmEstReq_descr_ = { "@L1CTL_Types.L1ctlDmEstReq", NULL, &L1ctlDmEstReq_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlDmEstReq_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlReset_reset__type_default_coding("RAW");
const XERdescriptor_t       L1ctlReset_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 L1ctlReset_padding_oer_ext_arr_[0] = {};
const int L1ctlReset_padding_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlReset_padding_oer_ = { -1, TRUE, 3, FALSE, 0, 0, L1ctlReset_padding_oer_ext_arr_, 0, L1ctlReset_padding_oer_p_};
const TTCN_Typedescriptor_t L1ctlReset_padding_descr_ = { "@L1CTL_Types.L1ctlReset.padding", &OCTETSTRING_ber_, &General__Types::OCT3_raw_, &OCTETSTRING_text_, &L1ctlReset_padding_xer_, &OCTETSTRING_json_, &L1ctlReset_padding_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlReset_padding_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlReset_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 L1ctlReset
const TTCN_Typedescriptor_t L1ctlReset_descr_ = { "@L1CTL_Types.L1ctlReset", NULL, &L1ctlReset_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlReset_default_coding("RAW");
const XERdescriptor_t       L1CtlCryptoReq_algo_xer_ = { {"algo>\n", "algo>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1CtlCryptoReq_algo_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1CtlCryptoReq_algo_descr_ = { "@L1CTL_Types.L1CtlCryptoReq.algo", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1CtlCryptoReq_algo_xer_, &INTEGER_json_, &L1CtlCryptoReq_algo_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1CtlCryptoReq_algo_default_coding("RAW");
const TTCN_RAWdescriptor_t L1CtlCryptoReq_key__len_raw_ = {8,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       L1CtlCryptoReq_key__len_xer_ = { {"key_len>\n", "key_len>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1CtlCryptoReq_key__len_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1CtlCryptoReq_key__len_descr_ = { "@L1CTL_Types.L1CtlCryptoReq.key_len", &INTEGER_ber_, &L1CtlCryptoReq_key__len_raw_, &INTEGER_text_, &L1CtlCryptoReq_key__len_xer_, &INTEGER_json_, &L1CtlCryptoReq_key__len_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1CtlCryptoReq_key__len_default_coding("RAW");
const XERdescriptor_t       L1CtlCryptoReq_key_xer_ = { {"key>\n", "key>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1CtlCryptoReq_key_oer_ext_arr_[0] = {};
const int L1CtlCryptoReq_key_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1CtlCryptoReq_key_oer_ = { -1, TRUE, -1, FALSE, 0, 0, L1CtlCryptoReq_key_oer_ext_arr_, 0, L1CtlCryptoReq_key_oer_p_};
const TTCN_Typedescriptor_t L1CtlCryptoReq_key_descr_ = { "@L1CTL_Types.L1CtlCryptoReq.key", &OCTETSTRING_ber_, &OCTETSTRING_raw_, &OCTETSTRING_text_, &L1CtlCryptoReq_key_xer_, &OCTETSTRING_json_, &L1CtlCryptoReq_key_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1CtlCryptoReq_key_default_coding("RAW");
const TTCN_RAWdescriptor_t L1CtlCryptoReq_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 L1CtlCryptoReq
const TTCN_Typedescriptor_t L1CtlCryptoReq_descr_ = { "@L1CTL_Types.L1CtlCryptoReq", NULL, &L1CtlCryptoReq_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1CtlCryptoReq_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlTrafficReq_data_raw_ = {0,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       L1ctlTrafficReq_data_xer_ = { {"data>\n", "data>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1ctlTrafficReq_data_oer_ext_arr_[0] = {};
const int L1ctlTrafficReq_data_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlTrafficReq_data_oer_ = { -1, TRUE, -1, FALSE, 0, 0, L1ctlTrafficReq_data_oer_ext_arr_, 0, L1ctlTrafficReq_data_oer_p_};
const TTCN_Typedescriptor_t L1ctlTrafficReq_data_descr_ = { "@L1CTL_Types.L1ctlTrafficReq.data", &OCTETSTRING_ber_, &L1ctlTrafficReq_data_raw_, &OCTETSTRING_text_, &L1ctlTrafficReq_data_xer_, &OCTETSTRING_json_, &L1ctlTrafficReq_data_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlTrafficReq_data_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlTrafficReq_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 L1ctlTrafficReq
const TTCN_Typedescriptor_t L1ctlTrafficReq_descr_ = { "@L1CTL_Types.L1ctlTrafficReq", NULL, &L1ctlTrafficReq_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlTrafficReq_default_coding("RAW");
const XERdescriptor_t       L1ctlGprsUlTbfCfgReq_tbf__ref_xer_ = { {"tbf_ref>\n", "tbf_ref>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlGprsUlTbfCfgReq_tbf__ref_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlGprsUlTbfCfgReq_tbf__ref_descr_ = { "@L1CTL_Types.L1ctlGprsUlTbfCfgReq.tbf_ref", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlGprsUlTbfCfgReq_tbf__ref_xer_, &INTEGER_json_, &L1ctlGprsUlTbfCfgReq_tbf__ref_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsUlTbfCfgReq_tbf__ref_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlGprsUlTbfCfgReq_slotmask_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_MSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,8,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       L1ctlGprsUlTbfCfgReq_slotmask_xer_ = { {"slotmask>\n", "slotmask>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlGprsUlTbfCfgReq_slotmask_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlGprsUlTbfCfgReq_slotmask_descr_ = { "@L1CTL_Types.L1ctlGprsUlTbfCfgReq.slotmask", &BITSTRING_ber_, &L1ctlGprsUlTbfCfgReq_slotmask_raw_, NULL, &L1ctlGprsUlTbfCfgReq_slotmask_xer_, &BITSTRING_json_, &L1ctlGprsUlTbfCfgReq_slotmask_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsUlTbfCfgReq_slotmask_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlGprsUlTbfCfgReq_pad_raw_ = {16,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       L1ctlGprsUlTbfCfgReq_pad_xer_ = { {"pad>\n", "pad>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1ctlGprsUlTbfCfgReq_pad_oer_ext_arr_[0] = {};
const int L1ctlGprsUlTbfCfgReq_pad_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlGprsUlTbfCfgReq_pad_oer_ = { -1, TRUE, 2, FALSE, 0, 0, L1ctlGprsUlTbfCfgReq_pad_oer_ext_arr_, 0, L1ctlGprsUlTbfCfgReq_pad_oer_p_};
const TTCN_Typedescriptor_t L1ctlGprsUlTbfCfgReq_pad_descr_ = { "@L1CTL_Types.L1ctlGprsUlTbfCfgReq.pad", &OCTETSTRING_ber_, &L1ctlGprsUlTbfCfgReq_pad_raw_, &OCTETSTRING_text_, &L1ctlGprsUlTbfCfgReq_pad_xer_, &OCTETSTRING_json_, &L1ctlGprsUlTbfCfgReq_pad_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsUlTbfCfgReq_pad_default_coding("RAW");
const XERdescriptor_t       L1ctlGprsUlTbfCfgReq_start__fn_xer_ = { {"start_fn>\n", "start_fn>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlGprsUlTbfCfgReq_start__fn_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlGprsUlTbfCfgReq_start__fn_descr_ = { "@L1CTL_Types.L1ctlGprsUlTbfCfgReq.start_fn", &INTEGER_ber_, &Osmocom__Types::uint32__t_raw_, &INTEGER_text_, &L1ctlGprsUlTbfCfgReq_start__fn_xer_, &INTEGER_json_, &L1ctlGprsUlTbfCfgReq_start__fn_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsUlTbfCfgReq_start__fn_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlGprsUlTbfCfgReq_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 L1ctlGprsUlTbfCfgReq
const TTCN_Typedescriptor_t L1ctlGprsUlTbfCfgReq_descr_ = { "@L1CTL_Types.L1ctlGprsUlTbfCfgReq", NULL, &L1ctlGprsUlTbfCfgReq_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsUlTbfCfgReq_default_coding("RAW");
const XERdescriptor_t       L1ctlGprsDlTbfCfgReq_tbf__ref_xer_ = { {"tbf_ref>\n", "tbf_ref>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlGprsDlTbfCfgReq_tbf__ref_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlGprsDlTbfCfgReq_tbf__ref_descr_ = { "@L1CTL_Types.L1ctlGprsDlTbfCfgReq.tbf_ref", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlGprsDlTbfCfgReq_tbf__ref_xer_, &INTEGER_json_, &L1ctlGprsDlTbfCfgReq_tbf__ref_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsDlTbfCfgReq_tbf__ref_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlGprsDlTbfCfgReq_slotmask_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_MSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,8,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       L1ctlGprsDlTbfCfgReq_slotmask_xer_ = { {"slotmask>\n", "slotmask>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlGprsDlTbfCfgReq_slotmask_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlGprsDlTbfCfgReq_slotmask_descr_ = { "@L1CTL_Types.L1ctlGprsDlTbfCfgReq.slotmask", &BITSTRING_ber_, &L1ctlGprsDlTbfCfgReq_slotmask_raw_, NULL, &L1ctlGprsDlTbfCfgReq_slotmask_xer_, &BITSTRING_json_, &L1ctlGprsDlTbfCfgReq_slotmask_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsDlTbfCfgReq_slotmask_default_coding("RAW");
const XERdescriptor_t       L1ctlGprsDlTbfCfgReq_dl__tfi_xer_ = { {"dl_tfi>\n", "dl_tfi>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlGprsDlTbfCfgReq_dl__tfi_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlGprsDlTbfCfgReq_dl__tfi_descr_ = { "@L1CTL_Types.L1ctlGprsDlTbfCfgReq.dl_tfi", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlGprsDlTbfCfgReq_dl__tfi_xer_, &INTEGER_json_, &L1ctlGprsDlTbfCfgReq_dl__tfi_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsDlTbfCfgReq_dl__tfi_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlGprsDlTbfCfgReq_pad_raw_ = {8,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       L1ctlGprsDlTbfCfgReq_pad_xer_ = { {"pad>\n", "pad>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1ctlGprsDlTbfCfgReq_pad_oer_ext_arr_[0] = {};
const int L1ctlGprsDlTbfCfgReq_pad_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlGprsDlTbfCfgReq_pad_oer_ = { -1, TRUE, 1, FALSE, 0, 0, L1ctlGprsDlTbfCfgReq_pad_oer_ext_arr_, 0, L1ctlGprsDlTbfCfgReq_pad_oer_p_};
const TTCN_Typedescriptor_t L1ctlGprsDlTbfCfgReq_pad_descr_ = { "@L1CTL_Types.L1ctlGprsDlTbfCfgReq.pad", &OCTETSTRING_ber_, &L1ctlGprsDlTbfCfgReq_pad_raw_, &OCTETSTRING_text_, &L1ctlGprsDlTbfCfgReq_pad_xer_, &OCTETSTRING_json_, &L1ctlGprsDlTbfCfgReq_pad_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsDlTbfCfgReq_pad_default_coding("RAW");
const XERdescriptor_t       L1ctlGprsDlTbfCfgReq_start__fn_xer_ = { {"start_fn>\n", "start_fn>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlGprsDlTbfCfgReq_start__fn_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlGprsDlTbfCfgReq_start__fn_descr_ = { "@L1CTL_Types.L1ctlGprsDlTbfCfgReq.start_fn", &INTEGER_ber_, &Osmocom__Types::uint32__t_raw_, &INTEGER_text_, &L1ctlGprsDlTbfCfgReq_start__fn_xer_, &INTEGER_json_, &L1ctlGprsDlTbfCfgReq_start__fn_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsDlTbfCfgReq_start__fn_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlGprsDlTbfCfgReq_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 L1ctlGprsDlTbfCfgReq
const TTCN_Typedescriptor_t L1ctlGprsDlTbfCfgReq_descr_ = { "@L1CTL_Types.L1ctlGprsDlTbfCfgReq", NULL, &L1ctlGprsDlTbfCfgReq_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsDlTbfCfgReq_default_coding("RAW");
const XERdescriptor_t       L1ctlGprsBlockHdr_fn_xer_ = { {"fn>\n", "fn>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlGprsBlockHdr_fn_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlGprsBlockHdr_fn_descr_ = { "@L1CTL_Types.L1ctlGprsBlockHdr.fn", &INTEGER_ber_, &Osmocom__Types::uint32__t_raw_, &INTEGER_text_, &L1ctlGprsBlockHdr_fn_xer_, &INTEGER_json_, &L1ctlGprsBlockHdr_fn_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsBlockHdr_fn_default_coding("RAW");
const XERdescriptor_t       L1ctlGprsBlockHdr_tn_xer_ = { {"tn>\n", "tn>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlGprsBlockHdr_tn_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlGprsBlockHdr_tn_descr_ = { "@L1CTL_Types.L1ctlGprsBlockHdr.tn", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlGprsBlockHdr_tn_xer_, &INTEGER_json_, &L1ctlGprsBlockHdr_tn_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsBlockHdr_tn_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlGprsBlockHdr_pad_raw_ = {24,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       L1ctlGprsBlockHdr_pad_xer_ = { {"pad>\n", "pad>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1ctlGprsBlockHdr_pad_oer_ext_arr_[0] = {};
const int L1ctlGprsBlockHdr_pad_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlGprsBlockHdr_pad_oer_ = { -1, TRUE, 3, FALSE, 0, 0, L1ctlGprsBlockHdr_pad_oer_ext_arr_, 0, L1ctlGprsBlockHdr_pad_oer_p_};
const TTCN_Typedescriptor_t L1ctlGprsBlockHdr_pad_descr_ = { "@L1CTL_Types.L1ctlGprsBlockHdr.pad", &OCTETSTRING_ber_, &L1ctlGprsBlockHdr_pad_raw_, &OCTETSTRING_text_, &L1ctlGprsBlockHdr_pad_xer_, &OCTETSTRING_json_, &L1ctlGprsBlockHdr_pad_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsBlockHdr_pad_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlGprsBlockHdr_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 L1ctlGprsBlockHdr
const TTCN_Typedescriptor_t L1ctlGprsBlockHdr_descr_ = { "@L1CTL_Types.L1ctlGprsBlockHdr", NULL, &L1ctlGprsBlockHdr_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsBlockHdr_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlGprsUlBlockReq_hdr_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlGprsUlBlockReq_data_raw_ = {0,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       L1ctlGprsUlBlockReq_data_xer_ = { {"data>\n", "data>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1ctlGprsUlBlockReq_data_oer_ext_arr_[0] = {};
const int L1ctlGprsUlBlockReq_data_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlGprsUlBlockReq_data_oer_ = { -1, TRUE, -1, FALSE, 0, 0, L1ctlGprsUlBlockReq_data_oer_ext_arr_, 0, L1ctlGprsUlBlockReq_data_oer_p_};
const TTCN_Typedescriptor_t L1ctlGprsUlBlockReq_data_descr_ = { "@L1CTL_Types.L1ctlGprsUlBlockReq.data", &OCTETSTRING_ber_, &L1ctlGprsUlBlockReq_data_raw_, &OCTETSTRING_text_, &L1ctlGprsUlBlockReq_data_xer_, &OCTETSTRING_json_, &L1ctlGprsUlBlockReq_data_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsUlBlockReq_data_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlGprsUlBlockReq_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 L1ctlGprsUlBlockReq
const TTCN_Typedescriptor_t L1ctlGprsUlBlockReq_descr_ = { "@L1CTL_Types.L1ctlGprsUlBlockReq", NULL, &L1ctlGprsUlBlockReq_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsUlBlockReq_default_coding("RAW");
const XERdescriptor_t       L1ctlGprsUlBlockCnf_fn_xer_ = { {"fn>\n", "fn>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlGprsUlBlockCnf_fn_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlGprsUlBlockCnf_fn_descr_ = { "@L1CTL_Types.L1ctlGprsUlBlockCnf.fn", &INTEGER_ber_, &Osmocom__Types::uint32__t_raw_, &INTEGER_text_, &L1ctlGprsUlBlockCnf_fn_xer_, &INTEGER_json_, &L1ctlGprsUlBlockCnf_fn_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsUlBlockCnf_fn_default_coding("RAW");
const XERdescriptor_t       L1ctlGprsUlBlockCnf_tn_xer_ = { {"tn>\n", "tn>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlGprsUlBlockCnf_tn_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlGprsUlBlockCnf_tn_descr_ = { "@L1CTL_Types.L1ctlGprsUlBlockCnf.tn", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlGprsUlBlockCnf_tn_xer_, &INTEGER_json_, &L1ctlGprsUlBlockCnf_tn_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsUlBlockCnf_tn_default_coding("RAW");
const XERdescriptor_t       L1ctlGprsUlBlockCnf_data_xer_ = { {"data>\n", "data>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1ctlGprsUlBlockCnf_data_oer_ext_arr_[0] = {};
const int L1ctlGprsUlBlockCnf_data_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlGprsUlBlockCnf_data_oer_ = { -1, TRUE, -1, FALSE, 0, 0, L1ctlGprsUlBlockCnf_data_oer_ext_arr_, 0, L1ctlGprsUlBlockCnf_data_oer_p_};
const TTCN_Typedescriptor_t L1ctlGprsUlBlockCnf_data_descr_ = { "@L1CTL_Types.L1ctlGprsUlBlockCnf.data", &OCTETSTRING_ber_, &OCTETSTRING_raw_, &OCTETSTRING_text_, &L1ctlGprsUlBlockCnf_data_xer_, &OCTETSTRING_json_, &L1ctlGprsUlBlockCnf_data_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsUlBlockCnf_data_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlGprsUlBlockCnf_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 L1ctlGprsUlBlockCnf
const TTCN_Typedescriptor_t L1ctlGprsUlBlockCnf_descr_ = { "@L1CTL_Types.L1ctlGprsUlBlockCnf", NULL, &L1ctlGprsUlBlockCnf_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsUlBlockCnf_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlGprsDlBlockInd_hdr_default_coding("RAW");
const XERdescriptor_t       L1ctlGprsDlBlockInd_meas_ber10k_xer_ = { {"ber10k>\n", "ber10k>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlGprsDlBlockInd_meas_ber10k_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlGprsDlBlockInd_meas_ber10k_descr_ = { "@L1CTL_Types.L1ctlGprsDlBlockInd.meas.ber10k", &INTEGER_ber_, &Osmocom__Types::uint16__t_raw_, &INTEGER_text_, &L1ctlGprsDlBlockInd_meas_ber10k_xer_, &INTEGER_json_, &L1ctlGprsDlBlockInd_meas_ber10k_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsDlBlockInd_meas_ber10k_default_coding("RAW");
const XERdescriptor_t       L1ctlGprsDlBlockInd_meas_ci__cb_xer_ = { {"ci_cb>\n", "ci_cb>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlGprsDlBlockInd_meas_ci__cb_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlGprsDlBlockInd_meas_ci__cb_descr_ = { "@L1CTL_Types.L1ctlGprsDlBlockInd.meas.ci_cb", &INTEGER_ber_, &Osmocom__Types::int16__t_raw_, &INTEGER_text_, &L1ctlGprsDlBlockInd_meas_ci__cb_xer_, &INTEGER_json_, &L1ctlGprsDlBlockInd_meas_ci__cb_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsDlBlockInd_meas_ci__cb_default_coding("RAW");
const XERdescriptor_t       L1ctlGprsDlBlockInd_meas_rx__level_xer_ = { {"rx_level>\n", "rx_level>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlGprsDlBlockInd_meas_rx__level_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlGprsDlBlockInd_meas_rx__level_descr_ = { "@L1CTL_Types.L1ctlGprsDlBlockInd.meas.rx_level", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlGprsDlBlockInd_meas_rx__level_xer_, &INTEGER_json_, &L1ctlGprsDlBlockInd_meas_rx__level_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsDlBlockInd_meas_rx__level_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlGprsDlBlockInd_meas_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 L1ctlGprsDlBlockInd_meas
const TTCN_Typedescriptor_t L1ctlGprsDlBlockInd_meas_descr_ = { "@L1CTL_Types.L1ctlGprsDlBlockInd.meas", NULL, &L1ctlGprsDlBlockInd_meas_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsDlBlockInd_meas_default_coding("RAW");
const XERdescriptor_t       L1ctlGprsDlBlockInd_usf_xer_ = { {"usf>\n", "usf>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlGprsDlBlockInd_usf_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlGprsDlBlockInd_usf_descr_ = { "@L1CTL_Types.L1ctlGprsDlBlockInd.usf", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlGprsDlBlockInd_usf_xer_, &INTEGER_json_, &L1ctlGprsDlBlockInd_usf_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsDlBlockInd_usf_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlGprsDlBlockInd_data_raw_ = {0,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       L1ctlGprsDlBlockInd_data_xer_ = { {"data>\n", "data>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1ctlGprsDlBlockInd_data_oer_ext_arr_[0] = {};
const int L1ctlGprsDlBlockInd_data_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlGprsDlBlockInd_data_oer_ = { -1, TRUE, -1, FALSE, 0, 0, L1ctlGprsDlBlockInd_data_oer_ext_arr_, 0, L1ctlGprsDlBlockInd_data_oer_p_};
const TTCN_Typedescriptor_t L1ctlGprsDlBlockInd_data_descr_ = { "@L1CTL_Types.L1ctlGprsDlBlockInd.data", &OCTETSTRING_ber_, &L1ctlGprsDlBlockInd_data_raw_, &OCTETSTRING_text_, &L1ctlGprsDlBlockInd_data_xer_, &OCTETSTRING_json_, &L1ctlGprsDlBlockInd_data_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsDlBlockInd_data_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlGprsDlBlockInd_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 L1ctlGprsDlBlockInd
const TTCN_Typedescriptor_t L1ctlGprsDlBlockInd_descr_ = { "@L1CTL_Types.L1ctlGprsDlBlockInd", NULL, &L1ctlGprsDlBlockInd_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsDlBlockInd_default_coding("RAW");
const XERdescriptor_t       L1ctlGprsRtsInd_fn_xer_ = { {"fn>\n", "fn>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlGprsRtsInd_fn_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlGprsRtsInd_fn_descr_ = { "@L1CTL_Types.L1ctlGprsRtsInd.fn", &INTEGER_ber_, &Osmocom__Types::uint32__t_raw_, &INTEGER_text_, &L1ctlGprsRtsInd_fn_xer_, &INTEGER_json_, &L1ctlGprsRtsInd_fn_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsRtsInd_fn_default_coding("RAW");
const XERdescriptor_t       L1ctlGprsRtsInd_tn_xer_ = { {"tn>\n", "tn>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlGprsRtsInd_tn_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlGprsRtsInd_tn_descr_ = { "@L1CTL_Types.L1ctlGprsRtsInd.tn", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlGprsRtsInd_tn_xer_, &INTEGER_json_, &L1ctlGprsRtsInd_tn_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsRtsInd_tn_default_coding("RAW");
const XERdescriptor_t       L1ctlGprsRtsInd_usf_xer_ = { {"usf>\n", "usf>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t L1ctlGprsRtsInd_usf_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlGprsRtsInd_usf_descr_ = { "@L1CTL_Types.L1ctlGprsRtsInd.usf", &INTEGER_ber_, &Osmocom__Types::uint8__t_raw_, &INTEGER_text_, &L1ctlGprsRtsInd_usf_xer_, &INTEGER_json_, &L1ctlGprsRtsInd_usf_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsRtsInd_usf_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlGprsRtsInd_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 L1ctlGprsRtsInd
const TTCN_Typedescriptor_t L1ctlGprsRtsInd_descr_ = { "@L1CTL_Types.L1ctlGprsRtsInd", NULL, &L1ctlGprsRtsInd_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlGprsRtsInd_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlMsgPayload_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 L1ctlMsgPayload
const TTCN_Typedescriptor_t L1ctlMsgPayload_descr_ = { "@L1CTL_Types.L1ctlMsgPayload", NULL, &L1ctlMsgPayload_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlMsgPayload_fbsb__req_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_fbsb__conf_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_data__ind_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_rach__req_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_dm__est__req_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_data__req_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_reset__req_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_ccch__mode__req_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_ccch__mode__conf_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_par__req_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_crypto__req_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_tch__mode__req_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_tch__mode__conf_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_traffic__req_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_traffic__ind_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_ul__tbf__cfg__req_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_dl__tbf__cfg__req_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_ul__block__req_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_ul__block__cnf_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_dl__block__ind_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_ext__rach__req_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_rts__ind_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlMsgPayload_other_raw_ = {0,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       L1ctlMsgPayload_other_xer_ = { {"other>\n", "other>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int L1ctlMsgPayload_other_oer_ext_arr_[0] = {};
const int L1ctlMsgPayload_other_oer_p_[0] = {};
const TTCN_OERdescriptor_t L1ctlMsgPayload_other_oer_ = { -1, TRUE, -1, FALSE, 0, 0, L1ctlMsgPayload_other_oer_ext_arr_, 0, L1ctlMsgPayload_other_oer_p_};
const TTCN_Typedescriptor_t L1ctlMsgPayload_other_descr_ = { "@L1CTL_Types.L1ctlMsgPayload.other", &OCTETSTRING_ber_, &L1ctlMsgPayload_other_raw_, &OCTETSTRING_text_, &L1ctlMsgPayload_other_xer_, &OCTETSTRING_json_, &L1ctlMsgPayload_other_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlMsgPayload_other_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMsgPayload_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMessage_header_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlMessage_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 L1ctlMessage
const TTCN_Typedescriptor_t L1ctlMessage_descr_ = { "@L1CTL_Types.L1ctlMessage", NULL, &L1ctlMessage_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_RAWdescriptor_t L1ctlMessage_ul__info_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 L1ctlMessage_ul__info
const TTCN_Typedescriptor_t L1ctlMessage_ul__info_descr_ = { "@L1CTL_Types.L1ctlMessage.ul_info", NULL, &L1ctlMessage_ul__info_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlMessage_ul__info_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlMessage_dl__info_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 L1ctlMessage_dl__info
const TTCN_Typedescriptor_t L1ctlMessage_dl__info_descr_ = { "@L1CTL_Types.L1ctlMessage.dl_info", NULL, &L1ctlMessage_dl__info_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlMessage_dl__info_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlMessage_payload_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 L1ctlMessage_payload
const TTCN_Typedescriptor_t L1ctlMessage_payload_descr_ = { "@L1CTL_Types.L1ctlMessage.payload", NULL, &L1ctlMessage_payload_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlMessage_payload_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMessage_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlMessageLV_len_raw_ = {16,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       L1ctlMessageLV_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 L1ctlMessageLV_len_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t L1ctlMessageLV_len_descr_ = { "@L1CTL_Types.L1ctlMessageLV.len", &INTEGER_ber_, &L1ctlMessageLV_len_raw_, &INTEGER_text_, &L1ctlMessageLV_len_xer_, &INTEGER_json_, &L1ctlMessageLV_len_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlMessageLV_len_default_coding("RAW");
UNIVERSAL_CHARSTRING L1ctlMessageLV_msg_default_coding("RAW");
const TTCN_RAWdescriptor_t L1ctlMessageLV_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 L1ctlMessageLV
const TTCN_Typedescriptor_t L1ctlMessageLV_descr_ = { "@L1CTL_Types.L1ctlMessageLV", NULL, &L1ctlMessageLV_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING L1ctlMessageLV_default_coding("RAW");
L1ctlTchMode_template template_ts__L1CTL__TCH__MODE__REQ_tch__mode_defval;
const L1ctlTchMode_template& ts__L1CTL__TCH__MODE__REQ_tch__mode_defval = template_ts__L1CTL__TCH__MODE__REQ_tch__mode_defval;
L1ctlAudioMode_template template_ts__L1CTL__TCH__MODE__REQ_audio__mode_defval;
const L1ctlAudioMode_template& ts__L1CTL__TCH__MODE__REQ_audio__mode_defval = template_ts__L1CTL__TCH__MODE__REQ_audio__mode_defval;
L1ctlLoopMode_template template_ts__L1CTL__TCH__MODE__REQ_loop__mode_defval;
const L1ctlLoopMode_template& ts__L1CTL__TCH__MODE__REQ_loop__mode_defval = template_ts__L1CTL__TCH__MODE__REQ_loop__mode_defval;
INTEGER_template template_ts__L1CTL__TCH__MODE__REQ_amr__start__codec_defval;
const INTEGER_template& ts__L1CTL__TCH__MODE__REQ_amr__start__codec_defval = template_ts__L1CTL__TCH__MODE__REQ_amr__start__codec_defval;
BITSTRING_template template_ts__L1CTL__TCH__MODE__REQ_amr__codecs__bitmask_defval;
const BITSTRING_template& ts__L1CTL__TCH__MODE__REQ_amr__codecs__bitmask_defval = template_ts__L1CTL__TCH__MODE__REQ_amr__codecs__bitmask_defval;
L1ctlMessage_template template_tr__L1CTL__CCCH__MODE__CONF;
const L1ctlMessage_template& tr__L1CTL__CCCH__MODE__CONF = template_tr__L1CTL__CCCH__MODE__CONF;
GSM__Types::RslChannelNr_template template_ts__L1CTL__RACH__REQ_chan__nr_defval;
const GSM__Types::RslChannelNr_template& ts__L1CTL__RACH__REQ_chan__nr_defval = template_ts__L1CTL__RACH__REQ_chan__nr_defval;
GSM__Types::RslLinkId_template template_ts__L1CTL__RACH__REQ_link__id_defval;
const GSM__Types::RslLinkId_template& ts__L1CTL__RACH__REQ_link__id_defval = template_ts__L1CTL__RACH__REQ_link__id_defval;
L1ctlMessage_template template_tr__L1CTL__RACH__CONF;
const L1ctlMessage_template& tr__L1CTL__RACH__CONF = template_tr__L1CTL__RACH__CONF;
INTEGER_template template_ts__L1CTL__DATA__IND_fn_defval;
const INTEGER_template& ts__L1CTL__DATA__IND_fn_defval = template_ts__L1CTL__DATA__IND_fn_defval;
INTEGER_template template_ts__L1CTL__DATA__IND_rx__level_defval;
const INTEGER_template& ts__L1CTL__DATA__IND_rx__level_defval = template_ts__L1CTL__DATA__IND_rx__level_defval;
INTEGER_template template_ts__L1CTL__DATA__IND_num__biterr_defval;
const INTEGER_template& ts__L1CTL__DATA__IND_num__biterr_defval = template_ts__L1CTL__DATA__IND_num__biterr_defval;
INTEGER_template template_ts__L1CTL__DATA__IND_fire__crc_defval;
const INTEGER_template& ts__L1CTL__DATA__IND_fire__crc_defval = template_ts__L1CTL__DATA__IND_fire__crc_defval;
GSM__Types::RslLinkId_template template_tr__L1CTL__DATA__IND_link__id_defval;
const GSM__Types::RslLinkId_template& tr__L1CTL__DATA__IND_link__id_defval = template_tr__L1CTL__DATA__IND_link__id_defval;
OCTETSTRING_template template_tr__L1CTL__DATA__IND_l2__data_defval;
const OCTETSTRING_template& tr__L1CTL__DATA__IND_l2__data_defval = template_tr__L1CTL__DATA__IND_l2__data_defval;
INTEGER_template template_tr__L1CTL__DATA__IND_num__biterr_defval;
const INTEGER_template& tr__L1CTL__DATA__IND_num__biterr_defval = template_tr__L1CTL__DATA__IND_num__biterr_defval;
INTEGER_template template_tr__L1CTL__DATA__IND_fire__crc_defval;
const INTEGER_template& tr__L1CTL__DATA__IND_fire__crc_defval = template_tr__L1CTL__DATA__IND_fire__crc_defval;
GSM__Types::RslLinkId_template template_tr__L1CTL__DATA__CONF_link__id_defval;
const GSM__Types::RslLinkId_template& tr__L1CTL__DATA__CONF_link__id_defval = template_tr__L1CTL__DATA__CONF_link__id_defval;
GSM__Types::GsmBandArfcn_template template_tr__L1CTL__DATA__CONF_arfcn_defval;
const GSM__Types::GsmBandArfcn_template& tr__L1CTL__DATA__CONF_arfcn_defval = template_tr__L1CTL__DATA__CONF_arfcn_defval;
INTEGER_template template_tr__L1CTL__DATA__CONF_fn_defval;
const INTEGER_template& tr__L1CTL__DATA__CONF_fn_defval = template_tr__L1CTL__DATA__CONF_fn_defval;
GSM__Types::RslLinkId_template template_tr__L1CTL__TRAFFIC__CONF_link__id_defval;
const GSM__Types::RslLinkId_template& tr__L1CTL__TRAFFIC__CONF_link__id_defval = template_tr__L1CTL__TRAFFIC__CONF_link__id_defval;
GSM__Types::GsmBandArfcn_template template_tr__L1CTL__TRAFFIC__CONF_arfcn_defval;
const GSM__Types::GsmBandArfcn_template& tr__L1CTL__TRAFFIC__CONF_arfcn_defval = template_tr__L1CTL__TRAFFIC__CONF_arfcn_defval;
INTEGER_template template_tr__L1CTL__TRAFFIC__CONF_fn_defval;
const INTEGER_template& tr__L1CTL__TRAFFIC__CONF_fn_defval = template_tr__L1CTL__TRAFFIC__CONF_fn_defval;
GSM__Types::RslLinkId_template template_tr__L1CTL__TRAFFIC__IND_link__id_defval;
const GSM__Types::RslLinkId_template& tr__L1CTL__TRAFFIC__IND_link__id_defval = template_tr__L1CTL__TRAFFIC__IND_link__id_defval;
OCTETSTRING_template template_tr__L1CTL__TRAFFIC__IND_frame_defval;
const OCTETSTRING_template& tr__L1CTL__TRAFFIC__IND_frame_defval = template_tr__L1CTL__TRAFFIC__IND_frame_defval;
INTEGER_template template_tr__L1CTL__TRAFFIC__IND_num__biterr_defval;
const INTEGER_template& tr__L1CTL__TRAFFIC__IND_num__biterr_defval = template_tr__L1CTL__TRAFFIC__IND_num__biterr_defval;
INTEGER_template template_tr__L1CTL__TRAFFIC__IND_fire__crc_defval;
const INTEGER_template& tr__L1CTL__TRAFFIC__IND_fire__crc_defval = template_tr__L1CTL__TRAFFIC__IND_fire__crc_defval;
BITSTRING_template template_ts__L1CTL__GPRS__UL__TBF__CFG__REQ_slotmask_defval;
const BITSTRING_template& ts__L1CTL__GPRS__UL__TBF__CFG__REQ_slotmask_defval = template_ts__L1CTL__GPRS__UL__TBF__CFG__REQ_slotmask_defval;
INTEGER_template template_ts__L1CTL__GPRS__UL__TBF__CFG__REQ_start__fn_defval;
const INTEGER_template& ts__L1CTL__GPRS__UL__TBF__CFG__REQ_start__fn_defval = template_ts__L1CTL__GPRS__UL__TBF__CFG__REQ_start__fn_defval;
INTEGER_template template_tr__L1CTL__GPRS__UL__TBF__CFG__REQ_tbf__ref_defval;
const INTEGER_template& tr__L1CTL__GPRS__UL__TBF__CFG__REQ_tbf__ref_defval = template_tr__L1CTL__GPRS__UL__TBF__CFG__REQ_tbf__ref_defval;
BITSTRING_template template_tr__L1CTL__GPRS__UL__TBF__CFG__REQ_slotmask_defval;
const BITSTRING_template& tr__L1CTL__GPRS__UL__TBF__CFG__REQ_slotmask_defval = template_tr__L1CTL__GPRS__UL__TBF__CFG__REQ_slotmask_defval;
INTEGER_template template_tr__L1CTL__GPRS__UL__TBF__CFG__REQ_start__fn_defval;
const INTEGER_template& tr__L1CTL__GPRS__UL__TBF__CFG__REQ_start__fn_defval = template_tr__L1CTL__GPRS__UL__TBF__CFG__REQ_start__fn_defval;
BITSTRING_template template_ts__L1CTL__GPRS__DL__TBF__CFG__REQ_slotmask_defval;
const BITSTRING_template& ts__L1CTL__GPRS__DL__TBF__CFG__REQ_slotmask_defval = template_ts__L1CTL__GPRS__DL__TBF__CFG__REQ_slotmask_defval;
INTEGER_template template_ts__L1CTL__GPRS__DL__TBF__CFG__REQ_start__fn_defval;
const INTEGER_template& ts__L1CTL__GPRS__DL__TBF__CFG__REQ_start__fn_defval = template_ts__L1CTL__GPRS__DL__TBF__CFG__REQ_start__fn_defval;
INTEGER_template template_ts__L1CTL__GPRS__DL__TBF__CFG__REQ_dl__tfi_defval;
const INTEGER_template& ts__L1CTL__GPRS__DL__TBF__CFG__REQ_dl__tfi_defval = template_ts__L1CTL__GPRS__DL__TBF__CFG__REQ_dl__tfi_defval;
INTEGER_template template_tr__L1CTL__GPRS__DL__TBF__CFG__REQ_tbf__ref_defval;
const INTEGER_template& tr__L1CTL__GPRS__DL__TBF__CFG__REQ_tbf__ref_defval = template_tr__L1CTL__GPRS__DL__TBF__CFG__REQ_tbf__ref_defval;
BITSTRING_template template_tr__L1CTL__GPRS__DL__TBF__CFG__REQ_slotmask_defval;
const BITSTRING_template& tr__L1CTL__GPRS__DL__TBF__CFG__REQ_slotmask_defval = template_tr__L1CTL__GPRS__DL__TBF__CFG__REQ_slotmask_defval;
INTEGER_template template_tr__L1CTL__GPRS__DL__TBF__CFG__REQ_start__fn_defval;
const INTEGER_template& tr__L1CTL__GPRS__DL__TBF__CFG__REQ_start__fn_defval = template_tr__L1CTL__GPRS__DL__TBF__CFG__REQ_start__fn_defval;
INTEGER_template template_tr__L1CTL__GPRS__DL__TBF__CFG__REQ_dl__tfi_defval;
const INTEGER_template& tr__L1CTL__GPRS__DL__TBF__CFG__REQ_dl__tfi_defval = template_tr__L1CTL__GPRS__DL__TBF__CFG__REQ_dl__tfi_defval;
INTEGER_template template_tr__L1CTL__GPRS__UL__BLOCK__REQ_fn_defval;
const INTEGER_template& tr__L1CTL__GPRS__UL__BLOCK__REQ_fn_defval = template_tr__L1CTL__GPRS__UL__BLOCK__REQ_fn_defval;
INTEGER_template template_tr__L1CTL__GPRS__UL__BLOCK__REQ_tn_defval;
const INTEGER_template& tr__L1CTL__GPRS__UL__BLOCK__REQ_tn_defval = template_tr__L1CTL__GPRS__UL__BLOCK__REQ_tn_defval;
OCTETSTRING_template template_tr__L1CTL__GPRS__UL__BLOCK__REQ_data_defval;
const OCTETSTRING_template& tr__L1CTL__GPRS__UL__BLOCK__REQ_data_defval = template_tr__L1CTL__GPRS__UL__BLOCK__REQ_data_defval;
INTEGER_template template_ts__L1CTL__GPRS__DL__BLOCK__IND_ber10k_defval;
const INTEGER_template& ts__L1CTL__GPRS__DL__BLOCK__IND_ber10k_defval = template_ts__L1CTL__GPRS__DL__BLOCK__IND_ber10k_defval;
INTEGER_template template_ts__L1CTL__GPRS__DL__BLOCK__IND_ci__cb_defval;
const INTEGER_template& ts__L1CTL__GPRS__DL__BLOCK__IND_ci__cb_defval = template_ts__L1CTL__GPRS__DL__BLOCK__IND_ci__cb_defval;
INTEGER_template template_ts__L1CTL__GPRS__DL__BLOCK__IND_rx__level_defval;
const INTEGER_template& ts__L1CTL__GPRS__DL__BLOCK__IND_rx__level_defval = template_ts__L1CTL__GPRS__DL__BLOCK__IND_rx__level_defval;
INTEGER_template template_tr__L1CTL__GPRS__DL__BLOCK__IND_fn_defval;
const INTEGER_template& tr__L1CTL__GPRS__DL__BLOCK__IND_fn_defval = template_tr__L1CTL__GPRS__DL__BLOCK__IND_fn_defval;
INTEGER_template template_tr__L1CTL__GPRS__DL__BLOCK__IND_tn_defval;
const INTEGER_template& tr__L1CTL__GPRS__DL__BLOCK__IND_tn_defval = template_tr__L1CTL__GPRS__DL__BLOCK__IND_tn_defval;
INTEGER_template template_tr__L1CTL__GPRS__DL__BLOCK__IND_usf_defval;
const INTEGER_template& tr__L1CTL__GPRS__DL__BLOCK__IND_usf_defval = template_tr__L1CTL__GPRS__DL__BLOCK__IND_usf_defval;
OCTETSTRING_template template_tr__L1CTL__GPRS__DL__BLOCK__IND_data_defval;
const OCTETSTRING_template& tr__L1CTL__GPRS__DL__BLOCK__IND_data_defval = template_tr__L1CTL__GPRS__DL__BLOCK__IND_data_defval;
INTEGER_template template_tr__L1CTL__GPRS__DL__BLOCK__IND_ber10k_defval;
const INTEGER_template& tr__L1CTL__GPRS__DL__BLOCK__IND_ber10k_defval = template_tr__L1CTL__GPRS__DL__BLOCK__IND_ber10k_defval;
INTEGER_template template_tr__L1CTL__GPRS__DL__BLOCK__IND_ci__cb_defval;
const INTEGER_template& tr__L1CTL__GPRS__DL__BLOCK__IND_ci__cb_defval = template_tr__L1CTL__GPRS__DL__BLOCK__IND_ci__cb_defval;
INTEGER_template template_tr__L1CTL__GPRS__DL__BLOCK__IND_rx__level_defval;
const INTEGER_template& tr__L1CTL__GPRS__DL__BLOCK__IND_rx__level_defval = template_tr__L1CTL__GPRS__DL__BLOCK__IND_rx__level_defval;
OCTETSTRING const_c__DummyUI;
const OCTETSTRING& c__DummyUI = const_c__DummyUI;
TTCN_Module module_object("L1CTL_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 */

L1ctlMsgType::L1ctlMsgType()
{
enum_value = UNBOUND_VALUE;
}

L1ctlMsgType::L1ctlMsgType(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @L1CTL_Types.L1ctlMsgType with invalid numeric value %d.", other_value);
enum_value = (enum_type)other_value;
}

L1ctlMsgType::L1ctlMsgType(enum_type other_value)
{
enum_value = other_value;
}

L1ctlMsgType::L1ctlMsgType(const L1ctlMsgType& other_value)
: Base_Type()
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @L1CTL_Types.L1ctlMsgType.");
enum_value = other_value.enum_value;
}

L1ctlMsgType& L1ctlMsgType::operator=(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @L1CTL_Types.L1ctlMsgType.", other_value);
enum_value = (enum_type)other_value;
return *this;
}

L1ctlMsgType& L1ctlMsgType::operator=(enum_type other_value)
{
enum_value = other_value;
return *this;
}

L1ctlMsgType& L1ctlMsgType::operator=(const L1ctlMsgType& other_value)
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @L1CTL_Types.L1ctlMsgType.");
enum_value = other_value.enum_value;
return *this;
}

boolean L1ctlMsgType::operator==(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlMsgType.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlMsgType comparison is an unknown numeric value %d", other_value);
return enum_value == other_value;
}

boolean L1ctlMsgType::operator==(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlMsgType.");
return enum_value == other_value;
}

boolean L1ctlMsgType::operator==(const L1ctlMsgType& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlMsgType.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlMsgType.");
return enum_value == other_value.enum_value;
}

boolean L1ctlMsgType::operator<(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlMsgType.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlMsgType comparison is an unknown numeric value %d", other_value);
return enum_value < other_value;
}

boolean L1ctlMsgType::operator<(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlMsgType.");
return enum_value < other_value;
}

boolean L1ctlMsgType::operator<(const L1ctlMsgType& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlMsgType.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlMsgType.");
return enum_value < other_value.enum_value;
}

boolean L1ctlMsgType::operator>(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlMsgType.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlMsgType comparison is an unknown numeric value %d", other_value);
return enum_value > other_value;
}

boolean L1ctlMsgType::operator>(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlMsgType.");
return enum_value > other_value;
}

boolean L1ctlMsgType::operator>(const L1ctlMsgType& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlMsgType.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlMsgType.");
return enum_value > other_value.enum_value;
}

const char *L1ctlMsgType::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case L1CTL__NONE: return "L1CTL_NONE";
case L1CTL__FBSB__REQ: return "L1CTL_FBSB_REQ";
case L1CTL__FBSB__CONF: return "L1CTL_FBSB_CONF";
case L1CTL__DATA__IND: return "L1CTL_DATA_IND";
case L1CTL__RACH__REQ: return "L1CTL_RACH_REQ";
case L1CTL__DM__EST__REQ: return "L1CTL_DM_EST_REQ";
case L1CTL__DATA__REQ: return "L1CTL_DATA_REQ";
case L1CTL__RESET__IND: return "L1CTL_RESET_IND";
case L1CTL__PM__REQ: return "L1CTL_PM_REQ";
case L1CTL__PM__CONF: return "L1CTL_PM_CONF";
case L1CTL__ECHO__REQ: return "L1CTL_ECHO_REQ";
case L1CTL__ECHO__CONF: return "L1CTL_ECHO_CONF";
case L1CTL__RACH__CONF: return "L1CTL_RACH_CONF";
case L1CTL__RESET__REQ: return "L1CTL_RESET_REQ";
case L1CTL__RESET__CONF: return "L1CTL_RESET_CONF";
case L1CTL__DATA__CONF: return "L1CTL_DATA_CONF";
case L1CTL__CCCH__MODE__REQ: return "L1CTL_CCCH_MODE_REQ";
case L1CTL__CCCH__MODE__CONF: return "L1CTL_CCCH_MODE_CONF";
case L1CTL__DM__REL__REQ: return "L1CTL_DM_REL_REQ";
case L1CTL__PARAM__REQ: return "L1CTL_PARAM_REQ";
case L1CTL__DM__FREQ__REQ: return "L1CTL_DM_FREQ_REQ";
case L1CTL__CRYPTO__REQ: return "L1CTL_CRYPTO_REQ";
case L1CTL__SIM__REQ: return "L1CTL_SIM_REQ";
case L1CTL__SIM__CONF: return "L1CTL_SIM_CONF";
case L1CTL__TCH__MODE__REQ: return "L1CTL_TCH_MODE_REQ";
case L1CTL__TCH__MODE__CONF: return "L1CTL_TCH_MODE_CONF";
case L1CTL__NEIGH__PM__REQ: return "L1CTL_NEIGH_PM_REQ";
case L1CTL__NEIGH__PM__IND: return "L1CTL_NEIGH_PM_IND";
case L1CTL__TRAFFIC__REQ: return "L1CTL_TRAFFIC_REQ";
case L1CTL__TRAFFIC__CONF: return "L1CTL_TRAFFIC_CONF";
case L1CTL__TRAFFIC__IND: return "L1CTL_TRAFFIC_IND";
case L1CTL__BURST__IND: return "L1CTL_BURST_IND";
case L1CTL__GPRS__UL__TBF__CFG__REQ: return "L1CTL_GPRS_UL_TBF_CFG_REQ";
case L1CTL__GPRS__DL__TBF__CFG__REQ: return "L1CTL_GPRS_DL_TBF_CFG_REQ";
case L1CTL__GPRS__UL__BLOCK__REQ: return "L1CTL_GPRS_UL_BLOCK_REQ";
case L1CTL__GPRS__DL__BLOCK__IND: return "L1CTL_GPRS_DL_BLOCK_IND";
case L1CTL__EXT__RACH__REQ: return "L1CTL_EXT_RACH_REQ";
case L1CTL__GPRS__RTS__IND: return "L1CTL_GPRS_RTS_IND";
case L1CTL__GPRS__UL__BLOCK__CNF: return "L1CTL_GPRS_UL_BLOCK_CNF";
default:
return "<unknown>";
}
}

L1ctlMsgType::enum_type L1ctlMsgType::str_to_enum(const char *str_par, const int* int_par, const int* int_par2)
{
if (int_par == NULL && int_par2 == NULL) {
if (!strcmp(str_par, "L1CTL_NONE")) return L1CTL__NONE;
if (!strcmp(str_par, "L1CTL_FBSB_REQ")) return L1CTL__FBSB__REQ;
if (!strcmp(str_par, "L1CTL_FBSB_CONF")) return L1CTL__FBSB__CONF;
if (!strcmp(str_par, "L1CTL_DATA_IND")) return L1CTL__DATA__IND;
if (!strcmp(str_par, "L1CTL_RACH_REQ")) return L1CTL__RACH__REQ;
if (!strcmp(str_par, "L1CTL_DM_EST_REQ")) return L1CTL__DM__EST__REQ;
if (!strcmp(str_par, "L1CTL_DATA_REQ")) return L1CTL__DATA__REQ;
if (!strcmp(str_par, "L1CTL_RESET_IND")) return L1CTL__RESET__IND;
if (!strcmp(str_par, "L1CTL_PM_REQ")) return L1CTL__PM__REQ;
if (!strcmp(str_par, "L1CTL_PM_CONF")) return L1CTL__PM__CONF;
if (!strcmp(str_par, "L1CTL_ECHO_REQ")) return L1CTL__ECHO__REQ;
if (!strcmp(str_par, "L1CTL_ECHO_CONF")) return L1CTL__ECHO__CONF;
if (!strcmp(str_par, "L1CTL_RACH_CONF")) return L1CTL__RACH__CONF;
if (!strcmp(str_par, "L1CTL_RESET_REQ")) return L1CTL__RESET__REQ;
if (!strcmp(str_par, "L1CTL_RESET_CONF")) return L1CTL__RESET__CONF;
if (!strcmp(str_par, "L1CTL_DATA_CONF")) return L1CTL__DATA__CONF;
if (!strcmp(str_par, "L1CTL_CCCH_MODE_REQ")) return L1CTL__CCCH__MODE__REQ;
if (!strcmp(str_par, "L1CTL_CCCH_MODE_CONF")) return L1CTL__CCCH__MODE__CONF;
if (!strcmp(str_par, "L1CTL_DM_REL_REQ")) return L1CTL__DM__REL__REQ;
if (!strcmp(str_par, "L1CTL_PARAM_REQ")) return L1CTL__PARAM__REQ;
if (!strcmp(str_par, "L1CTL_DM_FREQ_REQ")) return L1CTL__DM__FREQ__REQ;
if (!strcmp(str_par, "L1CTL_CRYPTO_REQ")) return L1CTL__CRYPTO__REQ;
if (!strcmp(str_par, "L1CTL_SIM_REQ")) return L1CTL__SIM__REQ;
if (!strcmp(str_par, "L1CTL_SIM_CONF")) return L1CTL__SIM__CONF;
if (!strcmp(str_par, "L1CTL_TCH_MODE_REQ")) return L1CTL__TCH__MODE__REQ;
if (!strcmp(str_par, "L1CTL_TCH_MODE_CONF")) return L1CTL__TCH__MODE__CONF;
if (!strcmp(str_par, "L1CTL_NEIGH_PM_REQ")) return L1CTL__NEIGH__PM__REQ;
if (!strcmp(str_par, "L1CTL_NEIGH_PM_IND")) return L1CTL__NEIGH__PM__IND;
if (!strcmp(str_par, "L1CTL_TRAFFIC_REQ")) return L1CTL__TRAFFIC__REQ;
if (!strcmp(str_par, "L1CTL_TRAFFIC_CONF")) return L1CTL__TRAFFIC__CONF;
if (!strcmp(str_par, "L1CTL_TRAFFIC_IND")) return L1CTL__TRAFFIC__IND;
if (!strcmp(str_par, "L1CTL_BURST_IND")) return L1CTL__BURST__IND;
if (!strcmp(str_par, "L1CTL_GPRS_UL_TBF_CFG_REQ")) return L1CTL__GPRS__UL__TBF__CFG__REQ;
if (!strcmp(str_par, "L1CTL_GPRS_DL_TBF_CFG_REQ")) return L1CTL__GPRS__DL__TBF__CFG__REQ;
if (!strcmp(str_par, "L1CTL_GPRS_UL_BLOCK_REQ")) return L1CTL__GPRS__UL__BLOCK__REQ;
if (!strcmp(str_par, "L1CTL_GPRS_DL_BLOCK_IND")) return L1CTL__GPRS__DL__BLOCK__IND;
if (!strcmp(str_par, "L1CTL_EXT_RACH_REQ")) return L1CTL__EXT__RACH__REQ;
if (!strcmp(str_par, "L1CTL_GPRS_RTS_IND")) return L1CTL__GPRS__RTS__IND;
if (!strcmp(str_par, "L1CTL_GPRS_UL_BLOCK_CNF")) return L1CTL__GPRS__UL__BLOCK__CNF;
}
return UNKNOWN_VALUE;
}

boolean L1ctlMsgType::is_valid_enum(int int_par)
{
switch (int_par) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
case 26:
case 27:
case 28:
case 29:
case 30:
case 31:
case 32:
case 33:
case 34:
case 35:
case 36:
case 37:
case 38:
return TRUE;
default:
return FALSE;
}
}

int L1ctlMsgType::enum2int(enum_type enum_par)
{
if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @L1CTL_Types.L1ctlMsgType.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int L1ctlMsgType::enum2int(const L1ctlMsgType& enum_par)
{
if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @L1CTL_Types.L1ctlMsgType.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

void L1ctlMsgType::int2enum(int int_val)
{
if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @L1CTL_Types.L1ctlMsgType.", int_val);
enum_value = (enum_type)int_val;
}

L1ctlMsgType::operator L1ctlMsgType::enum_type() const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @L1CTL_Types.L1ctlMsgType.");
return enum_value;
}

void L1ctlMsgType::log() const
{
if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value);
else TTCN_Logger::log_event_unbound();
}

void L1ctlMsgType::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "enumerated value");
  if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@L1CTL_Types.L1ctlMsgType");
  enum_value = str_to_enum(param.get_enumerated(), param.get_enumerated_value());
  if (!is_valid_enum(enum_value)) {
    param.error("Invalid enumerated value for type @L1CTL_Types.L1ctlMsgType.");
  }
}

void L1ctlMsgType::encode_text(Text_Buf& text_buf) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @L1CTL_Types.L1ctlMsgType.");
text_buf.push_int(enum_value);
}

void L1ctlMsgType::decode_text(Text_Buf& text_buf)
{
enum_value = (enum_type)text_buf.pull_int().get_val();
if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @L1CTL_Types.L1ctlMsgType.", enum_value);
}

void L1ctlMsgType::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 L1ctlMsgType::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 L1ctlMsgType::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*)
{
  int decoded_value = 0;
  int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 6, no_err);
  if (decoded_length < 0) return decoded_length;
  if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value;
  else {
    if(no_err){
     return -1;
    } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name);
    enum_value = UNKNOWN_VALUE;
    }
  }
  return decoded_length;
}

int L1ctlMsgType::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const
{
  return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 6);
}

void L1ctlMsgType_template::copy_template(const L1ctlMsgType_template& other_value)
{
set_selection(other_value);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = other_value.single_value;
break;
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 L1ctlMsgType_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 L1ctlMsgType_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlMsgType_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 enumerated type @L1CTL_Types.L1ctlMsgType.");
}
}

L1ctlMsgType_template::L1ctlMsgType_template()
{
}

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

L1ctlMsgType_template::L1ctlMsgType_template(int other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (!L1ctlMsgType::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @L1CTL_Types.L1ctlMsgType with unknown numeric value %d.", other_value);
single_value = (L1ctlMsgType::enum_type)other_value;
}

L1ctlMsgType_template::L1ctlMsgType_template(L1ctlMsgType::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

L1ctlMsgType_template::L1ctlMsgType_template(const L1ctlMsgType& other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (other_value.enum_value == L1ctlMsgType::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @L1CTL_Types.L1ctlMsgType.");
single_value = other_value.enum_value;
}

L1ctlMsgType_template::L1ctlMsgType_template(const OPTIONAL<L1ctlMsgType>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlMsgType::enum_type)(const L1ctlMsgType&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of enumerated type @L1CTL_Types.L1ctlMsgType from an unbound optional field.");
}
}

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

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

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

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

boolean L1ctlMsgType_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
return TRUE;
}

boolean L1ctlMsgType_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value != L1ctlMsgType::UNBOUND_VALUE;
}

void L1ctlMsgType_template::clean_up()
{
switch (template_selection) {
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;
}

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

L1ctlMsgType_template& L1ctlMsgType_template::operator=(int other_value)
{
if (!L1ctlMsgType::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @L1CTL_Types.L1ctlMsgType.", other_value);
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlMsgType::enum_type)other_value;
return *this;
}

L1ctlMsgType_template& L1ctlMsgType_template::operator=(L1ctlMsgType::enum_type other_value)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value;
return *this;
}

L1ctlMsgType_template& L1ctlMsgType_template::operator=(const L1ctlMsgType& other_value)
{
if (other_value.enum_value == L1ctlMsgType::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @L1CTL_Types.L1ctlMsgType to a template.");
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value.enum_value;
return *this;
}

L1ctlMsgType_template& L1ctlMsgType_template::operator=(const OPTIONAL<L1ctlMsgType>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlMsgType::enum_type)(const L1ctlMsgType&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of enumerated type @L1CTL_Types.L1ctlMsgType.");
}
return *this;
}

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

boolean L1ctlMsgType_template::match(L1ctlMsgType::enum_type other_value, boolean) const
{
switch (template_selection) {
case SPECIFIC_VALUE:
return single_value == other_value;
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value)) 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 enumerated type @L1CTL_Types.L1ctlMsgType.");
}
return FALSE;
}

boolean L1ctlMsgType_template::match(const L1ctlMsgType& other_value, boolean) const
{
if (other_value.enum_value == L1ctlMsgType::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @L1CTL_Types.L1ctlMsgType with an unbound value.");
return match(other_value.enum_value);
}

L1ctlMsgType::enum_type L1ctlMsgType_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @L1CTL_Types.L1ctlMsgType.");
return single_value;
}

void L1ctlMsgType_template::set_type(template_sel template_type, unsigned int list_length)
{
clean_up();
switch (template_type) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlMsgType_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @L1CTL_Types.L1ctlMsgType.");
}
}

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

void L1ctlMsgType_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(L1ctlMsgType::enum_to_str(single_value), single_value);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[elem_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 L1ctlMsgType_template::log_match(const L1ctlMsgType& match_value, boolean) const
{
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}

void L1ctlMsgType_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);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @L1CTL_Types.L1ctlMsgType.");
}
}

void L1ctlMsgType_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (L1ctlMsgType::enum_type)text_buf.pull_int().get_val();
if (!L1ctlMsgType::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @L1CTL_Types.L1ctlMsgType.", single_value);
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 L1ctlMsgType_template[value_list.n_values];
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @L1CTL_Types.L1ctlMsgType.");
}
}

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

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

void L1ctlMsgType_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "enumerated 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: {
    L1ctlMsgType_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_Enumerated: {
    L1ctlMsgType::enum_type enum_val = L1ctlMsgType::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!L1ctlMsgType::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @L1CTL_Types.L1ctlMsgType.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlMsgType_template* precondition = new L1ctlMsgType_template;
    precondition->set_param(*m_p->get_elem(0));
    L1ctlMsgType_template* implied_template = new L1ctlMsgType_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = L1ctlMsgType_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@L1CTL_Types.L1ctlMsgType");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlMsgType_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_VALUE:
if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return;
break;
case TR_OMIT:
if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return;
break;
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 : "@L1CTL_Types.L1ctlMsgType");
}

L1ctlCcchMode::L1ctlCcchMode()
{
enum_value = UNBOUND_VALUE;
}

L1ctlCcchMode::L1ctlCcchMode(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @L1CTL_Types.L1ctlCcchMode with invalid numeric value %d.", other_value);
enum_value = (enum_type)other_value;
}

L1ctlCcchMode::L1ctlCcchMode(enum_type other_value)
{
enum_value = other_value;
}

L1ctlCcchMode::L1ctlCcchMode(const L1ctlCcchMode& other_value)
: Base_Type()
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @L1CTL_Types.L1ctlCcchMode.");
enum_value = other_value.enum_value;
}

L1ctlCcchMode& L1ctlCcchMode::operator=(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @L1CTL_Types.L1ctlCcchMode.", other_value);
enum_value = (enum_type)other_value;
return *this;
}

L1ctlCcchMode& L1ctlCcchMode::operator=(enum_type other_value)
{
enum_value = other_value;
return *this;
}

L1ctlCcchMode& L1ctlCcchMode::operator=(const L1ctlCcchMode& other_value)
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @L1CTL_Types.L1ctlCcchMode.");
enum_value = other_value.enum_value;
return *this;
}

boolean L1ctlCcchMode::operator==(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlCcchMode.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlCcchMode comparison is an unknown numeric value %d", other_value);
return enum_value == other_value;
}

boolean L1ctlCcchMode::operator==(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlCcchMode.");
return enum_value == other_value;
}

boolean L1ctlCcchMode::operator==(const L1ctlCcchMode& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlCcchMode.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlCcchMode.");
return enum_value == other_value.enum_value;
}

boolean L1ctlCcchMode::operator<(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlCcchMode.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlCcchMode comparison is an unknown numeric value %d", other_value);
return enum_value < other_value;
}

boolean L1ctlCcchMode::operator<(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlCcchMode.");
return enum_value < other_value;
}

boolean L1ctlCcchMode::operator<(const L1ctlCcchMode& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlCcchMode.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlCcchMode.");
return enum_value < other_value.enum_value;
}

boolean L1ctlCcchMode::operator>(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlCcchMode.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlCcchMode comparison is an unknown numeric value %d", other_value);
return enum_value > other_value;
}

boolean L1ctlCcchMode::operator>(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlCcchMode.");
return enum_value > other_value;
}

boolean L1ctlCcchMode::operator>(const L1ctlCcchMode& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlCcchMode.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlCcchMode.");
return enum_value > other_value.enum_value;
}

const char *L1ctlCcchMode::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case CCCH__MODE__NONE: return "CCCH_MODE_NONE";
case CCCH__MODE__NON__COMBINED: return "CCCH_MODE_NON_COMBINED";
case CCCH__MODE__COMBINED: return "CCCH_MODE_COMBINED";
case CCCH__MODE__COMBINED__CBCH: return "CCCH_MODE_COMBINED_CBCH";
default:
return "<unknown>";
}
}

L1ctlCcchMode::enum_type L1ctlCcchMode::str_to_enum(const char *str_par, const int* int_par, const int* int_par2)
{
if (int_par == NULL && int_par2 == NULL) {
if (!strcmp(str_par, "CCCH_MODE_NONE")) return CCCH__MODE__NONE;
if (!strcmp(str_par, "CCCH_MODE_NON_COMBINED")) return CCCH__MODE__NON__COMBINED;
if (!strcmp(str_par, "CCCH_MODE_COMBINED")) return CCCH__MODE__COMBINED;
if (!strcmp(str_par, "CCCH_MODE_COMBINED_CBCH")) return CCCH__MODE__COMBINED__CBCH;
}
return UNKNOWN_VALUE;
}

boolean L1ctlCcchMode::is_valid_enum(int int_par)
{
switch (int_par) {
case 0:
case 1:
case 2:
case 3:
return TRUE;
default:
return FALSE;
}
}

int L1ctlCcchMode::enum2int(enum_type enum_par)
{
if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @L1CTL_Types.L1ctlCcchMode.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int L1ctlCcchMode::enum2int(const L1ctlCcchMode& enum_par)
{
if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @L1CTL_Types.L1ctlCcchMode.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

void L1ctlCcchMode::int2enum(int int_val)
{
if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @L1CTL_Types.L1ctlCcchMode.", int_val);
enum_value = (enum_type)int_val;
}

L1ctlCcchMode::operator L1ctlCcchMode::enum_type() const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @L1CTL_Types.L1ctlCcchMode.");
return enum_value;
}

void L1ctlCcchMode::log() const
{
if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value);
else TTCN_Logger::log_event_unbound();
}

void L1ctlCcchMode::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "enumerated value");
  if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@L1CTL_Types.L1ctlCcchMode");
  enum_value = str_to_enum(param.get_enumerated(), param.get_enumerated_value());
  if (!is_valid_enum(enum_value)) {
    param.error("Invalid enumerated value for type @L1CTL_Types.L1ctlCcchMode.");
  }
}

void L1ctlCcchMode::encode_text(Text_Buf& text_buf) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @L1CTL_Types.L1ctlCcchMode.");
text_buf.push_int(enum_value);
}

void L1ctlCcchMode::decode_text(Text_Buf& text_buf)
{
enum_value = (enum_type)text_buf.pull_int().get_val();
if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @L1CTL_Types.L1ctlCcchMode.", enum_value);
}

void L1ctlCcchMode::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 L1ctlCcchMode::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 L1ctlCcchMode::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*)
{
  int decoded_value = 0;
  int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err);
  if (decoded_length < 0) return decoded_length;
  if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value;
  else {
    if(no_err){
     return -1;
    } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name);
    enum_value = UNKNOWN_VALUE;
    }
  }
  return decoded_length;
}

int L1ctlCcchMode::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const
{
  return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3);
}

void L1ctlCcchMode_template::copy_template(const L1ctlCcchMode_template& other_value)
{
set_selection(other_value);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = other_value.single_value;
break;
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 L1ctlCcchMode_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 L1ctlCcchMode_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlCcchMode_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 enumerated type @L1CTL_Types.L1ctlCcchMode.");
}
}

L1ctlCcchMode_template::L1ctlCcchMode_template()
{
}

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

L1ctlCcchMode_template::L1ctlCcchMode_template(int other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (!L1ctlCcchMode::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @L1CTL_Types.L1ctlCcchMode with unknown numeric value %d.", other_value);
single_value = (L1ctlCcchMode::enum_type)other_value;
}

L1ctlCcchMode_template::L1ctlCcchMode_template(L1ctlCcchMode::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

L1ctlCcchMode_template::L1ctlCcchMode_template(const L1ctlCcchMode& other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (other_value.enum_value == L1ctlCcchMode::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @L1CTL_Types.L1ctlCcchMode.");
single_value = other_value.enum_value;
}

L1ctlCcchMode_template::L1ctlCcchMode_template(const OPTIONAL<L1ctlCcchMode>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlCcchMode::enum_type)(const L1ctlCcchMode&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of enumerated type @L1CTL_Types.L1ctlCcchMode from an unbound optional field.");
}
}

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

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

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

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

boolean L1ctlCcchMode_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
return TRUE;
}

boolean L1ctlCcchMode_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value != L1ctlCcchMode::UNBOUND_VALUE;
}

void L1ctlCcchMode_template::clean_up()
{
switch (template_selection) {
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;
}

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

L1ctlCcchMode_template& L1ctlCcchMode_template::operator=(int other_value)
{
if (!L1ctlCcchMode::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @L1CTL_Types.L1ctlCcchMode.", other_value);
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlCcchMode::enum_type)other_value;
return *this;
}

L1ctlCcchMode_template& L1ctlCcchMode_template::operator=(L1ctlCcchMode::enum_type other_value)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value;
return *this;
}

L1ctlCcchMode_template& L1ctlCcchMode_template::operator=(const L1ctlCcchMode& other_value)
{
if (other_value.enum_value == L1ctlCcchMode::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @L1CTL_Types.L1ctlCcchMode to a template.");
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value.enum_value;
return *this;
}

L1ctlCcchMode_template& L1ctlCcchMode_template::operator=(const OPTIONAL<L1ctlCcchMode>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlCcchMode::enum_type)(const L1ctlCcchMode&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of enumerated type @L1CTL_Types.L1ctlCcchMode.");
}
return *this;
}

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

boolean L1ctlCcchMode_template::match(L1ctlCcchMode::enum_type other_value, boolean) const
{
switch (template_selection) {
case SPECIFIC_VALUE:
return single_value == other_value;
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value)) 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 enumerated type @L1CTL_Types.L1ctlCcchMode.");
}
return FALSE;
}

boolean L1ctlCcchMode_template::match(const L1ctlCcchMode& other_value, boolean) const
{
if (other_value.enum_value == L1ctlCcchMode::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @L1CTL_Types.L1ctlCcchMode with an unbound value.");
return match(other_value.enum_value);
}

L1ctlCcchMode::enum_type L1ctlCcchMode_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @L1CTL_Types.L1ctlCcchMode.");
return single_value;
}

void L1ctlCcchMode_template::set_type(template_sel template_type, unsigned int list_length)
{
clean_up();
switch (template_type) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlCcchMode_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @L1CTL_Types.L1ctlCcchMode.");
}
}

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

void L1ctlCcchMode_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(L1ctlCcchMode::enum_to_str(single_value), single_value);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[elem_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 L1ctlCcchMode_template::log_match(const L1ctlCcchMode& match_value, boolean) const
{
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}

void L1ctlCcchMode_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);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @L1CTL_Types.L1ctlCcchMode.");
}
}

void L1ctlCcchMode_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (L1ctlCcchMode::enum_type)text_buf.pull_int().get_val();
if (!L1ctlCcchMode::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @L1CTL_Types.L1ctlCcchMode.", single_value);
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 L1ctlCcchMode_template[value_list.n_values];
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @L1CTL_Types.L1ctlCcchMode.");
}
}

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

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

void L1ctlCcchMode_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "enumerated 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: {
    L1ctlCcchMode_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_Enumerated: {
    L1ctlCcchMode::enum_type enum_val = L1ctlCcchMode::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!L1ctlCcchMode::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @L1CTL_Types.L1ctlCcchMode.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlCcchMode_template* precondition = new L1ctlCcchMode_template;
    precondition->set_param(*m_p->get_elem(0));
    L1ctlCcchMode_template* implied_template = new L1ctlCcchMode_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = L1ctlCcchMode_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@L1CTL_Types.L1ctlCcchMode");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlCcchMode_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_VALUE:
if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return;
break;
case TR_OMIT:
if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return;
break;
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 : "@L1CTL_Types.L1ctlCcchMode");
}

L1ctlNeighMode::L1ctlNeighMode()
{
enum_value = UNBOUND_VALUE;
}

L1ctlNeighMode::L1ctlNeighMode(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @L1CTL_Types.L1ctlNeighMode with invalid numeric value %d.", other_value);
enum_value = (enum_type)other_value;
}

L1ctlNeighMode::L1ctlNeighMode(enum_type other_value)
{
enum_value = other_value;
}

L1ctlNeighMode::L1ctlNeighMode(const L1ctlNeighMode& other_value)
: Base_Type()
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @L1CTL_Types.L1ctlNeighMode.");
enum_value = other_value.enum_value;
}

L1ctlNeighMode& L1ctlNeighMode::operator=(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @L1CTL_Types.L1ctlNeighMode.", other_value);
enum_value = (enum_type)other_value;
return *this;
}

L1ctlNeighMode& L1ctlNeighMode::operator=(enum_type other_value)
{
enum_value = other_value;
return *this;
}

L1ctlNeighMode& L1ctlNeighMode::operator=(const L1ctlNeighMode& other_value)
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @L1CTL_Types.L1ctlNeighMode.");
enum_value = other_value.enum_value;
return *this;
}

boolean L1ctlNeighMode::operator==(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlNeighMode.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlNeighMode comparison is an unknown numeric value %d", other_value);
return enum_value == other_value;
}

boolean L1ctlNeighMode::operator==(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlNeighMode.");
return enum_value == other_value;
}

boolean L1ctlNeighMode::operator==(const L1ctlNeighMode& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlNeighMode.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlNeighMode.");
return enum_value == other_value.enum_value;
}

boolean L1ctlNeighMode::operator<(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlNeighMode.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlNeighMode comparison is an unknown numeric value %d", other_value);
return enum_value < other_value;
}

boolean L1ctlNeighMode::operator<(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlNeighMode.");
return enum_value < other_value;
}

boolean L1ctlNeighMode::operator<(const L1ctlNeighMode& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlNeighMode.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlNeighMode.");
return enum_value < other_value.enum_value;
}

boolean L1ctlNeighMode::operator>(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlNeighMode.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlNeighMode comparison is an unknown numeric value %d", other_value);
return enum_value > other_value;
}

boolean L1ctlNeighMode::operator>(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlNeighMode.");
return enum_value > other_value;
}

boolean L1ctlNeighMode::operator>(const L1ctlNeighMode& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlNeighMode.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlNeighMode.");
return enum_value > other_value.enum_value;
}

const char *L1ctlNeighMode::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case NEIGH__MODE__NONE: return "NEIGH_MODE_NONE";
case NEIGH__MODE__PM: return "NEIGH_MODE_PM";
case NEIGH__MODE__SB: return "NEIGH_MODE_SB";
default:
return "<unknown>";
}
}

L1ctlNeighMode::enum_type L1ctlNeighMode::str_to_enum(const char *str_par, const int* int_par, const int* int_par2)
{
if (int_par == NULL && int_par2 == NULL) {
if (!strcmp(str_par, "NEIGH_MODE_NONE")) return NEIGH__MODE__NONE;
if (!strcmp(str_par, "NEIGH_MODE_PM")) return NEIGH__MODE__PM;
if (!strcmp(str_par, "NEIGH_MODE_SB")) return NEIGH__MODE__SB;
}
return UNKNOWN_VALUE;
}

boolean L1ctlNeighMode::is_valid_enum(int int_par)
{
switch (int_par) {
case 0:
case 1:
case 2:
return TRUE;
default:
return FALSE;
}
}

int L1ctlNeighMode::enum2int(enum_type enum_par)
{
if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @L1CTL_Types.L1ctlNeighMode.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int L1ctlNeighMode::enum2int(const L1ctlNeighMode& enum_par)
{
if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @L1CTL_Types.L1ctlNeighMode.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

void L1ctlNeighMode::int2enum(int int_val)
{
if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @L1CTL_Types.L1ctlNeighMode.", int_val);
enum_value = (enum_type)int_val;
}

L1ctlNeighMode::operator L1ctlNeighMode::enum_type() const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @L1CTL_Types.L1ctlNeighMode.");
return enum_value;
}

void L1ctlNeighMode::log() const
{
if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value);
else TTCN_Logger::log_event_unbound();
}

void L1ctlNeighMode::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "enumerated value");
  if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@L1CTL_Types.L1ctlNeighMode");
  enum_value = str_to_enum(param.get_enumerated(), param.get_enumerated_value());
  if (!is_valid_enum(enum_value)) {
    param.error("Invalid enumerated value for type @L1CTL_Types.L1ctlNeighMode.");
  }
}

void L1ctlNeighMode::encode_text(Text_Buf& text_buf) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @L1CTL_Types.L1ctlNeighMode.");
text_buf.push_int(enum_value);
}

void L1ctlNeighMode::decode_text(Text_Buf& text_buf)
{
enum_value = (enum_type)text_buf.pull_int().get_val();
if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @L1CTL_Types.L1ctlNeighMode.", enum_value);
}

void L1ctlNeighMode::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 L1ctlNeighMode::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 L1ctlNeighMode::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*)
{
  int decoded_value = 0;
  int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err);
  if (decoded_length < 0) return decoded_length;
  if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value;
  else {
    if(no_err){
     return -1;
    } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name);
    enum_value = UNKNOWN_VALUE;
    }
  }
  return decoded_length;
}

int L1ctlNeighMode::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const
{
  return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2);
}

void L1ctlNeighMode_template::copy_template(const L1ctlNeighMode_template& other_value)
{
set_selection(other_value);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = other_value.single_value;
break;
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 L1ctlNeighMode_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 L1ctlNeighMode_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlNeighMode_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 enumerated type @L1CTL_Types.L1ctlNeighMode.");
}
}

L1ctlNeighMode_template::L1ctlNeighMode_template()
{
}

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

L1ctlNeighMode_template::L1ctlNeighMode_template(int other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (!L1ctlNeighMode::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @L1CTL_Types.L1ctlNeighMode with unknown numeric value %d.", other_value);
single_value = (L1ctlNeighMode::enum_type)other_value;
}

L1ctlNeighMode_template::L1ctlNeighMode_template(L1ctlNeighMode::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

L1ctlNeighMode_template::L1ctlNeighMode_template(const L1ctlNeighMode& other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (other_value.enum_value == L1ctlNeighMode::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @L1CTL_Types.L1ctlNeighMode.");
single_value = other_value.enum_value;
}

L1ctlNeighMode_template::L1ctlNeighMode_template(const OPTIONAL<L1ctlNeighMode>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlNeighMode::enum_type)(const L1ctlNeighMode&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of enumerated type @L1CTL_Types.L1ctlNeighMode from an unbound optional field.");
}
}

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

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

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

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

boolean L1ctlNeighMode_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
return TRUE;
}

boolean L1ctlNeighMode_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value != L1ctlNeighMode::UNBOUND_VALUE;
}

void L1ctlNeighMode_template::clean_up()
{
switch (template_selection) {
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;
}

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

L1ctlNeighMode_template& L1ctlNeighMode_template::operator=(int other_value)
{
if (!L1ctlNeighMode::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @L1CTL_Types.L1ctlNeighMode.", other_value);
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlNeighMode::enum_type)other_value;
return *this;
}

L1ctlNeighMode_template& L1ctlNeighMode_template::operator=(L1ctlNeighMode::enum_type other_value)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value;
return *this;
}

L1ctlNeighMode_template& L1ctlNeighMode_template::operator=(const L1ctlNeighMode& other_value)
{
if (other_value.enum_value == L1ctlNeighMode::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @L1CTL_Types.L1ctlNeighMode to a template.");
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value.enum_value;
return *this;
}

L1ctlNeighMode_template& L1ctlNeighMode_template::operator=(const OPTIONAL<L1ctlNeighMode>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlNeighMode::enum_type)(const L1ctlNeighMode&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of enumerated type @L1CTL_Types.L1ctlNeighMode.");
}
return *this;
}

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

boolean L1ctlNeighMode_template::match(L1ctlNeighMode::enum_type other_value, boolean) const
{
switch (template_selection) {
case SPECIFIC_VALUE:
return single_value == other_value;
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value)) 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 enumerated type @L1CTL_Types.L1ctlNeighMode.");
}
return FALSE;
}

boolean L1ctlNeighMode_template::match(const L1ctlNeighMode& other_value, boolean) const
{
if (other_value.enum_value == L1ctlNeighMode::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @L1CTL_Types.L1ctlNeighMode with an unbound value.");
return match(other_value.enum_value);
}

L1ctlNeighMode::enum_type L1ctlNeighMode_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @L1CTL_Types.L1ctlNeighMode.");
return single_value;
}

void L1ctlNeighMode_template::set_type(template_sel template_type, unsigned int list_length)
{
clean_up();
switch (template_type) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlNeighMode_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @L1CTL_Types.L1ctlNeighMode.");
}
}

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

void L1ctlNeighMode_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(L1ctlNeighMode::enum_to_str(single_value), single_value);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[elem_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 L1ctlNeighMode_template::log_match(const L1ctlNeighMode& match_value, boolean) const
{
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}

void L1ctlNeighMode_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);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @L1CTL_Types.L1ctlNeighMode.");
}
}

void L1ctlNeighMode_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (L1ctlNeighMode::enum_type)text_buf.pull_int().get_val();
if (!L1ctlNeighMode::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @L1CTL_Types.L1ctlNeighMode.", single_value);
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 L1ctlNeighMode_template[value_list.n_values];
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @L1CTL_Types.L1ctlNeighMode.");
}
}

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

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

void L1ctlNeighMode_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "enumerated 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: {
    L1ctlNeighMode_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_Enumerated: {
    L1ctlNeighMode::enum_type enum_val = L1ctlNeighMode::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!L1ctlNeighMode::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @L1CTL_Types.L1ctlNeighMode.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlNeighMode_template* precondition = new L1ctlNeighMode_template;
    precondition->set_param(*m_p->get_elem(0));
    L1ctlNeighMode_template* implied_template = new L1ctlNeighMode_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = L1ctlNeighMode_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@L1CTL_Types.L1ctlNeighMode");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlNeighMode_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_VALUE:
if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return;
break;
case TR_OMIT:
if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return;
break;
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 : "@L1CTL_Types.L1ctlNeighMode");
}

L1ctlResetType::L1ctlResetType()
{
enum_value = UNBOUND_VALUE;
}

L1ctlResetType::L1ctlResetType(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @L1CTL_Types.L1ctlResetType with invalid numeric value %d.", other_value);
enum_value = (enum_type)other_value;
}

L1ctlResetType::L1ctlResetType(enum_type other_value)
{
enum_value = other_value;
}

L1ctlResetType::L1ctlResetType(const L1ctlResetType& other_value)
: Base_Type()
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @L1CTL_Types.L1ctlResetType.");
enum_value = other_value.enum_value;
}

L1ctlResetType& L1ctlResetType::operator=(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @L1CTL_Types.L1ctlResetType.", other_value);
enum_value = (enum_type)other_value;
return *this;
}

L1ctlResetType& L1ctlResetType::operator=(enum_type other_value)
{
enum_value = other_value;
return *this;
}

L1ctlResetType& L1ctlResetType::operator=(const L1ctlResetType& other_value)
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @L1CTL_Types.L1ctlResetType.");
enum_value = other_value.enum_value;
return *this;
}

boolean L1ctlResetType::operator==(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlResetType.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlResetType comparison is an unknown numeric value %d", other_value);
return enum_value == other_value;
}

boolean L1ctlResetType::operator==(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlResetType.");
return enum_value == other_value;
}

boolean L1ctlResetType::operator==(const L1ctlResetType& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlResetType.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlResetType.");
return enum_value == other_value.enum_value;
}

boolean L1ctlResetType::operator<(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlResetType.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlResetType comparison is an unknown numeric value %d", other_value);
return enum_value < other_value;
}

boolean L1ctlResetType::operator<(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlResetType.");
return enum_value < other_value;
}

boolean L1ctlResetType::operator<(const L1ctlResetType& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlResetType.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlResetType.");
return enum_value < other_value.enum_value;
}

boolean L1ctlResetType::operator>(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlResetType.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlResetType comparison is an unknown numeric value %d", other_value);
return enum_value > other_value;
}

boolean L1ctlResetType::operator>(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlResetType.");
return enum_value > other_value;
}

boolean L1ctlResetType::operator>(const L1ctlResetType& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlResetType.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlResetType.");
return enum_value > other_value.enum_value;
}

const char *L1ctlResetType::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case L1CTL__RES__T__BOOT: return "L1CTL_RES_T_BOOT";
case L1CTL__RES__T__FULL: return "L1CTL_RES_T_FULL";
case L1CTL__RES__T__SCHED: return "L1CTL_RES_T_SCHED";
default:
return "<unknown>";
}
}

L1ctlResetType::enum_type L1ctlResetType::str_to_enum(const char *str_par, const int* int_par, const int* int_par2)
{
if (int_par == NULL && int_par2 == NULL) {
if (!strcmp(str_par, "L1CTL_RES_T_BOOT")) return L1CTL__RES__T__BOOT;
if (!strcmp(str_par, "L1CTL_RES_T_FULL")) return L1CTL__RES__T__FULL;
if (!strcmp(str_par, "L1CTL_RES_T_SCHED")) return L1CTL__RES__T__SCHED;
}
return UNKNOWN_VALUE;
}

boolean L1ctlResetType::is_valid_enum(int int_par)
{
switch (int_par) {
case 0:
case 1:
case 2:
return TRUE;
default:
return FALSE;
}
}

int L1ctlResetType::enum2int(enum_type enum_par)
{
if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @L1CTL_Types.L1ctlResetType.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int L1ctlResetType::enum2int(const L1ctlResetType& enum_par)
{
if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @L1CTL_Types.L1ctlResetType.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

void L1ctlResetType::int2enum(int int_val)
{
if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @L1CTL_Types.L1ctlResetType.", int_val);
enum_value = (enum_type)int_val;
}

L1ctlResetType::operator L1ctlResetType::enum_type() const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @L1CTL_Types.L1ctlResetType.");
return enum_value;
}

void L1ctlResetType::log() const
{
if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value);
else TTCN_Logger::log_event_unbound();
}

void L1ctlResetType::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "enumerated value");
  if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@L1CTL_Types.L1ctlResetType");
  enum_value = str_to_enum(param.get_enumerated(), param.get_enumerated_value());
  if (!is_valid_enum(enum_value)) {
    param.error("Invalid enumerated value for type @L1CTL_Types.L1ctlResetType.");
  }
}

void L1ctlResetType::encode_text(Text_Buf& text_buf) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @L1CTL_Types.L1ctlResetType.");
text_buf.push_int(enum_value);
}

void L1ctlResetType::decode_text(Text_Buf& text_buf)
{
enum_value = (enum_type)text_buf.pull_int().get_val();
if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @L1CTL_Types.L1ctlResetType.", enum_value);
}

void L1ctlResetType::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 L1ctlResetType::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 L1ctlResetType::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*)
{
  int decoded_value = 0;
  int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err);
  if (decoded_length < 0) return decoded_length;
  if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value;
  else {
    if(no_err){
     return -1;
    } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name);
    enum_value = UNKNOWN_VALUE;
    }
  }
  return decoded_length;
}

int L1ctlResetType::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const
{
  return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2);
}

void L1ctlResetType_template::copy_template(const L1ctlResetType_template& other_value)
{
set_selection(other_value);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = other_value.single_value;
break;
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 L1ctlResetType_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 L1ctlResetType_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlResetType_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 enumerated type @L1CTL_Types.L1ctlResetType.");
}
}

L1ctlResetType_template::L1ctlResetType_template()
{
}

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

L1ctlResetType_template::L1ctlResetType_template(int other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (!L1ctlResetType::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @L1CTL_Types.L1ctlResetType with unknown numeric value %d.", other_value);
single_value = (L1ctlResetType::enum_type)other_value;
}

L1ctlResetType_template::L1ctlResetType_template(L1ctlResetType::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

L1ctlResetType_template::L1ctlResetType_template(const L1ctlResetType& other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (other_value.enum_value == L1ctlResetType::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @L1CTL_Types.L1ctlResetType.");
single_value = other_value.enum_value;
}

L1ctlResetType_template::L1ctlResetType_template(const OPTIONAL<L1ctlResetType>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlResetType::enum_type)(const L1ctlResetType&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of enumerated type @L1CTL_Types.L1ctlResetType from an unbound optional field.");
}
}

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

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

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

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

boolean L1ctlResetType_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
return TRUE;
}

boolean L1ctlResetType_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value != L1ctlResetType::UNBOUND_VALUE;
}

void L1ctlResetType_template::clean_up()
{
switch (template_selection) {
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;
}

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

L1ctlResetType_template& L1ctlResetType_template::operator=(int other_value)
{
if (!L1ctlResetType::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @L1CTL_Types.L1ctlResetType.", other_value);
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlResetType::enum_type)other_value;
return *this;
}

L1ctlResetType_template& L1ctlResetType_template::operator=(L1ctlResetType::enum_type other_value)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value;
return *this;
}

L1ctlResetType_template& L1ctlResetType_template::operator=(const L1ctlResetType& other_value)
{
if (other_value.enum_value == L1ctlResetType::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @L1CTL_Types.L1ctlResetType to a template.");
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value.enum_value;
return *this;
}

L1ctlResetType_template& L1ctlResetType_template::operator=(const OPTIONAL<L1ctlResetType>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlResetType::enum_type)(const L1ctlResetType&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of enumerated type @L1CTL_Types.L1ctlResetType.");
}
return *this;
}

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

boolean L1ctlResetType_template::match(L1ctlResetType::enum_type other_value, boolean) const
{
switch (template_selection) {
case SPECIFIC_VALUE:
return single_value == other_value;
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value)) 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 enumerated type @L1CTL_Types.L1ctlResetType.");
}
return FALSE;
}

boolean L1ctlResetType_template::match(const L1ctlResetType& other_value, boolean) const
{
if (other_value.enum_value == L1ctlResetType::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @L1CTL_Types.L1ctlResetType with an unbound value.");
return match(other_value.enum_value);
}

L1ctlResetType::enum_type L1ctlResetType_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @L1CTL_Types.L1ctlResetType.");
return single_value;
}

void L1ctlResetType_template::set_type(template_sel template_type, unsigned int list_length)
{
clean_up();
switch (template_type) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlResetType_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @L1CTL_Types.L1ctlResetType.");
}
}

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

void L1ctlResetType_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(L1ctlResetType::enum_to_str(single_value), single_value);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[elem_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 L1ctlResetType_template::log_match(const L1ctlResetType& match_value, boolean) const
{
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}

void L1ctlResetType_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);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @L1CTL_Types.L1ctlResetType.");
}
}

void L1ctlResetType_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (L1ctlResetType::enum_type)text_buf.pull_int().get_val();
if (!L1ctlResetType::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @L1CTL_Types.L1ctlResetType.", single_value);
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 L1ctlResetType_template[value_list.n_values];
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @L1CTL_Types.L1ctlResetType.");
}
}

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

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

void L1ctlResetType_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "enumerated 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: {
    L1ctlResetType_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_Enumerated: {
    L1ctlResetType::enum_type enum_val = L1ctlResetType::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!L1ctlResetType::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @L1CTL_Types.L1ctlResetType.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlResetType_template* precondition = new L1ctlResetType_template;
    precondition->set_param(*m_p->get_elem(0));
    L1ctlResetType_template* implied_template = new L1ctlResetType_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = L1ctlResetType_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@L1CTL_Types.L1ctlResetType");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlResetType_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_VALUE:
if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return;
break;
case TR_OMIT:
if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return;
break;
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 : "@L1CTL_Types.L1ctlResetType");
}

L1ctlHdrFlags::L1ctlHdrFlags()
{
}

L1ctlHdrFlags::L1ctlHdrFlags(const BITSTRING& par_padding,
    const BOOLEAN& par_f__done)
  :   field_padding(par_padding),
  field_f__done(par_f__done)
{
}

L1ctlHdrFlags::L1ctlHdrFlags(const L1ctlHdrFlags& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlHdrFlags.");
if (other_value.padding().is_bound()) field_padding = other_value.padding();
else field_padding.clean_up();
if (other_value.f__done().is_bound()) field_f__done = other_value.f__done();
else field_f__done.clean_up();
}

void L1ctlHdrFlags::clean_up()
{
field_padding.clean_up();
field_f__done.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlHdrFlags::get_descriptor() const { return &L1ctlHdrFlags_descr_; }
L1ctlHdrFlags& L1ctlHdrFlags::operator=(const L1ctlHdrFlags& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlHdrFlags.");
  if (other_value.padding().is_bound()) field_padding = other_value.padding();
  else field_padding.clean_up();
  if (other_value.f__done().is_bound()) field_f__done = other_value.f__done();
  else field_f__done.clean_up();
}
return *this;
}

boolean L1ctlHdrFlags::operator==(const L1ctlHdrFlags& other_value) const
{
return field_padding==other_value.field_padding
  && field_f__done==other_value.field_f__done;
}

boolean L1ctlHdrFlags::is_bound() const
{
return (field_padding.is_bound())
  || (field_f__done.is_bound());
}
boolean L1ctlHdrFlags::is_value() const
{
return field_padding.is_value()
  && field_f__done.is_value();
}
void L1ctlHdrFlags::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ padding := ");
field_padding.log();
TTCN_Logger::log_event_str(", f_done := ");
field_f__done.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlHdrFlags::set_implicit_omit()
{
if (padding().is_bound()) padding().set_implicit_omit();
if (f__done().is_bound()) f__done().set_implicit_omit();
}

void L1ctlHdrFlags::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record value of type @L1CTL_Types.L1ctlHdrFlags has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) padding().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) f__done().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "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++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "f_done")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          f__done().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 @L1CTL_Types.L1ctlHdrFlags: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlHdrFlags");
  }
}

void L1ctlHdrFlags::encode_text(Text_Buf& text_buf) const
{
field_padding.encode_text(text_buf);
field_f__done.encode_text(text_buf);
}

void L1ctlHdrFlags::decode_text(Text_Buf& text_buf)
{
field_padding.decode_text(text_buf);
field_f__done.decode_text(text_buf);
}

void L1ctlHdrFlags::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 L1ctlHdrFlags::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 L1ctlHdrFlags::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::BIT7_descr_.raw->forceomit);
  decoded_field_length = field_padding.RAW_decode(General__Types::BIT7_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, BOOLEAN_descr_.raw->forceomit);
  decoded_field_length = field_f__done.RAW_decode(BOOLEAN_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

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

struct L1ctlHdrFlags_template::single_value_struct {
BITSTRING_template field_padding;
BOOLEAN_template field_f__done;
};

void L1ctlHdrFlags_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_padding = ANY_VALUE;
single_value->field_f__done = ANY_VALUE;
}
}
}

void L1ctlHdrFlags_template::copy_value(const L1ctlHdrFlags& other_value)
{
single_value = new single_value_struct;
if (other_value.padding().is_bound()) {
  single_value->field_padding = other_value.padding();
} else {
  single_value->field_padding.clean_up();
}
if (other_value.f__done().is_bound()) {
  single_value->field_f__done = other_value.f__done();
} else {
  single_value->field_f__done.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlHdrFlags_template::copy_template(const L1ctlHdrFlags_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.padding().get_selection()) {
single_value->field_padding = other_value.padding();
} else {
single_value->field_padding.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.f__done().get_selection()) {
single_value->field_f__done = other_value.f__done();
} else {
single_value->field_f__done.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 L1ctlHdrFlags_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 L1ctlHdrFlags_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlHdrFlags_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 @L1CTL_Types.L1ctlHdrFlags.");
break;
}
set_selection(other_value);
}

L1ctlHdrFlags_template::L1ctlHdrFlags_template()
{
}

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

L1ctlHdrFlags_template::L1ctlHdrFlags_template(const L1ctlHdrFlags& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlHdrFlags_template::match(const L1ctlHdrFlags& 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.padding().is_bound()) return FALSE;
if(!single_value->field_padding.match(other_value.padding(), legacy))return FALSE;
if(!other_value.f__done().is_bound()) return FALSE;
if(!single_value->field_f__done.match(other_value.f__done(), 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 @L1CTL_Types.L1ctlHdrFlags.");
}
return FALSE;
}

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

boolean L1ctlHdrFlags_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_padding.is_value()
 && single_value->field_f__done.is_value();
}

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

L1ctlHdrFlags L1ctlHdrFlags_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 @L1CTL_Types.L1ctlHdrFlags.");
L1ctlHdrFlags ret_val;
if (single_value->field_padding.is_bound()) {
ret_val.padding() = single_value->field_padding.valueof();
}
if (single_value->field_f__done.is_bound()) {
ret_val.f__done() = single_value->field_f__done.valueof();
}
return ret_val;
}

void L1ctlHdrFlags_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 @L1CTL_Types.L1ctlHdrFlags.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlHdrFlags_template[list_length];
}

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

BITSTRING_template& L1ctlHdrFlags_template::padding()
{
set_specific();
return single_value->field_padding;
}

const BITSTRING_template& L1ctlHdrFlags_template::padding() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field padding of a non-specific template of type @L1CTL_Types.L1ctlHdrFlags.");
return single_value->field_padding;
}

BOOLEAN_template& L1ctlHdrFlags_template::f__done()
{
set_specific();
return single_value->field_f__done;
}

const BOOLEAN_template& L1ctlHdrFlags_template::f__done() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field f_done of a non-specific template of type @L1CTL_Types.L1ctlHdrFlags.");
return single_value->field_f__done;
}

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

void L1ctlHdrFlags_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ padding := ");
single_value->field_padding.log();
TTCN_Logger::log_event_str(", f_done := ");
single_value->field_f__done.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 L1ctlHdrFlags_template::log_match(const L1ctlHdrFlags& 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_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);
}
if(!single_value->field_f__done.match(match_value.f__done(), legacy)){
TTCN_Logger::log_logmatch_info(".f_done");
single_value->field_f__done.log_match(match_value.f__done(), 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("{ padding := ");
single_value->field_padding.log_match(match_value.padding(), legacy);
TTCN_Logger::log_event_str(", f_done := ");
single_value->field_f__done.log_match(match_value.f__done(), 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 L1ctlHdrFlags_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (padding().is_bound()) padding().set_implicit_omit();
if (f__done().is_bound()) f__done().set_implicit_omit();
}

void L1ctlHdrFlags_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_padding.encode_text(text_buf);
single_value->field_f__done.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 @L1CTL_Types.L1ctlHdrFlags.");
}
}

void L1ctlHdrFlags_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_padding.decode_text(text_buf);
single_value->field_f__done.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 L1ctlHdrFlags_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 @L1CTL_Types.L1ctlHdrFlags.");
}
}

void L1ctlHdrFlags_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: {
    L1ctlHdrFlags_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @L1CTL_Types.L1ctlHdrFlags has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) padding().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) f__done().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "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++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "f_done")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          f__done().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 @L1CTL_Types.L1ctlHdrFlags: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlHdrFlags_template* precondition = new L1ctlHdrFlags_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlHdrFlags_template* implied_template = new L1ctlHdrFlags_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlHdrFlags_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlHdrFlags");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlHdrFlags_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_padding.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlHdrFlags");
single_value->field_f__done.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlHdrFlags");
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 : "@L1CTL_Types.L1ctlHdrFlags");
}

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

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

L1ctlHeader::L1ctlHeader()
{
}

L1ctlHeader::L1ctlHeader(const L1ctlMsgType& par_msg__type,
    const L1ctlHdrFlags& par_flags,
    const OCTETSTRING& par_padding)
  :   field_msg__type(par_msg__type),
  field_flags(par_flags),
  field_padding(par_padding)
{
}

L1ctlHeader::L1ctlHeader(const L1ctlHeader& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlHeader.");
if (other_value.msg__type().is_bound()) field_msg__type = other_value.msg__type();
else field_msg__type.clean_up();
if (other_value.flags().is_bound()) field_flags = other_value.flags();
else field_flags.clean_up();
if (other_value.padding().is_bound()) field_padding = other_value.padding();
else field_padding.clean_up();
}

void L1ctlHeader::clean_up()
{
field_msg__type.clean_up();
field_flags.clean_up();
field_padding.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlHeader::get_descriptor() const { return &L1ctlHeader_descr_; }
L1ctlHeader& L1ctlHeader::operator=(const L1ctlHeader& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlHeader.");
  if (other_value.msg__type().is_bound()) field_msg__type = other_value.msg__type();
  else field_msg__type.clean_up();
  if (other_value.flags().is_bound()) field_flags = other_value.flags();
  else field_flags.clean_up();
  if (other_value.padding().is_bound()) field_padding = other_value.padding();
  else field_padding.clean_up();
}
return *this;
}

boolean L1ctlHeader::operator==(const L1ctlHeader& other_value) const
{
return field_msg__type==other_value.field_msg__type
  && field_flags==other_value.field_flags
  && field_padding==other_value.field_padding;
}

boolean L1ctlHeader::is_bound() const
{
return (field_msg__type.is_bound())
  || (field_flags.is_bound())
  || (field_padding.is_bound());
}
boolean L1ctlHeader::is_value() const
{
return field_msg__type.is_value()
  && field_flags.is_value()
  && field_padding.is_value();
}
void L1ctlHeader::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ msg_type := ");
field_msg__type.log();
TTCN_Logger::log_event_str(", flags := ");
field_flags.log();
TTCN_Logger::log_event_str(", padding := ");
field_padding.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlHeader::set_implicit_omit()
{
if (msg__type().is_bound()) msg__type().set_implicit_omit();
if (flags().is_bound()) flags().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

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

void L1ctlHeader::encode_text(Text_Buf& text_buf) const
{
field_msg__type.encode_text(text_buf);
field_flags.encode_text(text_buf);
field_padding.encode_text(text_buf);
}

void L1ctlHeader::decode_text(Text_Buf& text_buf)
{
field_msg__type.decode_text(text_buf);
field_flags.decode_text(text_buf);
field_padding.decode_text(text_buf);
}

void L1ctlHeader::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 L1ctlHeader::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 L1ctlHeader::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, L1ctlMsgType_descr_.raw->forceomit);
  decoded_field_length = field_msg__type.RAW_decode(L1ctlMsgType_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, L1ctlHdrFlags_descr_.raw->forceomit);
  decoded_field_length = field_flags.RAW_decode(L1ctlHdrFlags_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::OCT2_descr_.raw->forceomit);
  decoded_field_length = field_padding.RAW_decode(General__Types::OCT2_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 L1ctlHeader::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, L1ctlMsgType_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, L1ctlHdrFlags_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::OCT2_descr_.raw);
  encoded_length += field_msg__type.RAW_encode(L1ctlMsgType_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_flags.RAW_encode(L1ctlHdrFlags_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_padding.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct L1ctlHeader_template::single_value_struct {
L1ctlMsgType_template field_msg__type;
L1ctlHdrFlags_template field_flags;
OCTETSTRING_template field_padding;
};

void L1ctlHeader_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_msg__type = ANY_VALUE;
single_value->field_flags = ANY_VALUE;
single_value->field_padding = ANY_VALUE;
}
}
}

void L1ctlHeader_template::copy_value(const L1ctlHeader& other_value)
{
single_value = new single_value_struct;
if (other_value.msg__type().is_bound()) {
  single_value->field_msg__type = other_value.msg__type();
} else {
  single_value->field_msg__type.clean_up();
}
if (other_value.flags().is_bound()) {
  single_value->field_flags = other_value.flags();
} else {
  single_value->field_flags.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 L1ctlHeader_template::copy_template(const L1ctlHeader_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.msg__type().get_selection()) {
single_value->field_msg__type = other_value.msg__type();
} else {
single_value->field_msg__type.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.flags().get_selection()) {
single_value->field_flags = other_value.flags();
} else {
single_value->field_flags.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 L1ctlHeader_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 L1ctlHeader_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlHeader_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 @L1CTL_Types.L1ctlHeader.");
break;
}
set_selection(other_value);
}

L1ctlHeader_template::L1ctlHeader_template()
{
}

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

L1ctlHeader_template::L1ctlHeader_template(const L1ctlHeader& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlHeader_template::match(const L1ctlHeader& 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.msg__type().is_bound()) return FALSE;
if(!single_value->field_msg__type.match(other_value.msg__type(), legacy))return FALSE;
if(!other_value.flags().is_bound()) return FALSE;
if(!single_value->field_flags.match(other_value.flags(), 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 @L1CTL_Types.L1ctlHeader.");
}
return FALSE;
}

boolean L1ctlHeader_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_msg__type.is_bound()
 || single_value->field_flags.is_bound()
 || single_value->field_padding.is_bound();
}

boolean L1ctlHeader_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_msg__type.is_value()
 && single_value->field_flags.is_value()
 && single_value->field_padding.is_value();
}

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

L1ctlHeader L1ctlHeader_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 @L1CTL_Types.L1ctlHeader.");
L1ctlHeader ret_val;
if (single_value->field_msg__type.is_bound()) {
ret_val.msg__type() = single_value->field_msg__type.valueof();
}
if (single_value->field_flags.is_bound()) {
ret_val.flags() = single_value->field_flags.valueof();
}
if (single_value->field_padding.is_bound()) {
ret_val.padding() = single_value->field_padding.valueof();
}
return ret_val;
}

void L1ctlHeader_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 @L1CTL_Types.L1ctlHeader.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlHeader_template[list_length];
}

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

L1ctlMsgType_template& L1ctlHeader_template::msg__type()
{
set_specific();
return single_value->field_msg__type;
}

const L1ctlMsgType_template& L1ctlHeader_template::msg__type() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field msg_type of a non-specific template of type @L1CTL_Types.L1ctlHeader.");
return single_value->field_msg__type;
}

L1ctlHdrFlags_template& L1ctlHeader_template::flags()
{
set_specific();
return single_value->field_flags;
}

const L1ctlHdrFlags_template& L1ctlHeader_template::flags() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field flags of a non-specific template of type @L1CTL_Types.L1ctlHeader.");
return single_value->field_flags;
}

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

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

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

void L1ctlHeader_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ msg_type := ");
single_value->field_msg__type.log();
TTCN_Logger::log_event_str(", flags := ");
single_value->field_flags.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 L1ctlHeader_template::log_match(const L1ctlHeader& 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_msg__type.match(match_value.msg__type(), legacy)){
TTCN_Logger::log_logmatch_info(".msg_type");
single_value->field_msg__type.log_match(match_value.msg__type(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_flags.match(match_value.flags(), legacy)){
TTCN_Logger::log_logmatch_info(".flags");
single_value->field_flags.log_match(match_value.flags(), 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("{ msg_type := ");
single_value->field_msg__type.log_match(match_value.msg__type(), legacy);
TTCN_Logger::log_event_str(", flags := ");
single_value->field_flags.log_match(match_value.flags(), 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 L1ctlHeader_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (msg__type().is_bound()) msg__type().set_implicit_omit();
if (flags().is_bound()) flags().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

void L1ctlHeader_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_msg__type.encode_text(text_buf);
single_value->field_flags.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 @L1CTL_Types.L1ctlHeader.");
}
}

void L1ctlHeader_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_msg__type.decode_text(text_buf);
single_value->field_flags.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 L1ctlHeader_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 @L1CTL_Types.L1ctlHeader.");
}
}

void L1ctlHeader_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: {
    L1ctlHeader_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 @L1CTL_Types.L1ctlHeader 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) msg__type().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) flags().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) padding().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(), "msg_type")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          msg__type().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(), "flags")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          flags().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 @L1CTL_Types.L1ctlHeader: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlHeader_template* precondition = new L1ctlHeader_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlHeader_template* implied_template = new L1ctlHeader_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlHeader_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlHeader");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlHeader_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_msg__type.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlHeader");
single_value->field_flags.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlHeader");
single_value->field_padding.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlHeader");
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 : "@L1CTL_Types.L1ctlHeader");
}

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

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

L1ctlDlInfo::L1ctlDlInfo()
{
}

L1ctlDlInfo::L1ctlDlInfo(const GSM__Types::RslChannelNr& par_chan__nr,
    const GSM__Types::RslLinkId& par_link__id,
    const GSM__Types::GsmBandArfcn& par_arfcn,
    const INTEGER& par_frame__nr,
    const INTEGER& par_rx__level,
    const INTEGER& par_snr,
    const INTEGER& par_num__biterr,
    const INTEGER& par_fire__crc)
  :   field_chan__nr(par_chan__nr),
  field_link__id(par_link__id),
  field_arfcn(par_arfcn),
  field_frame__nr(par_frame__nr),
  field_rx__level(par_rx__level),
  field_snr(par_snr),
  field_num__biterr(par_num__biterr),
  field_fire__crc(par_fire__crc)
{
}

L1ctlDlInfo::L1ctlDlInfo(const L1ctlDlInfo& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlDlInfo.");
if (other_value.chan__nr().is_bound()) field_chan__nr = other_value.chan__nr();
else field_chan__nr.clean_up();
if (other_value.link__id().is_bound()) field_link__id = other_value.link__id();
else field_link__id.clean_up();
if (other_value.arfcn().is_bound()) field_arfcn = other_value.arfcn();
else field_arfcn.clean_up();
if (other_value.frame__nr().is_bound()) field_frame__nr = other_value.frame__nr();
else field_frame__nr.clean_up();
if (other_value.rx__level().is_bound()) field_rx__level = other_value.rx__level();
else field_rx__level.clean_up();
if (other_value.snr().is_bound()) field_snr = other_value.snr();
else field_snr.clean_up();
if (other_value.num__biterr().is_bound()) field_num__biterr = other_value.num__biterr();
else field_num__biterr.clean_up();
if (other_value.fire__crc().is_bound()) field_fire__crc = other_value.fire__crc();
else field_fire__crc.clean_up();
}

void L1ctlDlInfo::clean_up()
{
field_chan__nr.clean_up();
field_link__id.clean_up();
field_arfcn.clean_up();
field_frame__nr.clean_up();
field_rx__level.clean_up();
field_snr.clean_up();
field_num__biterr.clean_up();
field_fire__crc.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlDlInfo::get_descriptor() const { return &L1ctlDlInfo_descr_; }
L1ctlDlInfo& L1ctlDlInfo::operator=(const L1ctlDlInfo& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlDlInfo.");
  if (other_value.chan__nr().is_bound()) field_chan__nr = other_value.chan__nr();
  else field_chan__nr.clean_up();
  if (other_value.link__id().is_bound()) field_link__id = other_value.link__id();
  else field_link__id.clean_up();
  if (other_value.arfcn().is_bound()) field_arfcn = other_value.arfcn();
  else field_arfcn.clean_up();
  if (other_value.frame__nr().is_bound()) field_frame__nr = other_value.frame__nr();
  else field_frame__nr.clean_up();
  if (other_value.rx__level().is_bound()) field_rx__level = other_value.rx__level();
  else field_rx__level.clean_up();
  if (other_value.snr().is_bound()) field_snr = other_value.snr();
  else field_snr.clean_up();
  if (other_value.num__biterr().is_bound()) field_num__biterr = other_value.num__biterr();
  else field_num__biterr.clean_up();
  if (other_value.fire__crc().is_bound()) field_fire__crc = other_value.fire__crc();
  else field_fire__crc.clean_up();
}
return *this;
}

boolean L1ctlDlInfo::operator==(const L1ctlDlInfo& other_value) const
{
return field_chan__nr==other_value.field_chan__nr
  && field_link__id==other_value.field_link__id
  && field_arfcn==other_value.field_arfcn
  && field_frame__nr==other_value.field_frame__nr
  && field_rx__level==other_value.field_rx__level
  && field_snr==other_value.field_snr
  && field_num__biterr==other_value.field_num__biterr
  && field_fire__crc==other_value.field_fire__crc;
}

boolean L1ctlDlInfo::is_bound() const
{
return (field_chan__nr.is_bound())
  || (field_link__id.is_bound())
  || (field_arfcn.is_bound())
  || (field_frame__nr.is_bound())
  || (field_rx__level.is_bound())
  || (field_snr.is_bound())
  || (field_num__biterr.is_bound())
  || (field_fire__crc.is_bound());
}
boolean L1ctlDlInfo::is_value() const
{
return field_chan__nr.is_value()
  && field_link__id.is_value()
  && field_arfcn.is_value()
  && field_frame__nr.is_value()
  && field_rx__level.is_value()
  && field_snr.is_value()
  && field_num__biterr.is_value()
  && field_fire__crc.is_value();
}
void L1ctlDlInfo::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ chan_nr := ");
field_chan__nr.log();
TTCN_Logger::log_event_str(", link_id := ");
field_link__id.log();
TTCN_Logger::log_event_str(", arfcn := ");
field_arfcn.log();
TTCN_Logger::log_event_str(", frame_nr := ");
field_frame__nr.log();
TTCN_Logger::log_event_str(", rx_level := ");
field_rx__level.log();
TTCN_Logger::log_event_str(", snr := ");
field_snr.log();
TTCN_Logger::log_event_str(", num_biterr := ");
field_num__biterr.log();
TTCN_Logger::log_event_str(", fire_crc := ");
field_fire__crc.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlDlInfo::set_implicit_omit()
{
if (chan__nr().is_bound()) chan__nr().set_implicit_omit();
if (link__id().is_bound()) link__id().set_implicit_omit();
if (arfcn().is_bound()) arfcn().set_implicit_omit();
if (frame__nr().is_bound()) frame__nr().set_implicit_omit();
if (rx__level().is_bound()) rx__level().set_implicit_omit();
if (snr().is_bound()) snr().set_implicit_omit();
if (num__biterr().is_bound()) num__biterr().set_implicit_omit();
if (fire__crc().is_bound()) fire__crc().set_implicit_omit();
}

void L1ctlDlInfo::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 (8<param.get_size()) {
      param.error("record value of type @L1CTL_Types.L1ctlDlInfo has 8 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) chan__nr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) link__id().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) arfcn().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) frame__nr().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) rx__level().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) snr().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) num__biterr().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) fire__crc().set_param(*param.get_elem(7));
    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(), "chan_nr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          chan__nr().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(), "link_id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          link__id().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(), "arfcn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          arfcn().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(), "frame_nr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          frame__nr().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(), "rx_level")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rx__level().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(), "snr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          snr().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(), "num_biterr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          num__biterr().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(), "fire_crc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fire__crc().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 @L1CTL_Types.L1ctlDlInfo: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlDlInfo");
  }
}

void L1ctlDlInfo::encode_text(Text_Buf& text_buf) const
{
field_chan__nr.encode_text(text_buf);
field_link__id.encode_text(text_buf);
field_arfcn.encode_text(text_buf);
field_frame__nr.encode_text(text_buf);
field_rx__level.encode_text(text_buf);
field_snr.encode_text(text_buf);
field_num__biterr.encode_text(text_buf);
field_fire__crc.encode_text(text_buf);
}

void L1ctlDlInfo::decode_text(Text_Buf& text_buf)
{
field_chan__nr.decode_text(text_buf);
field_link__id.decode_text(text_buf);
field_arfcn.decode_text(text_buf);
field_frame__nr.decode_text(text_buf);
field_rx__level.decode_text(text_buf);
field_snr.decode_text(text_buf);
field_num__biterr.decode_text(text_buf);
field_fire__crc.decode_text(text_buf);
}

void L1ctlDlInfo::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 L1ctlDlInfo::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 L1ctlDlInfo::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, GSM__Types::RslChannelNr_descr_.raw->forceomit);
  decoded_field_length = field_chan__nr.RAW_decode(GSM__Types::RslChannelNr_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, GSM__Types::RslLinkId_descr_.raw->forceomit);
  decoded_field_length = field_link__id.RAW_decode(GSM__Types::RslLinkId_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, GSM__Types::GsmBandArfcn_descr_.raw->forceomit);
  decoded_field_length = field_arfcn.RAW_decode(GSM__Types::GsmBandArfcn_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, Osmocom__Types::uint32__t_descr_.raw->forceomit);
  decoded_field_length = field_frame__nr.RAW_decode(Osmocom__Types::uint32__t_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, GSM__Types::GsmRxLev_descr_.raw->forceomit);
  decoded_field_length = field_rx__level.RAW_decode(GSM__Types::GsmRxLev_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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_snr.RAW_decode(Osmocom__Types::uint8__t_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_6_force_omit(6, force_omit, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_num__biterr.RAW_decode(Osmocom__Types::uint8__t_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_6_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_7_force_omit(7, force_omit, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_fire__crc.RAW_decode(Osmocom__Types::uint8__t_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_7_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int L1ctlDlInfo::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 = 8;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(8);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, GSM__Types::RslChannelNr_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, GSM__Types::RslLinkId_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, GSM__Types::GsmBandArfcn_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, Osmocom__Types::uint32__t_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, GSM__Types::GsmRxLev_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, Osmocom__Types::uint8__t_descr_.raw);
  encoded_length += field_chan__nr.RAW_encode(GSM__Types::RslChannelNr_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_link__id.RAW_encode(GSM__Types::RslLinkId_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_arfcn.RAW_encode(GSM__Types::GsmBandArfcn_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_frame__nr.RAW_encode(Osmocom__Types::uint32__t_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_rx__level.RAW_encode(GSM__Types::GsmRxLev_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_snr.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[5]);
  encoded_length += field_num__biterr.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[6]);
  encoded_length += field_fire__crc.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[7]);
  return myleaf.length = encoded_length;
}

struct L1ctlDlInfo_template::single_value_struct {
GSM__Types::RslChannelNr_template field_chan__nr;
GSM__Types::RslLinkId_template field_link__id;
GSM__Types::GsmBandArfcn_template field_arfcn;
INTEGER_template field_frame__nr;
INTEGER_template field_rx__level;
INTEGER_template field_snr;
INTEGER_template field_num__biterr;
INTEGER_template field_fire__crc;
};

void L1ctlDlInfo_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_chan__nr = ANY_VALUE;
single_value->field_link__id = ANY_VALUE;
single_value->field_arfcn = ANY_VALUE;
single_value->field_frame__nr = ANY_VALUE;
single_value->field_rx__level = ANY_VALUE;
single_value->field_snr = ANY_VALUE;
single_value->field_num__biterr = ANY_VALUE;
single_value->field_fire__crc = ANY_VALUE;
}
}
}

void L1ctlDlInfo_template::copy_value(const L1ctlDlInfo& other_value)
{
single_value = new single_value_struct;
if (other_value.chan__nr().is_bound()) {
  single_value->field_chan__nr = other_value.chan__nr();
} else {
  single_value->field_chan__nr.clean_up();
}
if (other_value.link__id().is_bound()) {
  single_value->field_link__id = other_value.link__id();
} else {
  single_value->field_link__id.clean_up();
}
if (other_value.arfcn().is_bound()) {
  single_value->field_arfcn = other_value.arfcn();
} else {
  single_value->field_arfcn.clean_up();
}
if (other_value.frame__nr().is_bound()) {
  single_value->field_frame__nr = other_value.frame__nr();
} else {
  single_value->field_frame__nr.clean_up();
}
if (other_value.rx__level().is_bound()) {
  single_value->field_rx__level = other_value.rx__level();
} else {
  single_value->field_rx__level.clean_up();
}
if (other_value.snr().is_bound()) {
  single_value->field_snr = other_value.snr();
} else {
  single_value->field_snr.clean_up();
}
if (other_value.num__biterr().is_bound()) {
  single_value->field_num__biterr = other_value.num__biterr();
} else {
  single_value->field_num__biterr.clean_up();
}
if (other_value.fire__crc().is_bound()) {
  single_value->field_fire__crc = other_value.fire__crc();
} else {
  single_value->field_fire__crc.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlDlInfo_template::copy_template(const L1ctlDlInfo_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.chan__nr().get_selection()) {
single_value->field_chan__nr = other_value.chan__nr();
} else {
single_value->field_chan__nr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.link__id().get_selection()) {
single_value->field_link__id = other_value.link__id();
} else {
single_value->field_link__id.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.arfcn().get_selection()) {
single_value->field_arfcn = other_value.arfcn();
} else {
single_value->field_arfcn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.frame__nr().get_selection()) {
single_value->field_frame__nr = other_value.frame__nr();
} else {
single_value->field_frame__nr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rx__level().get_selection()) {
single_value->field_rx__level = other_value.rx__level();
} else {
single_value->field_rx__level.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.snr().get_selection()) {
single_value->field_snr = other_value.snr();
} else {
single_value->field_snr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.num__biterr().get_selection()) {
single_value->field_num__biterr = other_value.num__biterr();
} else {
single_value->field_num__biterr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.fire__crc().get_selection()) {
single_value->field_fire__crc = other_value.fire__crc();
} else {
single_value->field_fire__crc.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 L1ctlDlInfo_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 L1ctlDlInfo_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlDlInfo_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 @L1CTL_Types.L1ctlDlInfo.");
break;
}
set_selection(other_value);
}

L1ctlDlInfo_template::L1ctlDlInfo_template()
{
}

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

L1ctlDlInfo_template::L1ctlDlInfo_template(const L1ctlDlInfo& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlDlInfo_template::match(const L1ctlDlInfo& 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.chan__nr().is_bound()) return FALSE;
if(!single_value->field_chan__nr.match(other_value.chan__nr(), legacy))return FALSE;
if(!other_value.link__id().is_bound()) return FALSE;
if(!single_value->field_link__id.match(other_value.link__id(), legacy))return FALSE;
if(!other_value.arfcn().is_bound()) return FALSE;
if(!single_value->field_arfcn.match(other_value.arfcn(), legacy))return FALSE;
if(!other_value.frame__nr().is_bound()) return FALSE;
if(!single_value->field_frame__nr.match(other_value.frame__nr(), legacy))return FALSE;
if(!other_value.rx__level().is_bound()) return FALSE;
if(!single_value->field_rx__level.match(other_value.rx__level(), legacy))return FALSE;
if(!other_value.snr().is_bound()) return FALSE;
if(!single_value->field_snr.match(other_value.snr(), legacy))return FALSE;
if(!other_value.num__biterr().is_bound()) return FALSE;
if(!single_value->field_num__biterr.match(other_value.num__biterr(), legacy))return FALSE;
if(!other_value.fire__crc().is_bound()) return FALSE;
if(!single_value->field_fire__crc.match(other_value.fire__crc(), 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 @L1CTL_Types.L1ctlDlInfo.");
}
return FALSE;
}

boolean L1ctlDlInfo_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_chan__nr.is_bound()
 || single_value->field_link__id.is_bound()
 || single_value->field_arfcn.is_bound()
 || single_value->field_frame__nr.is_bound()
 || single_value->field_rx__level.is_bound()
 || single_value->field_snr.is_bound()
 || single_value->field_num__biterr.is_bound()
 || single_value->field_fire__crc.is_bound();
}

boolean L1ctlDlInfo_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_chan__nr.is_value()
 && single_value->field_link__id.is_value()
 && single_value->field_arfcn.is_value()
 && single_value->field_frame__nr.is_value()
 && single_value->field_rx__level.is_value()
 && single_value->field_snr.is_value()
 && single_value->field_num__biterr.is_value()
 && single_value->field_fire__crc.is_value();
}

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

L1ctlDlInfo L1ctlDlInfo_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 @L1CTL_Types.L1ctlDlInfo.");
L1ctlDlInfo ret_val;
if (single_value->field_chan__nr.is_bound()) {
ret_val.chan__nr() = single_value->field_chan__nr.valueof();
}
if (single_value->field_link__id.is_bound()) {
ret_val.link__id() = single_value->field_link__id.valueof();
}
if (single_value->field_arfcn.is_bound()) {
ret_val.arfcn() = single_value->field_arfcn.valueof();
}
if (single_value->field_frame__nr.is_bound()) {
ret_val.frame__nr() = single_value->field_frame__nr.valueof();
}
if (single_value->field_rx__level.is_bound()) {
ret_val.rx__level() = single_value->field_rx__level.valueof();
}
if (single_value->field_snr.is_bound()) {
ret_val.snr() = single_value->field_snr.valueof();
}
if (single_value->field_num__biterr.is_bound()) {
ret_val.num__biterr() = single_value->field_num__biterr.valueof();
}
if (single_value->field_fire__crc.is_bound()) {
ret_val.fire__crc() = single_value->field_fire__crc.valueof();
}
return ret_val;
}

void L1ctlDlInfo_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 @L1CTL_Types.L1ctlDlInfo.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlDlInfo_template[list_length];
}

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

GSM__Types::RslChannelNr_template& L1ctlDlInfo_template::chan__nr()
{
set_specific();
return single_value->field_chan__nr;
}

const GSM__Types::RslChannelNr_template& L1ctlDlInfo_template::chan__nr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field chan_nr of a non-specific template of type @L1CTL_Types.L1ctlDlInfo.");
return single_value->field_chan__nr;
}

GSM__Types::RslLinkId_template& L1ctlDlInfo_template::link__id()
{
set_specific();
return single_value->field_link__id;
}

const GSM__Types::RslLinkId_template& L1ctlDlInfo_template::link__id() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field link_id of a non-specific template of type @L1CTL_Types.L1ctlDlInfo.");
return single_value->field_link__id;
}

GSM__Types::GsmBandArfcn_template& L1ctlDlInfo_template::arfcn()
{
set_specific();
return single_value->field_arfcn;
}

const GSM__Types::GsmBandArfcn_template& L1ctlDlInfo_template::arfcn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field arfcn of a non-specific template of type @L1CTL_Types.L1ctlDlInfo.");
return single_value->field_arfcn;
}

INTEGER_template& L1ctlDlInfo_template::frame__nr()
{
set_specific();
return single_value->field_frame__nr;
}

const INTEGER_template& L1ctlDlInfo_template::frame__nr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field frame_nr of a non-specific template of type @L1CTL_Types.L1ctlDlInfo.");
return single_value->field_frame__nr;
}

INTEGER_template& L1ctlDlInfo_template::rx__level()
{
set_specific();
return single_value->field_rx__level;
}

const INTEGER_template& L1ctlDlInfo_template::rx__level() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rx_level of a non-specific template of type @L1CTL_Types.L1ctlDlInfo.");
return single_value->field_rx__level;
}

INTEGER_template& L1ctlDlInfo_template::snr()
{
set_specific();
return single_value->field_snr;
}

const INTEGER_template& L1ctlDlInfo_template::snr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field snr of a non-specific template of type @L1CTL_Types.L1ctlDlInfo.");
return single_value->field_snr;
}

INTEGER_template& L1ctlDlInfo_template::num__biterr()
{
set_specific();
return single_value->field_num__biterr;
}

const INTEGER_template& L1ctlDlInfo_template::num__biterr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field num_biterr of a non-specific template of type @L1CTL_Types.L1ctlDlInfo.");
return single_value->field_num__biterr;
}

INTEGER_template& L1ctlDlInfo_template::fire__crc()
{
set_specific();
return single_value->field_fire__crc;
}

const INTEGER_template& L1ctlDlInfo_template::fire__crc() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field fire_crc of a non-specific template of type @L1CTL_Types.L1ctlDlInfo.");
return single_value->field_fire__crc;
}

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

void L1ctlDlInfo_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ chan_nr := ");
single_value->field_chan__nr.log();
TTCN_Logger::log_event_str(", link_id := ");
single_value->field_link__id.log();
TTCN_Logger::log_event_str(", arfcn := ");
single_value->field_arfcn.log();
TTCN_Logger::log_event_str(", frame_nr := ");
single_value->field_frame__nr.log();
TTCN_Logger::log_event_str(", rx_level := ");
single_value->field_rx__level.log();
TTCN_Logger::log_event_str(", snr := ");
single_value->field_snr.log();
TTCN_Logger::log_event_str(", num_biterr := ");
single_value->field_num__biterr.log();
TTCN_Logger::log_event_str(", fire_crc := ");
single_value->field_fire__crc.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 L1ctlDlInfo_template::log_match(const L1ctlDlInfo& 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_chan__nr.match(match_value.chan__nr(), legacy)){
TTCN_Logger::log_logmatch_info(".chan_nr");
single_value->field_chan__nr.log_match(match_value.chan__nr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_link__id.match(match_value.link__id(), legacy)){
TTCN_Logger::log_logmatch_info(".link_id");
single_value->field_link__id.log_match(match_value.link__id(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_arfcn.match(match_value.arfcn(), legacy)){
TTCN_Logger::log_logmatch_info(".arfcn");
single_value->field_arfcn.log_match(match_value.arfcn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_frame__nr.match(match_value.frame__nr(), legacy)){
TTCN_Logger::log_logmatch_info(".frame_nr");
single_value->field_frame__nr.log_match(match_value.frame__nr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rx__level.match(match_value.rx__level(), legacy)){
TTCN_Logger::log_logmatch_info(".rx_level");
single_value->field_rx__level.log_match(match_value.rx__level(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_snr.match(match_value.snr(), legacy)){
TTCN_Logger::log_logmatch_info(".snr");
single_value->field_snr.log_match(match_value.snr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_num__biterr.match(match_value.num__biterr(), legacy)){
TTCN_Logger::log_logmatch_info(".num_biterr");
single_value->field_num__biterr.log_match(match_value.num__biterr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_fire__crc.match(match_value.fire__crc(), legacy)){
TTCN_Logger::log_logmatch_info(".fire_crc");
single_value->field_fire__crc.log_match(match_value.fire__crc(), 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("{ chan_nr := ");
single_value->field_chan__nr.log_match(match_value.chan__nr(), legacy);
TTCN_Logger::log_event_str(", link_id := ");
single_value->field_link__id.log_match(match_value.link__id(), legacy);
TTCN_Logger::log_event_str(", arfcn := ");
single_value->field_arfcn.log_match(match_value.arfcn(), legacy);
TTCN_Logger::log_event_str(", frame_nr := ");
single_value->field_frame__nr.log_match(match_value.frame__nr(), legacy);
TTCN_Logger::log_event_str(", rx_level := ");
single_value->field_rx__level.log_match(match_value.rx__level(), legacy);
TTCN_Logger::log_event_str(", snr := ");
single_value->field_snr.log_match(match_value.snr(), legacy);
TTCN_Logger::log_event_str(", num_biterr := ");
single_value->field_num__biterr.log_match(match_value.num__biterr(), legacy);
TTCN_Logger::log_event_str(", fire_crc := ");
single_value->field_fire__crc.log_match(match_value.fire__crc(), 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 L1ctlDlInfo_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (chan__nr().is_bound()) chan__nr().set_implicit_omit();
if (link__id().is_bound()) link__id().set_implicit_omit();
if (arfcn().is_bound()) arfcn().set_implicit_omit();
if (frame__nr().is_bound()) frame__nr().set_implicit_omit();
if (rx__level().is_bound()) rx__level().set_implicit_omit();
if (snr().is_bound()) snr().set_implicit_omit();
if (num__biterr().is_bound()) num__biterr().set_implicit_omit();
if (fire__crc().is_bound()) fire__crc().set_implicit_omit();
}

void L1ctlDlInfo_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_chan__nr.encode_text(text_buf);
single_value->field_link__id.encode_text(text_buf);
single_value->field_arfcn.encode_text(text_buf);
single_value->field_frame__nr.encode_text(text_buf);
single_value->field_rx__level.encode_text(text_buf);
single_value->field_snr.encode_text(text_buf);
single_value->field_num__biterr.encode_text(text_buf);
single_value->field_fire__crc.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 @L1CTL_Types.L1ctlDlInfo.");
}
}

void L1ctlDlInfo_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_chan__nr.decode_text(text_buf);
single_value->field_link__id.decode_text(text_buf);
single_value->field_arfcn.decode_text(text_buf);
single_value->field_frame__nr.decode_text(text_buf);
single_value->field_rx__level.decode_text(text_buf);
single_value->field_snr.decode_text(text_buf);
single_value->field_num__biterr.decode_text(text_buf);
single_value->field_fire__crc.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 L1ctlDlInfo_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 @L1CTL_Types.L1ctlDlInfo.");
}
}

void L1ctlDlInfo_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: {
    L1ctlDlInfo_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 (8<param.get_size()) {
      param.error("record template of type @L1CTL_Types.L1ctlDlInfo has 8 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) chan__nr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) link__id().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) arfcn().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) frame__nr().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) rx__level().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) snr().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) num__biterr().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) fire__crc().set_param(*param.get_elem(7));
    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(), "chan_nr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          chan__nr().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(), "link_id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          link__id().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(), "arfcn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          arfcn().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(), "frame_nr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          frame__nr().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(), "rx_level")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rx__level().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(), "snr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          snr().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(), "num_biterr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          num__biterr().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(), "fire_crc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fire__crc().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 @L1CTL_Types.L1ctlDlInfo: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlDlInfo_template* precondition = new L1ctlDlInfo_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlDlInfo_template* implied_template = new L1ctlDlInfo_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlDlInfo_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlDlInfo");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlDlInfo_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_chan__nr.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlDlInfo");
single_value->field_link__id.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlDlInfo");
single_value->field_arfcn.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlDlInfo");
single_value->field_frame__nr.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlDlInfo");
single_value->field_rx__level.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlDlInfo");
single_value->field_snr.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlDlInfo");
single_value->field_num__biterr.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlDlInfo");
single_value->field_fire__crc.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlDlInfo");
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 : "@L1CTL_Types.L1ctlDlInfo");
}

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

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

L1ctlFbsbConf::L1ctlFbsbConf()
{
}

L1ctlFbsbConf::L1ctlFbsbConf(const INTEGER& par_initial__freq__err,
    const INTEGER& par_result,
    const INTEGER& par_bsic)
  :   field_initial__freq__err(par_initial__freq__err),
  field_result(par_result),
  field_bsic(par_bsic)
{
}

L1ctlFbsbConf::L1ctlFbsbConf(const L1ctlFbsbConf& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlFbsbConf.");
if (other_value.initial__freq__err().is_bound()) field_initial__freq__err = other_value.initial__freq__err();
else field_initial__freq__err.clean_up();
if (other_value.result().is_bound()) field_result = other_value.result();
else field_result.clean_up();
if (other_value.bsic().is_bound()) field_bsic = other_value.bsic();
else field_bsic.clean_up();
}

void L1ctlFbsbConf::clean_up()
{
field_initial__freq__err.clean_up();
field_result.clean_up();
field_bsic.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlFbsbConf::get_descriptor() const { return &L1ctlFbsbConf_descr_; }
L1ctlFbsbConf& L1ctlFbsbConf::operator=(const L1ctlFbsbConf& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlFbsbConf.");
  if (other_value.initial__freq__err().is_bound()) field_initial__freq__err = other_value.initial__freq__err();
  else field_initial__freq__err.clean_up();
  if (other_value.result().is_bound()) field_result = other_value.result();
  else field_result.clean_up();
  if (other_value.bsic().is_bound()) field_bsic = other_value.bsic();
  else field_bsic.clean_up();
}
return *this;
}

boolean L1ctlFbsbConf::operator==(const L1ctlFbsbConf& other_value) const
{
return field_initial__freq__err==other_value.field_initial__freq__err
  && field_result==other_value.field_result
  && field_bsic==other_value.field_bsic;
}

boolean L1ctlFbsbConf::is_bound() const
{
return (field_initial__freq__err.is_bound())
  || (field_result.is_bound())
  || (field_bsic.is_bound());
}
boolean L1ctlFbsbConf::is_value() const
{
return field_initial__freq__err.is_value()
  && field_result.is_value()
  && field_bsic.is_value();
}
void L1ctlFbsbConf::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ initial_freq_err := ");
field_initial__freq__err.log();
TTCN_Logger::log_event_str(", result := ");
field_result.log();
TTCN_Logger::log_event_str(", bsic := ");
field_bsic.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlFbsbConf::set_implicit_omit()
{
if (initial__freq__err().is_bound()) initial__freq__err().set_implicit_omit();
if (result().is_bound()) result().set_implicit_omit();
if (bsic().is_bound()) bsic().set_implicit_omit();
}

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

void L1ctlFbsbConf::encode_text(Text_Buf& text_buf) const
{
field_initial__freq__err.encode_text(text_buf);
field_result.encode_text(text_buf);
field_bsic.encode_text(text_buf);
}

void L1ctlFbsbConf::decode_text(Text_Buf& text_buf)
{
field_initial__freq__err.decode_text(text_buf);
field_result.decode_text(text_buf);
field_bsic.decode_text(text_buf);
}

void L1ctlFbsbConf::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 L1ctlFbsbConf::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 L1ctlFbsbConf::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, Osmocom__Types::int16__t_descr_.raw->forceomit);
  decoded_field_length = field_initial__freq__err.RAW_decode(Osmocom__Types::int16__t_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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_result.RAW_decode(Osmocom__Types::uint8__t_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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_bsic.RAW_decode(Osmocom__Types::uint8__t_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 L1ctlFbsbConf::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, Osmocom__Types::int16__t_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Osmocom__Types::uint8__t_descr_.raw);
  encoded_length += field_initial__freq__err.RAW_encode(Osmocom__Types::int16__t_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_result.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_bsic.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct L1ctlFbsbConf_template::single_value_struct {
INTEGER_template field_initial__freq__err;
INTEGER_template field_result;
INTEGER_template field_bsic;
};

void L1ctlFbsbConf_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_initial__freq__err = ANY_VALUE;
single_value->field_result = ANY_VALUE;
single_value->field_bsic = ANY_VALUE;
}
}
}

void L1ctlFbsbConf_template::copy_value(const L1ctlFbsbConf& other_value)
{
single_value = new single_value_struct;
if (other_value.initial__freq__err().is_bound()) {
  single_value->field_initial__freq__err = other_value.initial__freq__err();
} else {
  single_value->field_initial__freq__err.clean_up();
}
if (other_value.result().is_bound()) {
  single_value->field_result = other_value.result();
} else {
  single_value->field_result.clean_up();
}
if (other_value.bsic().is_bound()) {
  single_value->field_bsic = other_value.bsic();
} else {
  single_value->field_bsic.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlFbsbConf_template::copy_template(const L1ctlFbsbConf_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.initial__freq__err().get_selection()) {
single_value->field_initial__freq__err = other_value.initial__freq__err();
} else {
single_value->field_initial__freq__err.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.result().get_selection()) {
single_value->field_result = other_value.result();
} else {
single_value->field_result.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.bsic().get_selection()) {
single_value->field_bsic = other_value.bsic();
} else {
single_value->field_bsic.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 L1ctlFbsbConf_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 L1ctlFbsbConf_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlFbsbConf_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 @L1CTL_Types.L1ctlFbsbConf.");
break;
}
set_selection(other_value);
}

L1ctlFbsbConf_template::L1ctlFbsbConf_template()
{
}

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

L1ctlFbsbConf_template::L1ctlFbsbConf_template(const L1ctlFbsbConf& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlFbsbConf_template::match(const L1ctlFbsbConf& 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.initial__freq__err().is_bound()) return FALSE;
if(!single_value->field_initial__freq__err.match(other_value.initial__freq__err(), legacy))return FALSE;
if(!other_value.result().is_bound()) return FALSE;
if(!single_value->field_result.match(other_value.result(), legacy))return FALSE;
if(!other_value.bsic().is_bound()) return FALSE;
if(!single_value->field_bsic.match(other_value.bsic(), 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 @L1CTL_Types.L1ctlFbsbConf.");
}
return FALSE;
}

boolean L1ctlFbsbConf_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_initial__freq__err.is_bound()
 || single_value->field_result.is_bound()
 || single_value->field_bsic.is_bound();
}

boolean L1ctlFbsbConf_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_initial__freq__err.is_value()
 && single_value->field_result.is_value()
 && single_value->field_bsic.is_value();
}

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

L1ctlFbsbConf L1ctlFbsbConf_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 @L1CTL_Types.L1ctlFbsbConf.");
L1ctlFbsbConf ret_val;
if (single_value->field_initial__freq__err.is_bound()) {
ret_val.initial__freq__err() = single_value->field_initial__freq__err.valueof();
}
if (single_value->field_result.is_bound()) {
ret_val.result() = single_value->field_result.valueof();
}
if (single_value->field_bsic.is_bound()) {
ret_val.bsic() = single_value->field_bsic.valueof();
}
return ret_val;
}

void L1ctlFbsbConf_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 @L1CTL_Types.L1ctlFbsbConf.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlFbsbConf_template[list_length];
}

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

INTEGER_template& L1ctlFbsbConf_template::initial__freq__err()
{
set_specific();
return single_value->field_initial__freq__err;
}

const INTEGER_template& L1ctlFbsbConf_template::initial__freq__err() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field initial_freq_err of a non-specific template of type @L1CTL_Types.L1ctlFbsbConf.");
return single_value->field_initial__freq__err;
}

INTEGER_template& L1ctlFbsbConf_template::result()
{
set_specific();
return single_value->field_result;
}

const INTEGER_template& L1ctlFbsbConf_template::result() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field result of a non-specific template of type @L1CTL_Types.L1ctlFbsbConf.");
return single_value->field_result;
}

INTEGER_template& L1ctlFbsbConf_template::bsic()
{
set_specific();
return single_value->field_bsic;
}

const INTEGER_template& L1ctlFbsbConf_template::bsic() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field bsic of a non-specific template of type @L1CTL_Types.L1ctlFbsbConf.");
return single_value->field_bsic;
}

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

void L1ctlFbsbConf_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ initial_freq_err := ");
single_value->field_initial__freq__err.log();
TTCN_Logger::log_event_str(", result := ");
single_value->field_result.log();
TTCN_Logger::log_event_str(", bsic := ");
single_value->field_bsic.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 L1ctlFbsbConf_template::log_match(const L1ctlFbsbConf& 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_initial__freq__err.match(match_value.initial__freq__err(), legacy)){
TTCN_Logger::log_logmatch_info(".initial_freq_err");
single_value->field_initial__freq__err.log_match(match_value.initial__freq__err(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_result.match(match_value.result(), legacy)){
TTCN_Logger::log_logmatch_info(".result");
single_value->field_result.log_match(match_value.result(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_bsic.match(match_value.bsic(), legacy)){
TTCN_Logger::log_logmatch_info(".bsic");
single_value->field_bsic.log_match(match_value.bsic(), 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("{ initial_freq_err := ");
single_value->field_initial__freq__err.log_match(match_value.initial__freq__err(), legacy);
TTCN_Logger::log_event_str(", result := ");
single_value->field_result.log_match(match_value.result(), legacy);
TTCN_Logger::log_event_str(", bsic := ");
single_value->field_bsic.log_match(match_value.bsic(), 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 L1ctlFbsbConf_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (initial__freq__err().is_bound()) initial__freq__err().set_implicit_omit();
if (result().is_bound()) result().set_implicit_omit();
if (bsic().is_bound()) bsic().set_implicit_omit();
}

void L1ctlFbsbConf_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_initial__freq__err.encode_text(text_buf);
single_value->field_result.encode_text(text_buf);
single_value->field_bsic.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 @L1CTL_Types.L1ctlFbsbConf.");
}
}

void L1ctlFbsbConf_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_initial__freq__err.decode_text(text_buf);
single_value->field_result.decode_text(text_buf);
single_value->field_bsic.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 L1ctlFbsbConf_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 @L1CTL_Types.L1ctlFbsbConf.");
}
}

void L1ctlFbsbConf_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: {
    L1ctlFbsbConf_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 @L1CTL_Types.L1ctlFbsbConf 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) initial__freq__err().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) result().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) bsic().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(), "initial_freq_err")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          initial__freq__err().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(), "result")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          result().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(), "bsic")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bsic().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 @L1CTL_Types.L1ctlFbsbConf: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlFbsbConf_template* precondition = new L1ctlFbsbConf_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlFbsbConf_template* implied_template = new L1ctlFbsbConf_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlFbsbConf_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlFbsbConf");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlFbsbConf_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_initial__freq__err.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlFbsbConf");
single_value->field_result.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlFbsbConf");
single_value->field_bsic.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlFbsbConf");
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 : "@L1CTL_Types.L1ctlFbsbConf");
}

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

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

L1ctlCcchModeConf::L1ctlCcchModeConf()
{
}

L1ctlCcchModeConf::L1ctlCcchModeConf(const L1ctlCcchMode& par_ccch__mode,
    const OCTETSTRING& par_padding)
  :   field_ccch__mode(par_ccch__mode),
  field_padding(par_padding)
{
}

L1ctlCcchModeConf::L1ctlCcchModeConf(const L1ctlCcchModeConf& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlCcchModeConf.");
if (other_value.ccch__mode().is_bound()) field_ccch__mode = other_value.ccch__mode();
else field_ccch__mode.clean_up();
if (other_value.padding().is_bound()) field_padding = other_value.padding();
else field_padding.clean_up();
}

void L1ctlCcchModeConf::clean_up()
{
field_ccch__mode.clean_up();
field_padding.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlCcchModeConf::get_descriptor() const { return &L1ctlCcchModeConf_descr_; }
L1ctlCcchModeConf& L1ctlCcchModeConf::operator=(const L1ctlCcchModeConf& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlCcchModeConf.");
  if (other_value.ccch__mode().is_bound()) field_ccch__mode = other_value.ccch__mode();
  else field_ccch__mode.clean_up();
  if (other_value.padding().is_bound()) field_padding = other_value.padding();
  else field_padding.clean_up();
}
return *this;
}

boolean L1ctlCcchModeConf::operator==(const L1ctlCcchModeConf& other_value) const
{
return field_ccch__mode==other_value.field_ccch__mode
  && field_padding==other_value.field_padding;
}

boolean L1ctlCcchModeConf::is_bound() const
{
return (field_ccch__mode.is_bound())
  || (field_padding.is_bound());
}
boolean L1ctlCcchModeConf::is_value() const
{
return field_ccch__mode.is_value()
  && field_padding.is_value();
}
void L1ctlCcchModeConf::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ ccch_mode := ");
field_ccch__mode.log();
TTCN_Logger::log_event_str(", padding := ");
field_padding.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlCcchModeConf::set_implicit_omit()
{
if (ccch__mode().is_bound()) ccch__mode().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

void L1ctlCcchModeConf::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record value of type @L1CTL_Types.L1ctlCcchModeConf has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) ccch__mode().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) padding().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ccch_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ccch__mode().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 @L1CTL_Types.L1ctlCcchModeConf: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlCcchModeConf");
  }
}

void L1ctlCcchModeConf::encode_text(Text_Buf& text_buf) const
{
field_ccch__mode.encode_text(text_buf);
field_padding.encode_text(text_buf);
}

void L1ctlCcchModeConf::decode_text(Text_Buf& text_buf)
{
field_ccch__mode.decode_text(text_buf);
field_padding.decode_text(text_buf);
}

void L1ctlCcchModeConf::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 L1ctlCcchModeConf::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 L1ctlCcchModeConf::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, L1ctlCcchMode_descr_.raw->forceomit);
  decoded_field_length = field_ccch__mode.RAW_decode(L1ctlCcchMode_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::OCT3_descr_.raw->forceomit);
  decoded_field_length = field_padding.RAW_decode(General__Types::OCT3_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

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

struct L1ctlCcchModeConf_template::single_value_struct {
L1ctlCcchMode_template field_ccch__mode;
OCTETSTRING_template field_padding;
};

void L1ctlCcchModeConf_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_ccch__mode = ANY_VALUE;
single_value->field_padding = ANY_VALUE;
}
}
}

void L1ctlCcchModeConf_template::copy_value(const L1ctlCcchModeConf& other_value)
{
single_value = new single_value_struct;
if (other_value.ccch__mode().is_bound()) {
  single_value->field_ccch__mode = other_value.ccch__mode();
} else {
  single_value->field_ccch__mode.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 L1ctlCcchModeConf_template::copy_template(const L1ctlCcchModeConf_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.ccch__mode().get_selection()) {
single_value->field_ccch__mode = other_value.ccch__mode();
} else {
single_value->field_ccch__mode.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 L1ctlCcchModeConf_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 L1ctlCcchModeConf_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlCcchModeConf_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 @L1CTL_Types.L1ctlCcchModeConf.");
break;
}
set_selection(other_value);
}

L1ctlCcchModeConf_template::L1ctlCcchModeConf_template()
{
}

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

L1ctlCcchModeConf_template::L1ctlCcchModeConf_template(const L1ctlCcchModeConf& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlCcchModeConf_template::match(const L1ctlCcchModeConf& 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.ccch__mode().is_bound()) return FALSE;
if(!single_value->field_ccch__mode.match(other_value.ccch__mode(), 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 @L1CTL_Types.L1ctlCcchModeConf.");
}
return FALSE;
}

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

boolean L1ctlCcchModeConf_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_ccch__mode.is_value()
 && single_value->field_padding.is_value();
}

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

L1ctlCcchModeConf L1ctlCcchModeConf_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 @L1CTL_Types.L1ctlCcchModeConf.");
L1ctlCcchModeConf ret_val;
if (single_value->field_ccch__mode.is_bound()) {
ret_val.ccch__mode() = single_value->field_ccch__mode.valueof();
}
if (single_value->field_padding.is_bound()) {
ret_val.padding() = single_value->field_padding.valueof();
}
return ret_val;
}

void L1ctlCcchModeConf_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 @L1CTL_Types.L1ctlCcchModeConf.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlCcchModeConf_template[list_length];
}

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

L1ctlCcchMode_template& L1ctlCcchModeConf_template::ccch__mode()
{
set_specific();
return single_value->field_ccch__mode;
}

const L1ctlCcchMode_template& L1ctlCcchModeConf_template::ccch__mode() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ccch_mode of a non-specific template of type @L1CTL_Types.L1ctlCcchModeConf.");
return single_value->field_ccch__mode;
}

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

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

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

void L1ctlCcchModeConf_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ ccch_mode := ");
single_value->field_ccch__mode.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 L1ctlCcchModeConf_template::log_match(const L1ctlCcchModeConf& 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_ccch__mode.match(match_value.ccch__mode(), legacy)){
TTCN_Logger::log_logmatch_info(".ccch_mode");
single_value->field_ccch__mode.log_match(match_value.ccch__mode(), 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("{ ccch_mode := ");
single_value->field_ccch__mode.log_match(match_value.ccch__mode(), 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 L1ctlCcchModeConf_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (ccch__mode().is_bound()) ccch__mode().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

void L1ctlCcchModeConf_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_ccch__mode.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 @L1CTL_Types.L1ctlCcchModeConf.");
}
}

void L1ctlCcchModeConf_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_ccch__mode.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 L1ctlCcchModeConf_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 @L1CTL_Types.L1ctlCcchModeConf.");
}
}

void L1ctlCcchModeConf_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: {
    L1ctlCcchModeConf_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @L1CTL_Types.L1ctlCcchModeConf has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) ccch__mode().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) padding().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ccch_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ccch__mode().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 @L1CTL_Types.L1ctlCcchModeConf: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlCcchModeConf_template* precondition = new L1ctlCcchModeConf_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlCcchModeConf_template* implied_template = new L1ctlCcchModeConf_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlCcchModeConf_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlCcchModeConf");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlCcchModeConf_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_ccch__mode.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlCcchModeConf");
single_value->field_padding.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlCcchModeConf");
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 : "@L1CTL_Types.L1ctlCcchModeConf");
}

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

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

L1ctlTchMode::L1ctlTchMode()
{
enum_value = UNBOUND_VALUE;
}

L1ctlTchMode::L1ctlTchMode(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @L1CTL_Types.L1ctlTchMode with invalid numeric value %d.", other_value);
enum_value = (enum_type)other_value;
}

L1ctlTchMode::L1ctlTchMode(enum_type other_value)
{
enum_value = other_value;
}

L1ctlTchMode::L1ctlTchMode(const L1ctlTchMode& other_value)
: Base_Type()
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @L1CTL_Types.L1ctlTchMode.");
enum_value = other_value.enum_value;
}

L1ctlTchMode& L1ctlTchMode::operator=(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @L1CTL_Types.L1ctlTchMode.", other_value);
enum_value = (enum_type)other_value;
return *this;
}

L1ctlTchMode& L1ctlTchMode::operator=(enum_type other_value)
{
enum_value = other_value;
return *this;
}

L1ctlTchMode& L1ctlTchMode::operator=(const L1ctlTchMode& other_value)
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @L1CTL_Types.L1ctlTchMode.");
enum_value = other_value.enum_value;
return *this;
}

boolean L1ctlTchMode::operator==(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlTchMode.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlTchMode comparison is an unknown numeric value %d", other_value);
return enum_value == other_value;
}

boolean L1ctlTchMode::operator==(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlTchMode.");
return enum_value == other_value;
}

boolean L1ctlTchMode::operator==(const L1ctlTchMode& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlTchMode.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlTchMode.");
return enum_value == other_value.enum_value;
}

boolean L1ctlTchMode::operator<(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlTchMode.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlTchMode comparison is an unknown numeric value %d", other_value);
return enum_value < other_value;
}

boolean L1ctlTchMode::operator<(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlTchMode.");
return enum_value < other_value;
}

boolean L1ctlTchMode::operator<(const L1ctlTchMode& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlTchMode.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlTchMode.");
return enum_value < other_value.enum_value;
}

boolean L1ctlTchMode::operator>(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlTchMode.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlTchMode comparison is an unknown numeric value %d", other_value);
return enum_value > other_value;
}

boolean L1ctlTchMode::operator>(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlTchMode.");
return enum_value > other_value;
}

boolean L1ctlTchMode::operator>(const L1ctlTchMode& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlTchMode.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlTchMode.");
return enum_value > other_value.enum_value;
}

const char *L1ctlTchMode::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case L1CTL__CHAN__MODE__SIGN: return "L1CTL_CHAN_MODE_SIGN";
case L1CTL__CHAN__MODE__SPEECH__V1: return "L1CTL_CHAN_MODE_SPEECH_V1";
case L1CTL__CHAN__MODE__SPEECH__V2: return "L1CTL_CHAN_MODE_SPEECH_V2";
case L1CTL__CHAN__MODE__SPEECH__V3: return "L1CTL_CHAN_MODE_SPEECH_V3";
case L1CTL__CHAN__MODE__DATA__14k5: return "L1CTL_CHAN_MODE_DATA_14k5";
case L1CTL__CHAN__MODE__DATA__12k0: return "L1CTL_CHAN_MODE_DATA_12k0";
case L1CTL__CHAN__MODE__DATA__6k0: return "L1CTL_CHAN_MODE_DATA_6k0";
case L1CTL__CHAN__MODE__DATA__3k6: return "L1CTL_CHAN_MODE_DATA_3k6";
default:
return "<unknown>";
}
}

L1ctlTchMode::enum_type L1ctlTchMode::str_to_enum(const char *str_par, const int* int_par, const int* int_par2)
{
if (int_par == NULL && int_par2 == NULL) {
if (!strcmp(str_par, "L1CTL_CHAN_MODE_SIGN")) return L1CTL__CHAN__MODE__SIGN;
if (!strcmp(str_par, "L1CTL_CHAN_MODE_SPEECH_V1")) return L1CTL__CHAN__MODE__SPEECH__V1;
if (!strcmp(str_par, "L1CTL_CHAN_MODE_SPEECH_V2")) return L1CTL__CHAN__MODE__SPEECH__V2;
if (!strcmp(str_par, "L1CTL_CHAN_MODE_SPEECH_V3")) return L1CTL__CHAN__MODE__SPEECH__V3;
if (!strcmp(str_par, "L1CTL_CHAN_MODE_DATA_14k5")) return L1CTL__CHAN__MODE__DATA__14k5;
if (!strcmp(str_par, "L1CTL_CHAN_MODE_DATA_12k0")) return L1CTL__CHAN__MODE__DATA__12k0;
if (!strcmp(str_par, "L1CTL_CHAN_MODE_DATA_6k0")) return L1CTL__CHAN__MODE__DATA__6k0;
if (!strcmp(str_par, "L1CTL_CHAN_MODE_DATA_3k6")) return L1CTL__CHAN__MODE__DATA__3k6;
}
return UNKNOWN_VALUE;
}

boolean L1ctlTchMode::is_valid_enum(int int_par)
{
switch (int_par) {
case 0:
case 1:
case 33:
case 65:
case 15:
case 3:
case 11:
case 19:
return TRUE;
default:
return FALSE;
}
}

int L1ctlTchMode::enum2int(enum_type enum_par)
{
if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @L1CTL_Types.L1ctlTchMode.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int L1ctlTchMode::enum2int(const L1ctlTchMode& enum_par)
{
if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @L1CTL_Types.L1ctlTchMode.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

void L1ctlTchMode::int2enum(int int_val)
{
if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @L1CTL_Types.L1ctlTchMode.", int_val);
enum_value = (enum_type)int_val;
}

L1ctlTchMode::operator L1ctlTchMode::enum_type() const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @L1CTL_Types.L1ctlTchMode.");
return enum_value;
}

void L1ctlTchMode::log() const
{
if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value);
else TTCN_Logger::log_event_unbound();
}

void L1ctlTchMode::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "enumerated value");
  if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@L1CTL_Types.L1ctlTchMode");
  enum_value = str_to_enum(param.get_enumerated(), param.get_enumerated_value());
  if (!is_valid_enum(enum_value)) {
    param.error("Invalid enumerated value for type @L1CTL_Types.L1ctlTchMode.");
  }
}

void L1ctlTchMode::encode_text(Text_Buf& text_buf) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @L1CTL_Types.L1ctlTchMode.");
text_buf.push_int(enum_value);
}

void L1ctlTchMode::decode_text(Text_Buf& text_buf)
{
enum_value = (enum_type)text_buf.pull_int().get_val();
if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @L1CTL_Types.L1ctlTchMode.", enum_value);
}

void L1ctlTchMode::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 L1ctlTchMode::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 L1ctlTchMode::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*)
{
  int decoded_value = 0;
  int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 7, no_err);
  if (decoded_length < 0) return decoded_length;
  if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value;
  else {
    if(no_err){
     return -1;
    } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name);
    enum_value = UNKNOWN_VALUE;
    }
  }
  return decoded_length;
}

int L1ctlTchMode::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const
{
  return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 7);
}

void L1ctlTchMode_template::copy_template(const L1ctlTchMode_template& other_value)
{
set_selection(other_value);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = other_value.single_value;
break;
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 L1ctlTchMode_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 L1ctlTchMode_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlTchMode_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 enumerated type @L1CTL_Types.L1ctlTchMode.");
}
}

L1ctlTchMode_template::L1ctlTchMode_template()
{
}

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

L1ctlTchMode_template::L1ctlTchMode_template(int other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (!L1ctlTchMode::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @L1CTL_Types.L1ctlTchMode with unknown numeric value %d.", other_value);
single_value = (L1ctlTchMode::enum_type)other_value;
}

L1ctlTchMode_template::L1ctlTchMode_template(L1ctlTchMode::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

L1ctlTchMode_template::L1ctlTchMode_template(const L1ctlTchMode& other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (other_value.enum_value == L1ctlTchMode::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @L1CTL_Types.L1ctlTchMode.");
single_value = other_value.enum_value;
}

L1ctlTchMode_template::L1ctlTchMode_template(const OPTIONAL<L1ctlTchMode>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlTchMode::enum_type)(const L1ctlTchMode&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of enumerated type @L1CTL_Types.L1ctlTchMode from an unbound optional field.");
}
}

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

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

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

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

boolean L1ctlTchMode_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
return TRUE;
}

boolean L1ctlTchMode_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value != L1ctlTchMode::UNBOUND_VALUE;
}

void L1ctlTchMode_template::clean_up()
{
switch (template_selection) {
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;
}

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

L1ctlTchMode_template& L1ctlTchMode_template::operator=(int other_value)
{
if (!L1ctlTchMode::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @L1CTL_Types.L1ctlTchMode.", other_value);
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlTchMode::enum_type)other_value;
return *this;
}

L1ctlTchMode_template& L1ctlTchMode_template::operator=(L1ctlTchMode::enum_type other_value)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value;
return *this;
}

L1ctlTchMode_template& L1ctlTchMode_template::operator=(const L1ctlTchMode& other_value)
{
if (other_value.enum_value == L1ctlTchMode::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @L1CTL_Types.L1ctlTchMode to a template.");
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value.enum_value;
return *this;
}

L1ctlTchMode_template& L1ctlTchMode_template::operator=(const OPTIONAL<L1ctlTchMode>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlTchMode::enum_type)(const L1ctlTchMode&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of enumerated type @L1CTL_Types.L1ctlTchMode.");
}
return *this;
}

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

boolean L1ctlTchMode_template::match(L1ctlTchMode::enum_type other_value, boolean) const
{
switch (template_selection) {
case SPECIFIC_VALUE:
return single_value == other_value;
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value)) 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 enumerated type @L1CTL_Types.L1ctlTchMode.");
}
return FALSE;
}

boolean L1ctlTchMode_template::match(const L1ctlTchMode& other_value, boolean) const
{
if (other_value.enum_value == L1ctlTchMode::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @L1CTL_Types.L1ctlTchMode with an unbound value.");
return match(other_value.enum_value);
}

L1ctlTchMode::enum_type L1ctlTchMode_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @L1CTL_Types.L1ctlTchMode.");
return single_value;
}

void L1ctlTchMode_template::set_type(template_sel template_type, unsigned int list_length)
{
clean_up();
switch (template_type) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlTchMode_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @L1CTL_Types.L1ctlTchMode.");
}
}

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

void L1ctlTchMode_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(L1ctlTchMode::enum_to_str(single_value), single_value);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[elem_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 L1ctlTchMode_template::log_match(const L1ctlTchMode& match_value, boolean) const
{
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}

void L1ctlTchMode_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);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @L1CTL_Types.L1ctlTchMode.");
}
}

void L1ctlTchMode_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (L1ctlTchMode::enum_type)text_buf.pull_int().get_val();
if (!L1ctlTchMode::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @L1CTL_Types.L1ctlTchMode.", single_value);
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 L1ctlTchMode_template[value_list.n_values];
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @L1CTL_Types.L1ctlTchMode.");
}
}

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

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

void L1ctlTchMode_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "enumerated 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: {
    L1ctlTchMode_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_Enumerated: {
    L1ctlTchMode::enum_type enum_val = L1ctlTchMode::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!L1ctlTchMode::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @L1CTL_Types.L1ctlTchMode.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlTchMode_template* precondition = new L1ctlTchMode_template;
    precondition->set_param(*m_p->get_elem(0));
    L1ctlTchMode_template* implied_template = new L1ctlTchMode_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = L1ctlTchMode_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@L1CTL_Types.L1ctlTchMode");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlTchMode_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_VALUE:
if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return;
break;
case TR_OMIT:
if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return;
break;
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 : "@L1CTL_Types.L1ctlTchMode");
}

L1ctlLoopMode::L1ctlLoopMode()
{
enum_value = UNBOUND_VALUE;
}

L1ctlLoopMode::L1ctlLoopMode(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @L1CTL_Types.L1ctlLoopMode with invalid numeric value %d.", other_value);
enum_value = (enum_type)other_value;
}

L1ctlLoopMode::L1ctlLoopMode(enum_type other_value)
{
enum_value = other_value;
}

L1ctlLoopMode::L1ctlLoopMode(const L1ctlLoopMode& other_value)
: Base_Type()
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @L1CTL_Types.L1ctlLoopMode.");
enum_value = other_value.enum_value;
}

L1ctlLoopMode& L1ctlLoopMode::operator=(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @L1CTL_Types.L1ctlLoopMode.", other_value);
enum_value = (enum_type)other_value;
return *this;
}

L1ctlLoopMode& L1ctlLoopMode::operator=(enum_type other_value)
{
enum_value = other_value;
return *this;
}

L1ctlLoopMode& L1ctlLoopMode::operator=(const L1ctlLoopMode& other_value)
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @L1CTL_Types.L1ctlLoopMode.");
enum_value = other_value.enum_value;
return *this;
}

boolean L1ctlLoopMode::operator==(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlLoopMode.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlLoopMode comparison is an unknown numeric value %d", other_value);
return enum_value == other_value;
}

boolean L1ctlLoopMode::operator==(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlLoopMode.");
return enum_value == other_value;
}

boolean L1ctlLoopMode::operator==(const L1ctlLoopMode& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlLoopMode.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlLoopMode.");
return enum_value == other_value.enum_value;
}

boolean L1ctlLoopMode::operator<(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlLoopMode.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlLoopMode comparison is an unknown numeric value %d", other_value);
return enum_value < other_value;
}

boolean L1ctlLoopMode::operator<(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlLoopMode.");
return enum_value < other_value;
}

boolean L1ctlLoopMode::operator<(const L1ctlLoopMode& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlLoopMode.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlLoopMode.");
return enum_value < other_value.enum_value;
}

boolean L1ctlLoopMode::operator>(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlLoopMode.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlLoopMode comparison is an unknown numeric value %d", other_value);
return enum_value > other_value;
}

boolean L1ctlLoopMode::operator>(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlLoopMode.");
return enum_value > other_value;
}

boolean L1ctlLoopMode::operator>(const L1ctlLoopMode& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlLoopMode.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlLoopMode.");
return enum_value > other_value.enum_value;
}

const char *L1ctlLoopMode::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case L1CTL__LOOP__MODE__OPEN: return "L1CTL_LOOP_MODE_OPEN";
case L1CTL__LOOP__MODE__A: return "L1CTL_LOOP_MODE_A";
case L1CTL__LOOP__MODE__B: return "L1CTL_LOOP_MODE_B";
case L1CTL__LOOP__MODE__C: return "L1CTL_LOOP_MODE_C";
case L1CTL__LOOP__MODE__D: return "L1CTL_LOOP_MODE_D";
case L1CTL__LOOP__MODE__E: return "L1CTL_LOOP_MODE_E";
case L1CTL__LOOP__MODE__F: return "L1CTL_LOOP_MODE_F";
case L1CTL__LOOP__MODE__I: return "L1CTL_LOOP_MODE_I";
default:
return "<unknown>";
}
}

L1ctlLoopMode::enum_type L1ctlLoopMode::str_to_enum(const char *str_par, const int* int_par, const int* int_par2)
{
if (int_par == NULL && int_par2 == NULL) {
if (!strcmp(str_par, "L1CTL_LOOP_MODE_OPEN")) return L1CTL__LOOP__MODE__OPEN;
if (!strcmp(str_par, "L1CTL_LOOP_MODE_A")) return L1CTL__LOOP__MODE__A;
if (!strcmp(str_par, "L1CTL_LOOP_MODE_B")) return L1CTL__LOOP__MODE__B;
if (!strcmp(str_par, "L1CTL_LOOP_MODE_C")) return L1CTL__LOOP__MODE__C;
if (!strcmp(str_par, "L1CTL_LOOP_MODE_D")) return L1CTL__LOOP__MODE__D;
if (!strcmp(str_par, "L1CTL_LOOP_MODE_E")) return L1CTL__LOOP__MODE__E;
if (!strcmp(str_par, "L1CTL_LOOP_MODE_F")) return L1CTL__LOOP__MODE__F;
if (!strcmp(str_par, "L1CTL_LOOP_MODE_I")) return L1CTL__LOOP__MODE__I;
}
return UNKNOWN_VALUE;
}

boolean L1ctlLoopMode::is_valid_enum(int int_par)
{
switch (int_par) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
return TRUE;
default:
return FALSE;
}
}

int L1ctlLoopMode::enum2int(enum_type enum_par)
{
if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @L1CTL_Types.L1ctlLoopMode.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int L1ctlLoopMode::enum2int(const L1ctlLoopMode& enum_par)
{
if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @L1CTL_Types.L1ctlLoopMode.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

void L1ctlLoopMode::int2enum(int int_val)
{
if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @L1CTL_Types.L1ctlLoopMode.", int_val);
enum_value = (enum_type)int_val;
}

L1ctlLoopMode::operator L1ctlLoopMode::enum_type() const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @L1CTL_Types.L1ctlLoopMode.");
return enum_value;
}

void L1ctlLoopMode::log() const
{
if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value);
else TTCN_Logger::log_event_unbound();
}

void L1ctlLoopMode::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "enumerated value");
  if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@L1CTL_Types.L1ctlLoopMode");
  enum_value = str_to_enum(param.get_enumerated(), param.get_enumerated_value());
  if (!is_valid_enum(enum_value)) {
    param.error("Invalid enumerated value for type @L1CTL_Types.L1ctlLoopMode.");
  }
}

void L1ctlLoopMode::encode_text(Text_Buf& text_buf) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @L1CTL_Types.L1ctlLoopMode.");
text_buf.push_int(enum_value);
}

void L1ctlLoopMode::decode_text(Text_Buf& text_buf)
{
enum_value = (enum_type)text_buf.pull_int().get_val();
if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @L1CTL_Types.L1ctlLoopMode.", enum_value);
}

void L1ctlLoopMode::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 L1ctlLoopMode::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 L1ctlLoopMode::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*)
{
  int decoded_value = 0;
  int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 4, no_err);
  if (decoded_length < 0) return decoded_length;
  if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value;
  else {
    if(no_err){
     return -1;
    } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name);
    enum_value = UNKNOWN_VALUE;
    }
  }
  return decoded_length;
}

int L1ctlLoopMode::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const
{
  return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 4);
}

void L1ctlLoopMode_template::copy_template(const L1ctlLoopMode_template& other_value)
{
set_selection(other_value);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = other_value.single_value;
break;
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 L1ctlLoopMode_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 L1ctlLoopMode_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlLoopMode_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 enumerated type @L1CTL_Types.L1ctlLoopMode.");
}
}

L1ctlLoopMode_template::L1ctlLoopMode_template()
{
}

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

L1ctlLoopMode_template::L1ctlLoopMode_template(int other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (!L1ctlLoopMode::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @L1CTL_Types.L1ctlLoopMode with unknown numeric value %d.", other_value);
single_value = (L1ctlLoopMode::enum_type)other_value;
}

L1ctlLoopMode_template::L1ctlLoopMode_template(L1ctlLoopMode::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

L1ctlLoopMode_template::L1ctlLoopMode_template(const L1ctlLoopMode& other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (other_value.enum_value == L1ctlLoopMode::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @L1CTL_Types.L1ctlLoopMode.");
single_value = other_value.enum_value;
}

L1ctlLoopMode_template::L1ctlLoopMode_template(const OPTIONAL<L1ctlLoopMode>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlLoopMode::enum_type)(const L1ctlLoopMode&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of enumerated type @L1CTL_Types.L1ctlLoopMode from an unbound optional field.");
}
}

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

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

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

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

boolean L1ctlLoopMode_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
return TRUE;
}

boolean L1ctlLoopMode_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value != L1ctlLoopMode::UNBOUND_VALUE;
}

void L1ctlLoopMode_template::clean_up()
{
switch (template_selection) {
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;
}

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

L1ctlLoopMode_template& L1ctlLoopMode_template::operator=(int other_value)
{
if (!L1ctlLoopMode::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @L1CTL_Types.L1ctlLoopMode.", other_value);
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlLoopMode::enum_type)other_value;
return *this;
}

L1ctlLoopMode_template& L1ctlLoopMode_template::operator=(L1ctlLoopMode::enum_type other_value)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value;
return *this;
}

L1ctlLoopMode_template& L1ctlLoopMode_template::operator=(const L1ctlLoopMode& other_value)
{
if (other_value.enum_value == L1ctlLoopMode::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @L1CTL_Types.L1ctlLoopMode to a template.");
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value.enum_value;
return *this;
}

L1ctlLoopMode_template& L1ctlLoopMode_template::operator=(const OPTIONAL<L1ctlLoopMode>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlLoopMode::enum_type)(const L1ctlLoopMode&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of enumerated type @L1CTL_Types.L1ctlLoopMode.");
}
return *this;
}

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

boolean L1ctlLoopMode_template::match(L1ctlLoopMode::enum_type other_value, boolean) const
{
switch (template_selection) {
case SPECIFIC_VALUE:
return single_value == other_value;
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value)) 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 enumerated type @L1CTL_Types.L1ctlLoopMode.");
}
return FALSE;
}

boolean L1ctlLoopMode_template::match(const L1ctlLoopMode& other_value, boolean) const
{
if (other_value.enum_value == L1ctlLoopMode::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @L1CTL_Types.L1ctlLoopMode with an unbound value.");
return match(other_value.enum_value);
}

L1ctlLoopMode::enum_type L1ctlLoopMode_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @L1CTL_Types.L1ctlLoopMode.");
return single_value;
}

void L1ctlLoopMode_template::set_type(template_sel template_type, unsigned int list_length)
{
clean_up();
switch (template_type) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlLoopMode_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @L1CTL_Types.L1ctlLoopMode.");
}
}

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

void L1ctlLoopMode_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(L1ctlLoopMode::enum_to_str(single_value), single_value);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[elem_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 L1ctlLoopMode_template::log_match(const L1ctlLoopMode& match_value, boolean) const
{
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}

void L1ctlLoopMode_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);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @L1CTL_Types.L1ctlLoopMode.");
}
}

void L1ctlLoopMode_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (L1ctlLoopMode::enum_type)text_buf.pull_int().get_val();
if (!L1ctlLoopMode::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @L1CTL_Types.L1ctlLoopMode.", single_value);
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 L1ctlLoopMode_template[value_list.n_values];
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @L1CTL_Types.L1ctlLoopMode.");
}
}

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

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

void L1ctlLoopMode_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "enumerated 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: {
    L1ctlLoopMode_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_Enumerated: {
    L1ctlLoopMode::enum_type enum_val = L1ctlLoopMode::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!L1ctlLoopMode::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @L1CTL_Types.L1ctlLoopMode.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlLoopMode_template* precondition = new L1ctlLoopMode_template;
    precondition->set_param(*m_p->get_elem(0));
    L1ctlLoopMode_template* implied_template = new L1ctlLoopMode_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = L1ctlLoopMode_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@L1CTL_Types.L1ctlLoopMode");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlLoopMode_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_VALUE:
if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return;
break;
case TR_OMIT:
if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return;
break;
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 : "@L1CTL_Types.L1ctlLoopMode");
}

L1ctlAudioMode::L1ctlAudioMode()
{
}

L1ctlAudioMode::L1ctlAudioMode(const BITSTRING& par_padding,
    const BOOLEAN& par_tx__microphone,
    const BOOLEAN& par_tx__traffic__req,
    const BOOLEAN& par_rx__speaker,
    const BOOLEAN& par_rx__traffic__ind)
  :   field_padding(par_padding),
  field_tx__microphone(par_tx__microphone),
  field_tx__traffic__req(par_tx__traffic__req),
  field_rx__speaker(par_rx__speaker),
  field_rx__traffic__ind(par_rx__traffic__ind)
{
}

L1ctlAudioMode::L1ctlAudioMode(const L1ctlAudioMode& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlAudioMode.");
if (other_value.padding().is_bound()) field_padding = other_value.padding();
else field_padding.clean_up();
if (other_value.tx__microphone().is_bound()) field_tx__microphone = other_value.tx__microphone();
else field_tx__microphone.clean_up();
if (other_value.tx__traffic__req().is_bound()) field_tx__traffic__req = other_value.tx__traffic__req();
else field_tx__traffic__req.clean_up();
if (other_value.rx__speaker().is_bound()) field_rx__speaker = other_value.rx__speaker();
else field_rx__speaker.clean_up();
if (other_value.rx__traffic__ind().is_bound()) field_rx__traffic__ind = other_value.rx__traffic__ind();
else field_rx__traffic__ind.clean_up();
}

void L1ctlAudioMode::clean_up()
{
field_padding.clean_up();
field_tx__microphone.clean_up();
field_tx__traffic__req.clean_up();
field_rx__speaker.clean_up();
field_rx__traffic__ind.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlAudioMode::get_descriptor() const { return &L1ctlAudioMode_descr_; }
L1ctlAudioMode& L1ctlAudioMode::operator=(const L1ctlAudioMode& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlAudioMode.");
  if (other_value.padding().is_bound()) field_padding = other_value.padding();
  else field_padding.clean_up();
  if (other_value.tx__microphone().is_bound()) field_tx__microphone = other_value.tx__microphone();
  else field_tx__microphone.clean_up();
  if (other_value.tx__traffic__req().is_bound()) field_tx__traffic__req = other_value.tx__traffic__req();
  else field_tx__traffic__req.clean_up();
  if (other_value.rx__speaker().is_bound()) field_rx__speaker = other_value.rx__speaker();
  else field_rx__speaker.clean_up();
  if (other_value.rx__traffic__ind().is_bound()) field_rx__traffic__ind = other_value.rx__traffic__ind();
  else field_rx__traffic__ind.clean_up();
}
return *this;
}

boolean L1ctlAudioMode::operator==(const L1ctlAudioMode& other_value) const
{
return field_padding==other_value.field_padding
  && field_tx__microphone==other_value.field_tx__microphone
  && field_tx__traffic__req==other_value.field_tx__traffic__req
  && field_rx__speaker==other_value.field_rx__speaker
  && field_rx__traffic__ind==other_value.field_rx__traffic__ind;
}

boolean L1ctlAudioMode::is_bound() const
{
return (field_padding.is_bound())
  || (field_tx__microphone.is_bound())
  || (field_tx__traffic__req.is_bound())
  || (field_rx__speaker.is_bound())
  || (field_rx__traffic__ind.is_bound());
}
boolean L1ctlAudioMode::is_value() const
{
return field_padding.is_value()
  && field_tx__microphone.is_value()
  && field_tx__traffic__req.is_value()
  && field_rx__speaker.is_value()
  && field_rx__traffic__ind.is_value();
}
void L1ctlAudioMode::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ padding := ");
field_padding.log();
TTCN_Logger::log_event_str(", tx_microphone := ");
field_tx__microphone.log();
TTCN_Logger::log_event_str(", tx_traffic_req := ");
field_tx__traffic__req.log();
TTCN_Logger::log_event_str(", rx_speaker := ");
field_rx__speaker.log();
TTCN_Logger::log_event_str(", rx_traffic_ind := ");
field_rx__traffic__ind.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlAudioMode::set_implicit_omit()
{
if (padding().is_bound()) padding().set_implicit_omit();
if (tx__microphone().is_bound()) tx__microphone().set_implicit_omit();
if (tx__traffic__req().is_bound()) tx__traffic__req().set_implicit_omit();
if (rx__speaker().is_bound()) rx__speaker().set_implicit_omit();
if (rx__traffic__ind().is_bound()) rx__traffic__ind().set_implicit_omit();
}

void L1ctlAudioMode::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 @L1CTL_Types.L1ctlAudioMode 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) padding().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tx__microphone().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) tx__traffic__req().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rx__speaker().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) rx__traffic__ind().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(), "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++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tx_microphone")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tx__microphone().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(), "tx_traffic_req")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tx__traffic__req().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(), "rx_speaker")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rx__speaker().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(), "rx_traffic_ind")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rx__traffic__ind().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 @L1CTL_Types.L1ctlAudioMode: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlAudioMode");
  }
}

void L1ctlAudioMode::encode_text(Text_Buf& text_buf) const
{
field_padding.encode_text(text_buf);
field_tx__microphone.encode_text(text_buf);
field_tx__traffic__req.encode_text(text_buf);
field_rx__speaker.encode_text(text_buf);
field_rx__traffic__ind.encode_text(text_buf);
}

void L1ctlAudioMode::decode_text(Text_Buf& text_buf)
{
field_padding.decode_text(text_buf);
field_tx__microphone.decode_text(text_buf);
field_tx__traffic__req.decode_text(text_buf);
field_rx__speaker.decode_text(text_buf);
field_rx__traffic__ind.decode_text(text_buf);
}

void L1ctlAudioMode::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 L1ctlAudioMode::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 L1ctlAudioMode::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::BIT4_descr_.raw->forceomit);
  decoded_field_length = field_padding.RAW_decode(General__Types::BIT4_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, BOOLEAN_descr_.raw->forceomit);
  decoded_field_length = field_tx__microphone.RAW_decode(BOOLEAN_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, BOOLEAN_descr_.raw->forceomit);
  decoded_field_length = field_tx__traffic__req.RAW_decode(BOOLEAN_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, BOOLEAN_descr_.raw->forceomit);
  decoded_field_length = field_rx__speaker.RAW_decode(BOOLEAN_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, BOOLEAN_descr_.raw->forceomit);
  decoded_field_length = field_rx__traffic__ind.RAW_decode(BOOLEAN_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 L1ctlAudioMode::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, General__Types::BIT4_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, BOOLEAN_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, BOOLEAN_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, BOOLEAN_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, BOOLEAN_descr_.raw);
  encoded_length += field_padding.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_tx__microphone.RAW_encode(BOOLEAN_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_tx__traffic__req.RAW_encode(BOOLEAN_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_rx__speaker.RAW_encode(BOOLEAN_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_rx__traffic__ind.RAW_encode(BOOLEAN_descr_, *myleaf.body.node.nodes[4]);
  return myleaf.length = encoded_length;
}

struct L1ctlAudioMode_template::single_value_struct {
BITSTRING_template field_padding;
BOOLEAN_template field_tx__microphone;
BOOLEAN_template field_tx__traffic__req;
BOOLEAN_template field_rx__speaker;
BOOLEAN_template field_rx__traffic__ind;
};

void L1ctlAudioMode_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_padding = ANY_VALUE;
single_value->field_tx__microphone = ANY_VALUE;
single_value->field_tx__traffic__req = ANY_VALUE;
single_value->field_rx__speaker = ANY_VALUE;
single_value->field_rx__traffic__ind = ANY_VALUE;
}
}
}

void L1ctlAudioMode_template::copy_value(const L1ctlAudioMode& other_value)
{
single_value = new single_value_struct;
if (other_value.padding().is_bound()) {
  single_value->field_padding = other_value.padding();
} else {
  single_value->field_padding.clean_up();
}
if (other_value.tx__microphone().is_bound()) {
  single_value->field_tx__microphone = other_value.tx__microphone();
} else {
  single_value->field_tx__microphone.clean_up();
}
if (other_value.tx__traffic__req().is_bound()) {
  single_value->field_tx__traffic__req = other_value.tx__traffic__req();
} else {
  single_value->field_tx__traffic__req.clean_up();
}
if (other_value.rx__speaker().is_bound()) {
  single_value->field_rx__speaker = other_value.rx__speaker();
} else {
  single_value->field_rx__speaker.clean_up();
}
if (other_value.rx__traffic__ind().is_bound()) {
  single_value->field_rx__traffic__ind = other_value.rx__traffic__ind();
} else {
  single_value->field_rx__traffic__ind.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlAudioMode_template::copy_template(const L1ctlAudioMode_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.padding().get_selection()) {
single_value->field_padding = other_value.padding();
} else {
single_value->field_padding.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tx__microphone().get_selection()) {
single_value->field_tx__microphone = other_value.tx__microphone();
} else {
single_value->field_tx__microphone.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tx__traffic__req().get_selection()) {
single_value->field_tx__traffic__req = other_value.tx__traffic__req();
} else {
single_value->field_tx__traffic__req.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rx__speaker().get_selection()) {
single_value->field_rx__speaker = other_value.rx__speaker();
} else {
single_value->field_rx__speaker.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rx__traffic__ind().get_selection()) {
single_value->field_rx__traffic__ind = other_value.rx__traffic__ind();
} else {
single_value->field_rx__traffic__ind.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 L1ctlAudioMode_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 L1ctlAudioMode_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlAudioMode_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 @L1CTL_Types.L1ctlAudioMode.");
break;
}
set_selection(other_value);
}

L1ctlAudioMode_template::L1ctlAudioMode_template()
{
}

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

L1ctlAudioMode_template::L1ctlAudioMode_template(const L1ctlAudioMode& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlAudioMode_template::match(const L1ctlAudioMode& 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.padding().is_bound()) return FALSE;
if(!single_value->field_padding.match(other_value.padding(), legacy))return FALSE;
if(!other_value.tx__microphone().is_bound()) return FALSE;
if(!single_value->field_tx__microphone.match(other_value.tx__microphone(), legacy))return FALSE;
if(!other_value.tx__traffic__req().is_bound()) return FALSE;
if(!single_value->field_tx__traffic__req.match(other_value.tx__traffic__req(), legacy))return FALSE;
if(!other_value.rx__speaker().is_bound()) return FALSE;
if(!single_value->field_rx__speaker.match(other_value.rx__speaker(), legacy))return FALSE;
if(!other_value.rx__traffic__ind().is_bound()) return FALSE;
if(!single_value->field_rx__traffic__ind.match(other_value.rx__traffic__ind(), 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 @L1CTL_Types.L1ctlAudioMode.");
}
return FALSE;
}

boolean L1ctlAudioMode_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_padding.is_bound()
 || single_value->field_tx__microphone.is_bound()
 || single_value->field_tx__traffic__req.is_bound()
 || single_value->field_rx__speaker.is_bound()
 || single_value->field_rx__traffic__ind.is_bound();
}

boolean L1ctlAudioMode_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_padding.is_value()
 && single_value->field_tx__microphone.is_value()
 && single_value->field_tx__traffic__req.is_value()
 && single_value->field_rx__speaker.is_value()
 && single_value->field_rx__traffic__ind.is_value();
}

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

L1ctlAudioMode L1ctlAudioMode_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 @L1CTL_Types.L1ctlAudioMode.");
L1ctlAudioMode ret_val;
if (single_value->field_padding.is_bound()) {
ret_val.padding() = single_value->field_padding.valueof();
}
if (single_value->field_tx__microphone.is_bound()) {
ret_val.tx__microphone() = single_value->field_tx__microphone.valueof();
}
if (single_value->field_tx__traffic__req.is_bound()) {
ret_val.tx__traffic__req() = single_value->field_tx__traffic__req.valueof();
}
if (single_value->field_rx__speaker.is_bound()) {
ret_val.rx__speaker() = single_value->field_rx__speaker.valueof();
}
if (single_value->field_rx__traffic__ind.is_bound()) {
ret_val.rx__traffic__ind() = single_value->field_rx__traffic__ind.valueof();
}
return ret_val;
}

void L1ctlAudioMode_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 @L1CTL_Types.L1ctlAudioMode.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlAudioMode_template[list_length];
}

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

BITSTRING_template& L1ctlAudioMode_template::padding()
{
set_specific();
return single_value->field_padding;
}

const BITSTRING_template& L1ctlAudioMode_template::padding() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field padding of a non-specific template of type @L1CTL_Types.L1ctlAudioMode.");
return single_value->field_padding;
}

BOOLEAN_template& L1ctlAudioMode_template::tx__microphone()
{
set_specific();
return single_value->field_tx__microphone;
}

const BOOLEAN_template& L1ctlAudioMode_template::tx__microphone() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tx_microphone of a non-specific template of type @L1CTL_Types.L1ctlAudioMode.");
return single_value->field_tx__microphone;
}

BOOLEAN_template& L1ctlAudioMode_template::tx__traffic__req()
{
set_specific();
return single_value->field_tx__traffic__req;
}

const BOOLEAN_template& L1ctlAudioMode_template::tx__traffic__req() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tx_traffic_req of a non-specific template of type @L1CTL_Types.L1ctlAudioMode.");
return single_value->field_tx__traffic__req;
}

BOOLEAN_template& L1ctlAudioMode_template::rx__speaker()
{
set_specific();
return single_value->field_rx__speaker;
}

const BOOLEAN_template& L1ctlAudioMode_template::rx__speaker() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rx_speaker of a non-specific template of type @L1CTL_Types.L1ctlAudioMode.");
return single_value->field_rx__speaker;
}

BOOLEAN_template& L1ctlAudioMode_template::rx__traffic__ind()
{
set_specific();
return single_value->field_rx__traffic__ind;
}

const BOOLEAN_template& L1ctlAudioMode_template::rx__traffic__ind() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rx_traffic_ind of a non-specific template of type @L1CTL_Types.L1ctlAudioMode.");
return single_value->field_rx__traffic__ind;
}

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

void L1ctlAudioMode_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ padding := ");
single_value->field_padding.log();
TTCN_Logger::log_event_str(", tx_microphone := ");
single_value->field_tx__microphone.log();
TTCN_Logger::log_event_str(", tx_traffic_req := ");
single_value->field_tx__traffic__req.log();
TTCN_Logger::log_event_str(", rx_speaker := ");
single_value->field_rx__speaker.log();
TTCN_Logger::log_event_str(", rx_traffic_ind := ");
single_value->field_rx__traffic__ind.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 L1ctlAudioMode_template::log_match(const L1ctlAudioMode& 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_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);
}
if(!single_value->field_tx__microphone.match(match_value.tx__microphone(), legacy)){
TTCN_Logger::log_logmatch_info(".tx_microphone");
single_value->field_tx__microphone.log_match(match_value.tx__microphone(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tx__traffic__req.match(match_value.tx__traffic__req(), legacy)){
TTCN_Logger::log_logmatch_info(".tx_traffic_req");
single_value->field_tx__traffic__req.log_match(match_value.tx__traffic__req(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rx__speaker.match(match_value.rx__speaker(), legacy)){
TTCN_Logger::log_logmatch_info(".rx_speaker");
single_value->field_rx__speaker.log_match(match_value.rx__speaker(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rx__traffic__ind.match(match_value.rx__traffic__ind(), legacy)){
TTCN_Logger::log_logmatch_info(".rx_traffic_ind");
single_value->field_rx__traffic__ind.log_match(match_value.rx__traffic__ind(), 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("{ padding := ");
single_value->field_padding.log_match(match_value.padding(), legacy);
TTCN_Logger::log_event_str(", tx_microphone := ");
single_value->field_tx__microphone.log_match(match_value.tx__microphone(), legacy);
TTCN_Logger::log_event_str(", tx_traffic_req := ");
single_value->field_tx__traffic__req.log_match(match_value.tx__traffic__req(), legacy);
TTCN_Logger::log_event_str(", rx_speaker := ");
single_value->field_rx__speaker.log_match(match_value.rx__speaker(), legacy);
TTCN_Logger::log_event_str(", rx_traffic_ind := ");
single_value->field_rx__traffic__ind.log_match(match_value.rx__traffic__ind(), 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 L1ctlAudioMode_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (padding().is_bound()) padding().set_implicit_omit();
if (tx__microphone().is_bound()) tx__microphone().set_implicit_omit();
if (tx__traffic__req().is_bound()) tx__traffic__req().set_implicit_omit();
if (rx__speaker().is_bound()) rx__speaker().set_implicit_omit();
if (rx__traffic__ind().is_bound()) rx__traffic__ind().set_implicit_omit();
}

void L1ctlAudioMode_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_padding.encode_text(text_buf);
single_value->field_tx__microphone.encode_text(text_buf);
single_value->field_tx__traffic__req.encode_text(text_buf);
single_value->field_rx__speaker.encode_text(text_buf);
single_value->field_rx__traffic__ind.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 @L1CTL_Types.L1ctlAudioMode.");
}
}

void L1ctlAudioMode_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_padding.decode_text(text_buf);
single_value->field_tx__microphone.decode_text(text_buf);
single_value->field_tx__traffic__req.decode_text(text_buf);
single_value->field_rx__speaker.decode_text(text_buf);
single_value->field_rx__traffic__ind.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 L1ctlAudioMode_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 @L1CTL_Types.L1ctlAudioMode.");
}
}

void L1ctlAudioMode_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: {
    L1ctlAudioMode_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 @L1CTL_Types.L1ctlAudioMode 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) padding().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tx__microphone().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) tx__traffic__req().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rx__speaker().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) rx__traffic__ind().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(), "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++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tx_microphone")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tx__microphone().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(), "tx_traffic_req")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tx__traffic__req().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(), "rx_speaker")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rx__speaker().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(), "rx_traffic_ind")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rx__traffic__ind().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 @L1CTL_Types.L1ctlAudioMode: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlAudioMode_template* precondition = new L1ctlAudioMode_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlAudioMode_template* implied_template = new L1ctlAudioMode_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlAudioMode_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlAudioMode");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlAudioMode_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_padding.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlAudioMode");
single_value->field_tx__microphone.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlAudioMode");
single_value->field_tx__traffic__req.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlAudioMode");
single_value->field_rx__speaker.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlAudioMode");
single_value->field_rx__traffic__ind.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlAudioMode");
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 : "@L1CTL_Types.L1ctlAudioMode");
}

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

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

L1ctlTchModeConf_amr::L1ctlTchModeConf_amr()
{
}

L1ctlTchModeConf_amr::L1ctlTchModeConf_amr(const INTEGER& par_start__codec,
    const BITSTRING& par_codecs__bitmask)
  :   field_start__codec(par_start__codec),
  field_codecs__bitmask(par_codecs__bitmask)
{
}

L1ctlTchModeConf_amr::L1ctlTchModeConf_amr(const L1ctlTchModeConf_amr& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlTchModeConf.amr.");
if (other_value.start__codec().is_bound()) field_start__codec = other_value.start__codec();
else field_start__codec.clean_up();
if (other_value.codecs__bitmask().is_bound()) field_codecs__bitmask = other_value.codecs__bitmask();
else field_codecs__bitmask.clean_up();
}

void L1ctlTchModeConf_amr::clean_up()
{
field_start__codec.clean_up();
field_codecs__bitmask.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlTchModeConf_amr::get_descriptor() const { return &L1ctlTchModeConf_amr_descr_; }
L1ctlTchModeConf_amr& L1ctlTchModeConf_amr::operator=(const L1ctlTchModeConf_amr& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlTchModeConf.amr.");
  if (other_value.start__codec().is_bound()) field_start__codec = other_value.start__codec();
  else field_start__codec.clean_up();
  if (other_value.codecs__bitmask().is_bound()) field_codecs__bitmask = other_value.codecs__bitmask();
  else field_codecs__bitmask.clean_up();
}
return *this;
}

boolean L1ctlTchModeConf_amr::operator==(const L1ctlTchModeConf_amr& other_value) const
{
return field_start__codec==other_value.field_start__codec
  && field_codecs__bitmask==other_value.field_codecs__bitmask;
}

boolean L1ctlTchModeConf_amr::is_bound() const
{
return (field_start__codec.is_bound())
  || (field_codecs__bitmask.is_bound());
}
boolean L1ctlTchModeConf_amr::is_value() const
{
return field_start__codec.is_value()
  && field_codecs__bitmask.is_value();
}
void L1ctlTchModeConf_amr::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ start_codec := ");
field_start__codec.log();
TTCN_Logger::log_event_str(", codecs_bitmask := ");
field_codecs__bitmask.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlTchModeConf_amr::set_implicit_omit()
{
if (start__codec().is_bound()) start__codec().set_implicit_omit();
if (codecs__bitmask().is_bound()) codecs__bitmask().set_implicit_omit();
}

void L1ctlTchModeConf_amr::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record value of type @L1CTL_Types.L1ctlTchModeConf.amr has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) start__codec().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) codecs__bitmask().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "start_codec")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          start__codec().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(), "codecs_bitmask")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          codecs__bitmask().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 @L1CTL_Types.L1ctlTchModeConf.amr: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlTchModeConf.amr");
  }
}

void L1ctlTchModeConf_amr::encode_text(Text_Buf& text_buf) const
{
field_start__codec.encode_text(text_buf);
field_codecs__bitmask.encode_text(text_buf);
}

void L1ctlTchModeConf_amr::decode_text(Text_Buf& text_buf)
{
field_start__codec.decode_text(text_buf);
field_codecs__bitmask.decode_text(text_buf);
}

void L1ctlTchModeConf_amr::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 L1ctlTchModeConf_amr::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 L1ctlTchModeConf_amr::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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_start__codec.RAW_decode(Osmocom__Types::uint8__t_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::BIT8_descr_.raw->forceomit);
  decoded_field_length = field_codecs__bitmask.RAW_decode(General__Types::BIT8_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

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

struct L1ctlTchModeConf_amr_template::single_value_struct {
INTEGER_template field_start__codec;
BITSTRING_template field_codecs__bitmask;
};

void L1ctlTchModeConf_amr_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_start__codec = ANY_VALUE;
single_value->field_codecs__bitmask = ANY_VALUE;
}
}
}

void L1ctlTchModeConf_amr_template::copy_value(const L1ctlTchModeConf_amr& other_value)
{
single_value = new single_value_struct;
if (other_value.start__codec().is_bound()) {
  single_value->field_start__codec = other_value.start__codec();
} else {
  single_value->field_start__codec.clean_up();
}
if (other_value.codecs__bitmask().is_bound()) {
  single_value->field_codecs__bitmask = other_value.codecs__bitmask();
} else {
  single_value->field_codecs__bitmask.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlTchModeConf_amr_template::copy_template(const L1ctlTchModeConf_amr_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.start__codec().get_selection()) {
single_value->field_start__codec = other_value.start__codec();
} else {
single_value->field_start__codec.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.codecs__bitmask().get_selection()) {
single_value->field_codecs__bitmask = other_value.codecs__bitmask();
} else {
single_value->field_codecs__bitmask.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 L1ctlTchModeConf_amr_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 L1ctlTchModeConf_amr_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlTchModeConf_amr_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 @L1CTL_Types.L1ctlTchModeConf.amr.");
break;
}
set_selection(other_value);
}

L1ctlTchModeConf_amr_template::L1ctlTchModeConf_amr_template()
{
}

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

L1ctlTchModeConf_amr_template::L1ctlTchModeConf_amr_template(const L1ctlTchModeConf_amr& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlTchModeConf_amr_template::match(const L1ctlTchModeConf_amr& 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.start__codec().is_bound()) return FALSE;
if(!single_value->field_start__codec.match(other_value.start__codec(), legacy))return FALSE;
if(!other_value.codecs__bitmask().is_bound()) return FALSE;
if(!single_value->field_codecs__bitmask.match(other_value.codecs__bitmask(), 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 @L1CTL_Types.L1ctlTchModeConf.amr.");
}
return FALSE;
}

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

boolean L1ctlTchModeConf_amr_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_start__codec.is_value()
 && single_value->field_codecs__bitmask.is_value();
}

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

L1ctlTchModeConf_amr L1ctlTchModeConf_amr_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 @L1CTL_Types.L1ctlTchModeConf.amr.");
L1ctlTchModeConf_amr ret_val;
if (single_value->field_start__codec.is_bound()) {
ret_val.start__codec() = single_value->field_start__codec.valueof();
}
if (single_value->field_codecs__bitmask.is_bound()) {
ret_val.codecs__bitmask() = single_value->field_codecs__bitmask.valueof();
}
return ret_val;
}

void L1ctlTchModeConf_amr_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 @L1CTL_Types.L1ctlTchModeConf.amr.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlTchModeConf_amr_template[list_length];
}

L1ctlTchModeConf_amr_template& L1ctlTchModeConf_amr_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 @L1CTL_Types.L1ctlTchModeConf.amr.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @L1CTL_Types.L1ctlTchModeConf.amr.");
return value_list.list_value[list_index];
}

INTEGER_template& L1ctlTchModeConf_amr_template::start__codec()
{
set_specific();
return single_value->field_start__codec;
}

const INTEGER_template& L1ctlTchModeConf_amr_template::start__codec() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field start_codec of a non-specific template of type @L1CTL_Types.L1ctlTchModeConf.amr.");
return single_value->field_start__codec;
}

BITSTRING_template& L1ctlTchModeConf_amr_template::codecs__bitmask()
{
set_specific();
return single_value->field_codecs__bitmask;
}

const BITSTRING_template& L1ctlTchModeConf_amr_template::codecs__bitmask() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field codecs_bitmask of a non-specific template of type @L1CTL_Types.L1ctlTchModeConf.amr.");
return single_value->field_codecs__bitmask;
}

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

void L1ctlTchModeConf_amr_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ start_codec := ");
single_value->field_start__codec.log();
TTCN_Logger::log_event_str(", codecs_bitmask := ");
single_value->field_codecs__bitmask.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 L1ctlTchModeConf_amr_template::log_match(const L1ctlTchModeConf_amr& 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_start__codec.match(match_value.start__codec(), legacy)){
TTCN_Logger::log_logmatch_info(".start_codec");
single_value->field_start__codec.log_match(match_value.start__codec(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_codecs__bitmask.match(match_value.codecs__bitmask(), legacy)){
TTCN_Logger::log_logmatch_info(".codecs_bitmask");
single_value->field_codecs__bitmask.log_match(match_value.codecs__bitmask(), 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("{ start_codec := ");
single_value->field_start__codec.log_match(match_value.start__codec(), legacy);
TTCN_Logger::log_event_str(", codecs_bitmask := ");
single_value->field_codecs__bitmask.log_match(match_value.codecs__bitmask(), 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 L1ctlTchModeConf_amr_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (start__codec().is_bound()) start__codec().set_implicit_omit();
if (codecs__bitmask().is_bound()) codecs__bitmask().set_implicit_omit();
}

void L1ctlTchModeConf_amr_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_start__codec.encode_text(text_buf);
single_value->field_codecs__bitmask.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 @L1CTL_Types.L1ctlTchModeConf.amr.");
}
}

void L1ctlTchModeConf_amr_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_start__codec.decode_text(text_buf);
single_value->field_codecs__bitmask.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 L1ctlTchModeConf_amr_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 @L1CTL_Types.L1ctlTchModeConf.amr.");
}
}

void L1ctlTchModeConf_amr_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: {
    L1ctlTchModeConf_amr_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @L1CTL_Types.L1ctlTchModeConf.amr has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) start__codec().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) codecs__bitmask().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "start_codec")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          start__codec().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(), "codecs_bitmask")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          codecs__bitmask().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 @L1CTL_Types.L1ctlTchModeConf.amr: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlTchModeConf_amr_template* precondition = new L1ctlTchModeConf_amr_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlTchModeConf_amr_template* implied_template = new L1ctlTchModeConf_amr_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlTchModeConf_amr_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlTchModeConf.amr");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlTchModeConf_amr_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_start__codec.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlTchModeConf.amr");
single_value->field_codecs__bitmask.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlTchModeConf.amr");
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 : "@L1CTL_Types.L1ctlTchModeConf.amr");
}

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

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

L1ctlTchModeConf::L1ctlTchModeConf()
{
}

L1ctlTchModeConf::L1ctlTchModeConf(const L1ctlTchMode& par_tch__mode,
    const L1ctlAudioMode& par_audio__mode,
    const L1ctlTchModeConf_amr& par_amr)
  :   field_tch__mode(par_tch__mode),
  field_audio__mode(par_audio__mode),
  field_amr(par_amr)
{
}

L1ctlTchModeConf::L1ctlTchModeConf(const L1ctlTchModeConf& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlTchModeConf.");
if (other_value.tch__mode().is_bound()) field_tch__mode = other_value.tch__mode();
else field_tch__mode.clean_up();
if (other_value.audio__mode().is_bound()) field_audio__mode = other_value.audio__mode();
else field_audio__mode.clean_up();
if (other_value.amr().is_bound()) field_amr = other_value.amr();
else field_amr.clean_up();
}

void L1ctlTchModeConf::clean_up()
{
field_tch__mode.clean_up();
field_audio__mode.clean_up();
field_amr.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlTchModeConf::get_descriptor() const { return &L1ctlTchModeConf_descr_; }
L1ctlTchModeConf& L1ctlTchModeConf::operator=(const L1ctlTchModeConf& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlTchModeConf.");
  if (other_value.tch__mode().is_bound()) field_tch__mode = other_value.tch__mode();
  else field_tch__mode.clean_up();
  if (other_value.audio__mode().is_bound()) field_audio__mode = other_value.audio__mode();
  else field_audio__mode.clean_up();
  if (other_value.amr().is_bound()) field_amr = other_value.amr();
  else field_amr.clean_up();
}
return *this;
}

boolean L1ctlTchModeConf::operator==(const L1ctlTchModeConf& other_value) const
{
return field_tch__mode==other_value.field_tch__mode
  && field_audio__mode==other_value.field_audio__mode
  && field_amr==other_value.field_amr;
}

boolean L1ctlTchModeConf::is_bound() const
{
return (field_tch__mode.is_bound())
  || (field_audio__mode.is_bound())
  || (field_amr.is_bound());
}
boolean L1ctlTchModeConf::is_value() const
{
return field_tch__mode.is_value()
  && field_audio__mode.is_value()
  && field_amr.is_value();
}
void L1ctlTchModeConf::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ tch_mode := ");
field_tch__mode.log();
TTCN_Logger::log_event_str(", audio_mode := ");
field_audio__mode.log();
TTCN_Logger::log_event_str(", amr := ");
field_amr.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlTchModeConf::set_implicit_omit()
{
if (tch__mode().is_bound()) tch__mode().set_implicit_omit();
if (audio__mode().is_bound()) audio__mode().set_implicit_omit();
if (amr().is_bound()) amr().set_implicit_omit();
}

void L1ctlTchModeConf::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 @L1CTL_Types.L1ctlTchModeConf 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) tch__mode().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) audio__mode().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) amr().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(), "tch_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tch__mode().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(), "audio_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          audio__mode().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(), "amr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          amr().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 @L1CTL_Types.L1ctlTchModeConf: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlTchModeConf");
  }
}

void L1ctlTchModeConf::encode_text(Text_Buf& text_buf) const
{
field_tch__mode.encode_text(text_buf);
field_audio__mode.encode_text(text_buf);
field_amr.encode_text(text_buf);
}

void L1ctlTchModeConf::decode_text(Text_Buf& text_buf)
{
field_tch__mode.decode_text(text_buf);
field_audio__mode.decode_text(text_buf);
field_amr.decode_text(text_buf);
}

void L1ctlTchModeConf::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 L1ctlTchModeConf::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 L1ctlTchModeConf::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, L1ctlTchMode_descr_.raw->forceomit);
  decoded_field_length = field_tch__mode.RAW_decode(L1ctlTchMode_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, L1ctlAudioMode_descr_.raw->forceomit);
  decoded_field_length = field_audio__mode.RAW_decode(L1ctlAudioMode_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, L1ctlTchModeConf_amr_descr_.raw->forceomit);
  decoded_field_length = field_amr.RAW_decode(L1ctlTchModeConf_amr_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 L1ctlTchModeConf::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, L1ctlTchMode_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, L1ctlAudioMode_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, L1ctlTchModeConf_amr_descr_.raw);
  encoded_length += field_tch__mode.RAW_encode(L1ctlTchMode_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_audio__mode.RAW_encode(L1ctlAudioMode_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_amr.RAW_encode(L1ctlTchModeConf_amr_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct L1ctlTchModeConf_template::single_value_struct {
L1ctlTchMode_template field_tch__mode;
L1ctlAudioMode_template field_audio__mode;
L1ctlTchModeConf_amr_template field_amr;
};

void L1ctlTchModeConf_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_tch__mode = ANY_VALUE;
single_value->field_audio__mode = ANY_VALUE;
single_value->field_amr = ANY_VALUE;
}
}
}

void L1ctlTchModeConf_template::copy_value(const L1ctlTchModeConf& other_value)
{
single_value = new single_value_struct;
if (other_value.tch__mode().is_bound()) {
  single_value->field_tch__mode = other_value.tch__mode();
} else {
  single_value->field_tch__mode.clean_up();
}
if (other_value.audio__mode().is_bound()) {
  single_value->field_audio__mode = other_value.audio__mode();
} else {
  single_value->field_audio__mode.clean_up();
}
if (other_value.amr().is_bound()) {
  single_value->field_amr = other_value.amr();
} else {
  single_value->field_amr.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlTchModeConf_template::copy_template(const L1ctlTchModeConf_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.tch__mode().get_selection()) {
single_value->field_tch__mode = other_value.tch__mode();
} else {
single_value->field_tch__mode.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.audio__mode().get_selection()) {
single_value->field_audio__mode = other_value.audio__mode();
} else {
single_value->field_audio__mode.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.amr().get_selection()) {
single_value->field_amr = other_value.amr();
} else {
single_value->field_amr.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 L1ctlTchModeConf_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 L1ctlTchModeConf_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlTchModeConf_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 @L1CTL_Types.L1ctlTchModeConf.");
break;
}
set_selection(other_value);
}

L1ctlTchModeConf_template::L1ctlTchModeConf_template()
{
}

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

L1ctlTchModeConf_template::L1ctlTchModeConf_template(const L1ctlTchModeConf& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlTchModeConf_template::match(const L1ctlTchModeConf& 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.tch__mode().is_bound()) return FALSE;
if(!single_value->field_tch__mode.match(other_value.tch__mode(), legacy))return FALSE;
if(!other_value.audio__mode().is_bound()) return FALSE;
if(!single_value->field_audio__mode.match(other_value.audio__mode(), legacy))return FALSE;
if(!other_value.amr().is_bound()) return FALSE;
if(!single_value->field_amr.match(other_value.amr(), 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 @L1CTL_Types.L1ctlTchModeConf.");
}
return FALSE;
}

boolean L1ctlTchModeConf_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_tch__mode.is_bound()
 || single_value->field_audio__mode.is_bound()
 || single_value->field_amr.is_bound();
}

boolean L1ctlTchModeConf_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_tch__mode.is_value()
 && single_value->field_audio__mode.is_value()
 && single_value->field_amr.is_value();
}

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

L1ctlTchModeConf L1ctlTchModeConf_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 @L1CTL_Types.L1ctlTchModeConf.");
L1ctlTchModeConf ret_val;
if (single_value->field_tch__mode.is_bound()) {
ret_val.tch__mode() = single_value->field_tch__mode.valueof();
}
if (single_value->field_audio__mode.is_bound()) {
ret_val.audio__mode() = single_value->field_audio__mode.valueof();
}
if (single_value->field_amr.is_bound()) {
ret_val.amr() = single_value->field_amr.valueof();
}
return ret_val;
}

void L1ctlTchModeConf_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 @L1CTL_Types.L1ctlTchModeConf.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlTchModeConf_template[list_length];
}

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

L1ctlTchMode_template& L1ctlTchModeConf_template::tch__mode()
{
set_specific();
return single_value->field_tch__mode;
}

const L1ctlTchMode_template& L1ctlTchModeConf_template::tch__mode() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tch_mode of a non-specific template of type @L1CTL_Types.L1ctlTchModeConf.");
return single_value->field_tch__mode;
}

L1ctlAudioMode_template& L1ctlTchModeConf_template::audio__mode()
{
set_specific();
return single_value->field_audio__mode;
}

const L1ctlAudioMode_template& L1ctlTchModeConf_template::audio__mode() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field audio_mode of a non-specific template of type @L1CTL_Types.L1ctlTchModeConf.");
return single_value->field_audio__mode;
}

L1ctlTchModeConf_amr_template& L1ctlTchModeConf_template::amr()
{
set_specific();
return single_value->field_amr;
}

const L1ctlTchModeConf_amr_template& L1ctlTchModeConf_template::amr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field amr of a non-specific template of type @L1CTL_Types.L1ctlTchModeConf.");
return single_value->field_amr;
}

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

void L1ctlTchModeConf_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ tch_mode := ");
single_value->field_tch__mode.log();
TTCN_Logger::log_event_str(", audio_mode := ");
single_value->field_audio__mode.log();
TTCN_Logger::log_event_str(", amr := ");
single_value->field_amr.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 L1ctlTchModeConf_template::log_match(const L1ctlTchModeConf& 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_tch__mode.match(match_value.tch__mode(), legacy)){
TTCN_Logger::log_logmatch_info(".tch_mode");
single_value->field_tch__mode.log_match(match_value.tch__mode(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_audio__mode.match(match_value.audio__mode(), legacy)){
TTCN_Logger::log_logmatch_info(".audio_mode");
single_value->field_audio__mode.log_match(match_value.audio__mode(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_amr.match(match_value.amr(), legacy)){
TTCN_Logger::log_logmatch_info(".amr");
single_value->field_amr.log_match(match_value.amr(), 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("{ tch_mode := ");
single_value->field_tch__mode.log_match(match_value.tch__mode(), legacy);
TTCN_Logger::log_event_str(", audio_mode := ");
single_value->field_audio__mode.log_match(match_value.audio__mode(), legacy);
TTCN_Logger::log_event_str(", amr := ");
single_value->field_amr.log_match(match_value.amr(), 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 L1ctlTchModeConf_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (tch__mode().is_bound()) tch__mode().set_implicit_omit();
if (audio__mode().is_bound()) audio__mode().set_implicit_omit();
if (amr().is_bound()) amr().set_implicit_omit();
}

void L1ctlTchModeConf_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_tch__mode.encode_text(text_buf);
single_value->field_audio__mode.encode_text(text_buf);
single_value->field_amr.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 @L1CTL_Types.L1ctlTchModeConf.");
}
}

void L1ctlTchModeConf_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_tch__mode.decode_text(text_buf);
single_value->field_audio__mode.decode_text(text_buf);
single_value->field_amr.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 L1ctlTchModeConf_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 @L1CTL_Types.L1ctlTchModeConf.");
}
}

void L1ctlTchModeConf_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: {
    L1ctlTchModeConf_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 @L1CTL_Types.L1ctlTchModeConf 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) tch__mode().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) audio__mode().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) amr().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(), "tch_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tch__mode().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(), "audio_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          audio__mode().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(), "amr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          amr().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 @L1CTL_Types.L1ctlTchModeConf: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlTchModeConf_template* precondition = new L1ctlTchModeConf_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlTchModeConf_template* implied_template = new L1ctlTchModeConf_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlTchModeConf_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlTchModeConf");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlTchModeConf_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_tch__mode.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlTchModeConf");
single_value->field_audio__mode.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlTchModeConf");
single_value->field_amr.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlTchModeConf");
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 : "@L1CTL_Types.L1ctlTchModeConf");
}

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

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

L1ctlDataInd::L1ctlDataInd()
{
}

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

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

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

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

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

boolean L1ctlDataInd::is_bound() const
{
return (field_payload.is_bound());
}
boolean L1ctlDataInd::is_value() const
{
return field_payload.is_value();
}
void L1ctlDataInd::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 L1ctlDataInd::set_implicit_omit()
{
if (payload().is_bound()) payload().set_implicit_omit();
}

void L1ctlDataInd::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 @L1CTL_Types.L1ctlDataInd 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 @L1CTL_Types.L1ctlDataInd: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlDataInd");
  }
}

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

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

void L1ctlDataInd::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 L1ctlDataInd::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 L1ctlDataInd::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, L1ctlDataInd_payload_descr_.raw->forceomit);
  decoded_field_length = field_payload.RAW_decode(L1ctlDataInd_payload_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 L1ctlDataInd::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, L1ctlDataInd_payload_descr_.raw);
  encoded_length += field_payload.RAW_encode(L1ctlDataInd_payload_descr_, *myleaf.body.node.nodes[0]);
  return myleaf.length = encoded_length;
}

struct L1ctlDataInd_template::single_value_struct {
OCTETSTRING_template field_payload;
};

void L1ctlDataInd_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 L1ctlDataInd_template::copy_value(const L1ctlDataInd& 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 L1ctlDataInd_template::copy_template(const L1ctlDataInd_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 L1ctlDataInd_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 L1ctlDataInd_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlDataInd_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 @L1CTL_Types.L1ctlDataInd.");
break;
}
set_selection(other_value);
}

L1ctlDataInd_template::L1ctlDataInd_template()
{
}

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

L1ctlDataInd_template::L1ctlDataInd_template(const L1ctlDataInd& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlDataInd_template::match(const L1ctlDataInd& 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 @L1CTL_Types.L1ctlDataInd.");
}
return FALSE;
}

boolean L1ctlDataInd_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 L1ctlDataInd_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_payload.is_value();
}

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

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

void L1ctlDataInd_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 @L1CTL_Types.L1ctlDataInd.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlDataInd_template[list_length];
}

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

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

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

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

void L1ctlDataInd_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 L1ctlDataInd_template::log_match(const L1ctlDataInd& 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 L1ctlDataInd_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (payload().is_bound()) payload().set_implicit_omit();
}

void L1ctlDataInd_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 @L1CTL_Types.L1ctlDataInd.");
}
}

void L1ctlDataInd_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 L1ctlDataInd_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 @L1CTL_Types.L1ctlDataInd.");
}
}

void L1ctlDataInd_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: {
    L1ctlDataInd_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 @L1CTL_Types.L1ctlDataInd 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 @L1CTL_Types.L1ctlDataInd: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlDataInd_template* precondition = new L1ctlDataInd_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlDataInd_template* implied_template = new L1ctlDataInd_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlDataInd_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlDataInd");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlDataInd_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 : "@L1CTL_Types.L1ctlDataInd");
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 : "@L1CTL_Types.L1ctlDataInd");
}

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

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

L1ctlUlInfo::L1ctlUlInfo()
{
}

L1ctlUlInfo::L1ctlUlInfo(const GSM__Types::RslChannelNr& par_chan__nr,
    const GSM__Types::RslLinkId& par_link__id,
    const OCTETSTRING& par_padding)
  :   field_chan__nr(par_chan__nr),
  field_link__id(par_link__id),
  field_padding(par_padding)
{
}

L1ctlUlInfo::L1ctlUlInfo(const L1ctlUlInfo& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlUlInfo.");
if (other_value.chan__nr().is_bound()) field_chan__nr = other_value.chan__nr();
else field_chan__nr.clean_up();
if (other_value.link__id().is_bound()) field_link__id = other_value.link__id();
else field_link__id.clean_up();
if (other_value.padding().is_bound()) field_padding = other_value.padding();
else field_padding.clean_up();
}

void L1ctlUlInfo::clean_up()
{
field_chan__nr.clean_up();
field_link__id.clean_up();
field_padding.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlUlInfo::get_descriptor() const { return &L1ctlUlInfo_descr_; }
L1ctlUlInfo& L1ctlUlInfo::operator=(const L1ctlUlInfo& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlUlInfo.");
  if (other_value.chan__nr().is_bound()) field_chan__nr = other_value.chan__nr();
  else field_chan__nr.clean_up();
  if (other_value.link__id().is_bound()) field_link__id = other_value.link__id();
  else field_link__id.clean_up();
  if (other_value.padding().is_bound()) field_padding = other_value.padding();
  else field_padding.clean_up();
}
return *this;
}

boolean L1ctlUlInfo::operator==(const L1ctlUlInfo& other_value) const
{
return field_chan__nr==other_value.field_chan__nr
  && field_link__id==other_value.field_link__id
  && field_padding==other_value.field_padding;
}

boolean L1ctlUlInfo::is_bound() const
{
return (field_chan__nr.is_bound())
  || (field_link__id.is_bound())
  || (field_padding.is_bound());
}
boolean L1ctlUlInfo::is_value() const
{
return field_chan__nr.is_value()
  && field_link__id.is_value()
  && field_padding.is_value();
}
void L1ctlUlInfo::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ chan_nr := ");
field_chan__nr.log();
TTCN_Logger::log_event_str(", link_id := ");
field_link__id.log();
TTCN_Logger::log_event_str(", padding := ");
field_padding.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlUlInfo::set_implicit_omit()
{
if (chan__nr().is_bound()) chan__nr().set_implicit_omit();
if (link__id().is_bound()) link__id().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

void L1ctlUlInfo::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 @L1CTL_Types.L1ctlUlInfo 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) chan__nr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) link__id().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) padding().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(), "chan_nr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          chan__nr().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(), "link_id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          link__id().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 @L1CTL_Types.L1ctlUlInfo: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlUlInfo");
  }
}

void L1ctlUlInfo::encode_text(Text_Buf& text_buf) const
{
field_chan__nr.encode_text(text_buf);
field_link__id.encode_text(text_buf);
field_padding.encode_text(text_buf);
}

void L1ctlUlInfo::decode_text(Text_Buf& text_buf)
{
field_chan__nr.decode_text(text_buf);
field_link__id.decode_text(text_buf);
field_padding.decode_text(text_buf);
}

void L1ctlUlInfo::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 L1ctlUlInfo::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 L1ctlUlInfo::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, GSM__Types::RslChannelNr_descr_.raw->forceomit);
  decoded_field_length = field_chan__nr.RAW_decode(GSM__Types::RslChannelNr_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, GSM__Types::RslLinkId_descr_.raw->forceomit);
  decoded_field_length = field_link__id.RAW_decode(GSM__Types::RslLinkId_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::OCT2_descr_.raw->forceomit);
  decoded_field_length = field_padding.RAW_decode(General__Types::OCT2_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 L1ctlUlInfo::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, GSM__Types::RslChannelNr_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, GSM__Types::RslLinkId_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::OCT2_descr_.raw);
  encoded_length += field_chan__nr.RAW_encode(GSM__Types::RslChannelNr_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_link__id.RAW_encode(GSM__Types::RslLinkId_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_padding.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct L1ctlUlInfo_template::single_value_struct {
GSM__Types::RslChannelNr_template field_chan__nr;
GSM__Types::RslLinkId_template field_link__id;
OCTETSTRING_template field_padding;
};

void L1ctlUlInfo_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_chan__nr = ANY_VALUE;
single_value->field_link__id = ANY_VALUE;
single_value->field_padding = ANY_VALUE;
}
}
}

void L1ctlUlInfo_template::copy_value(const L1ctlUlInfo& other_value)
{
single_value = new single_value_struct;
if (other_value.chan__nr().is_bound()) {
  single_value->field_chan__nr = other_value.chan__nr();
} else {
  single_value->field_chan__nr.clean_up();
}
if (other_value.link__id().is_bound()) {
  single_value->field_link__id = other_value.link__id();
} else {
  single_value->field_link__id.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 L1ctlUlInfo_template::copy_template(const L1ctlUlInfo_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.chan__nr().get_selection()) {
single_value->field_chan__nr = other_value.chan__nr();
} else {
single_value->field_chan__nr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.link__id().get_selection()) {
single_value->field_link__id = other_value.link__id();
} else {
single_value->field_link__id.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 L1ctlUlInfo_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 L1ctlUlInfo_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlUlInfo_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 @L1CTL_Types.L1ctlUlInfo.");
break;
}
set_selection(other_value);
}

L1ctlUlInfo_template::L1ctlUlInfo_template()
{
}

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

L1ctlUlInfo_template::L1ctlUlInfo_template(const L1ctlUlInfo& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlUlInfo_template::match(const L1ctlUlInfo& 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.chan__nr().is_bound()) return FALSE;
if(!single_value->field_chan__nr.match(other_value.chan__nr(), legacy))return FALSE;
if(!other_value.link__id().is_bound()) return FALSE;
if(!single_value->field_link__id.match(other_value.link__id(), 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 @L1CTL_Types.L1ctlUlInfo.");
}
return FALSE;
}

boolean L1ctlUlInfo_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_chan__nr.is_bound()
 || single_value->field_link__id.is_bound()
 || single_value->field_padding.is_bound();
}

boolean L1ctlUlInfo_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_chan__nr.is_value()
 && single_value->field_link__id.is_value()
 && single_value->field_padding.is_value();
}

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

L1ctlUlInfo L1ctlUlInfo_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 @L1CTL_Types.L1ctlUlInfo.");
L1ctlUlInfo ret_val;
if (single_value->field_chan__nr.is_bound()) {
ret_val.chan__nr() = single_value->field_chan__nr.valueof();
}
if (single_value->field_link__id.is_bound()) {
ret_val.link__id() = single_value->field_link__id.valueof();
}
if (single_value->field_padding.is_bound()) {
ret_val.padding() = single_value->field_padding.valueof();
}
return ret_val;
}

void L1ctlUlInfo_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 @L1CTL_Types.L1ctlUlInfo.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlUlInfo_template[list_length];
}

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

GSM__Types::RslChannelNr_template& L1ctlUlInfo_template::chan__nr()
{
set_specific();
return single_value->field_chan__nr;
}

const GSM__Types::RslChannelNr_template& L1ctlUlInfo_template::chan__nr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field chan_nr of a non-specific template of type @L1CTL_Types.L1ctlUlInfo.");
return single_value->field_chan__nr;
}

GSM__Types::RslLinkId_template& L1ctlUlInfo_template::link__id()
{
set_specific();
return single_value->field_link__id;
}

const GSM__Types::RslLinkId_template& L1ctlUlInfo_template::link__id() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field link_id of a non-specific template of type @L1CTL_Types.L1ctlUlInfo.");
return single_value->field_link__id;
}

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

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

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

void L1ctlUlInfo_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ chan_nr := ");
single_value->field_chan__nr.log();
TTCN_Logger::log_event_str(", link_id := ");
single_value->field_link__id.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 L1ctlUlInfo_template::log_match(const L1ctlUlInfo& 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_chan__nr.match(match_value.chan__nr(), legacy)){
TTCN_Logger::log_logmatch_info(".chan_nr");
single_value->field_chan__nr.log_match(match_value.chan__nr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_link__id.match(match_value.link__id(), legacy)){
TTCN_Logger::log_logmatch_info(".link_id");
single_value->field_link__id.log_match(match_value.link__id(), 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("{ chan_nr := ");
single_value->field_chan__nr.log_match(match_value.chan__nr(), legacy);
TTCN_Logger::log_event_str(", link_id := ");
single_value->field_link__id.log_match(match_value.link__id(), 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 L1ctlUlInfo_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (chan__nr().is_bound()) chan__nr().set_implicit_omit();
if (link__id().is_bound()) link__id().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

void L1ctlUlInfo_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_chan__nr.encode_text(text_buf);
single_value->field_link__id.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 @L1CTL_Types.L1ctlUlInfo.");
}
}

void L1ctlUlInfo_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_chan__nr.decode_text(text_buf);
single_value->field_link__id.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 L1ctlUlInfo_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 @L1CTL_Types.L1ctlUlInfo.");
}
}

void L1ctlUlInfo_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: {
    L1ctlUlInfo_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 @L1CTL_Types.L1ctlUlInfo 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) chan__nr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) link__id().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) padding().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(), "chan_nr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          chan__nr().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(), "link_id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          link__id().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 @L1CTL_Types.L1ctlUlInfo: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlUlInfo_template* precondition = new L1ctlUlInfo_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlUlInfo_template* implied_template = new L1ctlUlInfo_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlUlInfo_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlUlInfo");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlUlInfo_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_chan__nr.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlUlInfo");
single_value->field_link__id.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlUlInfo");
single_value->field_padding.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlUlInfo");
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 : "@L1CTL_Types.L1ctlUlInfo");
}

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

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

L1ctlFbsbFlags::L1ctlFbsbFlags()
{
}

L1ctlFbsbFlags::L1ctlFbsbFlags(const BITSTRING& par_padding,
    const BOOLEAN& par_sb,
    const BOOLEAN& par_fb1,
    const BOOLEAN& par_fb0)
  :   field_padding(par_padding),
  field_sb(par_sb),
  field_fb1(par_fb1),
  field_fb0(par_fb0)
{
}

L1ctlFbsbFlags::L1ctlFbsbFlags(const L1ctlFbsbFlags& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlFbsbFlags.");
if (other_value.padding().is_bound()) field_padding = other_value.padding();
else field_padding.clean_up();
if (other_value.sb().is_bound()) field_sb = other_value.sb();
else field_sb.clean_up();
if (other_value.fb1().is_bound()) field_fb1 = other_value.fb1();
else field_fb1.clean_up();
if (other_value.fb0().is_bound()) field_fb0 = other_value.fb0();
else field_fb0.clean_up();
}

void L1ctlFbsbFlags::clean_up()
{
field_padding.clean_up();
field_sb.clean_up();
field_fb1.clean_up();
field_fb0.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlFbsbFlags::get_descriptor() const { return &L1ctlFbsbFlags_descr_; }
L1ctlFbsbFlags& L1ctlFbsbFlags::operator=(const L1ctlFbsbFlags& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlFbsbFlags.");
  if (other_value.padding().is_bound()) field_padding = other_value.padding();
  else field_padding.clean_up();
  if (other_value.sb().is_bound()) field_sb = other_value.sb();
  else field_sb.clean_up();
  if (other_value.fb1().is_bound()) field_fb1 = other_value.fb1();
  else field_fb1.clean_up();
  if (other_value.fb0().is_bound()) field_fb0 = other_value.fb0();
  else field_fb0.clean_up();
}
return *this;
}

boolean L1ctlFbsbFlags::operator==(const L1ctlFbsbFlags& other_value) const
{
return field_padding==other_value.field_padding
  && field_sb==other_value.field_sb
  && field_fb1==other_value.field_fb1
  && field_fb0==other_value.field_fb0;
}

boolean L1ctlFbsbFlags::is_bound() const
{
return (field_padding.is_bound())
  || (field_sb.is_bound())
  || (field_fb1.is_bound())
  || (field_fb0.is_bound());
}
boolean L1ctlFbsbFlags::is_value() const
{
return field_padding.is_value()
  && field_sb.is_value()
  && field_fb1.is_value()
  && field_fb0.is_value();
}
void L1ctlFbsbFlags::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ padding := ");
field_padding.log();
TTCN_Logger::log_event_str(", sb := ");
field_sb.log();
TTCN_Logger::log_event_str(", fb1 := ");
field_fb1.log();
TTCN_Logger::log_event_str(", fb0 := ");
field_fb0.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlFbsbFlags::set_implicit_omit()
{
if (padding().is_bound()) padding().set_implicit_omit();
if (sb().is_bound()) sb().set_implicit_omit();
if (fb1().is_bound()) fb1().set_implicit_omit();
if (fb0().is_bound()) fb0().set_implicit_omit();
}

void L1ctlFbsbFlags::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 @L1CTL_Types.L1ctlFbsbFlags 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) padding().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) sb().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) fb1().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) fb0().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(), "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++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "sb")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sb().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(), "fb1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fb1().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(), "fb0")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fb0().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 @L1CTL_Types.L1ctlFbsbFlags: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlFbsbFlags");
  }
}

void L1ctlFbsbFlags::encode_text(Text_Buf& text_buf) const
{
field_padding.encode_text(text_buf);
field_sb.encode_text(text_buf);
field_fb1.encode_text(text_buf);
field_fb0.encode_text(text_buf);
}

void L1ctlFbsbFlags::decode_text(Text_Buf& text_buf)
{
field_padding.decode_text(text_buf);
field_sb.decode_text(text_buf);
field_fb1.decode_text(text_buf);
field_fb0.decode_text(text_buf);
}

void L1ctlFbsbFlags::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 L1ctlFbsbFlags::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 L1ctlFbsbFlags::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, L1ctlFbsbFlags_padding_descr_.raw->forceomit);
  decoded_field_length = field_padding.RAW_decode(L1ctlFbsbFlags_padding_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, L1ctlFbsbFlags_sb_descr_.raw->forceomit);
  decoded_field_length = field_sb.RAW_decode(L1ctlFbsbFlags_sb_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, L1ctlFbsbFlags_fb1_descr_.raw->forceomit);
  decoded_field_length = field_fb1.RAW_decode(L1ctlFbsbFlags_fb1_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, L1ctlFbsbFlags_fb0_descr_.raw->forceomit);
  decoded_field_length = field_fb0.RAW_decode(L1ctlFbsbFlags_fb0_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 L1ctlFbsbFlags::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, L1ctlFbsbFlags_padding_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, L1ctlFbsbFlags_sb_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, L1ctlFbsbFlags_fb1_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, L1ctlFbsbFlags_fb0_descr_.raw);
  encoded_length += field_padding.RAW_encode(L1ctlFbsbFlags_padding_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_sb.RAW_encode(L1ctlFbsbFlags_sb_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_fb1.RAW_encode(L1ctlFbsbFlags_fb1_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_fb0.RAW_encode(L1ctlFbsbFlags_fb0_descr_, *myleaf.body.node.nodes[3]);
  return myleaf.length = encoded_length;
}

struct L1ctlFbsbFlags_template::single_value_struct {
BITSTRING_template field_padding;
BOOLEAN_template field_sb;
BOOLEAN_template field_fb1;
BOOLEAN_template field_fb0;
};

void L1ctlFbsbFlags_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_padding = ANY_VALUE;
single_value->field_sb = ANY_VALUE;
single_value->field_fb1 = ANY_VALUE;
single_value->field_fb0 = ANY_VALUE;
}
}
}

void L1ctlFbsbFlags_template::copy_value(const L1ctlFbsbFlags& other_value)
{
single_value = new single_value_struct;
if (other_value.padding().is_bound()) {
  single_value->field_padding = other_value.padding();
} else {
  single_value->field_padding.clean_up();
}
if (other_value.sb().is_bound()) {
  single_value->field_sb = other_value.sb();
} else {
  single_value->field_sb.clean_up();
}
if (other_value.fb1().is_bound()) {
  single_value->field_fb1 = other_value.fb1();
} else {
  single_value->field_fb1.clean_up();
}
if (other_value.fb0().is_bound()) {
  single_value->field_fb0 = other_value.fb0();
} else {
  single_value->field_fb0.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlFbsbFlags_template::copy_template(const L1ctlFbsbFlags_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.padding().get_selection()) {
single_value->field_padding = other_value.padding();
} else {
single_value->field_padding.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.sb().get_selection()) {
single_value->field_sb = other_value.sb();
} else {
single_value->field_sb.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.fb1().get_selection()) {
single_value->field_fb1 = other_value.fb1();
} else {
single_value->field_fb1.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.fb0().get_selection()) {
single_value->field_fb0 = other_value.fb0();
} else {
single_value->field_fb0.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 L1ctlFbsbFlags_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 L1ctlFbsbFlags_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlFbsbFlags_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 @L1CTL_Types.L1ctlFbsbFlags.");
break;
}
set_selection(other_value);
}

L1ctlFbsbFlags_template::L1ctlFbsbFlags_template()
{
}

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

L1ctlFbsbFlags_template::L1ctlFbsbFlags_template(const L1ctlFbsbFlags& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlFbsbFlags_template::match(const L1ctlFbsbFlags& 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.padding().is_bound()) return FALSE;
if(!single_value->field_padding.match(other_value.padding(), legacy))return FALSE;
if(!other_value.sb().is_bound()) return FALSE;
if(!single_value->field_sb.match(other_value.sb(), legacy))return FALSE;
if(!other_value.fb1().is_bound()) return FALSE;
if(!single_value->field_fb1.match(other_value.fb1(), legacy))return FALSE;
if(!other_value.fb0().is_bound()) return FALSE;
if(!single_value->field_fb0.match(other_value.fb0(), 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 @L1CTL_Types.L1ctlFbsbFlags.");
}
return FALSE;
}

boolean L1ctlFbsbFlags_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_padding.is_bound()
 || single_value->field_sb.is_bound()
 || single_value->field_fb1.is_bound()
 || single_value->field_fb0.is_bound();
}

boolean L1ctlFbsbFlags_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_padding.is_value()
 && single_value->field_sb.is_value()
 && single_value->field_fb1.is_value()
 && single_value->field_fb0.is_value();
}

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

L1ctlFbsbFlags L1ctlFbsbFlags_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 @L1CTL_Types.L1ctlFbsbFlags.");
L1ctlFbsbFlags ret_val;
if (single_value->field_padding.is_bound()) {
ret_val.padding() = single_value->field_padding.valueof();
}
if (single_value->field_sb.is_bound()) {
ret_val.sb() = single_value->field_sb.valueof();
}
if (single_value->field_fb1.is_bound()) {
ret_val.fb1() = single_value->field_fb1.valueof();
}
if (single_value->field_fb0.is_bound()) {
ret_val.fb0() = single_value->field_fb0.valueof();
}
return ret_val;
}

void L1ctlFbsbFlags_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 @L1CTL_Types.L1ctlFbsbFlags.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlFbsbFlags_template[list_length];
}

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

BITSTRING_template& L1ctlFbsbFlags_template::padding()
{
set_specific();
return single_value->field_padding;
}

const BITSTRING_template& L1ctlFbsbFlags_template::padding() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field padding of a non-specific template of type @L1CTL_Types.L1ctlFbsbFlags.");
return single_value->field_padding;
}

BOOLEAN_template& L1ctlFbsbFlags_template::sb()
{
set_specific();
return single_value->field_sb;
}

const BOOLEAN_template& L1ctlFbsbFlags_template::sb() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field sb of a non-specific template of type @L1CTL_Types.L1ctlFbsbFlags.");
return single_value->field_sb;
}

BOOLEAN_template& L1ctlFbsbFlags_template::fb1()
{
set_specific();
return single_value->field_fb1;
}

const BOOLEAN_template& L1ctlFbsbFlags_template::fb1() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field fb1 of a non-specific template of type @L1CTL_Types.L1ctlFbsbFlags.");
return single_value->field_fb1;
}

BOOLEAN_template& L1ctlFbsbFlags_template::fb0()
{
set_specific();
return single_value->field_fb0;
}

const BOOLEAN_template& L1ctlFbsbFlags_template::fb0() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field fb0 of a non-specific template of type @L1CTL_Types.L1ctlFbsbFlags.");
return single_value->field_fb0;
}

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

void L1ctlFbsbFlags_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ padding := ");
single_value->field_padding.log();
TTCN_Logger::log_event_str(", sb := ");
single_value->field_sb.log();
TTCN_Logger::log_event_str(", fb1 := ");
single_value->field_fb1.log();
TTCN_Logger::log_event_str(", fb0 := ");
single_value->field_fb0.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 L1ctlFbsbFlags_template::log_match(const L1ctlFbsbFlags& 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_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);
}
if(!single_value->field_sb.match(match_value.sb(), legacy)){
TTCN_Logger::log_logmatch_info(".sb");
single_value->field_sb.log_match(match_value.sb(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_fb1.match(match_value.fb1(), legacy)){
TTCN_Logger::log_logmatch_info(".fb1");
single_value->field_fb1.log_match(match_value.fb1(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_fb0.match(match_value.fb0(), legacy)){
TTCN_Logger::log_logmatch_info(".fb0");
single_value->field_fb0.log_match(match_value.fb0(), 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("{ padding := ");
single_value->field_padding.log_match(match_value.padding(), legacy);
TTCN_Logger::log_event_str(", sb := ");
single_value->field_sb.log_match(match_value.sb(), legacy);
TTCN_Logger::log_event_str(", fb1 := ");
single_value->field_fb1.log_match(match_value.fb1(), legacy);
TTCN_Logger::log_event_str(", fb0 := ");
single_value->field_fb0.log_match(match_value.fb0(), 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 L1ctlFbsbFlags_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (padding().is_bound()) padding().set_implicit_omit();
if (sb().is_bound()) sb().set_implicit_omit();
if (fb1().is_bound()) fb1().set_implicit_omit();
if (fb0().is_bound()) fb0().set_implicit_omit();
}

void L1ctlFbsbFlags_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_padding.encode_text(text_buf);
single_value->field_sb.encode_text(text_buf);
single_value->field_fb1.encode_text(text_buf);
single_value->field_fb0.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 @L1CTL_Types.L1ctlFbsbFlags.");
}
}

void L1ctlFbsbFlags_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_padding.decode_text(text_buf);
single_value->field_sb.decode_text(text_buf);
single_value->field_fb1.decode_text(text_buf);
single_value->field_fb0.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 L1ctlFbsbFlags_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 @L1CTL_Types.L1ctlFbsbFlags.");
}
}

void L1ctlFbsbFlags_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: {
    L1ctlFbsbFlags_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 @L1CTL_Types.L1ctlFbsbFlags 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) padding().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) sb().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) fb1().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) fb0().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(), "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++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "sb")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sb().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(), "fb1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fb1().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(), "fb0")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fb0().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 @L1CTL_Types.L1ctlFbsbFlags: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlFbsbFlags_template* precondition = new L1ctlFbsbFlags_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlFbsbFlags_template* implied_template = new L1ctlFbsbFlags_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlFbsbFlags_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlFbsbFlags");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlFbsbFlags_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_padding.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlFbsbFlags");
single_value->field_sb.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlFbsbFlags");
single_value->field_fb1.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlFbsbFlags");
single_value->field_fb0.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlFbsbFlags");
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 : "@L1CTL_Types.L1ctlFbsbFlags");
}

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

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

L1ctlFbsbReq::L1ctlFbsbReq()
{
}

L1ctlFbsbReq::L1ctlFbsbReq(const GSM__Types::GsmBandArfcn& par_arfcn,
    const INTEGER& par_timeout__tdma__frames,
    const INTEGER& par_freq__err__thresh1,
    const INTEGER& par_freq__err__thresh2,
    const INTEGER& par_num__freqerr__avg,
    const L1ctlFbsbFlags& par_flags,
    const INTEGER& par_sync__info__idx,
    const L1ctlCcchMode& par_ccch__mode,
    const INTEGER& par_rxlev__exp)
  :   field_arfcn(par_arfcn),
  field_timeout__tdma__frames(par_timeout__tdma__frames),
  field_freq__err__thresh1(par_freq__err__thresh1),
  field_freq__err__thresh2(par_freq__err__thresh2),
  field_num__freqerr__avg(par_num__freqerr__avg),
  field_flags(par_flags),
  field_sync__info__idx(par_sync__info__idx),
  field_ccch__mode(par_ccch__mode),
  field_rxlev__exp(par_rxlev__exp)
{
}

L1ctlFbsbReq::L1ctlFbsbReq(const L1ctlFbsbReq& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlFbsbReq.");
if (other_value.arfcn().is_bound()) field_arfcn = other_value.arfcn();
else field_arfcn.clean_up();
if (other_value.timeout__tdma__frames().is_bound()) field_timeout__tdma__frames = other_value.timeout__tdma__frames();
else field_timeout__tdma__frames.clean_up();
if (other_value.freq__err__thresh1().is_bound()) field_freq__err__thresh1 = other_value.freq__err__thresh1();
else field_freq__err__thresh1.clean_up();
if (other_value.freq__err__thresh2().is_bound()) field_freq__err__thresh2 = other_value.freq__err__thresh2();
else field_freq__err__thresh2.clean_up();
if (other_value.num__freqerr__avg().is_bound()) field_num__freqerr__avg = other_value.num__freqerr__avg();
else field_num__freqerr__avg.clean_up();
if (other_value.flags().is_bound()) field_flags = other_value.flags();
else field_flags.clean_up();
if (other_value.sync__info__idx().is_bound()) field_sync__info__idx = other_value.sync__info__idx();
else field_sync__info__idx.clean_up();
if (other_value.ccch__mode().is_bound()) field_ccch__mode = other_value.ccch__mode();
else field_ccch__mode.clean_up();
if (other_value.rxlev__exp().is_bound()) field_rxlev__exp = other_value.rxlev__exp();
else field_rxlev__exp.clean_up();
}

void L1ctlFbsbReq::clean_up()
{
field_arfcn.clean_up();
field_timeout__tdma__frames.clean_up();
field_freq__err__thresh1.clean_up();
field_freq__err__thresh2.clean_up();
field_num__freqerr__avg.clean_up();
field_flags.clean_up();
field_sync__info__idx.clean_up();
field_ccch__mode.clean_up();
field_rxlev__exp.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlFbsbReq::get_descriptor() const { return &L1ctlFbsbReq_descr_; }
L1ctlFbsbReq& L1ctlFbsbReq::operator=(const L1ctlFbsbReq& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlFbsbReq.");
  if (other_value.arfcn().is_bound()) field_arfcn = other_value.arfcn();
  else field_arfcn.clean_up();
  if (other_value.timeout__tdma__frames().is_bound()) field_timeout__tdma__frames = other_value.timeout__tdma__frames();
  else field_timeout__tdma__frames.clean_up();
  if (other_value.freq__err__thresh1().is_bound()) field_freq__err__thresh1 = other_value.freq__err__thresh1();
  else field_freq__err__thresh1.clean_up();
  if (other_value.freq__err__thresh2().is_bound()) field_freq__err__thresh2 = other_value.freq__err__thresh2();
  else field_freq__err__thresh2.clean_up();
  if (other_value.num__freqerr__avg().is_bound()) field_num__freqerr__avg = other_value.num__freqerr__avg();
  else field_num__freqerr__avg.clean_up();
  if (other_value.flags().is_bound()) field_flags = other_value.flags();
  else field_flags.clean_up();
  if (other_value.sync__info__idx().is_bound()) field_sync__info__idx = other_value.sync__info__idx();
  else field_sync__info__idx.clean_up();
  if (other_value.ccch__mode().is_bound()) field_ccch__mode = other_value.ccch__mode();
  else field_ccch__mode.clean_up();
  if (other_value.rxlev__exp().is_bound()) field_rxlev__exp = other_value.rxlev__exp();
  else field_rxlev__exp.clean_up();
}
return *this;
}

boolean L1ctlFbsbReq::operator==(const L1ctlFbsbReq& other_value) const
{
return field_arfcn==other_value.field_arfcn
  && field_timeout__tdma__frames==other_value.field_timeout__tdma__frames
  && field_freq__err__thresh1==other_value.field_freq__err__thresh1
  && field_freq__err__thresh2==other_value.field_freq__err__thresh2
  && field_num__freqerr__avg==other_value.field_num__freqerr__avg
  && field_flags==other_value.field_flags
  && field_sync__info__idx==other_value.field_sync__info__idx
  && field_ccch__mode==other_value.field_ccch__mode
  && field_rxlev__exp==other_value.field_rxlev__exp;
}

boolean L1ctlFbsbReq::is_bound() const
{
return (field_arfcn.is_bound())
  || (field_timeout__tdma__frames.is_bound())
  || (field_freq__err__thresh1.is_bound())
  || (field_freq__err__thresh2.is_bound())
  || (field_num__freqerr__avg.is_bound())
  || (field_flags.is_bound())
  || (field_sync__info__idx.is_bound())
  || (field_ccch__mode.is_bound())
  || (field_rxlev__exp.is_bound());
}
boolean L1ctlFbsbReq::is_value() const
{
return field_arfcn.is_value()
  && field_timeout__tdma__frames.is_value()
  && field_freq__err__thresh1.is_value()
  && field_freq__err__thresh2.is_value()
  && field_num__freqerr__avg.is_value()
  && field_flags.is_value()
  && field_sync__info__idx.is_value()
  && field_ccch__mode.is_value()
  && field_rxlev__exp.is_value();
}
void L1ctlFbsbReq::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ arfcn := ");
field_arfcn.log();
TTCN_Logger::log_event_str(", timeout_tdma_frames := ");
field_timeout__tdma__frames.log();
TTCN_Logger::log_event_str(", freq_err_thresh1 := ");
field_freq__err__thresh1.log();
TTCN_Logger::log_event_str(", freq_err_thresh2 := ");
field_freq__err__thresh2.log();
TTCN_Logger::log_event_str(", num_freqerr_avg := ");
field_num__freqerr__avg.log();
TTCN_Logger::log_event_str(", flags := ");
field_flags.log();
TTCN_Logger::log_event_str(", sync_info_idx := ");
field_sync__info__idx.log();
TTCN_Logger::log_event_str(", ccch_mode := ");
field_ccch__mode.log();
TTCN_Logger::log_event_str(", rxlev_exp := ");
field_rxlev__exp.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlFbsbReq::set_implicit_omit()
{
if (arfcn().is_bound()) arfcn().set_implicit_omit();
if (timeout__tdma__frames().is_bound()) timeout__tdma__frames().set_implicit_omit();
if (freq__err__thresh1().is_bound()) freq__err__thresh1().set_implicit_omit();
if (freq__err__thresh2().is_bound()) freq__err__thresh2().set_implicit_omit();
if (num__freqerr__avg().is_bound()) num__freqerr__avg().set_implicit_omit();
if (flags().is_bound()) flags().set_implicit_omit();
if (sync__info__idx().is_bound()) sync__info__idx().set_implicit_omit();
if (ccch__mode().is_bound()) ccch__mode().set_implicit_omit();
if (rxlev__exp().is_bound()) rxlev__exp().set_implicit_omit();
}

void L1ctlFbsbReq::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 (9<param.get_size()) {
      param.error("record value of type @L1CTL_Types.L1ctlFbsbReq has 9 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) arfcn().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) timeout__tdma__frames().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) freq__err__thresh1().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) freq__err__thresh2().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) num__freqerr__avg().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) flags().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) sync__info__idx().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) ccch__mode().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) rxlev__exp().set_param(*param.get_elem(8));
    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(), "arfcn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          arfcn().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(), "timeout_tdma_frames")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          timeout__tdma__frames().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(), "freq_err_thresh1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          freq__err__thresh1().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(), "freq_err_thresh2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          freq__err__thresh2().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(), "num_freqerr_avg")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          num__freqerr__avg().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(), "flags")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          flags().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(), "sync_info_idx")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sync__info__idx().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(), "ccch_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ccch__mode().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(), "rxlev_exp")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rxlev__exp().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 @L1CTL_Types.L1ctlFbsbReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlFbsbReq");
  }
}

void L1ctlFbsbReq::encode_text(Text_Buf& text_buf) const
{
field_arfcn.encode_text(text_buf);
field_timeout__tdma__frames.encode_text(text_buf);
field_freq__err__thresh1.encode_text(text_buf);
field_freq__err__thresh2.encode_text(text_buf);
field_num__freqerr__avg.encode_text(text_buf);
field_flags.encode_text(text_buf);
field_sync__info__idx.encode_text(text_buf);
field_ccch__mode.encode_text(text_buf);
field_rxlev__exp.encode_text(text_buf);
}

void L1ctlFbsbReq::decode_text(Text_Buf& text_buf)
{
field_arfcn.decode_text(text_buf);
field_timeout__tdma__frames.decode_text(text_buf);
field_freq__err__thresh1.decode_text(text_buf);
field_freq__err__thresh2.decode_text(text_buf);
field_num__freqerr__avg.decode_text(text_buf);
field_flags.decode_text(text_buf);
field_sync__info__idx.decode_text(text_buf);
field_ccch__mode.decode_text(text_buf);
field_rxlev__exp.decode_text(text_buf);
}

void L1ctlFbsbReq::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 L1ctlFbsbReq::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 L1ctlFbsbReq::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, GSM__Types::GsmBandArfcn_descr_.raw->forceomit);
  decoded_field_length = field_arfcn.RAW_decode(GSM__Types::GsmBandArfcn_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, Osmocom__Types::uint16__t_descr_.raw->forceomit);
  decoded_field_length = field_timeout__tdma__frames.RAW_decode(Osmocom__Types::uint16__t_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, Osmocom__Types::uint16__t_descr_.raw->forceomit);
  decoded_field_length = field_freq__err__thresh1.RAW_decode(Osmocom__Types::uint16__t_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, Osmocom__Types::uint16__t_descr_.raw->forceomit);
  decoded_field_length = field_freq__err__thresh2.RAW_decode(Osmocom__Types::uint16__t_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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_num__freqerr__avg.RAW_decode(Osmocom__Types::uint8__t_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, L1ctlFbsbFlags_descr_.raw->forceomit);
  decoded_field_length = field_flags.RAW_decode(L1ctlFbsbFlags_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_6_force_omit(6, force_omit, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_sync__info__idx.RAW_decode(Osmocom__Types::uint8__t_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_6_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_7_force_omit(7, force_omit, L1ctlCcchMode_descr_.raw->forceomit);
  decoded_field_length = field_ccch__mode.RAW_decode(L1ctlCcchMode_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_7_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_8_force_omit(8, force_omit, GSM__Types::GsmRxLev_descr_.raw->forceomit);
  decoded_field_length = field_rxlev__exp.RAW_decode(GSM__Types::GsmRxLev_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_8_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int L1ctlFbsbReq::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 = 9;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(9);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, GSM__Types::GsmBandArfcn_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Osmocom__Types::uint16__t_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Osmocom__Types::uint16__t_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, Osmocom__Types::uint16__t_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, L1ctlFbsbFlags_descr_.raw);
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, L1ctlCcchMode_descr_.raw);
  myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, GSM__Types::GsmRxLev_descr_.raw);
  encoded_length += field_arfcn.RAW_encode(GSM__Types::GsmBandArfcn_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_timeout__tdma__frames.RAW_encode(Osmocom__Types::uint16__t_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_freq__err__thresh1.RAW_encode(Osmocom__Types::uint16__t_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_freq__err__thresh2.RAW_encode(Osmocom__Types::uint16__t_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_num__freqerr__avg.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_flags.RAW_encode(L1ctlFbsbFlags_descr_, *myleaf.body.node.nodes[5]);
  encoded_length += field_sync__info__idx.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[6]);
  encoded_length += field_ccch__mode.RAW_encode(L1ctlCcchMode_descr_, *myleaf.body.node.nodes[7]);
  encoded_length += field_rxlev__exp.RAW_encode(GSM__Types::GsmRxLev_descr_, *myleaf.body.node.nodes[8]);
  return myleaf.length = encoded_length;
}

struct L1ctlFbsbReq_template::single_value_struct {
GSM__Types::GsmBandArfcn_template field_arfcn;
INTEGER_template field_timeout__tdma__frames;
INTEGER_template field_freq__err__thresh1;
INTEGER_template field_freq__err__thresh2;
INTEGER_template field_num__freqerr__avg;
L1ctlFbsbFlags_template field_flags;
INTEGER_template field_sync__info__idx;
L1ctlCcchMode_template field_ccch__mode;
INTEGER_template field_rxlev__exp;
};

void L1ctlFbsbReq_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_arfcn = ANY_VALUE;
single_value->field_timeout__tdma__frames = ANY_VALUE;
single_value->field_freq__err__thresh1 = ANY_VALUE;
single_value->field_freq__err__thresh2 = ANY_VALUE;
single_value->field_num__freqerr__avg = ANY_VALUE;
single_value->field_flags = ANY_VALUE;
single_value->field_sync__info__idx = ANY_VALUE;
single_value->field_ccch__mode = ANY_VALUE;
single_value->field_rxlev__exp = ANY_VALUE;
}
}
}

void L1ctlFbsbReq_template::copy_value(const L1ctlFbsbReq& other_value)
{
single_value = new single_value_struct;
if (other_value.arfcn().is_bound()) {
  single_value->field_arfcn = other_value.arfcn();
} else {
  single_value->field_arfcn.clean_up();
}
if (other_value.timeout__tdma__frames().is_bound()) {
  single_value->field_timeout__tdma__frames = other_value.timeout__tdma__frames();
} else {
  single_value->field_timeout__tdma__frames.clean_up();
}
if (other_value.freq__err__thresh1().is_bound()) {
  single_value->field_freq__err__thresh1 = other_value.freq__err__thresh1();
} else {
  single_value->field_freq__err__thresh1.clean_up();
}
if (other_value.freq__err__thresh2().is_bound()) {
  single_value->field_freq__err__thresh2 = other_value.freq__err__thresh2();
} else {
  single_value->field_freq__err__thresh2.clean_up();
}
if (other_value.num__freqerr__avg().is_bound()) {
  single_value->field_num__freqerr__avg = other_value.num__freqerr__avg();
} else {
  single_value->field_num__freqerr__avg.clean_up();
}
if (other_value.flags().is_bound()) {
  single_value->field_flags = other_value.flags();
} else {
  single_value->field_flags.clean_up();
}
if (other_value.sync__info__idx().is_bound()) {
  single_value->field_sync__info__idx = other_value.sync__info__idx();
} else {
  single_value->field_sync__info__idx.clean_up();
}
if (other_value.ccch__mode().is_bound()) {
  single_value->field_ccch__mode = other_value.ccch__mode();
} else {
  single_value->field_ccch__mode.clean_up();
}
if (other_value.rxlev__exp().is_bound()) {
  single_value->field_rxlev__exp = other_value.rxlev__exp();
} else {
  single_value->field_rxlev__exp.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlFbsbReq_template::copy_template(const L1ctlFbsbReq_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.arfcn().get_selection()) {
single_value->field_arfcn = other_value.arfcn();
} else {
single_value->field_arfcn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.timeout__tdma__frames().get_selection()) {
single_value->field_timeout__tdma__frames = other_value.timeout__tdma__frames();
} else {
single_value->field_timeout__tdma__frames.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.freq__err__thresh1().get_selection()) {
single_value->field_freq__err__thresh1 = other_value.freq__err__thresh1();
} else {
single_value->field_freq__err__thresh1.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.freq__err__thresh2().get_selection()) {
single_value->field_freq__err__thresh2 = other_value.freq__err__thresh2();
} else {
single_value->field_freq__err__thresh2.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.num__freqerr__avg().get_selection()) {
single_value->field_num__freqerr__avg = other_value.num__freqerr__avg();
} else {
single_value->field_num__freqerr__avg.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.flags().get_selection()) {
single_value->field_flags = other_value.flags();
} else {
single_value->field_flags.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.sync__info__idx().get_selection()) {
single_value->field_sync__info__idx = other_value.sync__info__idx();
} else {
single_value->field_sync__info__idx.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ccch__mode().get_selection()) {
single_value->field_ccch__mode = other_value.ccch__mode();
} else {
single_value->field_ccch__mode.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rxlev__exp().get_selection()) {
single_value->field_rxlev__exp = other_value.rxlev__exp();
} else {
single_value->field_rxlev__exp.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 L1ctlFbsbReq_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 L1ctlFbsbReq_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlFbsbReq_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 @L1CTL_Types.L1ctlFbsbReq.");
break;
}
set_selection(other_value);
}

L1ctlFbsbReq_template::L1ctlFbsbReq_template()
{
}

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

L1ctlFbsbReq_template::L1ctlFbsbReq_template(const L1ctlFbsbReq& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlFbsbReq_template::match(const L1ctlFbsbReq& 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.arfcn().is_bound()) return FALSE;
if(!single_value->field_arfcn.match(other_value.arfcn(), legacy))return FALSE;
if(!other_value.timeout__tdma__frames().is_bound()) return FALSE;
if(!single_value->field_timeout__tdma__frames.match(other_value.timeout__tdma__frames(), legacy))return FALSE;
if(!other_value.freq__err__thresh1().is_bound()) return FALSE;
if(!single_value->field_freq__err__thresh1.match(other_value.freq__err__thresh1(), legacy))return FALSE;
if(!other_value.freq__err__thresh2().is_bound()) return FALSE;
if(!single_value->field_freq__err__thresh2.match(other_value.freq__err__thresh2(), legacy))return FALSE;
if(!other_value.num__freqerr__avg().is_bound()) return FALSE;
if(!single_value->field_num__freqerr__avg.match(other_value.num__freqerr__avg(), legacy))return FALSE;
if(!other_value.flags().is_bound()) return FALSE;
if(!single_value->field_flags.match(other_value.flags(), legacy))return FALSE;
if(!other_value.sync__info__idx().is_bound()) return FALSE;
if(!single_value->field_sync__info__idx.match(other_value.sync__info__idx(), legacy))return FALSE;
if(!other_value.ccch__mode().is_bound()) return FALSE;
if(!single_value->field_ccch__mode.match(other_value.ccch__mode(), legacy))return FALSE;
if(!other_value.rxlev__exp().is_bound()) return FALSE;
if(!single_value->field_rxlev__exp.match(other_value.rxlev__exp(), 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 @L1CTL_Types.L1ctlFbsbReq.");
}
return FALSE;
}

boolean L1ctlFbsbReq_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_arfcn.is_bound()
 || single_value->field_timeout__tdma__frames.is_bound()
 || single_value->field_freq__err__thresh1.is_bound()
 || single_value->field_freq__err__thresh2.is_bound()
 || single_value->field_num__freqerr__avg.is_bound()
 || single_value->field_flags.is_bound()
 || single_value->field_sync__info__idx.is_bound()
 || single_value->field_ccch__mode.is_bound()
 || single_value->field_rxlev__exp.is_bound();
}

boolean L1ctlFbsbReq_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_arfcn.is_value()
 && single_value->field_timeout__tdma__frames.is_value()
 && single_value->field_freq__err__thresh1.is_value()
 && single_value->field_freq__err__thresh2.is_value()
 && single_value->field_num__freqerr__avg.is_value()
 && single_value->field_flags.is_value()
 && single_value->field_sync__info__idx.is_value()
 && single_value->field_ccch__mode.is_value()
 && single_value->field_rxlev__exp.is_value();
}

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

L1ctlFbsbReq L1ctlFbsbReq_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 @L1CTL_Types.L1ctlFbsbReq.");
L1ctlFbsbReq ret_val;
if (single_value->field_arfcn.is_bound()) {
ret_val.arfcn() = single_value->field_arfcn.valueof();
}
if (single_value->field_timeout__tdma__frames.is_bound()) {
ret_val.timeout__tdma__frames() = single_value->field_timeout__tdma__frames.valueof();
}
if (single_value->field_freq__err__thresh1.is_bound()) {
ret_val.freq__err__thresh1() = single_value->field_freq__err__thresh1.valueof();
}
if (single_value->field_freq__err__thresh2.is_bound()) {
ret_val.freq__err__thresh2() = single_value->field_freq__err__thresh2.valueof();
}
if (single_value->field_num__freqerr__avg.is_bound()) {
ret_val.num__freqerr__avg() = single_value->field_num__freqerr__avg.valueof();
}
if (single_value->field_flags.is_bound()) {
ret_val.flags() = single_value->field_flags.valueof();
}
if (single_value->field_sync__info__idx.is_bound()) {
ret_val.sync__info__idx() = single_value->field_sync__info__idx.valueof();
}
if (single_value->field_ccch__mode.is_bound()) {
ret_val.ccch__mode() = single_value->field_ccch__mode.valueof();
}
if (single_value->field_rxlev__exp.is_bound()) {
ret_val.rxlev__exp() = single_value->field_rxlev__exp.valueof();
}
return ret_val;
}

void L1ctlFbsbReq_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 @L1CTL_Types.L1ctlFbsbReq.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlFbsbReq_template[list_length];
}

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

GSM__Types::GsmBandArfcn_template& L1ctlFbsbReq_template::arfcn()
{
set_specific();
return single_value->field_arfcn;
}

const GSM__Types::GsmBandArfcn_template& L1ctlFbsbReq_template::arfcn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field arfcn of a non-specific template of type @L1CTL_Types.L1ctlFbsbReq.");
return single_value->field_arfcn;
}

INTEGER_template& L1ctlFbsbReq_template::timeout__tdma__frames()
{
set_specific();
return single_value->field_timeout__tdma__frames;
}

const INTEGER_template& L1ctlFbsbReq_template::timeout__tdma__frames() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field timeout_tdma_frames of a non-specific template of type @L1CTL_Types.L1ctlFbsbReq.");
return single_value->field_timeout__tdma__frames;
}

INTEGER_template& L1ctlFbsbReq_template::freq__err__thresh1()
{
set_specific();
return single_value->field_freq__err__thresh1;
}

const INTEGER_template& L1ctlFbsbReq_template::freq__err__thresh1() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field freq_err_thresh1 of a non-specific template of type @L1CTL_Types.L1ctlFbsbReq.");
return single_value->field_freq__err__thresh1;
}

INTEGER_template& L1ctlFbsbReq_template::freq__err__thresh2()
{
set_specific();
return single_value->field_freq__err__thresh2;
}

const INTEGER_template& L1ctlFbsbReq_template::freq__err__thresh2() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field freq_err_thresh2 of a non-specific template of type @L1CTL_Types.L1ctlFbsbReq.");
return single_value->field_freq__err__thresh2;
}

INTEGER_template& L1ctlFbsbReq_template::num__freqerr__avg()
{
set_specific();
return single_value->field_num__freqerr__avg;
}

const INTEGER_template& L1ctlFbsbReq_template::num__freqerr__avg() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field num_freqerr_avg of a non-specific template of type @L1CTL_Types.L1ctlFbsbReq.");
return single_value->field_num__freqerr__avg;
}

L1ctlFbsbFlags_template& L1ctlFbsbReq_template::flags()
{
set_specific();
return single_value->field_flags;
}

const L1ctlFbsbFlags_template& L1ctlFbsbReq_template::flags() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field flags of a non-specific template of type @L1CTL_Types.L1ctlFbsbReq.");
return single_value->field_flags;
}

INTEGER_template& L1ctlFbsbReq_template::sync__info__idx()
{
set_specific();
return single_value->field_sync__info__idx;
}

const INTEGER_template& L1ctlFbsbReq_template::sync__info__idx() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field sync_info_idx of a non-specific template of type @L1CTL_Types.L1ctlFbsbReq.");
return single_value->field_sync__info__idx;
}

L1ctlCcchMode_template& L1ctlFbsbReq_template::ccch__mode()
{
set_specific();
return single_value->field_ccch__mode;
}

const L1ctlCcchMode_template& L1ctlFbsbReq_template::ccch__mode() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ccch_mode of a non-specific template of type @L1CTL_Types.L1ctlFbsbReq.");
return single_value->field_ccch__mode;
}

INTEGER_template& L1ctlFbsbReq_template::rxlev__exp()
{
set_specific();
return single_value->field_rxlev__exp;
}

const INTEGER_template& L1ctlFbsbReq_template::rxlev__exp() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rxlev_exp of a non-specific template of type @L1CTL_Types.L1ctlFbsbReq.");
return single_value->field_rxlev__exp;
}

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

void L1ctlFbsbReq_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ arfcn := ");
single_value->field_arfcn.log();
TTCN_Logger::log_event_str(", timeout_tdma_frames := ");
single_value->field_timeout__tdma__frames.log();
TTCN_Logger::log_event_str(", freq_err_thresh1 := ");
single_value->field_freq__err__thresh1.log();
TTCN_Logger::log_event_str(", freq_err_thresh2 := ");
single_value->field_freq__err__thresh2.log();
TTCN_Logger::log_event_str(", num_freqerr_avg := ");
single_value->field_num__freqerr__avg.log();
TTCN_Logger::log_event_str(", flags := ");
single_value->field_flags.log();
TTCN_Logger::log_event_str(", sync_info_idx := ");
single_value->field_sync__info__idx.log();
TTCN_Logger::log_event_str(", ccch_mode := ");
single_value->field_ccch__mode.log();
TTCN_Logger::log_event_str(", rxlev_exp := ");
single_value->field_rxlev__exp.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 L1ctlFbsbReq_template::log_match(const L1ctlFbsbReq& 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_arfcn.match(match_value.arfcn(), legacy)){
TTCN_Logger::log_logmatch_info(".arfcn");
single_value->field_arfcn.log_match(match_value.arfcn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_timeout__tdma__frames.match(match_value.timeout__tdma__frames(), legacy)){
TTCN_Logger::log_logmatch_info(".timeout_tdma_frames");
single_value->field_timeout__tdma__frames.log_match(match_value.timeout__tdma__frames(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_freq__err__thresh1.match(match_value.freq__err__thresh1(), legacy)){
TTCN_Logger::log_logmatch_info(".freq_err_thresh1");
single_value->field_freq__err__thresh1.log_match(match_value.freq__err__thresh1(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_freq__err__thresh2.match(match_value.freq__err__thresh2(), legacy)){
TTCN_Logger::log_logmatch_info(".freq_err_thresh2");
single_value->field_freq__err__thresh2.log_match(match_value.freq__err__thresh2(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_num__freqerr__avg.match(match_value.num__freqerr__avg(), legacy)){
TTCN_Logger::log_logmatch_info(".num_freqerr_avg");
single_value->field_num__freqerr__avg.log_match(match_value.num__freqerr__avg(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_flags.match(match_value.flags(), legacy)){
TTCN_Logger::log_logmatch_info(".flags");
single_value->field_flags.log_match(match_value.flags(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_sync__info__idx.match(match_value.sync__info__idx(), legacy)){
TTCN_Logger::log_logmatch_info(".sync_info_idx");
single_value->field_sync__info__idx.log_match(match_value.sync__info__idx(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ccch__mode.match(match_value.ccch__mode(), legacy)){
TTCN_Logger::log_logmatch_info(".ccch_mode");
single_value->field_ccch__mode.log_match(match_value.ccch__mode(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rxlev__exp.match(match_value.rxlev__exp(), legacy)){
TTCN_Logger::log_logmatch_info(".rxlev_exp");
single_value->field_rxlev__exp.log_match(match_value.rxlev__exp(), 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("{ arfcn := ");
single_value->field_arfcn.log_match(match_value.arfcn(), legacy);
TTCN_Logger::log_event_str(", timeout_tdma_frames := ");
single_value->field_timeout__tdma__frames.log_match(match_value.timeout__tdma__frames(), legacy);
TTCN_Logger::log_event_str(", freq_err_thresh1 := ");
single_value->field_freq__err__thresh1.log_match(match_value.freq__err__thresh1(), legacy);
TTCN_Logger::log_event_str(", freq_err_thresh2 := ");
single_value->field_freq__err__thresh2.log_match(match_value.freq__err__thresh2(), legacy);
TTCN_Logger::log_event_str(", num_freqerr_avg := ");
single_value->field_num__freqerr__avg.log_match(match_value.num__freqerr__avg(), legacy);
TTCN_Logger::log_event_str(", flags := ");
single_value->field_flags.log_match(match_value.flags(), legacy);
TTCN_Logger::log_event_str(", sync_info_idx := ");
single_value->field_sync__info__idx.log_match(match_value.sync__info__idx(), legacy);
TTCN_Logger::log_event_str(", ccch_mode := ");
single_value->field_ccch__mode.log_match(match_value.ccch__mode(), legacy);
TTCN_Logger::log_event_str(", rxlev_exp := ");
single_value->field_rxlev__exp.log_match(match_value.rxlev__exp(), 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 L1ctlFbsbReq_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (arfcn().is_bound()) arfcn().set_implicit_omit();
if (timeout__tdma__frames().is_bound()) timeout__tdma__frames().set_implicit_omit();
if (freq__err__thresh1().is_bound()) freq__err__thresh1().set_implicit_omit();
if (freq__err__thresh2().is_bound()) freq__err__thresh2().set_implicit_omit();
if (num__freqerr__avg().is_bound()) num__freqerr__avg().set_implicit_omit();
if (flags().is_bound()) flags().set_implicit_omit();
if (sync__info__idx().is_bound()) sync__info__idx().set_implicit_omit();
if (ccch__mode().is_bound()) ccch__mode().set_implicit_omit();
if (rxlev__exp().is_bound()) rxlev__exp().set_implicit_omit();
}

void L1ctlFbsbReq_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_arfcn.encode_text(text_buf);
single_value->field_timeout__tdma__frames.encode_text(text_buf);
single_value->field_freq__err__thresh1.encode_text(text_buf);
single_value->field_freq__err__thresh2.encode_text(text_buf);
single_value->field_num__freqerr__avg.encode_text(text_buf);
single_value->field_flags.encode_text(text_buf);
single_value->field_sync__info__idx.encode_text(text_buf);
single_value->field_ccch__mode.encode_text(text_buf);
single_value->field_rxlev__exp.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 @L1CTL_Types.L1ctlFbsbReq.");
}
}

void L1ctlFbsbReq_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_arfcn.decode_text(text_buf);
single_value->field_timeout__tdma__frames.decode_text(text_buf);
single_value->field_freq__err__thresh1.decode_text(text_buf);
single_value->field_freq__err__thresh2.decode_text(text_buf);
single_value->field_num__freqerr__avg.decode_text(text_buf);
single_value->field_flags.decode_text(text_buf);
single_value->field_sync__info__idx.decode_text(text_buf);
single_value->field_ccch__mode.decode_text(text_buf);
single_value->field_rxlev__exp.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 L1ctlFbsbReq_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 @L1CTL_Types.L1ctlFbsbReq.");
}
}

void L1ctlFbsbReq_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: {
    L1ctlFbsbReq_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 (9<param.get_size()) {
      param.error("record template of type @L1CTL_Types.L1ctlFbsbReq has 9 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) arfcn().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) timeout__tdma__frames().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) freq__err__thresh1().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) freq__err__thresh2().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) num__freqerr__avg().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) flags().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) sync__info__idx().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) ccch__mode().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) rxlev__exp().set_param(*param.get_elem(8));
    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(), "arfcn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          arfcn().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(), "timeout_tdma_frames")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          timeout__tdma__frames().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(), "freq_err_thresh1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          freq__err__thresh1().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(), "freq_err_thresh2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          freq__err__thresh2().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(), "num_freqerr_avg")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          num__freqerr__avg().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(), "flags")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          flags().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(), "sync_info_idx")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sync__info__idx().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(), "ccch_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ccch__mode().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(), "rxlev_exp")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rxlev__exp().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 @L1CTL_Types.L1ctlFbsbReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlFbsbReq_template* precondition = new L1ctlFbsbReq_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlFbsbReq_template* implied_template = new L1ctlFbsbReq_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlFbsbReq_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlFbsbReq");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlFbsbReq_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_arfcn.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlFbsbReq");
single_value->field_timeout__tdma__frames.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlFbsbReq");
single_value->field_freq__err__thresh1.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlFbsbReq");
single_value->field_freq__err__thresh2.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlFbsbReq");
single_value->field_num__freqerr__avg.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlFbsbReq");
single_value->field_flags.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlFbsbReq");
single_value->field_sync__info__idx.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlFbsbReq");
single_value->field_ccch__mode.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlFbsbReq");
single_value->field_rxlev__exp.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlFbsbReq");
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 : "@L1CTL_Types.L1ctlFbsbReq");
}

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

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

L1ctlCcchModeReq::L1ctlCcchModeReq()
{
}

L1ctlCcchModeReq::L1ctlCcchModeReq(const L1ctlCcchMode& par_ccch__mode,
    const OCTETSTRING& par_padding)
  :   field_ccch__mode(par_ccch__mode),
  field_padding(par_padding)
{
}

L1ctlCcchModeReq::L1ctlCcchModeReq(const L1ctlCcchModeReq& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlCcchModeReq.");
if (other_value.ccch__mode().is_bound()) field_ccch__mode = other_value.ccch__mode();
else field_ccch__mode.clean_up();
if (other_value.padding().is_bound()) field_padding = other_value.padding();
else field_padding.clean_up();
}

void L1ctlCcchModeReq::clean_up()
{
field_ccch__mode.clean_up();
field_padding.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlCcchModeReq::get_descriptor() const { return &L1ctlCcchModeReq_descr_; }
L1ctlCcchModeReq& L1ctlCcchModeReq::operator=(const L1ctlCcchModeReq& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlCcchModeReq.");
  if (other_value.ccch__mode().is_bound()) field_ccch__mode = other_value.ccch__mode();
  else field_ccch__mode.clean_up();
  if (other_value.padding().is_bound()) field_padding = other_value.padding();
  else field_padding.clean_up();
}
return *this;
}

boolean L1ctlCcchModeReq::operator==(const L1ctlCcchModeReq& other_value) const
{
return field_ccch__mode==other_value.field_ccch__mode
  && field_padding==other_value.field_padding;
}

boolean L1ctlCcchModeReq::is_bound() const
{
return (field_ccch__mode.is_bound())
  || (field_padding.is_bound());
}
boolean L1ctlCcchModeReq::is_value() const
{
return field_ccch__mode.is_value()
  && field_padding.is_value();
}
void L1ctlCcchModeReq::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ ccch_mode := ");
field_ccch__mode.log();
TTCN_Logger::log_event_str(", padding := ");
field_padding.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlCcchModeReq::set_implicit_omit()
{
if (ccch__mode().is_bound()) ccch__mode().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

void L1ctlCcchModeReq::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record value of type @L1CTL_Types.L1ctlCcchModeReq has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) ccch__mode().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) padding().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ccch_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ccch__mode().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 @L1CTL_Types.L1ctlCcchModeReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlCcchModeReq");
  }
}

void L1ctlCcchModeReq::encode_text(Text_Buf& text_buf) const
{
field_ccch__mode.encode_text(text_buf);
field_padding.encode_text(text_buf);
}

void L1ctlCcchModeReq::decode_text(Text_Buf& text_buf)
{
field_ccch__mode.decode_text(text_buf);
field_padding.decode_text(text_buf);
}

void L1ctlCcchModeReq::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 L1ctlCcchModeReq::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 L1ctlCcchModeReq::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, L1ctlCcchMode_descr_.raw->forceomit);
  decoded_field_length = field_ccch__mode.RAW_decode(L1ctlCcchMode_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::OCT3_descr_.raw->forceomit);
  decoded_field_length = field_padding.RAW_decode(General__Types::OCT3_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

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

struct L1ctlCcchModeReq_template::single_value_struct {
L1ctlCcchMode_template field_ccch__mode;
OCTETSTRING_template field_padding;
};

void L1ctlCcchModeReq_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_ccch__mode = ANY_VALUE;
single_value->field_padding = ANY_VALUE;
}
}
}

void L1ctlCcchModeReq_template::copy_value(const L1ctlCcchModeReq& other_value)
{
single_value = new single_value_struct;
if (other_value.ccch__mode().is_bound()) {
  single_value->field_ccch__mode = other_value.ccch__mode();
} else {
  single_value->field_ccch__mode.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 L1ctlCcchModeReq_template::copy_template(const L1ctlCcchModeReq_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.ccch__mode().get_selection()) {
single_value->field_ccch__mode = other_value.ccch__mode();
} else {
single_value->field_ccch__mode.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 L1ctlCcchModeReq_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 L1ctlCcchModeReq_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlCcchModeReq_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 @L1CTL_Types.L1ctlCcchModeReq.");
break;
}
set_selection(other_value);
}

L1ctlCcchModeReq_template::L1ctlCcchModeReq_template()
{
}

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

L1ctlCcchModeReq_template::L1ctlCcchModeReq_template(const L1ctlCcchModeReq& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlCcchModeReq_template::match(const L1ctlCcchModeReq& 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.ccch__mode().is_bound()) return FALSE;
if(!single_value->field_ccch__mode.match(other_value.ccch__mode(), 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 @L1CTL_Types.L1ctlCcchModeReq.");
}
return FALSE;
}

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

boolean L1ctlCcchModeReq_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_ccch__mode.is_value()
 && single_value->field_padding.is_value();
}

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

L1ctlCcchModeReq L1ctlCcchModeReq_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 @L1CTL_Types.L1ctlCcchModeReq.");
L1ctlCcchModeReq ret_val;
if (single_value->field_ccch__mode.is_bound()) {
ret_val.ccch__mode() = single_value->field_ccch__mode.valueof();
}
if (single_value->field_padding.is_bound()) {
ret_val.padding() = single_value->field_padding.valueof();
}
return ret_val;
}

void L1ctlCcchModeReq_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 @L1CTL_Types.L1ctlCcchModeReq.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlCcchModeReq_template[list_length];
}

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

L1ctlCcchMode_template& L1ctlCcchModeReq_template::ccch__mode()
{
set_specific();
return single_value->field_ccch__mode;
}

const L1ctlCcchMode_template& L1ctlCcchModeReq_template::ccch__mode() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ccch_mode of a non-specific template of type @L1CTL_Types.L1ctlCcchModeReq.");
return single_value->field_ccch__mode;
}

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

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

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

void L1ctlCcchModeReq_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ ccch_mode := ");
single_value->field_ccch__mode.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 L1ctlCcchModeReq_template::log_match(const L1ctlCcchModeReq& 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_ccch__mode.match(match_value.ccch__mode(), legacy)){
TTCN_Logger::log_logmatch_info(".ccch_mode");
single_value->field_ccch__mode.log_match(match_value.ccch__mode(), 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("{ ccch_mode := ");
single_value->field_ccch__mode.log_match(match_value.ccch__mode(), 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 L1ctlCcchModeReq_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (ccch__mode().is_bound()) ccch__mode().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

void L1ctlCcchModeReq_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_ccch__mode.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 @L1CTL_Types.L1ctlCcchModeReq.");
}
}

void L1ctlCcchModeReq_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_ccch__mode.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 L1ctlCcchModeReq_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 @L1CTL_Types.L1ctlCcchModeReq.");
}
}

void L1ctlCcchModeReq_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: {
    L1ctlCcchModeReq_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @L1CTL_Types.L1ctlCcchModeReq has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) ccch__mode().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) padding().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ccch_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ccch__mode().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 @L1CTL_Types.L1ctlCcchModeReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlCcchModeReq_template* precondition = new L1ctlCcchModeReq_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlCcchModeReq_template* implied_template = new L1ctlCcchModeReq_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlCcchModeReq_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlCcchModeReq");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlCcchModeReq_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_ccch__mode.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlCcchModeReq");
single_value->field_padding.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlCcchModeReq");
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 : "@L1CTL_Types.L1ctlCcchModeReq");
}

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

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

L1ctlTchModeReq_amr::L1ctlTchModeReq_amr()
{
}

L1ctlTchModeReq_amr::L1ctlTchModeReq_amr(const INTEGER& par_start__codec,
    const BITSTRING& par_codecs__bitmask)
  :   field_start__codec(par_start__codec),
  field_codecs__bitmask(par_codecs__bitmask)
{
}

L1ctlTchModeReq_amr::L1ctlTchModeReq_amr(const L1ctlTchModeReq_amr& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlTchModeReq.amr.");
if (other_value.start__codec().is_bound()) field_start__codec = other_value.start__codec();
else field_start__codec.clean_up();
if (other_value.codecs__bitmask().is_bound()) field_codecs__bitmask = other_value.codecs__bitmask();
else field_codecs__bitmask.clean_up();
}

void L1ctlTchModeReq_amr::clean_up()
{
field_start__codec.clean_up();
field_codecs__bitmask.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlTchModeReq_amr::get_descriptor() const { return &L1ctlTchModeReq_amr_descr_; }
L1ctlTchModeReq_amr& L1ctlTchModeReq_amr::operator=(const L1ctlTchModeReq_amr& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlTchModeReq.amr.");
  if (other_value.start__codec().is_bound()) field_start__codec = other_value.start__codec();
  else field_start__codec.clean_up();
  if (other_value.codecs__bitmask().is_bound()) field_codecs__bitmask = other_value.codecs__bitmask();
  else field_codecs__bitmask.clean_up();
}
return *this;
}

boolean L1ctlTchModeReq_amr::operator==(const L1ctlTchModeReq_amr& other_value) const
{
return field_start__codec==other_value.field_start__codec
  && field_codecs__bitmask==other_value.field_codecs__bitmask;
}

boolean L1ctlTchModeReq_amr::is_bound() const
{
return (field_start__codec.is_bound())
  || (field_codecs__bitmask.is_bound());
}
boolean L1ctlTchModeReq_amr::is_value() const
{
return field_start__codec.is_value()
  && field_codecs__bitmask.is_value();
}
void L1ctlTchModeReq_amr::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ start_codec := ");
field_start__codec.log();
TTCN_Logger::log_event_str(", codecs_bitmask := ");
field_codecs__bitmask.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlTchModeReq_amr::set_implicit_omit()
{
if (start__codec().is_bound()) start__codec().set_implicit_omit();
if (codecs__bitmask().is_bound()) codecs__bitmask().set_implicit_omit();
}

void L1ctlTchModeReq_amr::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record value of type @L1CTL_Types.L1ctlTchModeReq.amr has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) start__codec().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) codecs__bitmask().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "start_codec")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          start__codec().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(), "codecs_bitmask")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          codecs__bitmask().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 @L1CTL_Types.L1ctlTchModeReq.amr: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlTchModeReq.amr");
  }
}

void L1ctlTchModeReq_amr::encode_text(Text_Buf& text_buf) const
{
field_start__codec.encode_text(text_buf);
field_codecs__bitmask.encode_text(text_buf);
}

void L1ctlTchModeReq_amr::decode_text(Text_Buf& text_buf)
{
field_start__codec.decode_text(text_buf);
field_codecs__bitmask.decode_text(text_buf);
}

void L1ctlTchModeReq_amr::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 L1ctlTchModeReq_amr::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 L1ctlTchModeReq_amr::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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_start__codec.RAW_decode(Osmocom__Types::uint8__t_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::BIT8_descr_.raw->forceomit);
  decoded_field_length = field_codecs__bitmask.RAW_decode(General__Types::BIT8_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

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

struct L1ctlTchModeReq_amr_template::single_value_struct {
INTEGER_template field_start__codec;
BITSTRING_template field_codecs__bitmask;
};

void L1ctlTchModeReq_amr_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_start__codec = ANY_VALUE;
single_value->field_codecs__bitmask = ANY_VALUE;
}
}
}

void L1ctlTchModeReq_amr_template::copy_value(const L1ctlTchModeReq_amr& other_value)
{
single_value = new single_value_struct;
if (other_value.start__codec().is_bound()) {
  single_value->field_start__codec = other_value.start__codec();
} else {
  single_value->field_start__codec.clean_up();
}
if (other_value.codecs__bitmask().is_bound()) {
  single_value->field_codecs__bitmask = other_value.codecs__bitmask();
} else {
  single_value->field_codecs__bitmask.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlTchModeReq_amr_template::copy_template(const L1ctlTchModeReq_amr_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.start__codec().get_selection()) {
single_value->field_start__codec = other_value.start__codec();
} else {
single_value->field_start__codec.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.codecs__bitmask().get_selection()) {
single_value->field_codecs__bitmask = other_value.codecs__bitmask();
} else {
single_value->field_codecs__bitmask.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 L1ctlTchModeReq_amr_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 L1ctlTchModeReq_amr_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlTchModeReq_amr_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 @L1CTL_Types.L1ctlTchModeReq.amr.");
break;
}
set_selection(other_value);
}

L1ctlTchModeReq_amr_template::L1ctlTchModeReq_amr_template()
{
}

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

L1ctlTchModeReq_amr_template::L1ctlTchModeReq_amr_template(const L1ctlTchModeReq_amr& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlTchModeReq_amr_template::match(const L1ctlTchModeReq_amr& 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.start__codec().is_bound()) return FALSE;
if(!single_value->field_start__codec.match(other_value.start__codec(), legacy))return FALSE;
if(!other_value.codecs__bitmask().is_bound()) return FALSE;
if(!single_value->field_codecs__bitmask.match(other_value.codecs__bitmask(), 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 @L1CTL_Types.L1ctlTchModeReq.amr.");
}
return FALSE;
}

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

boolean L1ctlTchModeReq_amr_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_start__codec.is_value()
 && single_value->field_codecs__bitmask.is_value();
}

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

L1ctlTchModeReq_amr L1ctlTchModeReq_amr_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 @L1CTL_Types.L1ctlTchModeReq.amr.");
L1ctlTchModeReq_amr ret_val;
if (single_value->field_start__codec.is_bound()) {
ret_val.start__codec() = single_value->field_start__codec.valueof();
}
if (single_value->field_codecs__bitmask.is_bound()) {
ret_val.codecs__bitmask() = single_value->field_codecs__bitmask.valueof();
}
return ret_val;
}

void L1ctlTchModeReq_amr_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 @L1CTL_Types.L1ctlTchModeReq.amr.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlTchModeReq_amr_template[list_length];
}

L1ctlTchModeReq_amr_template& L1ctlTchModeReq_amr_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 @L1CTL_Types.L1ctlTchModeReq.amr.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @L1CTL_Types.L1ctlTchModeReq.amr.");
return value_list.list_value[list_index];
}

INTEGER_template& L1ctlTchModeReq_amr_template::start__codec()
{
set_specific();
return single_value->field_start__codec;
}

const INTEGER_template& L1ctlTchModeReq_amr_template::start__codec() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field start_codec of a non-specific template of type @L1CTL_Types.L1ctlTchModeReq.amr.");
return single_value->field_start__codec;
}

BITSTRING_template& L1ctlTchModeReq_amr_template::codecs__bitmask()
{
set_specific();
return single_value->field_codecs__bitmask;
}

const BITSTRING_template& L1ctlTchModeReq_amr_template::codecs__bitmask() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field codecs_bitmask of a non-specific template of type @L1CTL_Types.L1ctlTchModeReq.amr.");
return single_value->field_codecs__bitmask;
}

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

void L1ctlTchModeReq_amr_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ start_codec := ");
single_value->field_start__codec.log();
TTCN_Logger::log_event_str(", codecs_bitmask := ");
single_value->field_codecs__bitmask.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 L1ctlTchModeReq_amr_template::log_match(const L1ctlTchModeReq_amr& 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_start__codec.match(match_value.start__codec(), legacy)){
TTCN_Logger::log_logmatch_info(".start_codec");
single_value->field_start__codec.log_match(match_value.start__codec(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_codecs__bitmask.match(match_value.codecs__bitmask(), legacy)){
TTCN_Logger::log_logmatch_info(".codecs_bitmask");
single_value->field_codecs__bitmask.log_match(match_value.codecs__bitmask(), 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("{ start_codec := ");
single_value->field_start__codec.log_match(match_value.start__codec(), legacy);
TTCN_Logger::log_event_str(", codecs_bitmask := ");
single_value->field_codecs__bitmask.log_match(match_value.codecs__bitmask(), 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 L1ctlTchModeReq_amr_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (start__codec().is_bound()) start__codec().set_implicit_omit();
if (codecs__bitmask().is_bound()) codecs__bitmask().set_implicit_omit();
}

void L1ctlTchModeReq_amr_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_start__codec.encode_text(text_buf);
single_value->field_codecs__bitmask.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 @L1CTL_Types.L1ctlTchModeReq.amr.");
}
}

void L1ctlTchModeReq_amr_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_start__codec.decode_text(text_buf);
single_value->field_codecs__bitmask.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 L1ctlTchModeReq_amr_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 @L1CTL_Types.L1ctlTchModeReq.amr.");
}
}

void L1ctlTchModeReq_amr_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: {
    L1ctlTchModeReq_amr_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @L1CTL_Types.L1ctlTchModeReq.amr has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) start__codec().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) codecs__bitmask().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "start_codec")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          start__codec().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(), "codecs_bitmask")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          codecs__bitmask().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 @L1CTL_Types.L1ctlTchModeReq.amr: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlTchModeReq_amr_template* precondition = new L1ctlTchModeReq_amr_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlTchModeReq_amr_template* implied_template = new L1ctlTchModeReq_amr_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlTchModeReq_amr_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlTchModeReq.amr");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlTchModeReq_amr_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_start__codec.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlTchModeReq.amr");
single_value->field_codecs__bitmask.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlTchModeReq.amr");
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 : "@L1CTL_Types.L1ctlTchModeReq.amr");
}

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

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

L1ctlTchModeReq::L1ctlTchModeReq()
{
}

L1ctlTchModeReq::L1ctlTchModeReq(const L1ctlTchMode& par_tch__mode,
    const L1ctlAudioMode& par_audio__mode,
    const L1ctlLoopMode& par_loop__mode,
    const L1ctlTchModeReq_amr& par_amr)
  :   field_tch__mode(par_tch__mode),
  field_audio__mode(par_audio__mode),
  field_loop__mode(par_loop__mode),
  field_amr(par_amr)
{
}

L1ctlTchModeReq::L1ctlTchModeReq(const L1ctlTchModeReq& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlTchModeReq.");
if (other_value.tch__mode().is_bound()) field_tch__mode = other_value.tch__mode();
else field_tch__mode.clean_up();
if (other_value.audio__mode().is_bound()) field_audio__mode = other_value.audio__mode();
else field_audio__mode.clean_up();
if (other_value.loop__mode().is_bound()) field_loop__mode = other_value.loop__mode();
else field_loop__mode.clean_up();
if (other_value.amr().is_bound()) field_amr = other_value.amr();
else field_amr.clean_up();
}

void L1ctlTchModeReq::clean_up()
{
field_tch__mode.clean_up();
field_audio__mode.clean_up();
field_loop__mode.clean_up();
field_amr.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlTchModeReq::get_descriptor() const { return &L1ctlTchModeReq_descr_; }
L1ctlTchModeReq& L1ctlTchModeReq::operator=(const L1ctlTchModeReq& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlTchModeReq.");
  if (other_value.tch__mode().is_bound()) field_tch__mode = other_value.tch__mode();
  else field_tch__mode.clean_up();
  if (other_value.audio__mode().is_bound()) field_audio__mode = other_value.audio__mode();
  else field_audio__mode.clean_up();
  if (other_value.loop__mode().is_bound()) field_loop__mode = other_value.loop__mode();
  else field_loop__mode.clean_up();
  if (other_value.amr().is_bound()) field_amr = other_value.amr();
  else field_amr.clean_up();
}
return *this;
}

boolean L1ctlTchModeReq::operator==(const L1ctlTchModeReq& other_value) const
{
return field_tch__mode==other_value.field_tch__mode
  && field_audio__mode==other_value.field_audio__mode
  && field_loop__mode==other_value.field_loop__mode
  && field_amr==other_value.field_amr;
}

boolean L1ctlTchModeReq::is_bound() const
{
return (field_tch__mode.is_bound())
  || (field_audio__mode.is_bound())
  || (field_loop__mode.is_bound())
  || (field_amr.is_bound());
}
boolean L1ctlTchModeReq::is_value() const
{
return field_tch__mode.is_value()
  && field_audio__mode.is_value()
  && field_loop__mode.is_value()
  && field_amr.is_value();
}
void L1ctlTchModeReq::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ tch_mode := ");
field_tch__mode.log();
TTCN_Logger::log_event_str(", audio_mode := ");
field_audio__mode.log();
TTCN_Logger::log_event_str(", loop_mode := ");
field_loop__mode.log();
TTCN_Logger::log_event_str(", amr := ");
field_amr.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlTchModeReq::set_implicit_omit()
{
if (tch__mode().is_bound()) tch__mode().set_implicit_omit();
if (audio__mode().is_bound()) audio__mode().set_implicit_omit();
if (loop__mode().is_bound()) loop__mode().set_implicit_omit();
if (amr().is_bound()) amr().set_implicit_omit();
}

void L1ctlTchModeReq::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 @L1CTL_Types.L1ctlTchModeReq 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) tch__mode().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) audio__mode().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) loop__mode().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) amr().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(), "tch_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tch__mode().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(), "audio_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          audio__mode().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(), "loop_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          loop__mode().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(), "amr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          amr().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 @L1CTL_Types.L1ctlTchModeReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlTchModeReq");
  }
}

void L1ctlTchModeReq::encode_text(Text_Buf& text_buf) const
{
field_tch__mode.encode_text(text_buf);
field_audio__mode.encode_text(text_buf);
field_loop__mode.encode_text(text_buf);
field_amr.encode_text(text_buf);
}

void L1ctlTchModeReq::decode_text(Text_Buf& text_buf)
{
field_tch__mode.decode_text(text_buf);
field_audio__mode.decode_text(text_buf);
field_loop__mode.decode_text(text_buf);
field_amr.decode_text(text_buf);
}

void L1ctlTchModeReq::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 L1ctlTchModeReq::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 L1ctlTchModeReq::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, L1ctlTchMode_descr_.raw->forceomit);
  decoded_field_length = field_tch__mode.RAW_decode(L1ctlTchMode_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, L1ctlAudioMode_descr_.raw->forceomit);
  decoded_field_length = field_audio__mode.RAW_decode(L1ctlAudioMode_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, L1ctlLoopMode_descr_.raw->forceomit);
  decoded_field_length = field_loop__mode.RAW_decode(L1ctlLoopMode_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, L1ctlTchModeReq_amr_descr_.raw->forceomit);
  decoded_field_length = field_amr.RAW_decode(L1ctlTchModeReq_amr_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 L1ctlTchModeReq::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, L1ctlTchMode_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, L1ctlAudioMode_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, L1ctlLoopMode_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, L1ctlTchModeReq_amr_descr_.raw);
  encoded_length += field_tch__mode.RAW_encode(L1ctlTchMode_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_audio__mode.RAW_encode(L1ctlAudioMode_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_loop__mode.RAW_encode(L1ctlLoopMode_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_amr.RAW_encode(L1ctlTchModeReq_amr_descr_, *myleaf.body.node.nodes[3]);
  return myleaf.length = encoded_length;
}

struct L1ctlTchModeReq_template::single_value_struct {
L1ctlTchMode_template field_tch__mode;
L1ctlAudioMode_template field_audio__mode;
L1ctlLoopMode_template field_loop__mode;
L1ctlTchModeReq_amr_template field_amr;
};

void L1ctlTchModeReq_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_tch__mode = ANY_VALUE;
single_value->field_audio__mode = ANY_VALUE;
single_value->field_loop__mode = ANY_VALUE;
single_value->field_amr = ANY_VALUE;
}
}
}

void L1ctlTchModeReq_template::copy_value(const L1ctlTchModeReq& other_value)
{
single_value = new single_value_struct;
if (other_value.tch__mode().is_bound()) {
  single_value->field_tch__mode = other_value.tch__mode();
} else {
  single_value->field_tch__mode.clean_up();
}
if (other_value.audio__mode().is_bound()) {
  single_value->field_audio__mode = other_value.audio__mode();
} else {
  single_value->field_audio__mode.clean_up();
}
if (other_value.loop__mode().is_bound()) {
  single_value->field_loop__mode = other_value.loop__mode();
} else {
  single_value->field_loop__mode.clean_up();
}
if (other_value.amr().is_bound()) {
  single_value->field_amr = other_value.amr();
} else {
  single_value->field_amr.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlTchModeReq_template::copy_template(const L1ctlTchModeReq_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.tch__mode().get_selection()) {
single_value->field_tch__mode = other_value.tch__mode();
} else {
single_value->field_tch__mode.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.audio__mode().get_selection()) {
single_value->field_audio__mode = other_value.audio__mode();
} else {
single_value->field_audio__mode.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.loop__mode().get_selection()) {
single_value->field_loop__mode = other_value.loop__mode();
} else {
single_value->field_loop__mode.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.amr().get_selection()) {
single_value->field_amr = other_value.amr();
} else {
single_value->field_amr.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 L1ctlTchModeReq_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 L1ctlTchModeReq_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlTchModeReq_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 @L1CTL_Types.L1ctlTchModeReq.");
break;
}
set_selection(other_value);
}

L1ctlTchModeReq_template::L1ctlTchModeReq_template()
{
}

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

L1ctlTchModeReq_template::L1ctlTchModeReq_template(const L1ctlTchModeReq& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlTchModeReq_template::match(const L1ctlTchModeReq& 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.tch__mode().is_bound()) return FALSE;
if(!single_value->field_tch__mode.match(other_value.tch__mode(), legacy))return FALSE;
if(!other_value.audio__mode().is_bound()) return FALSE;
if(!single_value->field_audio__mode.match(other_value.audio__mode(), legacy))return FALSE;
if(!other_value.loop__mode().is_bound()) return FALSE;
if(!single_value->field_loop__mode.match(other_value.loop__mode(), legacy))return FALSE;
if(!other_value.amr().is_bound()) return FALSE;
if(!single_value->field_amr.match(other_value.amr(), 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 @L1CTL_Types.L1ctlTchModeReq.");
}
return FALSE;
}

boolean L1ctlTchModeReq_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_tch__mode.is_bound()
 || single_value->field_audio__mode.is_bound()
 || single_value->field_loop__mode.is_bound()
 || single_value->field_amr.is_bound();
}

boolean L1ctlTchModeReq_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_tch__mode.is_value()
 && single_value->field_audio__mode.is_value()
 && single_value->field_loop__mode.is_value()
 && single_value->field_amr.is_value();
}

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

L1ctlTchModeReq L1ctlTchModeReq_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 @L1CTL_Types.L1ctlTchModeReq.");
L1ctlTchModeReq ret_val;
if (single_value->field_tch__mode.is_bound()) {
ret_val.tch__mode() = single_value->field_tch__mode.valueof();
}
if (single_value->field_audio__mode.is_bound()) {
ret_val.audio__mode() = single_value->field_audio__mode.valueof();
}
if (single_value->field_loop__mode.is_bound()) {
ret_val.loop__mode() = single_value->field_loop__mode.valueof();
}
if (single_value->field_amr.is_bound()) {
ret_val.amr() = single_value->field_amr.valueof();
}
return ret_val;
}

void L1ctlTchModeReq_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 @L1CTL_Types.L1ctlTchModeReq.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlTchModeReq_template[list_length];
}

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

L1ctlTchMode_template& L1ctlTchModeReq_template::tch__mode()
{
set_specific();
return single_value->field_tch__mode;
}

const L1ctlTchMode_template& L1ctlTchModeReq_template::tch__mode() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tch_mode of a non-specific template of type @L1CTL_Types.L1ctlTchModeReq.");
return single_value->field_tch__mode;
}

L1ctlAudioMode_template& L1ctlTchModeReq_template::audio__mode()
{
set_specific();
return single_value->field_audio__mode;
}

const L1ctlAudioMode_template& L1ctlTchModeReq_template::audio__mode() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field audio_mode of a non-specific template of type @L1CTL_Types.L1ctlTchModeReq.");
return single_value->field_audio__mode;
}

L1ctlLoopMode_template& L1ctlTchModeReq_template::loop__mode()
{
set_specific();
return single_value->field_loop__mode;
}

const L1ctlLoopMode_template& L1ctlTchModeReq_template::loop__mode() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field loop_mode of a non-specific template of type @L1CTL_Types.L1ctlTchModeReq.");
return single_value->field_loop__mode;
}

L1ctlTchModeReq_amr_template& L1ctlTchModeReq_template::amr()
{
set_specific();
return single_value->field_amr;
}

const L1ctlTchModeReq_amr_template& L1ctlTchModeReq_template::amr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field amr of a non-specific template of type @L1CTL_Types.L1ctlTchModeReq.");
return single_value->field_amr;
}

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

void L1ctlTchModeReq_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ tch_mode := ");
single_value->field_tch__mode.log();
TTCN_Logger::log_event_str(", audio_mode := ");
single_value->field_audio__mode.log();
TTCN_Logger::log_event_str(", loop_mode := ");
single_value->field_loop__mode.log();
TTCN_Logger::log_event_str(", amr := ");
single_value->field_amr.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 L1ctlTchModeReq_template::log_match(const L1ctlTchModeReq& 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_tch__mode.match(match_value.tch__mode(), legacy)){
TTCN_Logger::log_logmatch_info(".tch_mode");
single_value->field_tch__mode.log_match(match_value.tch__mode(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_audio__mode.match(match_value.audio__mode(), legacy)){
TTCN_Logger::log_logmatch_info(".audio_mode");
single_value->field_audio__mode.log_match(match_value.audio__mode(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_loop__mode.match(match_value.loop__mode(), legacy)){
TTCN_Logger::log_logmatch_info(".loop_mode");
single_value->field_loop__mode.log_match(match_value.loop__mode(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_amr.match(match_value.amr(), legacy)){
TTCN_Logger::log_logmatch_info(".amr");
single_value->field_amr.log_match(match_value.amr(), 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("{ tch_mode := ");
single_value->field_tch__mode.log_match(match_value.tch__mode(), legacy);
TTCN_Logger::log_event_str(", audio_mode := ");
single_value->field_audio__mode.log_match(match_value.audio__mode(), legacy);
TTCN_Logger::log_event_str(", loop_mode := ");
single_value->field_loop__mode.log_match(match_value.loop__mode(), legacy);
TTCN_Logger::log_event_str(", amr := ");
single_value->field_amr.log_match(match_value.amr(), 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 L1ctlTchModeReq_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (tch__mode().is_bound()) tch__mode().set_implicit_omit();
if (audio__mode().is_bound()) audio__mode().set_implicit_omit();
if (loop__mode().is_bound()) loop__mode().set_implicit_omit();
if (amr().is_bound()) amr().set_implicit_omit();
}

void L1ctlTchModeReq_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_tch__mode.encode_text(text_buf);
single_value->field_audio__mode.encode_text(text_buf);
single_value->field_loop__mode.encode_text(text_buf);
single_value->field_amr.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 @L1CTL_Types.L1ctlTchModeReq.");
}
}

void L1ctlTchModeReq_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_tch__mode.decode_text(text_buf);
single_value->field_audio__mode.decode_text(text_buf);
single_value->field_loop__mode.decode_text(text_buf);
single_value->field_amr.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 L1ctlTchModeReq_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 @L1CTL_Types.L1ctlTchModeReq.");
}
}

void L1ctlTchModeReq_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: {
    L1ctlTchModeReq_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 @L1CTL_Types.L1ctlTchModeReq 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) tch__mode().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) audio__mode().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) loop__mode().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) amr().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(), "tch_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tch__mode().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(), "audio_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          audio__mode().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(), "loop_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          loop__mode().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(), "amr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          amr().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 @L1CTL_Types.L1ctlTchModeReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlTchModeReq_template* precondition = new L1ctlTchModeReq_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlTchModeReq_template* implied_template = new L1ctlTchModeReq_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlTchModeReq_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlTchModeReq");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlTchModeReq_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_tch__mode.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlTchModeReq");
single_value->field_audio__mode.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlTchModeReq");
single_value->field_loop__mode.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlTchModeReq");
single_value->field_amr.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlTchModeReq");
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 : "@L1CTL_Types.L1ctlTchModeReq");
}

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

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

L1ctlRachReq::L1ctlRachReq()
{
}

L1ctlRachReq::L1ctlRachReq(const INTEGER& par_ra,
    const INTEGER& par_combined,
    const INTEGER& par_offset)
  :   field_ra(par_ra),
  field_combined(par_combined),
  field_offset(par_offset)
{
}

L1ctlRachReq::L1ctlRachReq(const L1ctlRachReq& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlRachReq.");
if (other_value.ra().is_bound()) field_ra = other_value.ra();
else field_ra.clean_up();
if (other_value.combined().is_bound()) field_combined = other_value.combined();
else field_combined.clean_up();
if (other_value.offset().is_bound()) field_offset = other_value.offset();
else field_offset.clean_up();
}

void L1ctlRachReq::clean_up()
{
field_ra.clean_up();
field_combined.clean_up();
field_offset.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlRachReq::get_descriptor() const { return &L1ctlRachReq_descr_; }
L1ctlRachReq& L1ctlRachReq::operator=(const L1ctlRachReq& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlRachReq.");
  if (other_value.ra().is_bound()) field_ra = other_value.ra();
  else field_ra.clean_up();
  if (other_value.combined().is_bound()) field_combined = other_value.combined();
  else field_combined.clean_up();
  if (other_value.offset().is_bound()) field_offset = other_value.offset();
  else field_offset.clean_up();
}
return *this;
}

boolean L1ctlRachReq::operator==(const L1ctlRachReq& other_value) const
{
return field_ra==other_value.field_ra
  && field_combined==other_value.field_combined
  && field_offset==other_value.field_offset;
}

boolean L1ctlRachReq::is_bound() const
{
return (field_ra.is_bound())
  || (field_combined.is_bound())
  || (field_offset.is_bound());
}
boolean L1ctlRachReq::is_value() const
{
return field_ra.is_value()
  && field_combined.is_value()
  && field_offset.is_value();
}
void L1ctlRachReq::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ ra := ");
field_ra.log();
TTCN_Logger::log_event_str(", combined := ");
field_combined.log();
TTCN_Logger::log_event_str(", offset := ");
field_offset.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlRachReq::set_implicit_omit()
{
if (ra().is_bound()) ra().set_implicit_omit();
if (combined().is_bound()) combined().set_implicit_omit();
if (offset().is_bound()) offset().set_implicit_omit();
}

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

void L1ctlRachReq::encode_text(Text_Buf& text_buf) const
{
field_ra.encode_text(text_buf);
field_combined.encode_text(text_buf);
field_offset.encode_text(text_buf);
}

void L1ctlRachReq::decode_text(Text_Buf& text_buf)
{
field_ra.decode_text(text_buf);
field_combined.decode_text(text_buf);
field_offset.decode_text(text_buf);
}

void L1ctlRachReq::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 L1ctlRachReq::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 L1ctlRachReq::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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_ra.RAW_decode(Osmocom__Types::uint8__t_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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_combined.RAW_decode(Osmocom__Types::uint8__t_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, Osmocom__Types::uint16__t_descr_.raw->forceomit);
  decoded_field_length = field_offset.RAW_decode(Osmocom__Types::uint16__t_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 L1ctlRachReq::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, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Osmocom__Types::uint16__t_descr_.raw);
  encoded_length += field_ra.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_combined.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_offset.RAW_encode(Osmocom__Types::uint16__t_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct L1ctlRachReq_template::single_value_struct {
INTEGER_template field_ra;
INTEGER_template field_combined;
INTEGER_template field_offset;
};

void L1ctlRachReq_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_ra = ANY_VALUE;
single_value->field_combined = ANY_VALUE;
single_value->field_offset = ANY_VALUE;
}
}
}

void L1ctlRachReq_template::copy_value(const L1ctlRachReq& other_value)
{
single_value = new single_value_struct;
if (other_value.ra().is_bound()) {
  single_value->field_ra = other_value.ra();
} else {
  single_value->field_ra.clean_up();
}
if (other_value.combined().is_bound()) {
  single_value->field_combined = other_value.combined();
} else {
  single_value->field_combined.clean_up();
}
if (other_value.offset().is_bound()) {
  single_value->field_offset = other_value.offset();
} else {
  single_value->field_offset.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlRachReq_template::copy_template(const L1ctlRachReq_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.ra().get_selection()) {
single_value->field_ra = other_value.ra();
} else {
single_value->field_ra.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.combined().get_selection()) {
single_value->field_combined = other_value.combined();
} else {
single_value->field_combined.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.offset().get_selection()) {
single_value->field_offset = other_value.offset();
} else {
single_value->field_offset.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 L1ctlRachReq_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 L1ctlRachReq_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlRachReq_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 @L1CTL_Types.L1ctlRachReq.");
break;
}
set_selection(other_value);
}

L1ctlRachReq_template::L1ctlRachReq_template()
{
}

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

L1ctlRachReq_template::L1ctlRachReq_template(const L1ctlRachReq& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlRachReq_template::match(const L1ctlRachReq& 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.ra().is_bound()) return FALSE;
if(!single_value->field_ra.match(other_value.ra(), legacy))return FALSE;
if(!other_value.combined().is_bound()) return FALSE;
if(!single_value->field_combined.match(other_value.combined(), legacy))return FALSE;
if(!other_value.offset().is_bound()) return FALSE;
if(!single_value->field_offset.match(other_value.offset(), 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 @L1CTL_Types.L1ctlRachReq.");
}
return FALSE;
}

boolean L1ctlRachReq_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_ra.is_bound()
 || single_value->field_combined.is_bound()
 || single_value->field_offset.is_bound();
}

boolean L1ctlRachReq_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_ra.is_value()
 && single_value->field_combined.is_value()
 && single_value->field_offset.is_value();
}

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

L1ctlRachReq L1ctlRachReq_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 @L1CTL_Types.L1ctlRachReq.");
L1ctlRachReq ret_val;
if (single_value->field_ra.is_bound()) {
ret_val.ra() = single_value->field_ra.valueof();
}
if (single_value->field_combined.is_bound()) {
ret_val.combined() = single_value->field_combined.valueof();
}
if (single_value->field_offset.is_bound()) {
ret_val.offset() = single_value->field_offset.valueof();
}
return ret_val;
}

void L1ctlRachReq_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 @L1CTL_Types.L1ctlRachReq.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlRachReq_template[list_length];
}

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

INTEGER_template& L1ctlRachReq_template::ra()
{
set_specific();
return single_value->field_ra;
}

const INTEGER_template& L1ctlRachReq_template::ra() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ra of a non-specific template of type @L1CTL_Types.L1ctlRachReq.");
return single_value->field_ra;
}

INTEGER_template& L1ctlRachReq_template::combined()
{
set_specific();
return single_value->field_combined;
}

const INTEGER_template& L1ctlRachReq_template::combined() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field combined of a non-specific template of type @L1CTL_Types.L1ctlRachReq.");
return single_value->field_combined;
}

INTEGER_template& L1ctlRachReq_template::offset()
{
set_specific();
return single_value->field_offset;
}

const INTEGER_template& L1ctlRachReq_template::offset() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field offset of a non-specific template of type @L1CTL_Types.L1ctlRachReq.");
return single_value->field_offset;
}

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

void L1ctlRachReq_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ ra := ");
single_value->field_ra.log();
TTCN_Logger::log_event_str(", combined := ");
single_value->field_combined.log();
TTCN_Logger::log_event_str(", offset := ");
single_value->field_offset.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 L1ctlRachReq_template::log_match(const L1ctlRachReq& 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_ra.match(match_value.ra(), legacy)){
TTCN_Logger::log_logmatch_info(".ra");
single_value->field_ra.log_match(match_value.ra(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_combined.match(match_value.combined(), legacy)){
TTCN_Logger::log_logmatch_info(".combined");
single_value->field_combined.log_match(match_value.combined(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_offset.match(match_value.offset(), legacy)){
TTCN_Logger::log_logmatch_info(".offset");
single_value->field_offset.log_match(match_value.offset(), 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("{ ra := ");
single_value->field_ra.log_match(match_value.ra(), legacy);
TTCN_Logger::log_event_str(", combined := ");
single_value->field_combined.log_match(match_value.combined(), legacy);
TTCN_Logger::log_event_str(", offset := ");
single_value->field_offset.log_match(match_value.offset(), 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 L1ctlRachReq_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (ra().is_bound()) ra().set_implicit_omit();
if (combined().is_bound()) combined().set_implicit_omit();
if (offset().is_bound()) offset().set_implicit_omit();
}

void L1ctlRachReq_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_ra.encode_text(text_buf);
single_value->field_combined.encode_text(text_buf);
single_value->field_offset.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 @L1CTL_Types.L1ctlRachReq.");
}
}

void L1ctlRachReq_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_ra.decode_text(text_buf);
single_value->field_combined.decode_text(text_buf);
single_value->field_offset.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 L1ctlRachReq_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 @L1CTL_Types.L1ctlRachReq.");
}
}

void L1ctlRachReq_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: {
    L1ctlRachReq_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 @L1CTL_Types.L1ctlRachReq 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) ra().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) combined().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) offset().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(), "ra")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ra().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(), "combined")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          combined().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(), "offset")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          offset().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 @L1CTL_Types.L1ctlRachReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlRachReq_template* precondition = new L1ctlRachReq_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlRachReq_template* implied_template = new L1ctlRachReq_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlRachReq_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlRachReq");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlRachReq_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_ra.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlRachReq");
single_value->field_combined.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlRachReq");
single_value->field_offset.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlRachReq");
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 : "@L1CTL_Types.L1ctlRachReq");
}

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

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

L1ctlRachSynchSeq::L1ctlRachSynchSeq()
{
enum_value = UNBOUND_VALUE;
}

L1ctlRachSynchSeq::L1ctlRachSynchSeq(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @L1CTL_Types.L1ctlRachSynchSeq with invalid numeric value %d.", other_value);
enum_value = (enum_type)other_value;
}

L1ctlRachSynchSeq::L1ctlRachSynchSeq(enum_type other_value)
{
enum_value = other_value;
}

L1ctlRachSynchSeq::L1ctlRachSynchSeq(const L1ctlRachSynchSeq& other_value)
: Base_Type()
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
enum_value = other_value.enum_value;
}

L1ctlRachSynchSeq& L1ctlRachSynchSeq::operator=(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.", other_value);
enum_value = (enum_type)other_value;
return *this;
}

L1ctlRachSynchSeq& L1ctlRachSynchSeq::operator=(enum_type other_value)
{
enum_value = other_value;
return *this;
}

L1ctlRachSynchSeq& L1ctlRachSynchSeq::operator=(const L1ctlRachSynchSeq& other_value)
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
enum_value = other_value.enum_value;
return *this;
}

boolean L1ctlRachSynchSeq::operator==(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlRachSynchSeq comparison is an unknown numeric value %d", other_value);
return enum_value == other_value;
}

boolean L1ctlRachSynchSeq::operator==(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
return enum_value == other_value;
}

boolean L1ctlRachSynchSeq::operator==(const L1ctlRachSynchSeq& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
return enum_value == other_value.enum_value;
}

boolean L1ctlRachSynchSeq::operator<(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlRachSynchSeq comparison is an unknown numeric value %d", other_value);
return enum_value < other_value;
}

boolean L1ctlRachSynchSeq::operator<(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
return enum_value < other_value;
}

boolean L1ctlRachSynchSeq::operator<(const L1ctlRachSynchSeq& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
return enum_value < other_value.enum_value;
}

boolean L1ctlRachSynchSeq::operator>(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @L1CTL_Types.L1ctlRachSynchSeq comparison is an unknown numeric value %d", other_value);
return enum_value > other_value;
}

boolean L1ctlRachSynchSeq::operator>(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
return enum_value > other_value;
}

boolean L1ctlRachSynchSeq::operator>(const L1ctlRachSynchSeq& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
return enum_value > other_value.enum_value;
}

const char *L1ctlRachSynchSeq::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case RACH__SYNCH__SEQ__TS0: return "RACH_SYNCH_SEQ_TS0";
case RACH__SYNCH__SEQ__TS1: return "RACH_SYNCH_SEQ_TS1";
case RACH__SYNCH__SEQ__TS2: return "RACH_SYNCH_SEQ_TS2";
default:
return "<unknown>";
}
}

L1ctlRachSynchSeq::enum_type L1ctlRachSynchSeq::str_to_enum(const char *str_par, const int* int_par, const int* int_par2)
{
if (int_par == NULL && int_par2 == NULL) {
if (!strcmp(str_par, "RACH_SYNCH_SEQ_TS0")) return RACH__SYNCH__SEQ__TS0;
if (!strcmp(str_par, "RACH_SYNCH_SEQ_TS1")) return RACH__SYNCH__SEQ__TS1;
if (!strcmp(str_par, "RACH_SYNCH_SEQ_TS2")) return RACH__SYNCH__SEQ__TS2;
}
return UNKNOWN_VALUE;
}

boolean L1ctlRachSynchSeq::is_valid_enum(int int_par)
{
switch (int_par) {
case 0:
case 1:
case 2:
return TRUE;
default:
return FALSE;
}
}

int L1ctlRachSynchSeq::enum2int(enum_type enum_par)
{
if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int L1ctlRachSynchSeq::enum2int(const L1ctlRachSynchSeq& enum_par)
{
if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

void L1ctlRachSynchSeq::int2enum(int int_val)
{
if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.", int_val);
enum_value = (enum_type)int_val;
}

L1ctlRachSynchSeq::operator L1ctlRachSynchSeq::enum_type() const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
return enum_value;
}

void L1ctlRachSynchSeq::log() const
{
if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value);
else TTCN_Logger::log_event_unbound();
}

void L1ctlRachSynchSeq::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "enumerated value");
  if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@L1CTL_Types.L1ctlRachSynchSeq");
  enum_value = str_to_enum(param.get_enumerated(), param.get_enumerated_value());
  if (!is_valid_enum(enum_value)) {
    param.error("Invalid enumerated value for type @L1CTL_Types.L1ctlRachSynchSeq.");
  }
}

void L1ctlRachSynchSeq::encode_text(Text_Buf& text_buf) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
text_buf.push_int(enum_value);
}

void L1ctlRachSynchSeq::decode_text(Text_Buf& text_buf)
{
enum_value = (enum_type)text_buf.pull_int().get_val();
if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @L1CTL_Types.L1ctlRachSynchSeq.", enum_value);
}

void L1ctlRachSynchSeq::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 L1ctlRachSynchSeq::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 L1ctlRachSynchSeq::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*)
{
  int decoded_value = 0;
  int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err);
  if (decoded_length < 0) return decoded_length;
  if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value;
  else {
    if(no_err){
     return -1;
    } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name);
    enum_value = UNKNOWN_VALUE;
    }
  }
  return decoded_length;
}

int L1ctlRachSynchSeq::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const
{
  return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2);
}

void L1ctlRachSynchSeq_template::copy_template(const L1ctlRachSynchSeq_template& other_value)
{
set_selection(other_value);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = other_value.single_value;
break;
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 L1ctlRachSynchSeq_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 L1ctlRachSynchSeq_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlRachSynchSeq_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 enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
}
}

L1ctlRachSynchSeq_template::L1ctlRachSynchSeq_template()
{
}

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

L1ctlRachSynchSeq_template::L1ctlRachSynchSeq_template(int other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (!L1ctlRachSynchSeq::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @L1CTL_Types.L1ctlRachSynchSeq with unknown numeric value %d.", other_value);
single_value = (L1ctlRachSynchSeq::enum_type)other_value;
}

L1ctlRachSynchSeq_template::L1ctlRachSynchSeq_template(L1ctlRachSynchSeq::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

L1ctlRachSynchSeq_template::L1ctlRachSynchSeq_template(const L1ctlRachSynchSeq& other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (other_value.enum_value == L1ctlRachSynchSeq::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
single_value = other_value.enum_value;
}

L1ctlRachSynchSeq_template::L1ctlRachSynchSeq_template(const OPTIONAL<L1ctlRachSynchSeq>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlRachSynchSeq::enum_type)(const L1ctlRachSynchSeq&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of enumerated type @L1CTL_Types.L1ctlRachSynchSeq from an unbound optional field.");
}
}

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

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

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

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

boolean L1ctlRachSynchSeq_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
return TRUE;
}

boolean L1ctlRachSynchSeq_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value != L1ctlRachSynchSeq::UNBOUND_VALUE;
}

void L1ctlRachSynchSeq_template::clean_up()
{
switch (template_selection) {
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;
}

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

L1ctlRachSynchSeq_template& L1ctlRachSynchSeq_template::operator=(int other_value)
{
if (!L1ctlRachSynchSeq::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.", other_value);
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlRachSynchSeq::enum_type)other_value;
return *this;
}

L1ctlRachSynchSeq_template& L1ctlRachSynchSeq_template::operator=(L1ctlRachSynchSeq::enum_type other_value)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value;
return *this;
}

L1ctlRachSynchSeq_template& L1ctlRachSynchSeq_template::operator=(const L1ctlRachSynchSeq& other_value)
{
if (other_value.enum_value == L1ctlRachSynchSeq::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @L1CTL_Types.L1ctlRachSynchSeq to a template.");
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value.enum_value;
return *this;
}

L1ctlRachSynchSeq_template& L1ctlRachSynchSeq_template::operator=(const OPTIONAL<L1ctlRachSynchSeq>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (L1ctlRachSynchSeq::enum_type)(const L1ctlRachSynchSeq&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
}
return *this;
}

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

boolean L1ctlRachSynchSeq_template::match(L1ctlRachSynchSeq::enum_type other_value, boolean) const
{
switch (template_selection) {
case SPECIFIC_VALUE:
return single_value == other_value;
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value)) 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 enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
}
return FALSE;
}

boolean L1ctlRachSynchSeq_template::match(const L1ctlRachSynchSeq& other_value, boolean) const
{
if (other_value.enum_value == L1ctlRachSynchSeq::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @L1CTL_Types.L1ctlRachSynchSeq with an unbound value.");
return match(other_value.enum_value);
}

L1ctlRachSynchSeq::enum_type L1ctlRachSynchSeq_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
return single_value;
}

void L1ctlRachSynchSeq_template::set_type(template_sel template_type, unsigned int list_length)
{
clean_up();
switch (template_type) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlRachSynchSeq_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
}
}

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

void L1ctlRachSynchSeq_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(L1ctlRachSynchSeq::enum_to_str(single_value), single_value);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[elem_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 L1ctlRachSynchSeq_template::log_match(const L1ctlRachSynchSeq& match_value, boolean) const
{
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}

void L1ctlRachSynchSeq_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);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
}
}

void L1ctlRachSynchSeq_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (L1ctlRachSynchSeq::enum_type)text_buf.pull_int().get_val();
if (!L1ctlRachSynchSeq::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.", single_value);
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 L1ctlRachSynchSeq_template[value_list.n_values];
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @L1CTL_Types.L1ctlRachSynchSeq.");
}
}

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

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

void L1ctlRachSynchSeq_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "enumerated 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: {
    L1ctlRachSynchSeq_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_Enumerated: {
    L1ctlRachSynchSeq::enum_type enum_val = L1ctlRachSynchSeq::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!L1ctlRachSynchSeq::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @L1CTL_Types.L1ctlRachSynchSeq.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlRachSynchSeq_template* precondition = new L1ctlRachSynchSeq_template;
    precondition->set_param(*m_p->get_elem(0));
    L1ctlRachSynchSeq_template* implied_template = new L1ctlRachSynchSeq_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = L1ctlRachSynchSeq_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@L1CTL_Types.L1ctlRachSynchSeq");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlRachSynchSeq_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_VALUE:
if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return;
break;
case TR_OMIT:
if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return;
break;
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 : "@L1CTL_Types.L1ctlRachSynchSeq");
}

L1ctlExtRachReq::L1ctlExtRachReq()
{
}

L1ctlExtRachReq::L1ctlExtRachReq(const INTEGER& par_ra11,
    const L1ctlRachSynchSeq& par_synch__seq,
    const INTEGER& par_combined,
    const INTEGER& par_offset)
  :   field_ra11(par_ra11),
  field_synch__seq(par_synch__seq),
  field_combined(par_combined),
  field_offset(par_offset)
{
}

L1ctlExtRachReq::L1ctlExtRachReq(const L1ctlExtRachReq& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlExtRachReq.");
if (other_value.ra11().is_bound()) field_ra11 = other_value.ra11();
else field_ra11.clean_up();
if (other_value.synch__seq().is_bound()) field_synch__seq = other_value.synch__seq();
else field_synch__seq.clean_up();
if (other_value.combined().is_bound()) field_combined = other_value.combined();
else field_combined.clean_up();
if (other_value.offset().is_bound()) field_offset = other_value.offset();
else field_offset.clean_up();
}

void L1ctlExtRachReq::clean_up()
{
field_ra11.clean_up();
field_synch__seq.clean_up();
field_combined.clean_up();
field_offset.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlExtRachReq::get_descriptor() const { return &L1ctlExtRachReq_descr_; }
L1ctlExtRachReq& L1ctlExtRachReq::operator=(const L1ctlExtRachReq& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlExtRachReq.");
  if (other_value.ra11().is_bound()) field_ra11 = other_value.ra11();
  else field_ra11.clean_up();
  if (other_value.synch__seq().is_bound()) field_synch__seq = other_value.synch__seq();
  else field_synch__seq.clean_up();
  if (other_value.combined().is_bound()) field_combined = other_value.combined();
  else field_combined.clean_up();
  if (other_value.offset().is_bound()) field_offset = other_value.offset();
  else field_offset.clean_up();
}
return *this;
}

boolean L1ctlExtRachReq::operator==(const L1ctlExtRachReq& other_value) const
{
return field_ra11==other_value.field_ra11
  && field_synch__seq==other_value.field_synch__seq
  && field_combined==other_value.field_combined
  && field_offset==other_value.field_offset;
}

boolean L1ctlExtRachReq::is_bound() const
{
return (field_ra11.is_bound())
  || (field_synch__seq.is_bound())
  || (field_combined.is_bound())
  || (field_offset.is_bound());
}
boolean L1ctlExtRachReq::is_value() const
{
return field_ra11.is_value()
  && field_synch__seq.is_value()
  && field_combined.is_value()
  && field_offset.is_value();
}
void L1ctlExtRachReq::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ ra11 := ");
field_ra11.log();
TTCN_Logger::log_event_str(", synch_seq := ");
field_synch__seq.log();
TTCN_Logger::log_event_str(", combined := ");
field_combined.log();
TTCN_Logger::log_event_str(", offset := ");
field_offset.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlExtRachReq::set_implicit_omit()
{
if (ra11().is_bound()) ra11().set_implicit_omit();
if (synch__seq().is_bound()) synch__seq().set_implicit_omit();
if (combined().is_bound()) combined().set_implicit_omit();
if (offset().is_bound()) offset().set_implicit_omit();
}

void L1ctlExtRachReq::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 @L1CTL_Types.L1ctlExtRachReq 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) ra11().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) synch__seq().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) combined().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) offset().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(), "ra11")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ra11().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(), "synch_seq")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          synch__seq().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(), "combined")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          combined().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(), "offset")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          offset().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 @L1CTL_Types.L1ctlExtRachReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlExtRachReq");
  }
}

void L1ctlExtRachReq::encode_text(Text_Buf& text_buf) const
{
field_ra11.encode_text(text_buf);
field_synch__seq.encode_text(text_buf);
field_combined.encode_text(text_buf);
field_offset.encode_text(text_buf);
}

void L1ctlExtRachReq::decode_text(Text_Buf& text_buf)
{
field_ra11.decode_text(text_buf);
field_synch__seq.decode_text(text_buf);
field_combined.decode_text(text_buf);
field_offset.decode_text(text_buf);
}

void L1ctlExtRachReq::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 L1ctlExtRachReq::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 L1ctlExtRachReq::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, Osmocom__Types::uint16__t_descr_.raw->forceomit);
  decoded_field_length = field_ra11.RAW_decode(Osmocom__Types::uint16__t_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, L1ctlRachSynchSeq_descr_.raw->forceomit);
  decoded_field_length = field_synch__seq.RAW_decode(L1ctlRachSynchSeq_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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_combined.RAW_decode(Osmocom__Types::uint8__t_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, Osmocom__Types::uint16__t_descr_.raw->forceomit);
  decoded_field_length = field_offset.RAW_decode(Osmocom__Types::uint16__t_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 L1ctlExtRachReq::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, Osmocom__Types::uint16__t_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, L1ctlRachSynchSeq_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, Osmocom__Types::uint16__t_descr_.raw);
  encoded_length += field_ra11.RAW_encode(Osmocom__Types::uint16__t_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_synch__seq.RAW_encode(L1ctlRachSynchSeq_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_combined.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_offset.RAW_encode(Osmocom__Types::uint16__t_descr_, *myleaf.body.node.nodes[3]);
  return myleaf.length = encoded_length;
}

struct L1ctlExtRachReq_template::single_value_struct {
INTEGER_template field_ra11;
L1ctlRachSynchSeq_template field_synch__seq;
INTEGER_template field_combined;
INTEGER_template field_offset;
};

void L1ctlExtRachReq_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_ra11 = ANY_VALUE;
single_value->field_synch__seq = ANY_VALUE;
single_value->field_combined = ANY_VALUE;
single_value->field_offset = ANY_VALUE;
}
}
}

void L1ctlExtRachReq_template::copy_value(const L1ctlExtRachReq& other_value)
{
single_value = new single_value_struct;
if (other_value.ra11().is_bound()) {
  single_value->field_ra11 = other_value.ra11();
} else {
  single_value->field_ra11.clean_up();
}
if (other_value.synch__seq().is_bound()) {
  single_value->field_synch__seq = other_value.synch__seq();
} else {
  single_value->field_synch__seq.clean_up();
}
if (other_value.combined().is_bound()) {
  single_value->field_combined = other_value.combined();
} else {
  single_value->field_combined.clean_up();
}
if (other_value.offset().is_bound()) {
  single_value->field_offset = other_value.offset();
} else {
  single_value->field_offset.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlExtRachReq_template::copy_template(const L1ctlExtRachReq_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.ra11().get_selection()) {
single_value->field_ra11 = other_value.ra11();
} else {
single_value->field_ra11.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.synch__seq().get_selection()) {
single_value->field_synch__seq = other_value.synch__seq();
} else {
single_value->field_synch__seq.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.combined().get_selection()) {
single_value->field_combined = other_value.combined();
} else {
single_value->field_combined.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.offset().get_selection()) {
single_value->field_offset = other_value.offset();
} else {
single_value->field_offset.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 L1ctlExtRachReq_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 L1ctlExtRachReq_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlExtRachReq_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 @L1CTL_Types.L1ctlExtRachReq.");
break;
}
set_selection(other_value);
}

L1ctlExtRachReq_template::L1ctlExtRachReq_template()
{
}

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

L1ctlExtRachReq_template::L1ctlExtRachReq_template(const L1ctlExtRachReq& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlExtRachReq_template::match(const L1ctlExtRachReq& 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.ra11().is_bound()) return FALSE;
if(!single_value->field_ra11.match(other_value.ra11(), legacy))return FALSE;
if(!other_value.synch__seq().is_bound()) return FALSE;
if(!single_value->field_synch__seq.match(other_value.synch__seq(), legacy))return FALSE;
if(!other_value.combined().is_bound()) return FALSE;
if(!single_value->field_combined.match(other_value.combined(), legacy))return FALSE;
if(!other_value.offset().is_bound()) return FALSE;
if(!single_value->field_offset.match(other_value.offset(), 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 @L1CTL_Types.L1ctlExtRachReq.");
}
return FALSE;
}

boolean L1ctlExtRachReq_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_ra11.is_bound()
 || single_value->field_synch__seq.is_bound()
 || single_value->field_combined.is_bound()
 || single_value->field_offset.is_bound();
}

boolean L1ctlExtRachReq_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_ra11.is_value()
 && single_value->field_synch__seq.is_value()
 && single_value->field_combined.is_value()
 && single_value->field_offset.is_value();
}

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

L1ctlExtRachReq L1ctlExtRachReq_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 @L1CTL_Types.L1ctlExtRachReq.");
L1ctlExtRachReq ret_val;
if (single_value->field_ra11.is_bound()) {
ret_val.ra11() = single_value->field_ra11.valueof();
}
if (single_value->field_synch__seq.is_bound()) {
ret_val.synch__seq() = single_value->field_synch__seq.valueof();
}
if (single_value->field_combined.is_bound()) {
ret_val.combined() = single_value->field_combined.valueof();
}
if (single_value->field_offset.is_bound()) {
ret_val.offset() = single_value->field_offset.valueof();
}
return ret_val;
}

void L1ctlExtRachReq_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 @L1CTL_Types.L1ctlExtRachReq.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlExtRachReq_template[list_length];
}

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

INTEGER_template& L1ctlExtRachReq_template::ra11()
{
set_specific();
return single_value->field_ra11;
}

const INTEGER_template& L1ctlExtRachReq_template::ra11() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ra11 of a non-specific template of type @L1CTL_Types.L1ctlExtRachReq.");
return single_value->field_ra11;
}

L1ctlRachSynchSeq_template& L1ctlExtRachReq_template::synch__seq()
{
set_specific();
return single_value->field_synch__seq;
}

const L1ctlRachSynchSeq_template& L1ctlExtRachReq_template::synch__seq() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field synch_seq of a non-specific template of type @L1CTL_Types.L1ctlExtRachReq.");
return single_value->field_synch__seq;
}

INTEGER_template& L1ctlExtRachReq_template::combined()
{
set_specific();
return single_value->field_combined;
}

const INTEGER_template& L1ctlExtRachReq_template::combined() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field combined of a non-specific template of type @L1CTL_Types.L1ctlExtRachReq.");
return single_value->field_combined;
}

INTEGER_template& L1ctlExtRachReq_template::offset()
{
set_specific();
return single_value->field_offset;
}

const INTEGER_template& L1ctlExtRachReq_template::offset() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field offset of a non-specific template of type @L1CTL_Types.L1ctlExtRachReq.");
return single_value->field_offset;
}

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

void L1ctlExtRachReq_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ ra11 := ");
single_value->field_ra11.log();
TTCN_Logger::log_event_str(", synch_seq := ");
single_value->field_synch__seq.log();
TTCN_Logger::log_event_str(", combined := ");
single_value->field_combined.log();
TTCN_Logger::log_event_str(", offset := ");
single_value->field_offset.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 L1ctlExtRachReq_template::log_match(const L1ctlExtRachReq& 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_ra11.match(match_value.ra11(), legacy)){
TTCN_Logger::log_logmatch_info(".ra11");
single_value->field_ra11.log_match(match_value.ra11(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_synch__seq.match(match_value.synch__seq(), legacy)){
TTCN_Logger::log_logmatch_info(".synch_seq");
single_value->field_synch__seq.log_match(match_value.synch__seq(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_combined.match(match_value.combined(), legacy)){
TTCN_Logger::log_logmatch_info(".combined");
single_value->field_combined.log_match(match_value.combined(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_offset.match(match_value.offset(), legacy)){
TTCN_Logger::log_logmatch_info(".offset");
single_value->field_offset.log_match(match_value.offset(), 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("{ ra11 := ");
single_value->field_ra11.log_match(match_value.ra11(), legacy);
TTCN_Logger::log_event_str(", synch_seq := ");
single_value->field_synch__seq.log_match(match_value.synch__seq(), legacy);
TTCN_Logger::log_event_str(", combined := ");
single_value->field_combined.log_match(match_value.combined(), legacy);
TTCN_Logger::log_event_str(", offset := ");
single_value->field_offset.log_match(match_value.offset(), 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 L1ctlExtRachReq_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (ra11().is_bound()) ra11().set_implicit_omit();
if (synch__seq().is_bound()) synch__seq().set_implicit_omit();
if (combined().is_bound()) combined().set_implicit_omit();
if (offset().is_bound()) offset().set_implicit_omit();
}

void L1ctlExtRachReq_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_ra11.encode_text(text_buf);
single_value->field_synch__seq.encode_text(text_buf);
single_value->field_combined.encode_text(text_buf);
single_value->field_offset.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 @L1CTL_Types.L1ctlExtRachReq.");
}
}

void L1ctlExtRachReq_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_ra11.decode_text(text_buf);
single_value->field_synch__seq.decode_text(text_buf);
single_value->field_combined.decode_text(text_buf);
single_value->field_offset.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 L1ctlExtRachReq_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 @L1CTL_Types.L1ctlExtRachReq.");
}
}

void L1ctlExtRachReq_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: {
    L1ctlExtRachReq_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 @L1CTL_Types.L1ctlExtRachReq 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) ra11().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) synch__seq().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) combined().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) offset().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(), "ra11")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ra11().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(), "synch_seq")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          synch__seq().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(), "combined")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          combined().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(), "offset")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          offset().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 @L1CTL_Types.L1ctlExtRachReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlExtRachReq_template* precondition = new L1ctlExtRachReq_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlExtRachReq_template* implied_template = new L1ctlExtRachReq_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlExtRachReq_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlExtRachReq");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlExtRachReq_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_ra11.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlExtRachReq");
single_value->field_synch__seq.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlExtRachReq");
single_value->field_combined.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlExtRachReq");
single_value->field_offset.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlExtRachReq");
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 : "@L1CTL_Types.L1ctlExtRachReq");
}

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

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

L1ctlParReq::L1ctlParReq()
{
}

L1ctlParReq::L1ctlParReq(const INTEGER& par_ta,
    const INTEGER& par_tx__power,
    const OCTETSTRING& par_padding)
  :   field_ta(par_ta),
  field_tx__power(par_tx__power),
  field_padding(par_padding)
{
}

L1ctlParReq::L1ctlParReq(const L1ctlParReq& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlParReq.");
if (other_value.ta().is_bound()) field_ta = other_value.ta();
else field_ta.clean_up();
if (other_value.tx__power().is_bound()) field_tx__power = other_value.tx__power();
else field_tx__power.clean_up();
if (other_value.padding().is_bound()) field_padding = other_value.padding();
else field_padding.clean_up();
}

void L1ctlParReq::clean_up()
{
field_ta.clean_up();
field_tx__power.clean_up();
field_padding.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlParReq::get_descriptor() const { return &L1ctlParReq_descr_; }
L1ctlParReq& L1ctlParReq::operator=(const L1ctlParReq& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlParReq.");
  if (other_value.ta().is_bound()) field_ta = other_value.ta();
  else field_ta.clean_up();
  if (other_value.tx__power().is_bound()) field_tx__power = other_value.tx__power();
  else field_tx__power.clean_up();
  if (other_value.padding().is_bound()) field_padding = other_value.padding();
  else field_padding.clean_up();
}
return *this;
}

boolean L1ctlParReq::operator==(const L1ctlParReq& other_value) const
{
return field_ta==other_value.field_ta
  && field_tx__power==other_value.field_tx__power
  && field_padding==other_value.field_padding;
}

boolean L1ctlParReq::is_bound() const
{
return (field_ta.is_bound())
  || (field_tx__power.is_bound())
  || (field_padding.is_bound());
}
boolean L1ctlParReq::is_value() const
{
return field_ta.is_value()
  && field_tx__power.is_value()
  && field_padding.is_value();
}
void L1ctlParReq::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ ta := ");
field_ta.log();
TTCN_Logger::log_event_str(", tx_power := ");
field_tx__power.log();
TTCN_Logger::log_event_str(", padding := ");
field_padding.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlParReq::set_implicit_omit()
{
if (ta().is_bound()) ta().set_implicit_omit();
if (tx__power().is_bound()) tx__power().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

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

void L1ctlParReq::encode_text(Text_Buf& text_buf) const
{
field_ta.encode_text(text_buf);
field_tx__power.encode_text(text_buf);
field_padding.encode_text(text_buf);
}

void L1ctlParReq::decode_text(Text_Buf& text_buf)
{
field_ta.decode_text(text_buf);
field_tx__power.decode_text(text_buf);
field_padding.decode_text(text_buf);
}

void L1ctlParReq::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 L1ctlParReq::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 L1ctlParReq::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, Osmocom__Types::int8__t_descr_.raw->forceomit);
  decoded_field_length = field_ta.RAW_decode(Osmocom__Types::int8__t_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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_tx__power.RAW_decode(Osmocom__Types::uint8__t_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::OCT2_descr_.raw->forceomit);
  decoded_field_length = field_padding.RAW_decode(General__Types::OCT2_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 L1ctlParReq::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, Osmocom__Types::int8__t_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::OCT2_descr_.raw);
  encoded_length += field_ta.RAW_encode(Osmocom__Types::int8__t_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_tx__power.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_padding.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct L1ctlParReq_template::single_value_struct {
INTEGER_template field_ta;
INTEGER_template field_tx__power;
OCTETSTRING_template field_padding;
};

void L1ctlParReq_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_ta = ANY_VALUE;
single_value->field_tx__power = ANY_VALUE;
single_value->field_padding = ANY_VALUE;
}
}
}

void L1ctlParReq_template::copy_value(const L1ctlParReq& other_value)
{
single_value = new single_value_struct;
if (other_value.ta().is_bound()) {
  single_value->field_ta = other_value.ta();
} else {
  single_value->field_ta.clean_up();
}
if (other_value.tx__power().is_bound()) {
  single_value->field_tx__power = other_value.tx__power();
} else {
  single_value->field_tx__power.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 L1ctlParReq_template::copy_template(const L1ctlParReq_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.ta().get_selection()) {
single_value->field_ta = other_value.ta();
} else {
single_value->field_ta.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tx__power().get_selection()) {
single_value->field_tx__power = other_value.tx__power();
} else {
single_value->field_tx__power.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 L1ctlParReq_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 L1ctlParReq_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlParReq_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 @L1CTL_Types.L1ctlParReq.");
break;
}
set_selection(other_value);
}

L1ctlParReq_template::L1ctlParReq_template()
{
}

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

L1ctlParReq_template::L1ctlParReq_template(const L1ctlParReq& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlParReq_template::match(const L1ctlParReq& 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.ta().is_bound()) return FALSE;
if(!single_value->field_ta.match(other_value.ta(), legacy))return FALSE;
if(!other_value.tx__power().is_bound()) return FALSE;
if(!single_value->field_tx__power.match(other_value.tx__power(), 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 @L1CTL_Types.L1ctlParReq.");
}
return FALSE;
}

boolean L1ctlParReq_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_ta.is_bound()
 || single_value->field_tx__power.is_bound()
 || single_value->field_padding.is_bound();
}

boolean L1ctlParReq_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_ta.is_value()
 && single_value->field_tx__power.is_value()
 && single_value->field_padding.is_value();
}

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

L1ctlParReq L1ctlParReq_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 @L1CTL_Types.L1ctlParReq.");
L1ctlParReq ret_val;
if (single_value->field_ta.is_bound()) {
ret_val.ta() = single_value->field_ta.valueof();
}
if (single_value->field_tx__power.is_bound()) {
ret_val.tx__power() = single_value->field_tx__power.valueof();
}
if (single_value->field_padding.is_bound()) {
ret_val.padding() = single_value->field_padding.valueof();
}
return ret_val;
}

void L1ctlParReq_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 @L1CTL_Types.L1ctlParReq.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlParReq_template[list_length];
}

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

INTEGER_template& L1ctlParReq_template::ta()
{
set_specific();
return single_value->field_ta;
}

const INTEGER_template& L1ctlParReq_template::ta() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ta of a non-specific template of type @L1CTL_Types.L1ctlParReq.");
return single_value->field_ta;
}

INTEGER_template& L1ctlParReq_template::tx__power()
{
set_specific();
return single_value->field_tx__power;
}

const INTEGER_template& L1ctlParReq_template::tx__power() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tx_power of a non-specific template of type @L1CTL_Types.L1ctlParReq.");
return single_value->field_tx__power;
}

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

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

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

void L1ctlParReq_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ ta := ");
single_value->field_ta.log();
TTCN_Logger::log_event_str(", tx_power := ");
single_value->field_tx__power.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 L1ctlParReq_template::log_match(const L1ctlParReq& 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_ta.match(match_value.ta(), legacy)){
TTCN_Logger::log_logmatch_info(".ta");
single_value->field_ta.log_match(match_value.ta(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tx__power.match(match_value.tx__power(), legacy)){
TTCN_Logger::log_logmatch_info(".tx_power");
single_value->field_tx__power.log_match(match_value.tx__power(), 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("{ ta := ");
single_value->field_ta.log_match(match_value.ta(), legacy);
TTCN_Logger::log_event_str(", tx_power := ");
single_value->field_tx__power.log_match(match_value.tx__power(), 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 L1ctlParReq_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (ta().is_bound()) ta().set_implicit_omit();
if (tx__power().is_bound()) tx__power().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

void L1ctlParReq_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_ta.encode_text(text_buf);
single_value->field_tx__power.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 @L1CTL_Types.L1ctlParReq.");
}
}

void L1ctlParReq_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_ta.decode_text(text_buf);
single_value->field_tx__power.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 L1ctlParReq_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 @L1CTL_Types.L1ctlParReq.");
}
}

void L1ctlParReq_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: {
    L1ctlParReq_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 @L1CTL_Types.L1ctlParReq 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) ta().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tx__power().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) padding().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(), "ta")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ta().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(), "tx_power")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tx__power().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 @L1CTL_Types.L1ctlParReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlParReq_template* precondition = new L1ctlParReq_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlParReq_template* implied_template = new L1ctlParReq_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlParReq_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlParReq");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlParReq_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_ta.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlParReq");
single_value->field_tx__power.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlParReq");
single_value->field_padding.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlParReq");
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 : "@L1CTL_Types.L1ctlParReq");
}

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

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

L1ctlDataReq::L1ctlDataReq()
{
}

L1ctlDataReq::L1ctlDataReq(const OPTIONAL< GSM__RR__Types::SacchL1Header >& par_l1header,
    const OCTETSTRING& par_l2__payload)
  :   field_l1header(par_l1header),
  field_l2__payload(par_l2__payload)
{
}

L1ctlDataReq::L1ctlDataReq(const L1ctlDataReq& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlDataReq.");
if (other_value.l1header().is_bound()) field_l1header = other_value.l1header();
else field_l1header.clean_up();
if (other_value.l2__payload().is_bound()) field_l2__payload = other_value.l2__payload();
else field_l2__payload.clean_up();
}

void L1ctlDataReq::clean_up()
{
field_l1header.clean_up();
field_l2__payload.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlDataReq::get_descriptor() const { return &L1ctlDataReq_descr_; }
L1ctlDataReq& L1ctlDataReq::operator=(const L1ctlDataReq& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlDataReq.");
  if (other_value.l1header().is_bound()) field_l1header = other_value.l1header();
  else field_l1header.clean_up();
  if (other_value.l2__payload().is_bound()) field_l2__payload = other_value.l2__payload();
  else field_l2__payload.clean_up();
}
return *this;
}

boolean L1ctlDataReq::operator==(const L1ctlDataReq& other_value) const
{
return field_l1header==other_value.field_l1header
  && field_l2__payload==other_value.field_l2__payload;
}

boolean L1ctlDataReq::is_bound() const
{
return (OPTIONAL_OMIT == field_l1header.get_selection() || field_l1header.is_bound())
  || (field_l2__payload.is_bound());
}
boolean L1ctlDataReq::is_value() const
{
return (OPTIONAL_OMIT == field_l1header.get_selection() || field_l1header.is_value())
  && field_l2__payload.is_value();
}
int L1ctlDataReq::size_of() const
{
  int ret_val = 1;
  if (field_l1header.ispresent()) ret_val++;
  return ret_val;
}

void L1ctlDataReq::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ l1header := ");
field_l1header.log();
TTCN_Logger::log_event_str(", l2_payload := ");
field_l2__payload.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlDataReq::set_implicit_omit()
{
if (!l1header().is_bound()) l1header() = OMIT_VALUE;
else l1header().set_implicit_omit();
if (l2__payload().is_bound()) l2__payload().set_implicit_omit();
}

void L1ctlDataReq::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record value of type @L1CTL_Types.L1ctlDataReq has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) l1header().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) l2__payload().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "l1header")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          l1header().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(), "l2_payload")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          l2__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 @L1CTL_Types.L1ctlDataReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlDataReq");
  }
}

void L1ctlDataReq::encode_text(Text_Buf& text_buf) const
{
field_l1header.encode_text(text_buf);
field_l2__payload.encode_text(text_buf);
}

void L1ctlDataReq::decode_text(Text_Buf& text_buf)
{
field_l1header.decode_text(text_buf);
field_l2__payload.decode_text(text_buf);
}

void L1ctlDataReq::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 L1ctlDataReq::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 L1ctlDataReq::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;
  if (limit > 0){
  if (force_omit != NULL && (*force_omit)(0)) {
    field_l1header = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_0_force_omit(0, force_omit, GSM__RR__Types::SacchL1Header_descr_.raw->forceomit);
  decoded_field_length = field_l1header().RAW_decode(GSM__RR__Types::SacchL1Header_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 1) {
  field_l1header = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  }
  }
  }
  else field_l1header=OMIT_VALUE;
  RAW_Force_Omit field_1_force_omit(1, force_omit, OCTETSTRING_descr_.raw->forceomit);
  decoded_field_length = field_l2__payload.RAW_decode(OCTETSTRING_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int L1ctlDataReq::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 2;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(2);
  if (field_l1header.ispresent()) {
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, GSM__RR__Types::SacchL1Header_descr_.raw);
  }
  else myleaf.body.node.nodes[0] = NULL;
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, OCTETSTRING_descr_.raw);
  if (field_l1header.ispresent()) {
  encoded_length += field_l1header().RAW_encode(GSM__RR__Types::SacchL1Header_descr_, *myleaf.body.node.nodes[0]);
  }
  encoded_length += field_l2__payload.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct L1ctlDataReq_template::single_value_struct {
GSM__RR__Types::SacchL1Header_template field_l1header;
OCTETSTRING_template field_l2__payload;
};

void L1ctlDataReq_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_l1header = ANY_OR_OMIT;
single_value->field_l2__payload = ANY_VALUE;
}
}
}

void L1ctlDataReq_template::copy_value(const L1ctlDataReq& other_value)
{
single_value = new single_value_struct;
if (other_value.l1header().is_bound()) {
  if (other_value.l1header().ispresent()) single_value->field_l1header = other_value.l1header()();
  else single_value->field_l1header = OMIT_VALUE;
} else {
  single_value->field_l1header.clean_up();
}
if (other_value.l2__payload().is_bound()) {
  single_value->field_l2__payload = other_value.l2__payload();
} else {
  single_value->field_l2__payload.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlDataReq_template::copy_template(const L1ctlDataReq_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.l1header().get_selection()) {
single_value->field_l1header = other_value.l1header();
} else {
single_value->field_l1header.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.l2__payload().get_selection()) {
single_value->field_l2__payload = other_value.l2__payload();
} else {
single_value->field_l2__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 L1ctlDataReq_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 L1ctlDataReq_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlDataReq_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 @L1CTL_Types.L1ctlDataReq.");
break;
}
set_selection(other_value);
}

L1ctlDataReq_template::L1ctlDataReq_template()
{
}

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

L1ctlDataReq_template::L1ctlDataReq_template(const L1ctlDataReq& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlDataReq_template::match(const L1ctlDataReq& 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.l1header().is_bound()) return FALSE;
if((other_value.l1header().ispresent() ? !single_value->field_l1header.match((const GSM__RR__Types::SacchL1Header&)other_value.l1header(), legacy) : !single_value->field_l1header.match_omit(legacy)))return FALSE;
if(!other_value.l2__payload().is_bound()) return FALSE;
if(!single_value->field_l2__payload.match(other_value.l2__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 @L1CTL_Types.L1ctlDataReq.");
}
return FALSE;
}

boolean L1ctlDataReq_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return (single_value->field_l1header.is_omit() || single_value->field_l1header.is_bound())
 || single_value->field_l2__payload.is_bound();
}

boolean L1ctlDataReq_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return (single_value->field_l1header.is_omit() || single_value->field_l1header.is_value())
 && single_value->field_l2__payload.is_value();
}

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

L1ctlDataReq L1ctlDataReq_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 @L1CTL_Types.L1ctlDataReq.");
L1ctlDataReq ret_val;
if (single_value->field_l1header.is_omit()) ret_val.l1header() = OMIT_VALUE;
else if (single_value->field_l1header.is_bound()) {
ret_val.l1header() = single_value->field_l1header.valueof();
}
if (single_value->field_l2__payload.is_bound()) {
ret_val.l2__payload() = single_value->field_l2__payload.valueof();
}
return ret_val;
}

void L1ctlDataReq_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 @L1CTL_Types.L1ctlDataReq.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlDataReq_template[list_length];
}

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

GSM__RR__Types::SacchL1Header_template& L1ctlDataReq_template::l1header()
{
set_specific();
return single_value->field_l1header;
}

const GSM__RR__Types::SacchL1Header_template& L1ctlDataReq_template::l1header() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field l1header of a non-specific template of type @L1CTL_Types.L1ctlDataReq.");
return single_value->field_l1header;
}

OCTETSTRING_template& L1ctlDataReq_template::l2__payload()
{
set_specific();
return single_value->field_l2__payload;
}

const OCTETSTRING_template& L1ctlDataReq_template::l2__payload() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field l2_payload of a non-specific template of type @L1CTL_Types.L1ctlDataReq.");
return single_value->field_l2__payload;
}

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

void L1ctlDataReq_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ l1header := ");
single_value->field_l1header.log();
TTCN_Logger::log_event_str(", l2_payload := ");
single_value->field_l2__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 L1ctlDataReq_template::log_match(const L1ctlDataReq& 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 (match_value.l1header().ispresent()){
if(!single_value->field_l1header.match(match_value.l1header(), legacy)){
TTCN_Logger::log_logmatch_info(".l1header");
single_value->field_l1header.log_match(match_value.l1header(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_l1header.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".l1header := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_l1header.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_l2__payload.match(match_value.l2__payload(), legacy)){
TTCN_Logger::log_logmatch_info(".l2_payload");
single_value->field_l2__payload.log_match(match_value.l2__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("{ l1header := ");
if (match_value.l1header().ispresent()) {
single_value->field_l1header.log_match(match_value.l1header(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_l1header.log();
if (single_value->field_l1header.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", l2_payload := ");
single_value->field_l2__payload.log_match(match_value.l2__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 L1ctlDataReq_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (!l1header().is_bound()) l1header() = OMIT_VALUE;
else l1header().set_implicit_omit();
if (l2__payload().is_bound()) l2__payload().set_implicit_omit();
}

void L1ctlDataReq_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_l1header.encode_text(text_buf);
single_value->field_l2__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 @L1CTL_Types.L1ctlDataReq.");
}
}

void L1ctlDataReq_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_l1header.decode_text(text_buf);
single_value->field_l2__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 L1ctlDataReq_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 @L1CTL_Types.L1ctlDataReq.");
}
}

void L1ctlDataReq_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: {
    L1ctlDataReq_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @L1CTL_Types.L1ctlDataReq has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) l1header().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) l2__payload().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "l1header")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          l1header().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(), "l2_payload")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          l2__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 @L1CTL_Types.L1ctlDataReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlDataReq_template* precondition = new L1ctlDataReq_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlDataReq_template* implied_template = new L1ctlDataReq_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlDataReq_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlDataReq");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlDataReq_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_l1header.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlDataReq");
single_value->field_l2__payload.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlDataReq");
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 : "@L1CTL_Types.L1ctlDataReq");
}

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

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

L1ctlH0::L1ctlH0()
{
}

L1ctlH0::L1ctlH0(const INTEGER& par_h,
    const GSM__Types::GsmBandArfcn& par_arfcn,
    const OCTETSTRING& par_padding)
  :   field_h(par_h),
  field_arfcn(par_arfcn),
  field_padding(par_padding)
{
}

L1ctlH0::L1ctlH0(const L1ctlH0& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlH0.");
if (other_value.h().is_bound()) field_h = other_value.h();
else field_h.clean_up();
if (other_value.arfcn().is_bound()) field_arfcn = other_value.arfcn();
else field_arfcn.clean_up();
if (other_value.padding().is_bound()) field_padding = other_value.padding();
else field_padding.clean_up();
}

void L1ctlH0::clean_up()
{
field_h.clean_up();
field_arfcn.clean_up();
field_padding.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlH0::get_descriptor() const { return &L1ctlH0_descr_; }
L1ctlH0& L1ctlH0::operator=(const L1ctlH0& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlH0.");
  if (other_value.h().is_bound()) field_h = other_value.h();
  else field_h.clean_up();
  if (other_value.arfcn().is_bound()) field_arfcn = other_value.arfcn();
  else field_arfcn.clean_up();
  if (other_value.padding().is_bound()) field_padding = other_value.padding();
  else field_padding.clean_up();
}
return *this;
}

boolean L1ctlH0::operator==(const L1ctlH0& other_value) const
{
return field_h==other_value.field_h
  && field_arfcn==other_value.field_arfcn
  && field_padding==other_value.field_padding;
}

boolean L1ctlH0::is_bound() const
{
return (field_h.is_bound())
  || (field_arfcn.is_bound())
  || (field_padding.is_bound());
}
boolean L1ctlH0::is_value() const
{
return field_h.is_value()
  && field_arfcn.is_value()
  && field_padding.is_value();
}
void L1ctlH0::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ h := ");
field_h.log();
TTCN_Logger::log_event_str(", arfcn := ");
field_arfcn.log();
TTCN_Logger::log_event_str(", padding := ");
field_padding.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlH0::set_implicit_omit()
{
if (h().is_bound()) h().set_implicit_omit();
if (arfcn().is_bound()) arfcn().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

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

void L1ctlH0::encode_text(Text_Buf& text_buf) const
{
field_h.encode_text(text_buf);
field_arfcn.encode_text(text_buf);
field_padding.encode_text(text_buf);
}

void L1ctlH0::decode_text(Text_Buf& text_buf)
{
field_h.decode_text(text_buf);
field_arfcn.decode_text(text_buf);
field_padding.decode_text(text_buf);
}

void L1ctlH0::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 L1ctlH0::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 L1ctlH0::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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_h.RAW_decode(Osmocom__Types::uint8__t_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, GSM__Types::GsmBandArfcn_descr_.raw->forceomit);
  decoded_field_length = field_arfcn.RAW_decode(GSM__Types::GsmBandArfcn_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, L1ctlH0_padding_descr_.raw->forceomit);
  decoded_field_length = field_padding.RAW_decode(L1ctlH0_padding_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 L1ctlH0::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, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, GSM__Types::GsmBandArfcn_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, L1ctlH0_padding_descr_.raw);
  encoded_length += field_h.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_arfcn.RAW_encode(GSM__Types::GsmBandArfcn_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_padding.RAW_encode(L1ctlH0_padding_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct L1ctlH0_template::single_value_struct {
INTEGER_template field_h;
GSM__Types::GsmBandArfcn_template field_arfcn;
OCTETSTRING_template field_padding;
};

void L1ctlH0_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_h = ANY_VALUE;
single_value->field_arfcn = ANY_VALUE;
single_value->field_padding = ANY_VALUE;
}
}
}

void L1ctlH0_template::copy_value(const L1ctlH0& other_value)
{
single_value = new single_value_struct;
if (other_value.h().is_bound()) {
  single_value->field_h = other_value.h();
} else {
  single_value->field_h.clean_up();
}
if (other_value.arfcn().is_bound()) {
  single_value->field_arfcn = other_value.arfcn();
} else {
  single_value->field_arfcn.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 L1ctlH0_template::copy_template(const L1ctlH0_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.h().get_selection()) {
single_value->field_h = other_value.h();
} else {
single_value->field_h.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.arfcn().get_selection()) {
single_value->field_arfcn = other_value.arfcn();
} else {
single_value->field_arfcn.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 L1ctlH0_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 L1ctlH0_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlH0_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 @L1CTL_Types.L1ctlH0.");
break;
}
set_selection(other_value);
}

L1ctlH0_template::L1ctlH0_template()
{
}

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

L1ctlH0_template::L1ctlH0_template(const L1ctlH0& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlH0_template::match(const L1ctlH0& 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.h().is_bound()) return FALSE;
if(!single_value->field_h.match(other_value.h(), legacy))return FALSE;
if(!other_value.arfcn().is_bound()) return FALSE;
if(!single_value->field_arfcn.match(other_value.arfcn(), 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 @L1CTL_Types.L1ctlH0.");
}
return FALSE;
}

boolean L1ctlH0_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_h.is_bound()
 || single_value->field_arfcn.is_bound()
 || single_value->field_padding.is_bound();
}

boolean L1ctlH0_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_h.is_value()
 && single_value->field_arfcn.is_value()
 && single_value->field_padding.is_value();
}

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

L1ctlH0 L1ctlH0_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 @L1CTL_Types.L1ctlH0.");
L1ctlH0 ret_val;
if (single_value->field_h.is_bound()) {
ret_val.h() = single_value->field_h.valueof();
}
if (single_value->field_arfcn.is_bound()) {
ret_val.arfcn() = single_value->field_arfcn.valueof();
}
if (single_value->field_padding.is_bound()) {
ret_val.padding() = single_value->field_padding.valueof();
}
return ret_val;
}

void L1ctlH0_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 @L1CTL_Types.L1ctlH0.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlH0_template[list_length];
}

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

INTEGER_template& L1ctlH0_template::h()
{
set_specific();
return single_value->field_h;
}

const INTEGER_template& L1ctlH0_template::h() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field h of a non-specific template of type @L1CTL_Types.L1ctlH0.");
return single_value->field_h;
}

GSM__Types::GsmBandArfcn_template& L1ctlH0_template::arfcn()
{
set_specific();
return single_value->field_arfcn;
}

const GSM__Types::GsmBandArfcn_template& L1ctlH0_template::arfcn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field arfcn of a non-specific template of type @L1CTL_Types.L1ctlH0.");
return single_value->field_arfcn;
}

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

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

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

void L1ctlH0_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ h := ");
single_value->field_h.log();
TTCN_Logger::log_event_str(", arfcn := ");
single_value->field_arfcn.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 L1ctlH0_template::log_match(const L1ctlH0& 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_h.match(match_value.h(), legacy)){
TTCN_Logger::log_logmatch_info(".h");
single_value->field_h.log_match(match_value.h(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_arfcn.match(match_value.arfcn(), legacy)){
TTCN_Logger::log_logmatch_info(".arfcn");
single_value->field_arfcn.log_match(match_value.arfcn(), 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("{ h := ");
single_value->field_h.log_match(match_value.h(), legacy);
TTCN_Logger::log_event_str(", arfcn := ");
single_value->field_arfcn.log_match(match_value.arfcn(), 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 L1ctlH0_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (h().is_bound()) h().set_implicit_omit();
if (arfcn().is_bound()) arfcn().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

void L1ctlH0_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_h.encode_text(text_buf);
single_value->field_arfcn.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 @L1CTL_Types.L1ctlH0.");
}
}

void L1ctlH0_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_h.decode_text(text_buf);
single_value->field_arfcn.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 L1ctlH0_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 @L1CTL_Types.L1ctlH0.");
}
}

void L1ctlH0_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: {
    L1ctlH0_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 @L1CTL_Types.L1ctlH0 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) h().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) arfcn().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) padding().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(), "h")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          h().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(), "arfcn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          arfcn().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 @L1CTL_Types.L1ctlH0: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlH0_template* precondition = new L1ctlH0_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlH0_template* implied_template = new L1ctlH0_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlH0_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlH0");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlH0_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_h.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlH0");
single_value->field_arfcn.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlH0");
single_value->field_padding.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlH0");
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 : "@L1CTL_Types.L1ctlH0");
}

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

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


const GSM__Types::GsmBandArfcn L1ctlMA::UNBOUND_ELEM;
L1ctlMA::L1ctlMA()
{
val_ptr = NULL;
}

L1ctlMA::L1ctlMA(null_type)
{
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
}

L1ctlMA::L1ctlMA(const L1ctlMA& other_value)
{
if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlMA.");
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}

L1ctlMA::~L1ctlMA()
{
clean_up();
if (val_ptr != NULL) val_ptr = NULL;
}

void L1ctlMA::clean_up()
{
if (val_ptr != NULL) {
if (val_ptr->ref_count > 1) {
val_ptr->ref_count--;
val_ptr = NULL;
}
else if (val_ptr->ref_count == 1) {
for (int elem_count = 0; elem_count < val_ptr->n_elements;
elem_count++)
if (val_ptr->value_elements[elem_count] != NULL)
delete val_ptr->value_elements[elem_count];
free_pointers((void**)val_ptr->value_elements);
delete val_ptr;
val_ptr = NULL;
}
else
TTCN_error("Internal error: Invalid reference counter in a record of/set of value.");
}
}

L1ctlMA& L1ctlMA::operator=(null_type)
{
clean_up();
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
return *this;
}

L1ctlMA& L1ctlMA::operator=(const L1ctlMA& other_value)
{
if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @L1CTL_Types.L1ctlMA.");
if (this != &other_value) {
clean_up();
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}
return *this;
}

boolean L1ctlMA::operator==(null_type) const
{
if (val_ptr == NULL)
TTCN_error("The left operand of comparison is an unbound value of type @L1CTL_Types.L1ctlMA.");
return val_ptr->n_elements == 0 ;
}

boolean L1ctlMA::operator==(const L1ctlMA& other_value) const
{
if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @L1CTL_Types.L1ctlMA.");
if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @L1CTL_Types.L1ctlMA.");
if (val_ptr == other_value.val_ptr) return TRUE;
if (val_ptr->n_elements != (other_value.val_ptr)->n_elements)
return FALSE;
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){
if (val_ptr->value_elements[elem_count] != NULL){
if ((other_value.val_ptr)->value_elements[elem_count] != NULL){
  if (*val_ptr->value_elements[elem_count] != *(other_value.val_ptr)->value_elements[elem_count]) return FALSE;
} else return FALSE;
} else {
if ((other_value.val_ptr)->value_elements[elem_count] != NULL) return FALSE;
}
}
return TRUE;
}

GSM__Types::GsmBandArfcn& L1ctlMA::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of type @L1CTL_Types.L1ctlMA using a negative index: %d.", index_value);
if (val_ptr == NULL) {
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
} else if (val_ptr->ref_count > 1) {
struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct;
new_val_ptr->ref_count = 1;
new_val_ptr->n_elements = (index_value >= val_ptr->n_elements) ? index_value + 1 : val_ptr->n_elements;
new_val_ptr->value_elements = (GSM__Types::GsmBandArfcn**)allocate_pointers(new_val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){
if (val_ptr->value_elements[elem_count] != NULL){
new_val_ptr->value_elements[elem_count] = new GSM__Types::GsmBandArfcn(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (index_value >= val_ptr->n_elements) set_size(index_value + 1);
if (val_ptr->value_elements[index_value] == NULL) {
val_ptr->value_elements[index_value] = new GSM__Types::GsmBandArfcn;
}
return *val_ptr->value_elements[index_value];
}

GSM__Types::GsmBandArfcn& L1ctlMA::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @L1CTL_Types.L1ctlMA.");
return (*this)[(int)index_value];
}

const GSM__Types::GsmBandArfcn& L1ctlMA::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @L1CTL_Types.L1ctlMA.");
if (index_value < 0) TTCN_error("Accessing an element of type @L1CTL_Types.L1ctlMA using a negative index: %d.", index_value);
if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @L1CTL_Types.L1ctlMA: The index is %d, but the value has only %d elements.", index_value, val_ptr->n_elements);
return (val_ptr->value_elements[index_value] == NULL) ?
UNBOUND_ELEM : *val_ptr->value_elements[index_value];
}

const GSM__Types::GsmBandArfcn& L1ctlMA::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @L1CTL_Types.L1ctlMA.");
return (*this)[(int)index_value];
}

L1ctlMA L1ctlMA::operator<<=(int rotate_count) const
{
return *this >>= (-rotate_count);
}

L1ctlMA L1ctlMA::operator<<=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate left operator.");
return *this >>= (int)(-rotate_count);
}

L1ctlMA L1ctlMA::operator>>=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate right operator.");
return *this >>= (int)rotate_count;
}

L1ctlMA L1ctlMA::operator>>=(int rotate_count) const
{
if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @L1CTL_Types.L1ctlMA.");
if (val_ptr->n_elements == 0) return *this;
int rc;
if (rotate_count>=0) rc = rotate_count % val_ptr->n_elements;
else rc = val_ptr->n_elements - ((-rotate_count) % val_ptr->n_elements);
if (rc == 0) return *this;
L1ctlMA ret_val;
ret_val.set_size(val_ptr->n_elements);
for (int i=0; i<val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[(i+rc)%val_ptr->n_elements] =new GSM__Types::GsmBandArfcn(*val_ptr->value_elements[i]);
}
}
return ret_val;
}

L1ctlMA L1ctlMA::operator+(const L1ctlMA& other_value) const
{
if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @L1CTL_Types.L1ctlMA concatenation.");
if (val_ptr->n_elements == 0) return other_value;
if (other_value.val_ptr->n_elements == 0) return *this;
L1ctlMA ret_val;
ret_val.set_size(val_ptr->n_elements+other_value.val_ptr->n_elements);
for (int i=0; i<val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i] = new GSM__Types::GsmBandArfcn(*val_ptr->value_elements[i]);
}
}
for (int i=0; i<other_value.val_ptr->n_elements; i++) {
if (other_value.val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i+val_ptr->n_elements] = new GSM__Types::GsmBandArfcn(*other_value.val_ptr->value_elements[i]);
}
}
return ret_val;
}

L1ctlMA L1ctlMA::substr(int index, int returncount) const
{
if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @L1CTL_Types.L1ctlMA.");
check_substr_arguments(val_ptr->n_elements, index, returncount, "@L1CTL_Types.L1ctlMA","element");
L1ctlMA ret_val;
ret_val.set_size(returncount);
for (int i=0; i<returncount; i++) {
if (val_ptr->value_elements[i+index] != NULL) {
ret_val.val_ptr->value_elements[i] = new GSM__Types::GsmBandArfcn(*val_ptr->value_elements[i+index]);
}
}
return ret_val;
}

L1ctlMA L1ctlMA::replace(int index, int len, const L1ctlMA& repl) const
{
if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @L1CTL_Types.L1ctlMA.");
if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @L1CTL_Types.L1ctlMA.");
check_replace_arguments(val_ptr->n_elements, index, len, "@L1CTL_Types.L1ctlMA","element");
L1ctlMA ret_val;
ret_val.set_size(val_ptr->n_elements + repl.val_ptr->n_elements - len);
for (int i = 0; i < index; i++) {
if (val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i] = new GSM__Types::GsmBandArfcn(*val_ptr->value_elements[i]);
}
}
for (int i = 0; i < repl.val_ptr->n_elements; i++) {
if (repl.val_ptr->value_elements[i] != NULL) {
ret_val.val_ptr->value_elements[i+index] = new GSM__Types::GsmBandArfcn(*repl.val_ptr->value_elements[i]);
}
}
for (int i = 0; i < val_ptr->n_elements - index - len; i++) {
if (val_ptr->value_elements[index+i+len] != NULL) {
ret_val.val_ptr->value_elements[index+i+repl.val_ptr->n_elements] = new GSM__Types::GsmBandArfcn(*val_ptr->value_elements[index+i+len]);
}
}
return ret_val;
}

L1ctlMA L1ctlMA::replace(int index, int len, const L1ctlMA_template& repl) const
{
if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value.");
return replace(index, len, repl.valueof());
}

void L1ctlMA::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @L1CTL_Types.L1ctlMA.");
if (val_ptr == NULL) {
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
} else if (val_ptr->ref_count > 1) {
struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct;
new_val_ptr->ref_count = 1;
new_val_ptr->n_elements = (new_size < val_ptr->n_elements) ? new_size : val_ptr->n_elements;
new_val_ptr->value_elements = (GSM__Types::GsmBandArfcn**)allocate_pointers(new_val_ptr->n_elements);
for (int elem_count = 0; elem_count < new_val_ptr->n_elements; elem_count++) {
if (val_ptr->value_elements[elem_count] != NULL){
new_val_ptr->value_elements[elem_count] = new GSM__Types::GsmBandArfcn(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (GSM__Types::GsmBandArfcn**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
#ifdef TITAN_MEMORY_DEBUG_SET_RECORD_OF
if((val_ptr->n_elements/1000)!=(new_size/1000)) TTCN_warning("New size of type @L1CTL_Types.L1ctlMA: %d",new_size);
#endif
val_ptr->n_elements = new_size;
} else if (new_size < val_ptr->n_elements) {
for (int elem_count = new_size; elem_count < val_ptr->n_elements; elem_count++)
if (val_ptr->value_elements[elem_count] != NULL)delete val_ptr->value_elements[elem_count];
val_ptr->value_elements = (GSM__Types::GsmBandArfcn**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}

boolean L1ctlMA::is_value() const
{
if (val_ptr == NULL) return FALSE;
for(int i = 0; i < val_ptr->n_elements; ++i) {
if (val_ptr->value_elements[i] == NULL || !val_ptr->value_elements[i]->is_value()) return FALSE;
}
return TRUE;
}

int L1ctlMA::size_of() const
{
if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @L1CTL_Types.L1ctlMA.");
return val_ptr->n_elements;
}

int L1ctlMA::lengthof() const
{
if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @L1CTL_Types.L1ctlMA.");
for (int my_length=val_ptr->n_elements; my_length>0; my_length--) if (val_ptr->value_elements[my_length-1] != NULL) return my_length;
return 0;
}

void L1ctlMA::log() const
{
if (val_ptr == NULL) {;
TTCN_Logger::log_event_unbound();
return;
}
switch (val_ptr->n_elements) {
case 0:
TTCN_Logger::log_event_str("{ }");
break;
default:
TTCN_Logger::log_event_str("{ ");
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
(*this)[elem_count].log();
}
TTCN_Logger::log_event_str(" }");
}
}

void L1ctlMA::set_implicit_omit()
{
if (val_ptr == NULL) return;
for (int i = 0; i < val_ptr->n_elements; i++) {
if (val_ptr->value_elements[i] != NULL) val_ptr->value_elements[i]->set_implicit_omit();
}
}

void L1ctlMA::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE|Module_Param::BC_LIST, "record of value");
  switch (param.get_operation_type()) {
  case Module_Param::OT_ASSIGN:
    if (param.get_type()==Module_Param::MP_Value_List && param.get_size()==0) {
      *this = NULL_VALUE;
      return;
    }
    switch (param.get_type()) {
    case Module_Param::MP_Value_List:
      set_size(param.get_size());
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        if (curr->get_type()!=Module_Param::MP_NotUsed) {
          (*this)[i].set_param(*curr);
          if (!(*this)[i].is_bound()) {
            delete val_ptr->value_elements[i];
            val_ptr->value_elements[i] = NULL;
          }
        }
      }
      break;
    case Module_Param::MP_Indexed_List:
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        (*this)[curr->get_id()->get_index()].set_param(*curr);
        if (!(*this)[curr->get_id()->get_index()].is_bound()) {
          delete val_ptr->value_elements[curr->get_id()->get_index()];
          val_ptr->value_elements[curr->get_id()->get_index()] = NULL;
        }
      }
      break;
    default:
      param.type_error("record of value", "@L1CTL_Types.L1ctlMA");
    }
    break;
  case Module_Param::OT_CONCAT:
    switch (param.get_type()) {
    case Module_Param::MP_Value_List: {
      if (!is_bound()) *this = NULL_VALUE;
      int start_idx = lengthof();
      for (size_t i=0; i<param.get_size(); ++i) {
        Module_Param* const curr = param.get_elem(i);
        if ((curr->get_type()!=Module_Param::MP_NotUsed)) {
          (*this)[start_idx+(int)i].set_param(*curr);
        }
      }
    } break;
    case Module_Param::MP_Indexed_List:
      param.error("Cannot concatenate an indexed value list");
      break;
    default:
      param.type_error("record of value", "@L1CTL_Types.L1ctlMA");
    }
    break;
  default:
    TTCN_error("Internal error: Unknown operation type.");
  }
}

void L1ctlMA::encode_text(Text_Buf& text_buf) const
{
if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @L1CTL_Types.L1ctlMA.");
text_buf.push_int(val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++)
(*this)[elem_count].encode_text(text_buf);
}

void L1ctlMA::decode_text(Text_Buf& text_buf)
{
clean_up();
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = text_buf.pull_int().get_val();
if (val_ptr->n_elements < 0) TTCN_error("Text decoder: Negative size was received for a value of type @L1CTL_Types.L1ctlMA.");
val_ptr->value_elements = (GSM__Types::GsmBandArfcn**)allocate_pointers(val_ptr->n_elements);
for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) {
val_ptr->value_elements[elem_count] = new GSM__Types::GsmBandArfcn;
val_ptr->value_elements[elem_count]->decode_text(text_buf);
}
}

void L1ctlMA::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 L1ctlMA::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 L1ctlMA::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean /*no_err*/, int sel_field, boolean first_call, const RAW_Force_Omit*){
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  int decoded_length=0;
  int decoded_field_length=0;
  size_t start_of_field=0;
  if(first_call) {
    clean_up();
    val_ptr=new recordof_setof_struct;
    val_ptr->ref_count=1;
    val_ptr->n_elements=0;
    val_ptr->value_elements=NULL;
  }
  int start_field=val_ptr->n_elements;
  if(p_td.raw->fieldlength || sel_field!=-1){
    int a=0;
    if(sel_field==-1) sel_field=p_td.raw->fieldlength;
    start_of_field=p_buf.get_pos_bit();
    for(a=0;a<sel_field;a++){
      decoded_field_length=(*this)[a+start_field].RAW_decode(*p_td.oftype_descr,p_buf,limit,top_bit_ord,TRUE);
      if(decoded_field_length < 0){
        while(a>=0){
          delete &(*this)[a+start_field];
          a--;
          val_ptr->n_elements--;
        }
        p_buf.set_pos_bit(start_of_field);
        return decoded_field_length;
      }
      decoded_length+=decoded_field_length;
      limit-=decoded_field_length;
    }
    if(a==0) val_ptr->n_elements=0;
  } else {
    if(limit==0){
      if(!first_call) return -1;
      val_ptr->n_elements=0;
      return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength;
    }
    int a=start_field;
    while(limit>0){
      start_of_field=p_buf.get_pos_bit();
      decoded_field_length=(*this)[a].RAW_decode(*p_td.oftype_descr,p_buf,limit,top_bit_ord,TRUE);
      if(decoded_field_length < 0){
        delete &(*this)[a];
        val_ptr->n_elements--;
        p_buf.set_pos_bit(start_of_field);
        if(a>start_field){
        return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength;
        } else return -1;
      }
      decoded_length+=decoded_field_length;
      limit-=decoded_field_length;
      a++;
    }
  }
 return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength;
}

int L1ctlMA::RAW_encode(const TTCN_Typedescriptor_t& p_td,RAW_enc_tree& myleaf) const{
  int encoded_length=0;
  int encoded_num_of_records=p_td.raw->fieldlength?smaller(val_ptr->n_elements, p_td.raw->fieldlength):val_ptr->n_elements;
  myleaf.isleaf=FALSE;
  myleaf.rec_of=TRUE;
  myleaf.body.node.num_of_nodes=encoded_num_of_records;
  myleaf.body.node.nodes=init_nodes_of_enc_tree(encoded_num_of_records);
  for(int a=0;a<encoded_num_of_records;a++){
    myleaf.body.node.nodes[a]=new RAW_enc_tree(TRUE,&myleaf,&(myleaf.curr_pos),a,p_td.oftype_descr->raw);
    encoded_length+=(*this)[a].RAW_encode(*p_td.oftype_descr,*myleaf.body.node.nodes[a]);
  }
 return myleaf.length=encoded_length;
}

void L1ctlMA_template::copy_value(const L1ctlMA& other_value)
{
if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @L1CTL_Types.L1ctlMA with an unbound value.");
single_value.n_elements = other_value.size_of();
single_value.value_elements = (GSM__Types::GsmBandArfcn_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (other_value[elem_count].is_bound()) {
single_value.value_elements[elem_count] = new GSM__Types::GsmBandArfcn_template(other_value[elem_count]);
} else {
single_value.value_elements[elem_count] = new GSM__Types::GsmBandArfcn_template;
}
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlMA_template::copy_template(const L1ctlMA_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value.n_elements = other_value.single_value.n_elements;
single_value.value_elements = (GSM__Types::GsmBandArfcn_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (UNINITIALIZED_TEMPLATE != other_value.single_value.value_elements[elem_count]->get_selection()) {
single_value.value_elements[elem_count] = new GSM__Types::GsmBandArfcn_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new GSM__Types::GsmBandArfcn_template;
}
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new L1ctlMA_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 L1ctlMA_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlMA_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 @L1CTL_Types.L1ctlMA.");
break;
}
set_selection(other_value);
}

boolean L1ctlMA_template::match_function_specific(const Base_Type *value_ptr, int value_index, const Restricted_Length_Template *template_ptr, int template_index, boolean legacy)
{
if (value_index >= 0) return ((const L1ctlMA_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const L1ctlMA*)value_ptr)[value_index], legacy);
else return ((const L1ctlMA_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit();
}

L1ctlMA_template::L1ctlMA_template()
{
}

L1ctlMA_template::L1ctlMA_template(template_sel other_value)
 : Base_Record_Of_Template(other_value)
{
check_single_selection(other_value);
}

L1ctlMA_template::L1ctlMA_template(null_type)
 : Base_Record_Of_Template(SPECIFIC_VALUE)
{
single_value.n_elements = 0;
single_value.value_elements = NULL;
}

L1ctlMA_template::L1ctlMA_template(const L1ctlMA& other_value)
{
copy_value(other_value);
}

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

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

L1ctlMA_template::L1ctlMA_template(Dynamic_Match_Interface<L1ctlMA>* p_dyn_match)
 : Base_Record_Of_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<L1ctlMA>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

L1ctlMA_template::L1ctlMA_template(const L1ctlMA_template& other_value)
 : Base_Record_Of_Template()
{
copy_template(other_value);
}

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

void L1ctlMA_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
delete single_value.value_elements[elem_count];
free_pointers((void**)single_value.value_elements);
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

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

L1ctlMA_template& L1ctlMA_template::operator=(null_type)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value.n_elements = 0;
single_value.value_elements = NULL;
return *this;
}

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

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

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

GSM__Types::GsmBandArfcn_template& L1ctlMA_template::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @L1CTL_Types.L1ctlMA using a negative index: %d.", index_value);
switch (template_selection)
{
  case SPECIFIC_VALUE:
    if(index_value < single_value.n_elements) break;
    // no break
  case OMIT_VALUE:
  case ANY_VALUE:
  case ANY_OR_OMIT:
  case UNINITIALIZED_TEMPLATE:
    set_size(index_value + 1);
    break;
  default:
    TTCN_error("Accessing an element of a non-specific template for type @L1CTL_Types.L1ctlMA.");
    break;
}
return *single_value.value_elements[index_value];
}

GSM__Types::GsmBandArfcn_template& L1ctlMA_template::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @L1CTL_Types.L1ctlMA.");
return (*this)[(int)index_value];
}

const GSM__Types::GsmBandArfcn_template& L1ctlMA_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @L1CTL_Types.L1ctlMA using a negative index: %d.", index_value);
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @L1CTL_Types.L1ctlMA.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @L1CTL_Types.L1ctlMA: The index is %d, but the template has only %d elements.", index_value, single_value.n_elements);
return *single_value.value_elements[index_value];
}

const GSM__Types::GsmBandArfcn_template& L1ctlMA_template::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @L1CTL_Types.L1ctlMA.");
return (*this)[(int)index_value];
}

void L1ctlMA_template::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @L1CTL_Types.L1ctlMA.");
template_sel old_selection = template_selection;
if (old_selection != SPECIFIC_VALUE) {
clean_up();
set_selection(SPECIFIC_VALUE);
single_value.n_elements = 0;
single_value.value_elements = NULL;
}
if (new_size > single_value.n_elements) {
single_value.value_elements = (GSM__Types::GsmBandArfcn_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++)
single_value.value_elements[elem_count] = new GSM__Types::GsmBandArfcn_template(ANY_VALUE);
} else {
for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++)
single_value.value_elements[elem_count] = new GSM__Types::GsmBandArfcn_template;
}
single_value.n_elements = new_size;
} else if (new_size < single_value.n_elements) {
for (int elem_count = new_size; elem_count < single_value.n_elements; elem_count++)
delete single_value.value_elements[elem_count];
single_value.value_elements = (GSM__Types::GsmBandArfcn_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}

int L1ctlMA_template::n_elem() const
{
  switch (template_selection) {
  case SPECIFIC_VALUE:
    return single_value.n_elements;
    break;
  case VALUE_LIST:
    return value_list.n_values;
    break;
  default:
    TTCN_error("Performing n_elem");
  }
}

int L1ctlMA_template::size_of(boolean is_size) const
{
const char* op_name = is_size ? "size" : "length";
int min_size;
boolean has_any_or_none;
if (is_ifpresent) TTCN_error("Performing %sof() operation on a template of type @L1CTL_Types.L1ctlMA which has an ifpresent attribute.", op_name);
switch (template_selection)
{
case SPECIFIC_VALUE: {
  min_size = 0;
  has_any_or_none = FALSE;
  int elem_count = single_value.n_elements;
  if (!is_size) { while (elem_count>0 && !single_value.value_elements[elem_count-1]->is_bound()) elem_count--; }
  for (int i=0; i<elem_count; i++) {
    switch (single_value.value_elements[i]->get_selection()) {
    case OMIT_VALUE:
      TTCN_error("Performing %sof() operation on a template of type @L1CTL_Types.L1ctlMA containing omit element.", op_name);
    case ANY_OR_OMIT:
      has_any_or_none = TRUE;
      break;
    default:
      min_size++;
      break;
    }
  }
} break;
case OMIT_VALUE:
  TTCN_error("Performing %sof() operation on a template of type @L1CTL_Types.L1ctlMA containing omit value.", op_name);
case ANY_VALUE:
case ANY_OR_OMIT:
  min_size = 0;
  has_any_or_none = TRUE;
  break;
case VALUE_LIST:
{
  if (value_list.n_values<1)
    TTCN_error("Performing %sof() operation on a template of type @L1CTL_Types.L1ctlMA containing an empty list.", op_name);
  int item_size = value_list.list_value[0].size_of(is_size);
  for (unsigned int i = 1; i < value_list.n_values; i++) {
    if (value_list.list_value[i].size_of(is_size)!=item_size)
      TTCN_error("Performing %sof() operation on a template of type @L1CTL_Types.L1ctlMA containing a value list with different sizes.", op_name);
  }
  min_size = item_size;
  has_any_or_none = FALSE;
  break;
}
case COMPLEMENTED_LIST:
  TTCN_error("Performing %sof() operation on a template of type @L1CTL_Types.L1ctlMA containing complemented list.", op_name);
default:
  TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @L1CTL_Types.L1ctlMA.", op_name);
}
return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @L1CTL_Types.L1ctlMA");
}

boolean L1ctlMA_template::match(const L1ctlMA& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
int value_length = other_value.size_of();
if (!match_length(value_length)) return FALSE;
switch (template_selection) {
case SPECIFIC_VALUE:
return match_record_of(&other_value, value_length, this, single_value.n_elements, match_function_specific, legacy);
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching with an uninitialized/unsupported template of type @L1CTL_Types.L1ctlMA.");
}
return FALSE;
}

boolean L1ctlMA_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
if (!single_value.value_elements[elem_count]->is_value()) return FALSE;
return TRUE;
}

L1ctlMA L1ctlMA_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 @L1CTL_Types.L1ctlMA.");
L1ctlMA ret_val;
ret_val.set_size(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++)
if (single_value.value_elements[elem_count]->is_bound()) {
ret_val[elem_count] = single_value.value_elements[elem_count]->valueof();
}
return ret_val;
}

L1ctlMA L1ctlMA_template::substr(int index, int returncount) const
{
if (!is_value()) TTCN_error("The first argument of function substr() is a template with non-specific value.");
return valueof().substr(index, returncount);
}

L1ctlMA L1ctlMA_template::replace(int index, int len, const L1ctlMA_template& repl) const
{
if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value.");
if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value.");
return valueof().replace(index, len, repl.valueof());
}

L1ctlMA L1ctlMA_template::replace(int index, int len, const L1ctlMA& repl) const
{
if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value.");
return valueof().replace(index, len, repl);
}

void L1ctlMA_template::set_type(template_sel template_type, unsigned int list_length)
{
clean_up();
switch (template_type) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = list_length;
value_list.list_value = new L1ctlMA_template[list_length];
break;
default:
TTCN_error("Internal error: Setting an invalid type for a template of type @L1CTL_Types.L1ctlMA.");
}
set_selection(template_type);
}

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

void L1ctlMA_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.n_elements > 0) {
TTCN_Logger::log_event_str("{ ");
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
if (permutation_starts_at(elem_count)) TTCN_Logger::log_event_str("permutation(");
single_value.value_elements[elem_count]->log();
if (permutation_ends_at(elem_count)) TTCN_Logger::log_char(')');
}
TTCN_Logger::log_event_str(" }");
} else TTCN_Logger::log_event_str("{ }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_restricted();
log_ifpresent();
}

void L1ctlMA_template::log_match(const L1ctlMA& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
}else{
if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if(!single_value.value_elements[elem_count]->match(match_value[elem_count], legacy)){
TTCN_Logger::log_logmatch_info("[%d]", elem_count);
single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
log_match_length(single_value.n_elements);
} else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) {
TTCN_Logger::log_event_str("{ ");
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy);
}
TTCN_Logger::log_event_str(" }");
log_match_length(single_value.n_elements);
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

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

void L1ctlMA_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_permutation(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value.n_elements = text_buf.pull_int().get_val();
if (single_value.n_elements < 0) TTCN_error("Text decoder: Negative size was received for a template of type @L1CTL_Types.L1ctlMA.");
single_value.value_elements = (GSM__Types::GsmBandArfcn_template**)allocate_pointers(single_value.n_elements);
for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) {
single_value.value_elements[elem_count] = new GSM__Types::GsmBandArfcn_template;
single_value.value_elements[elem_count]->decode_text(text_buf);
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new L1ctlMA_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of type @L1CTL_Types.L1ctlMA.");
}
}

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

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

void L1ctlMA_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
for (int i = 0; i < single_value.n_elements; i++) {
if (single_value.value_elements[i] != NULL) single_value.value_elements[i]->set_implicit_omit();
}
}

void L1ctlMA_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE|Module_Param::BC_LIST, "record of template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    L1ctlMA_template temp;
    temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = temp;
    break; }
  case Module_Param::MP_Indexed_List:
    if (template_selection!=SPECIFIC_VALUE) set_size(0);
    for (size_t p_i=0; p_i<param.get_size(); ++p_i) {
      (*this)[(int)(param.get_elem(p_i)->get_id()->get_index())].set_param(*param.get_elem(p_i));
    }
    break;
  case Module_Param::MP_Value_List: {
    set_size(param.get_size());
    int curr_idx = 0;
    for (size_t p_i=0; p_i<param.get_size(); ++p_i) {
      switch (param.get_elem(p_i)->get_type()) {
      case Module_Param::MP_NotUsed:
        curr_idx++;
        break;
      case Module_Param::MP_Permutation_Template: {
        int perm_start_idx = curr_idx;
        Module_Param* param_i = param.get_elem(p_i);
        for (size_t perm_i=0; perm_i<param_i->get_size(); perm_i++) {
          (*this)[curr_idx].set_param(*(param_i->get_elem(perm_i)));
          curr_idx++;
        }
        int perm_end_idx = curr_idx - 1;
        add_permutation(perm_start_idx, perm_end_idx);
      } break;
      default:
        (*this)[curr_idx].set_param(*param.get_elem(p_i));
        curr_idx++;
      }
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlMA_template* precondition = new L1ctlMA_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlMA_template* implied_template = new L1ctlMA_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlMA_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record of template", "@L1CTL_Types.L1ctlMA");
  }
  is_ifpresent = param.get_ifpresent();
  set_length_range(param);
}

void L1ctlMA_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
for (int i=0; i<single_value.n_elements; i++) single_value.value_elements[i]->check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlMA");
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 : "@L1CTL_Types.L1ctlMA");
}

boolean L1ctlMA_template::get_istemplate_kind(const char* type) const {
if (!strcmp(type, "AnyElement")) {
  if (template_selection != SPECIFIC_VALUE) {
    return FALSE;
  }
  for (int i = 0; i < single_value.n_elements; i++) {
    if (single_value.value_elements[i]->get_selection() == ANY_VALUE) {
      return TRUE;
    }
  }
  return FALSE;
} else if (!strcmp(type, "AnyElementsOrNone")) {
  if (template_selection != SPECIFIC_VALUE) {
    return FALSE;
  }
  for (int i = 0; i < single_value.n_elements; i++) {
    if (single_value.value_elements[i]->get_selection() == ANY_OR_OMIT) {
      return TRUE;
    }
  }
  return FALSE;
} else if (!strcmp(type, "permutation")) {
  return number_of_permutations;
} else if (!strcmp(type, "length")) {
  return length_restriction_type != NO_LENGTH_RESTRICTION;
} else {
  return Base_Template::get_istemplate_kind(type);
}
}
L1ctlH1::L1ctlH1()
{
}

L1ctlH1::L1ctlH1(const INTEGER& par_h,
    const INTEGER& par_hsn,
    const INTEGER& par_maio,
    const INTEGER& par_n,
    const OCTETSTRING& par_spare,
    const L1ctlMA& par_ma,
    const OCTETSTRING& par_padding)
  :   field_h(par_h),
  field_hsn(par_hsn),
  field_maio(par_maio),
  field_n(par_n),
  field_spare(par_spare),
  field_ma(par_ma),
  field_padding(par_padding)
{
}

L1ctlH1::L1ctlH1(const L1ctlH1& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlH1.");
if (other_value.h().is_bound()) field_h = other_value.h();
else field_h.clean_up();
if (other_value.hsn().is_bound()) field_hsn = other_value.hsn();
else field_hsn.clean_up();
if (other_value.maio().is_bound()) field_maio = other_value.maio();
else field_maio.clean_up();
if (other_value.n().is_bound()) field_n = other_value.n();
else field_n.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.ma().is_bound()) field_ma = other_value.ma();
else field_ma.clean_up();
if (other_value.padding().is_bound()) field_padding = other_value.padding();
else field_padding.clean_up();
}

void L1ctlH1::clean_up()
{
field_h.clean_up();
field_hsn.clean_up();
field_maio.clean_up();
field_n.clean_up();
field_spare.clean_up();
field_ma.clean_up();
field_padding.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlH1::get_descriptor() const { return &L1ctlH1_descr_; }
L1ctlH1& L1ctlH1::operator=(const L1ctlH1& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlH1.");
  if (other_value.h().is_bound()) field_h = other_value.h();
  else field_h.clean_up();
  if (other_value.hsn().is_bound()) field_hsn = other_value.hsn();
  else field_hsn.clean_up();
  if (other_value.maio().is_bound()) field_maio = other_value.maio();
  else field_maio.clean_up();
  if (other_value.n().is_bound()) field_n = other_value.n();
  else field_n.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.ma().is_bound()) field_ma = other_value.ma();
  else field_ma.clean_up();
  if (other_value.padding().is_bound()) field_padding = other_value.padding();
  else field_padding.clean_up();
}
return *this;
}

boolean L1ctlH1::operator==(const L1ctlH1& other_value) const
{
return field_h==other_value.field_h
  && field_hsn==other_value.field_hsn
  && field_maio==other_value.field_maio
  && field_n==other_value.field_n
  && field_spare==other_value.field_spare
  && field_ma==other_value.field_ma
  && field_padding==other_value.field_padding;
}

boolean L1ctlH1::is_bound() const
{
return (field_h.is_bound())
  || (field_hsn.is_bound())
  || (field_maio.is_bound())
  || (field_n.is_bound())
  || (field_spare.is_bound())
  || (field_ma.is_bound())
  || (field_padding.is_bound());
}
boolean L1ctlH1::is_value() const
{
return field_h.is_value()
  && field_hsn.is_value()
  && field_maio.is_value()
  && field_n.is_value()
  && field_spare.is_value()
  && field_ma.is_value()
  && field_padding.is_value();
}
void L1ctlH1::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ h := ");
field_h.log();
TTCN_Logger::log_event_str(", hsn := ");
field_hsn.log();
TTCN_Logger::log_event_str(", maio := ");
field_maio.log();
TTCN_Logger::log_event_str(", n := ");
field_n.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(", ma := ");
field_ma.log();
TTCN_Logger::log_event_str(", padding := ");
field_padding.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlH1::set_implicit_omit()
{
if (h().is_bound()) h().set_implicit_omit();
if (hsn().is_bound()) hsn().set_implicit_omit();
if (maio().is_bound()) maio().set_implicit_omit();
if (n().is_bound()) n().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (ma().is_bound()) ma().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

void L1ctlH1::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 @L1CTL_Types.L1ctlH1 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) h().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) hsn().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) maio().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) n().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) ma().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(), "h")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          h().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(), "hsn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          hsn().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(), "maio")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          maio().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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          n().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ma")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ma().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 @L1CTL_Types.L1ctlH1: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlH1");
  }
}

void L1ctlH1::encode_text(Text_Buf& text_buf) const
{
field_h.encode_text(text_buf);
field_hsn.encode_text(text_buf);
field_maio.encode_text(text_buf);
field_n.encode_text(text_buf);
field_spare.encode_text(text_buf);
field_ma.encode_text(text_buf);
field_padding.encode_text(text_buf);
}

void L1ctlH1::decode_text(Text_Buf& text_buf)
{
field_h.decode_text(text_buf);
field_hsn.decode_text(text_buf);
field_maio.decode_text(text_buf);
field_n.decode_text(text_buf);
field_spare.decode_text(text_buf);
field_ma.decode_text(text_buf);
field_padding.decode_text(text_buf);
}

void L1ctlH1::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 L1ctlH1::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 L1ctlH1::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_field3 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_h.RAW_decode(Osmocom__Types::uint8__t_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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_hsn.RAW_decode(Osmocom__Types::uint8__t_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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_maio.RAW_decode(Osmocom__Types::uint8__t_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, L1ctlH1_n_descr_.raw->forceomit);
  decoded_field_length = field_n.RAW_decode(L1ctlH1_n_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());
  INTEGER tmp3 = field_n.convert_to_Integer(L1ctlH1_n_descr_);
  field_n = tmp3;
  value_of_length_field3 += tmp3.get_long_long_val() * 1;
  RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(General__Types::OCT1_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, L1ctlMA_descr_.raw->forceomit);
  decoded_field_length = field_ma.RAW_decode(L1ctlMA_descr_, p_buf, limit, local_top_order, no_err, value_of_length_field3, 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_field3 -= decoded_field_length;
  RAW_Force_Omit field_6_force_omit(6, force_omit, OCTETSTRING_descr_.raw->forceomit);
  decoded_field_length = field_padding.RAW_decode(OCTETSTRING_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 L1ctlH1::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, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, L1ctlH1_n_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, L1ctlMA_descr_.raw);
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, OCTETSTRING_descr_.raw);
  encoded_length += field_h.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_hsn.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_maio.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += 8;
  myleaf.body.node.nodes[3]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[3]->coding_descr = &L1ctlH1_n_descr_;
  myleaf.body.node.nodes[3]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[3]->calcof.lengthto.unit = -1;
  myleaf.body.node.nodes[3]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[3]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[3]->length = 8;
  myleaf.body.node.nodes[3]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[5]->curr_pos.level;
  myleaf.body.node.nodes[3]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[5]->curr_pos.pos;
  encoded_length += field_spare.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_ma.RAW_encode(L1ctlMA_descr_, *myleaf.body.node.nodes[5]);
  encoded_length += field_padding.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[6]);
  return myleaf.length = encoded_length;
}

struct L1ctlH1_template::single_value_struct {
INTEGER_template field_h;
INTEGER_template field_hsn;
INTEGER_template field_maio;
INTEGER_template field_n;
OCTETSTRING_template field_spare;
L1ctlMA_template field_ma;
OCTETSTRING_template field_padding;
};

void L1ctlH1_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_h = ANY_VALUE;
single_value->field_hsn = ANY_VALUE;
single_value->field_maio = ANY_VALUE;
single_value->field_n = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
single_value->field_ma = ANY_VALUE;
single_value->field_padding = ANY_VALUE;
}
}
}

void L1ctlH1_template::copy_value(const L1ctlH1& other_value)
{
single_value = new single_value_struct;
if (other_value.h().is_bound()) {
  single_value->field_h = other_value.h();
} else {
  single_value->field_h.clean_up();
}
if (other_value.hsn().is_bound()) {
  single_value->field_hsn = other_value.hsn();
} else {
  single_value->field_hsn.clean_up();
}
if (other_value.maio().is_bound()) {
  single_value->field_maio = other_value.maio();
} else {
  single_value->field_maio.clean_up();
}
if (other_value.n().is_bound()) {
  single_value->field_n = other_value.n();
} else {
  single_value->field_n.clean_up();
}
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
if (other_value.ma().is_bound()) {
  single_value->field_ma = other_value.ma();
} else {
  single_value->field_ma.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 L1ctlH1_template::copy_template(const L1ctlH1_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.h().get_selection()) {
single_value->field_h = other_value.h();
} else {
single_value->field_h.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.hsn().get_selection()) {
single_value->field_hsn = other_value.hsn();
} else {
single_value->field_hsn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.maio().get_selection()) {
single_value->field_maio = other_value.maio();
} else {
single_value->field_maio.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.n().get_selection()) {
single_value->field_n = other_value.n();
} else {
single_value->field_n.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ma().get_selection()) {
single_value->field_ma = other_value.ma();
} else {
single_value->field_ma.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 L1ctlH1_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 L1ctlH1_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlH1_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 @L1CTL_Types.L1ctlH1.");
break;
}
set_selection(other_value);
}

L1ctlH1_template::L1ctlH1_template()
{
}

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

L1ctlH1_template::L1ctlH1_template(const L1ctlH1& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlH1_template::match(const L1ctlH1& 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.h().is_bound()) return FALSE;
if(!single_value->field_h.match(other_value.h(), legacy))return FALSE;
if(!other_value.hsn().is_bound()) return FALSE;
if(!single_value->field_hsn.match(other_value.hsn(), legacy))return FALSE;
if(!other_value.maio().is_bound()) return FALSE;
if(!single_value->field_maio.match(other_value.maio(), legacy))return FALSE;
if(!other_value.n().is_bound()) return FALSE;
if(!single_value->field_n.match(other_value.n(), legacy))return FALSE;
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
if(!other_value.ma().is_bound()) return FALSE;
if(!single_value->field_ma.match(other_value.ma(), 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 @L1CTL_Types.L1ctlH1.");
}
return FALSE;
}

boolean L1ctlH1_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_h.is_bound()
 || single_value->field_hsn.is_bound()
 || single_value->field_maio.is_bound()
 || single_value->field_n.is_bound()
 || single_value->field_spare.is_bound()
 || single_value->field_ma.is_bound()
 || single_value->field_padding.is_bound();
}

boolean L1ctlH1_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_h.is_value()
 && single_value->field_hsn.is_value()
 && single_value->field_maio.is_value()
 && single_value->field_n.is_value()
 && single_value->field_spare.is_value()
 && single_value->field_ma.is_value()
 && single_value->field_padding.is_value();
}

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

L1ctlH1 L1ctlH1_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 @L1CTL_Types.L1ctlH1.");
L1ctlH1 ret_val;
if (single_value->field_h.is_bound()) {
ret_val.h() = single_value->field_h.valueof();
}
if (single_value->field_hsn.is_bound()) {
ret_val.hsn() = single_value->field_hsn.valueof();
}
if (single_value->field_maio.is_bound()) {
ret_val.maio() = single_value->field_maio.valueof();
}
if (single_value->field_n.is_bound()) {
ret_val.n() = single_value->field_n.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_ma.is_bound()) {
ret_val.ma() = single_value->field_ma.valueof();
}
if (single_value->field_padding.is_bound()) {
ret_val.padding() = single_value->field_padding.valueof();
}
return ret_val;
}

void L1ctlH1_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 @L1CTL_Types.L1ctlH1.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlH1_template[list_length];
}

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

INTEGER_template& L1ctlH1_template::h()
{
set_specific();
return single_value->field_h;
}

const INTEGER_template& L1ctlH1_template::h() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field h of a non-specific template of type @L1CTL_Types.L1ctlH1.");
return single_value->field_h;
}

INTEGER_template& L1ctlH1_template::hsn()
{
set_specific();
return single_value->field_hsn;
}

const INTEGER_template& L1ctlH1_template::hsn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field hsn of a non-specific template of type @L1CTL_Types.L1ctlH1.");
return single_value->field_hsn;
}

INTEGER_template& L1ctlH1_template::maio()
{
set_specific();
return single_value->field_maio;
}

const INTEGER_template& L1ctlH1_template::maio() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field maio of a non-specific template of type @L1CTL_Types.L1ctlH1.");
return single_value->field_maio;
}

INTEGER_template& L1ctlH1_template::n()
{
set_specific();
return single_value->field_n;
}

const INTEGER_template& L1ctlH1_template::n() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field n of a non-specific template of type @L1CTL_Types.L1ctlH1.");
return single_value->field_n;
}

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

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

L1ctlMA_template& L1ctlH1_template::ma()
{
set_specific();
return single_value->field_ma;
}

const L1ctlMA_template& L1ctlH1_template::ma() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ma of a non-specific template of type @L1CTL_Types.L1ctlH1.");
return single_value->field_ma;
}

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

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

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

void L1ctlH1_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ h := ");
single_value->field_h.log();
TTCN_Logger::log_event_str(", hsn := ");
single_value->field_hsn.log();
TTCN_Logger::log_event_str(", maio := ");
single_value->field_maio.log();
TTCN_Logger::log_event_str(", n := ");
single_value->field_n.log();
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(", ma := ");
single_value->field_ma.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 L1ctlH1_template::log_match(const L1ctlH1& 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_h.match(match_value.h(), legacy)){
TTCN_Logger::log_logmatch_info(".h");
single_value->field_h.log_match(match_value.h(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_hsn.match(match_value.hsn(), legacy)){
TTCN_Logger::log_logmatch_info(".hsn");
single_value->field_hsn.log_match(match_value.hsn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_maio.match(match_value.maio(), legacy)){
TTCN_Logger::log_logmatch_info(".maio");
single_value->field_maio.log_match(match_value.maio(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_n.match(match_value.n(), legacy)){
TTCN_Logger::log_logmatch_info(".n");
single_value->field_n.log_match(match_value.n(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ma.match(match_value.ma(), legacy)){
TTCN_Logger::log_logmatch_info(".ma");
single_value->field_ma.log_match(match_value.ma(), 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("{ h := ");
single_value->field_h.log_match(match_value.h(), legacy);
TTCN_Logger::log_event_str(", hsn := ");
single_value->field_hsn.log_match(match_value.hsn(), legacy);
TTCN_Logger::log_event_str(", maio := ");
single_value->field_maio.log_match(match_value.maio(), legacy);
TTCN_Logger::log_event_str(", n := ");
single_value->field_n.log_match(match_value.n(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(", ma := ");
single_value->field_ma.log_match(match_value.ma(), 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 L1ctlH1_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (h().is_bound()) h().set_implicit_omit();
if (hsn().is_bound()) hsn().set_implicit_omit();
if (maio().is_bound()) maio().set_implicit_omit();
if (n().is_bound()) n().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (ma().is_bound()) ma().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

void L1ctlH1_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_h.encode_text(text_buf);
single_value->field_hsn.encode_text(text_buf);
single_value->field_maio.encode_text(text_buf);
single_value->field_n.encode_text(text_buf);
single_value->field_spare.encode_text(text_buf);
single_value->field_ma.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 @L1CTL_Types.L1ctlH1.");
}
}

void L1ctlH1_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_h.decode_text(text_buf);
single_value->field_hsn.decode_text(text_buf);
single_value->field_maio.decode_text(text_buf);
single_value->field_n.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
single_value->field_ma.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 L1ctlH1_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 @L1CTL_Types.L1ctlH1.");
}
}

void L1ctlH1_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: {
    L1ctlH1_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 @L1CTL_Types.L1ctlH1 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) h().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) hsn().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) maio().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) n().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) ma().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(), "h")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          h().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(), "hsn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          hsn().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(), "maio")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          maio().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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          n().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ma")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ma().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 @L1CTL_Types.L1ctlH1: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlH1_template* precondition = new L1ctlH1_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlH1_template* implied_template = new L1ctlH1_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlH1_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlH1");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlH1_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_h.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlH1");
single_value->field_hsn.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlH1");
single_value->field_maio.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlH1");
single_value->field_n.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlH1");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlH1");
single_value->field_ma.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlH1");
single_value->field_padding.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlH1");
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 : "@L1CTL_Types.L1ctlH1");
}

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

boolean L1ctlH1_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 L1ctlH0H1::copy_value(const L1ctlH0H1& other_value)
{
switch (other_value.union_selection) {
case ALT_h0:
field_h0 = new L1ctlH0(*other_value.field_h0);
break;
case ALT_h1:
field_h1 = new L1ctlH1(*other_value.field_h1);
break;
default:
TTCN_error("Assignment of an unbound union value of type @L1CTL_Types.L1ctlH0H1.");
}
union_selection = other_value.union_selection;
}

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

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

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

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

boolean L1ctlH0H1::operator==(const L1ctlH0H1& other_value) const
{
if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @L1CTL_Types.L1ctlH0H1.");
if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @L1CTL_Types.L1ctlH0H1.");
if (union_selection != other_value.union_selection) return FALSE;
switch (union_selection) {
case ALT_h0:
return *field_h0 == *other_value.field_h0;
case ALT_h1:
return *field_h1 == *other_value.field_h1;
default:
return FALSE;
}
}

L1ctlH0& L1ctlH0H1::h0()
{
if (union_selection != ALT_h0) {
clean_up();
field_h0 = new L1ctlH0;
union_selection = ALT_h0;
}
return *field_h0;
}

const L1ctlH0& L1ctlH0H1::h0() const
{
if (union_selection != ALT_h0) TTCN_error("Using non-selected field h0 in a value of union type @L1CTL_Types.L1ctlH0H1.");
return *field_h0;
}

L1ctlH1& L1ctlH0H1::h1()
{
if (union_selection != ALT_h1) {
clean_up();
field_h1 = new L1ctlH1;
union_selection = ALT_h1;
}
return *field_h1;
}

const L1ctlH1& L1ctlH0H1::h1() const
{
if (union_selection != ALT_h1) TTCN_error("Using non-selected field h1 in a value of union type @L1CTL_Types.L1ctlH0H1.");
return *field_h1;
}

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

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

boolean L1ctlH0H1::is_value() const
{
switch (union_selection) {
case UNBOUND_VALUE: return FALSE;
case ALT_h0: return field_h0->is_value();
case ALT_h1: return field_h1->is_value();
default: TTCN_error("Invalid selection in union is_bound");}
}

void L1ctlH0H1::clean_up()
{
switch (union_selection) {
case ALT_h0:
  delete field_h0;
  break;
case ALT_h1:
  delete field_h1;
  break;
default:
  break;
}
union_selection = UNBOUND_VALUE;
}

void L1ctlH0H1::log() const
{
switch (union_selection) {
case ALT_h0:
TTCN_Logger::log_event_str("{ h0 := ");
field_h0->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_h1:
TTCN_Logger::log_event_str("{ h1 := ");
field_h1->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_unbound();
}
}

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

void L1ctlH0H1::set_implicit_omit()
{
switch (union_selection) {
case ALT_h0:
field_h0->set_implicit_omit(); break;
case ALT_h1:
field_h1->set_implicit_omit(); break;
default: break;
}
}

void L1ctlH0H1::encode_text(Text_Buf& text_buf) const
{
text_buf.push_int(union_selection);
switch (union_selection) {
case ALT_h0:
field_h0->encode_text(text_buf);
break;
case ALT_h1:
field_h1->encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an unbound value of union type @L1CTL_Types.L1ctlH0H1.");
}
}

void L1ctlH0H1::decode_text(Text_Buf& text_buf)
{
switch ((union_selection_type)text_buf.pull_int().get_val()) {
case ALT_h0:
h0().decode_text(text_buf);
break;
case ALT_h1:
h1().decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for type @L1CTL_Types.L1ctlH0H1.");
}
}

void L1ctlH0H1::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 L1ctlH0H1::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 L1ctlH0H1::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, L1ctlH0_descr_.raw->forceomit);
      decoded_length = h0().RAW_decode(L1ctlH0_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, L1ctlH1_descr_.raw->forceomit);
      decoded_length = h1().RAW_decode(L1ctlH1_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;
    INTEGER temporal_0;
    int decoded_0_length;
    already_failed = FALSE;
    if (!already_failed) {
      p_buf.set_pos_bit(starting_pos + 0);
      decoded_0_length = temporal_0.RAW_decode(Osmocom__Types::uint8__t_descr_, p_buf, limit, top_bit_ord, TRUE);
      if (decoded_0_length > 0) {
        if (temporal_0 == 0) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(0, force_omit, L1ctlH0_descr_.raw->forceomit);
          decoded_length = h0().RAW_decode(L1ctlH0_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_h0).h() == 0) {
               return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
             }else already_failed = TRUE;
          }
        }
      }
    }
    already_failed = FALSE;
    if (!already_failed) {
      if (decoded_0_length > 0) {
        if (temporal_0 == 1) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(1, force_omit, L1ctlH1_descr_.raw->forceomit);
          decoded_length = h1().RAW_decode(L1ctlH1_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_h1).h() == 1) {
               return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
             }else already_failed = TRUE;
          }
        }
      }
    }
 }
 clean_up();
 return -1;
}

int L1ctlH0H1::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const
{
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 2;  myleaf.body.node.nodes = init_nodes_of_enc_tree(2);
  memset(myleaf.body.node.nodes, 0, 2 * sizeof(RAW_enc_tree *));
  switch (union_selection) {
  case ALT_h0:
    myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, L1ctlH0_descr_.raw);
    encoded_length = field_h0->RAW_encode(L1ctlH0_descr_, *myleaf.body.node.nodes[0]);
    myleaf.body.node.nodes[0]->coding_descr = &L1ctlH0_descr_;
    if ((*field_h0).h() != 0) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+2;
  int new_pos0[]={0,0};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,2,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
  INTEGER new_val = 0;
  new_val.RAW_encode(Osmocom__Types::uint8__t_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_h1:
    myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, L1ctlH1_descr_.raw);
    encoded_length = field_h1->RAW_encode(L1ctlH1_descr_, *myleaf.body.node.nodes[1]);
    myleaf.body.node.nodes[1]->coding_descr = &L1ctlH1_descr_;
    if ((*field_h1).h() != 1) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+2;
  int new_pos0[]={1,0};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,2,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
  INTEGER new_val = 1;
  new_val.RAW_encode(Osmocom__Types::uint8__t_descr_,*temp_leaf);
  } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  }
  free_tree_pos(pr_pos0.pos);
  }
    }
    break;
  default:
    TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  }
  return encoded_length;
}

void L1ctlH0H1_template::copy_value(const L1ctlH0H1& other_value)
{
single_value.union_selection = other_value.get_selection();
switch (single_value.union_selection) {
case L1ctlH0H1::ALT_h0:
single_value.field_h0 = new L1ctlH0_template(other_value.h0());
break;
case L1ctlH0H1::ALT_h1:
single_value.field_h1 = new L1ctlH1_template(other_value.h1());
break;
default:
TTCN_error("Initializing a template with an unbound value of type @L1CTL_Types.L1ctlH0H1.");
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlH0H1_template::copy_template(const L1ctlH0H1_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 L1ctlH0H1::ALT_h0:
single_value.field_h0 = new L1ctlH0_template(*other_value.single_value.field_h0);
break;
case L1ctlH0H1::ALT_h1:
single_value.field_h1 = new L1ctlH1_template(*other_value.single_value.field_h1);
break;
default:
TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @L1CTL_Types.L1ctlH0H1.");
}
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 L1ctlH0H1_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 L1ctlH0H1_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlH0H1_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 @L1CTL_Types.L1ctlH0H1.");
}
set_selection(other_value);
}

L1ctlH0H1_template::L1ctlH0H1_template()
{
}

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

L1ctlH0H1_template::L1ctlH0H1_template(const L1ctlH0H1& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

void L1ctlH0H1_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case L1ctlH0H1::ALT_h0:
delete single_value.field_h0;
break;
case L1ctlH0H1::ALT_h1:
delete single_value.field_h1;
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;
}

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

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

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

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

boolean L1ctlH0H1_template::match(const L1ctlH0H1& 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:
{
L1ctlH0H1::union_selection_type value_selection = other_value.get_selection();
if (value_selection == L1ctlH0H1::UNBOUND_VALUE) return FALSE;
if (value_selection != single_value.union_selection) return FALSE;
switch (value_selection) {
case L1ctlH0H1::ALT_h0:
return single_value.field_h0->match(other_value.h0(), legacy);
case L1ctlH0H1::ALT_h1:
return single_value.field_h1->match(other_value.h1(), legacy);
default:
TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @L1CTL_Types.L1ctlH0H1.");
}
}
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 @L1CTL_Types.L1ctlH0H1.");
}
return FALSE;
}

boolean L1ctlH0H1_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
switch (single_value.union_selection) {
case L1ctlH0H1::ALT_h0:
return single_value.field_h0->is_value();
case L1ctlH0H1::ALT_h1:
return single_value.field_h1->is_value();
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @L1CTL_Types.L1ctlH0H1.");
}
}

L1ctlH0H1 L1ctlH0H1_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 @L1CTL_Types.L1ctlH0H1.");
L1ctlH0H1 ret_val;
switch (single_value.union_selection) {
case L1ctlH0H1::ALT_h0:
ret_val.h0() = single_value.field_h0->valueof();
break;
case L1ctlH0H1::ALT_h1:
ret_val.h1() = single_value.field_h1->valueof();
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @L1CTL_Types.L1ctlH0H1.");
}
return ret_val;
}

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

L1ctlH0_template& L1ctlH0H1_template::h0()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != L1ctlH0H1::ALT_h0) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_h0 = new L1ctlH0_template(ANY_VALUE);
else single_value.field_h0 = new L1ctlH0_template;
single_value.union_selection = L1ctlH0H1::ALT_h0;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_h0;
}

const L1ctlH0_template& L1ctlH0H1_template::h0() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field h0 in a non-specific template of union type @L1CTL_Types.L1ctlH0H1.");
if (single_value.union_selection != L1ctlH0H1::ALT_h0) TTCN_error("Accessing non-selected field h0 in a template of union type @L1CTL_Types.L1ctlH0H1.");
return *single_value.field_h0;
}

L1ctlH1_template& L1ctlH0H1_template::h1()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != L1ctlH0H1::ALT_h1) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_h1 = new L1ctlH1_template(ANY_VALUE);
else single_value.field_h1 = new L1ctlH1_template;
single_value.union_selection = L1ctlH0H1::ALT_h1;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_h1;
}

const L1ctlH1_template& L1ctlH0H1_template::h1() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field h1 in a non-specific template of union type @L1CTL_Types.L1ctlH0H1.");
if (single_value.union_selection != L1ctlH0H1::ALT_h1) TTCN_error("Accessing non-selected field h1 in a template of union type @L1CTL_Types.L1ctlH0H1.");
return *single_value.field_h1;
}

boolean L1ctlH0H1_template::ischosen(L1ctlH0H1::union_selection_type checked_selection) const
{
if (checked_selection == L1ctlH0H1::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @L1CTL_Types.L1ctlH0H1.");
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.union_selection == L1ctlH0H1::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @L1CTL_Types.L1ctlH0H1.");
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 @L1CTL_Types.L1ctlH0H1 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 L1ctlH0H1_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case L1ctlH0H1::ALT_h0:
TTCN_Logger::log_event_str("{ h0 := ");
single_value.field_h0->log();
TTCN_Logger::log_event_str(" }");
break;
case L1ctlH0H1::ALT_h1:
TTCN_Logger::log_event_str("{ h1 := ");
single_value.field_h1->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 L1ctlH0H1_template::log_match(const L1ctlH0H1& 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 L1ctlH0H1::ALT_h0:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".h0");
single_value.field_h0->log_match(match_value.h0(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ h0 := ");
single_value.field_h0->log_match(match_value.h0(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case L1ctlH0H1::ALT_h1:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".h1");
single_value.field_h1->log_match(match_value.h1(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ h1 := ");
single_value.field_h1->log_match(match_value.h1(), 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 L1ctlH0H1_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
switch (single_value.union_selection) {
case L1ctlH0H1::ALT_h0:
single_value.field_h0->set_implicit_omit(); break;
case L1ctlH0H1::ALT_h1:
single_value.field_h1->set_implicit_omit(); break;
default: break;
}
}

void L1ctlH0H1_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 L1ctlH0H1::ALT_h0:
single_value.field_h0->encode_text(text_buf);
break;
case L1ctlH0H1::ALT_h1:
single_value.field_h1->encode_text(text_buf);
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @L1CTL_Types.L1ctlH0H1.");
}
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 @L1CTL_Types.L1ctlH0H1.");
}
}

void L1ctlH0H1_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
{
single_value.union_selection = L1ctlH0H1::UNBOUND_VALUE;
L1ctlH0H1::union_selection_type new_selection = (L1ctlH0H1::union_selection_type)text_buf.pull_int().get_val();
switch (new_selection) {
case L1ctlH0H1::ALT_h0:
single_value.field_h0 = new L1ctlH0_template;
single_value.field_h0->decode_text(text_buf);
break;
case L1ctlH0H1::ALT_h1:
single_value.field_h1 = new L1ctlH1_template;
single_value.field_h1->decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @L1CTL_Types.L1ctlH0H1.");
}
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 L1ctlH0H1_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 @L1CTL_Types.L1ctlH0H1.");
}
}

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

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

void L1ctlH0H1_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 L1ctlH0H1::ALT_h0:
single_value.field_h0->check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlH0H1");
return;
case L1ctlH0H1::ALT_h1:
single_value.field_h1->check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlH0H1");
return;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @L1CTL_Types.L1ctlH0H1.");
}
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 : "@L1CTL_Types.L1ctlH0H1");
}

L1ctlDmEstReq::L1ctlDmEstReq()
{
}

L1ctlDmEstReq::L1ctlDmEstReq(const INTEGER& par_tsc,
    const L1ctlH0H1& par_h0h1,
    const L1ctlTchMode& par_tch__mode,
    const L1ctlAudioMode& par_audio__mode)
  :   field_tsc(par_tsc),
  field_h0h1(par_h0h1),
  field_tch__mode(par_tch__mode),
  field_audio__mode(par_audio__mode)
{
}

L1ctlDmEstReq::L1ctlDmEstReq(const L1ctlDmEstReq& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlDmEstReq.");
if (other_value.tsc().is_bound()) field_tsc = other_value.tsc();
else field_tsc.clean_up();
if (other_value.h0h1().is_bound()) field_h0h1 = other_value.h0h1();
else field_h0h1.clean_up();
if (other_value.tch__mode().is_bound()) field_tch__mode = other_value.tch__mode();
else field_tch__mode.clean_up();
if (other_value.audio__mode().is_bound()) field_audio__mode = other_value.audio__mode();
else field_audio__mode.clean_up();
}

void L1ctlDmEstReq::clean_up()
{
field_tsc.clean_up();
field_h0h1.clean_up();
field_tch__mode.clean_up();
field_audio__mode.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlDmEstReq::get_descriptor() const { return &L1ctlDmEstReq_descr_; }
L1ctlDmEstReq& L1ctlDmEstReq::operator=(const L1ctlDmEstReq& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlDmEstReq.");
  if (other_value.tsc().is_bound()) field_tsc = other_value.tsc();
  else field_tsc.clean_up();
  if (other_value.h0h1().is_bound()) field_h0h1 = other_value.h0h1();
  else field_h0h1.clean_up();
  if (other_value.tch__mode().is_bound()) field_tch__mode = other_value.tch__mode();
  else field_tch__mode.clean_up();
  if (other_value.audio__mode().is_bound()) field_audio__mode = other_value.audio__mode();
  else field_audio__mode.clean_up();
}
return *this;
}

boolean L1ctlDmEstReq::operator==(const L1ctlDmEstReq& other_value) const
{
return field_tsc==other_value.field_tsc
  && field_h0h1==other_value.field_h0h1
  && field_tch__mode==other_value.field_tch__mode
  && field_audio__mode==other_value.field_audio__mode;
}

boolean L1ctlDmEstReq::is_bound() const
{
return (field_tsc.is_bound())
  || (field_h0h1.is_bound())
  || (field_tch__mode.is_bound())
  || (field_audio__mode.is_bound());
}
boolean L1ctlDmEstReq::is_value() const
{
return field_tsc.is_value()
  && field_h0h1.is_value()
  && field_tch__mode.is_value()
  && field_audio__mode.is_value();
}
void L1ctlDmEstReq::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ tsc := ");
field_tsc.log();
TTCN_Logger::log_event_str(", h0h1 := ");
field_h0h1.log();
TTCN_Logger::log_event_str(", tch_mode := ");
field_tch__mode.log();
TTCN_Logger::log_event_str(", audio_mode := ");
field_audio__mode.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlDmEstReq::set_implicit_omit()
{
if (tsc().is_bound()) tsc().set_implicit_omit();
if (h0h1().is_bound()) h0h1().set_implicit_omit();
if (tch__mode().is_bound()) tch__mode().set_implicit_omit();
if (audio__mode().is_bound()) audio__mode().set_implicit_omit();
}

void L1ctlDmEstReq::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 @L1CTL_Types.L1ctlDmEstReq 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) tsc().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) h0h1().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) tch__mode().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) audio__mode().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(), "tsc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tsc().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(), "h0h1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          h0h1().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(), "tch_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tch__mode().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(), "audio_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          audio__mode().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 @L1CTL_Types.L1ctlDmEstReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlDmEstReq");
  }
}

void L1ctlDmEstReq::encode_text(Text_Buf& text_buf) const
{
field_tsc.encode_text(text_buf);
field_h0h1.encode_text(text_buf);
field_tch__mode.encode_text(text_buf);
field_audio__mode.encode_text(text_buf);
}

void L1ctlDmEstReq::decode_text(Text_Buf& text_buf)
{
field_tsc.decode_text(text_buf);
field_h0h1.decode_text(text_buf);
field_tch__mode.decode_text(text_buf);
field_audio__mode.decode_text(text_buf);
}

void L1ctlDmEstReq::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 L1ctlDmEstReq::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 L1ctlDmEstReq::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, GSM__Types::GsmTsc_descr_.raw->forceomit);
  decoded_field_length = field_tsc.RAW_decode(GSM__Types::GsmTsc_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, L1ctlH0H1_descr_.raw->forceomit);
  decoded_field_length = field_h0h1.RAW_decode(L1ctlH0H1_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, L1ctlTchMode_descr_.raw->forceomit);
  decoded_field_length = field_tch__mode.RAW_decode(L1ctlTchMode_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, L1ctlAudioMode_descr_.raw->forceomit);
  decoded_field_length = field_audio__mode.RAW_decode(L1ctlAudioMode_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 L1ctlDmEstReq::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, GSM__Types::GsmTsc_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, L1ctlH0H1_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, L1ctlTchMode_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, L1ctlAudioMode_descr_.raw);
  encoded_length += field_tsc.RAW_encode(GSM__Types::GsmTsc_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_h0h1.RAW_encode(L1ctlH0H1_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_tch__mode.RAW_encode(L1ctlTchMode_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_audio__mode.RAW_encode(L1ctlAudioMode_descr_, *myleaf.body.node.nodes[3]);
  return myleaf.length = encoded_length;
}

struct L1ctlDmEstReq_template::single_value_struct {
INTEGER_template field_tsc;
L1ctlH0H1_template field_h0h1;
L1ctlTchMode_template field_tch__mode;
L1ctlAudioMode_template field_audio__mode;
};

void L1ctlDmEstReq_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_tsc = ANY_VALUE;
single_value->field_h0h1 = ANY_VALUE;
single_value->field_tch__mode = ANY_VALUE;
single_value->field_audio__mode = ANY_VALUE;
}
}
}

void L1ctlDmEstReq_template::copy_value(const L1ctlDmEstReq& other_value)
{
single_value = new single_value_struct;
if (other_value.tsc().is_bound()) {
  single_value->field_tsc = other_value.tsc();
} else {
  single_value->field_tsc.clean_up();
}
if (other_value.h0h1().is_bound()) {
  single_value->field_h0h1 = other_value.h0h1();
} else {
  single_value->field_h0h1.clean_up();
}
if (other_value.tch__mode().is_bound()) {
  single_value->field_tch__mode = other_value.tch__mode();
} else {
  single_value->field_tch__mode.clean_up();
}
if (other_value.audio__mode().is_bound()) {
  single_value->field_audio__mode = other_value.audio__mode();
} else {
  single_value->field_audio__mode.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlDmEstReq_template::copy_template(const L1ctlDmEstReq_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.tsc().get_selection()) {
single_value->field_tsc = other_value.tsc();
} else {
single_value->field_tsc.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.h0h1().get_selection()) {
single_value->field_h0h1 = other_value.h0h1();
} else {
single_value->field_h0h1.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tch__mode().get_selection()) {
single_value->field_tch__mode = other_value.tch__mode();
} else {
single_value->field_tch__mode.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.audio__mode().get_selection()) {
single_value->field_audio__mode = other_value.audio__mode();
} else {
single_value->field_audio__mode.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 L1ctlDmEstReq_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 L1ctlDmEstReq_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlDmEstReq_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 @L1CTL_Types.L1ctlDmEstReq.");
break;
}
set_selection(other_value);
}

L1ctlDmEstReq_template::L1ctlDmEstReq_template()
{
}

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

L1ctlDmEstReq_template::L1ctlDmEstReq_template(const L1ctlDmEstReq& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlDmEstReq_template::match(const L1ctlDmEstReq& 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.tsc().is_bound()) return FALSE;
if(!single_value->field_tsc.match(other_value.tsc(), legacy))return FALSE;
if(!other_value.h0h1().is_bound()) return FALSE;
if(!single_value->field_h0h1.match(other_value.h0h1(), legacy))return FALSE;
if(!other_value.tch__mode().is_bound()) return FALSE;
if(!single_value->field_tch__mode.match(other_value.tch__mode(), legacy))return FALSE;
if(!other_value.audio__mode().is_bound()) return FALSE;
if(!single_value->field_audio__mode.match(other_value.audio__mode(), 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 @L1CTL_Types.L1ctlDmEstReq.");
}
return FALSE;
}

boolean L1ctlDmEstReq_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_tsc.is_bound()
 || single_value->field_h0h1.is_bound()
 || single_value->field_tch__mode.is_bound()
 || single_value->field_audio__mode.is_bound();
}

boolean L1ctlDmEstReq_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_tsc.is_value()
 && single_value->field_h0h1.is_value()
 && single_value->field_tch__mode.is_value()
 && single_value->field_audio__mode.is_value();
}

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

L1ctlDmEstReq L1ctlDmEstReq_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 @L1CTL_Types.L1ctlDmEstReq.");
L1ctlDmEstReq ret_val;
if (single_value->field_tsc.is_bound()) {
ret_val.tsc() = single_value->field_tsc.valueof();
}
if (single_value->field_h0h1.is_bound()) {
ret_val.h0h1() = single_value->field_h0h1.valueof();
}
if (single_value->field_tch__mode.is_bound()) {
ret_val.tch__mode() = single_value->field_tch__mode.valueof();
}
if (single_value->field_audio__mode.is_bound()) {
ret_val.audio__mode() = single_value->field_audio__mode.valueof();
}
return ret_val;
}

void L1ctlDmEstReq_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 @L1CTL_Types.L1ctlDmEstReq.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlDmEstReq_template[list_length];
}

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

INTEGER_template& L1ctlDmEstReq_template::tsc()
{
set_specific();
return single_value->field_tsc;
}

const INTEGER_template& L1ctlDmEstReq_template::tsc() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tsc of a non-specific template of type @L1CTL_Types.L1ctlDmEstReq.");
return single_value->field_tsc;
}

L1ctlH0H1_template& L1ctlDmEstReq_template::h0h1()
{
set_specific();
return single_value->field_h0h1;
}

const L1ctlH0H1_template& L1ctlDmEstReq_template::h0h1() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field h0h1 of a non-specific template of type @L1CTL_Types.L1ctlDmEstReq.");
return single_value->field_h0h1;
}

L1ctlTchMode_template& L1ctlDmEstReq_template::tch__mode()
{
set_specific();
return single_value->field_tch__mode;
}

const L1ctlTchMode_template& L1ctlDmEstReq_template::tch__mode() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tch_mode of a non-specific template of type @L1CTL_Types.L1ctlDmEstReq.");
return single_value->field_tch__mode;
}

L1ctlAudioMode_template& L1ctlDmEstReq_template::audio__mode()
{
set_specific();
return single_value->field_audio__mode;
}

const L1ctlAudioMode_template& L1ctlDmEstReq_template::audio__mode() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field audio_mode of a non-specific template of type @L1CTL_Types.L1ctlDmEstReq.");
return single_value->field_audio__mode;
}

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

void L1ctlDmEstReq_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ tsc := ");
single_value->field_tsc.log();
TTCN_Logger::log_event_str(", h0h1 := ");
single_value->field_h0h1.log();
TTCN_Logger::log_event_str(", tch_mode := ");
single_value->field_tch__mode.log();
TTCN_Logger::log_event_str(", audio_mode := ");
single_value->field_audio__mode.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 L1ctlDmEstReq_template::log_match(const L1ctlDmEstReq& 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_tsc.match(match_value.tsc(), legacy)){
TTCN_Logger::log_logmatch_info(".tsc");
single_value->field_tsc.log_match(match_value.tsc(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_h0h1.match(match_value.h0h1(), legacy)){
TTCN_Logger::log_logmatch_info(".h0h1");
single_value->field_h0h1.log_match(match_value.h0h1(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tch__mode.match(match_value.tch__mode(), legacy)){
TTCN_Logger::log_logmatch_info(".tch_mode");
single_value->field_tch__mode.log_match(match_value.tch__mode(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_audio__mode.match(match_value.audio__mode(), legacy)){
TTCN_Logger::log_logmatch_info(".audio_mode");
single_value->field_audio__mode.log_match(match_value.audio__mode(), 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("{ tsc := ");
single_value->field_tsc.log_match(match_value.tsc(), legacy);
TTCN_Logger::log_event_str(", h0h1 := ");
single_value->field_h0h1.log_match(match_value.h0h1(), legacy);
TTCN_Logger::log_event_str(", tch_mode := ");
single_value->field_tch__mode.log_match(match_value.tch__mode(), legacy);
TTCN_Logger::log_event_str(", audio_mode := ");
single_value->field_audio__mode.log_match(match_value.audio__mode(), 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 L1ctlDmEstReq_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (tsc().is_bound()) tsc().set_implicit_omit();
if (h0h1().is_bound()) h0h1().set_implicit_omit();
if (tch__mode().is_bound()) tch__mode().set_implicit_omit();
if (audio__mode().is_bound()) audio__mode().set_implicit_omit();
}

void L1ctlDmEstReq_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_tsc.encode_text(text_buf);
single_value->field_h0h1.encode_text(text_buf);
single_value->field_tch__mode.encode_text(text_buf);
single_value->field_audio__mode.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 @L1CTL_Types.L1ctlDmEstReq.");
}
}

void L1ctlDmEstReq_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_tsc.decode_text(text_buf);
single_value->field_h0h1.decode_text(text_buf);
single_value->field_tch__mode.decode_text(text_buf);
single_value->field_audio__mode.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 L1ctlDmEstReq_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 @L1CTL_Types.L1ctlDmEstReq.");
}
}

void L1ctlDmEstReq_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: {
    L1ctlDmEstReq_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 @L1CTL_Types.L1ctlDmEstReq 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) tsc().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) h0h1().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) tch__mode().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) audio__mode().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(), "tsc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tsc().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(), "h0h1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          h0h1().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(), "tch_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tch__mode().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(), "audio_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          audio__mode().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 @L1CTL_Types.L1ctlDmEstReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlDmEstReq_template* precondition = new L1ctlDmEstReq_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlDmEstReq_template* implied_template = new L1ctlDmEstReq_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlDmEstReq_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlDmEstReq");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlDmEstReq_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_tsc.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlDmEstReq");
single_value->field_h0h1.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlDmEstReq");
single_value->field_tch__mode.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlDmEstReq");
single_value->field_audio__mode.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlDmEstReq");
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 : "@L1CTL_Types.L1ctlDmEstReq");
}

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

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

L1ctlReset::L1ctlReset()
{
}

L1ctlReset::L1ctlReset(const L1ctlResetType& par_reset__type,
    const OCTETSTRING& par_padding)
  :   field_reset__type(par_reset__type),
  field_padding(par_padding)
{
}

L1ctlReset::L1ctlReset(const L1ctlReset& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlReset.");
if (other_value.reset__type().is_bound()) field_reset__type = other_value.reset__type();
else field_reset__type.clean_up();
if (other_value.padding().is_bound()) field_padding = other_value.padding();
else field_padding.clean_up();
}

void L1ctlReset::clean_up()
{
field_reset__type.clean_up();
field_padding.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlReset::get_descriptor() const { return &L1ctlReset_descr_; }
L1ctlReset& L1ctlReset::operator=(const L1ctlReset& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlReset.");
  if (other_value.reset__type().is_bound()) field_reset__type = other_value.reset__type();
  else field_reset__type.clean_up();
  if (other_value.padding().is_bound()) field_padding = other_value.padding();
  else field_padding.clean_up();
}
return *this;
}

boolean L1ctlReset::operator==(const L1ctlReset& other_value) const
{
return field_reset__type==other_value.field_reset__type
  && field_padding==other_value.field_padding;
}

boolean L1ctlReset::is_bound() const
{
return (field_reset__type.is_bound())
  || (field_padding.is_bound());
}
boolean L1ctlReset::is_value() const
{
return field_reset__type.is_value()
  && field_padding.is_value();
}
void L1ctlReset::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ reset_type := ");
field_reset__type.log();
TTCN_Logger::log_event_str(", padding := ");
field_padding.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlReset::set_implicit_omit()
{
if (reset__type().is_bound()) reset__type().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

void L1ctlReset::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record value of type @L1CTL_Types.L1ctlReset has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) reset__type().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) padding().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "reset_type")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          reset__type().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 @L1CTL_Types.L1ctlReset: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlReset");
  }
}

void L1ctlReset::encode_text(Text_Buf& text_buf) const
{
field_reset__type.encode_text(text_buf);
field_padding.encode_text(text_buf);
}

void L1ctlReset::decode_text(Text_Buf& text_buf)
{
field_reset__type.decode_text(text_buf);
field_padding.decode_text(text_buf);
}

void L1ctlReset::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 L1ctlReset::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 L1ctlReset::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, L1ctlResetType_descr_.raw->forceomit);
  decoded_field_length = field_reset__type.RAW_decode(L1ctlResetType_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::OCT3_descr_.raw->forceomit);
  decoded_field_length = field_padding.RAW_decode(General__Types::OCT3_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

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

struct L1ctlReset_template::single_value_struct {
L1ctlResetType_template field_reset__type;
OCTETSTRING_template field_padding;
};

void L1ctlReset_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_reset__type = ANY_VALUE;
single_value->field_padding = ANY_VALUE;
}
}
}

void L1ctlReset_template::copy_value(const L1ctlReset& other_value)
{
single_value = new single_value_struct;
if (other_value.reset__type().is_bound()) {
  single_value->field_reset__type = other_value.reset__type();
} else {
  single_value->field_reset__type.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 L1ctlReset_template::copy_template(const L1ctlReset_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.reset__type().get_selection()) {
single_value->field_reset__type = other_value.reset__type();
} else {
single_value->field_reset__type.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 L1ctlReset_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 L1ctlReset_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlReset_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 @L1CTL_Types.L1ctlReset.");
break;
}
set_selection(other_value);
}

L1ctlReset_template::L1ctlReset_template()
{
}

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

L1ctlReset_template::L1ctlReset_template(const L1ctlReset& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlReset_template::match(const L1ctlReset& 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.reset__type().is_bound()) return FALSE;
if(!single_value->field_reset__type.match(other_value.reset__type(), 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 @L1CTL_Types.L1ctlReset.");
}
return FALSE;
}

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

boolean L1ctlReset_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_reset__type.is_value()
 && single_value->field_padding.is_value();
}

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

L1ctlReset L1ctlReset_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 @L1CTL_Types.L1ctlReset.");
L1ctlReset ret_val;
if (single_value->field_reset__type.is_bound()) {
ret_val.reset__type() = single_value->field_reset__type.valueof();
}
if (single_value->field_padding.is_bound()) {
ret_val.padding() = single_value->field_padding.valueof();
}
return ret_val;
}

void L1ctlReset_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 @L1CTL_Types.L1ctlReset.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlReset_template[list_length];
}

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

L1ctlResetType_template& L1ctlReset_template::reset__type()
{
set_specific();
return single_value->field_reset__type;
}

const L1ctlResetType_template& L1ctlReset_template::reset__type() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field reset_type of a non-specific template of type @L1CTL_Types.L1ctlReset.");
return single_value->field_reset__type;
}

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

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

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

void L1ctlReset_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ reset_type := ");
single_value->field_reset__type.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 L1ctlReset_template::log_match(const L1ctlReset& 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_reset__type.match(match_value.reset__type(), legacy)){
TTCN_Logger::log_logmatch_info(".reset_type");
single_value->field_reset__type.log_match(match_value.reset__type(), 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("{ reset_type := ");
single_value->field_reset__type.log_match(match_value.reset__type(), 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 L1ctlReset_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (reset__type().is_bound()) reset__type().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

void L1ctlReset_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_reset__type.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 @L1CTL_Types.L1ctlReset.");
}
}

void L1ctlReset_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_reset__type.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 L1ctlReset_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 @L1CTL_Types.L1ctlReset.");
}
}

void L1ctlReset_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: {
    L1ctlReset_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @L1CTL_Types.L1ctlReset has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) reset__type().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) padding().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "reset_type")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          reset__type().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 @L1CTL_Types.L1ctlReset: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlReset_template* precondition = new L1ctlReset_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlReset_template* implied_template = new L1ctlReset_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlReset_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlReset");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlReset_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_reset__type.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlReset");
single_value->field_padding.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlReset");
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 : "@L1CTL_Types.L1ctlReset");
}

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

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

L1CtlCryptoReq::L1CtlCryptoReq()
{
}

L1CtlCryptoReq::L1CtlCryptoReq(const INTEGER& par_algo,
    const INTEGER& par_key__len,
    const OCTETSTRING& par_key)
  :   field_algo(par_algo),
  field_key__len(par_key__len),
  field_key(par_key)
{
}

L1CtlCryptoReq::L1CtlCryptoReq(const L1CtlCryptoReq& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1CtlCryptoReq.");
if (other_value.algo().is_bound()) field_algo = other_value.algo();
else field_algo.clean_up();
if (other_value.key__len().is_bound()) field_key__len = other_value.key__len();
else field_key__len.clean_up();
if (other_value.key().is_bound()) field_key = other_value.key();
else field_key.clean_up();
}

void L1CtlCryptoReq::clean_up()
{
field_algo.clean_up();
field_key__len.clean_up();
field_key.clean_up();
}

const TTCN_Typedescriptor_t* L1CtlCryptoReq::get_descriptor() const { return &L1CtlCryptoReq_descr_; }
L1CtlCryptoReq& L1CtlCryptoReq::operator=(const L1CtlCryptoReq& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1CtlCryptoReq.");
  if (other_value.algo().is_bound()) field_algo = other_value.algo();
  else field_algo.clean_up();
  if (other_value.key__len().is_bound()) field_key__len = other_value.key__len();
  else field_key__len.clean_up();
  if (other_value.key().is_bound()) field_key = other_value.key();
  else field_key.clean_up();
}
return *this;
}

boolean L1CtlCryptoReq::operator==(const L1CtlCryptoReq& other_value) const
{
return field_algo==other_value.field_algo
  && field_key__len==other_value.field_key__len
  && field_key==other_value.field_key;
}

boolean L1CtlCryptoReq::is_bound() const
{
return (field_algo.is_bound())
  || (field_key__len.is_bound())
  || (field_key.is_bound());
}
boolean L1CtlCryptoReq::is_value() const
{
return field_algo.is_value()
  && field_key__len.is_value()
  && field_key.is_value();
}
void L1CtlCryptoReq::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ algo := ");
field_algo.log();
TTCN_Logger::log_event_str(", key_len := ");
field_key__len.log();
TTCN_Logger::log_event_str(", key := ");
field_key.log();
TTCN_Logger::log_event_str(" }");
}

void L1CtlCryptoReq::set_implicit_omit()
{
if (algo().is_bound()) algo().set_implicit_omit();
if (key__len().is_bound()) key__len().set_implicit_omit();
if (key().is_bound()) key().set_implicit_omit();
}

void L1CtlCryptoReq::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 @L1CTL_Types.L1CtlCryptoReq 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) algo().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) key__len().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) key().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(), "algo")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          algo().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(), "key_len")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          key__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(), "key")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          key().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 @L1CTL_Types.L1CtlCryptoReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1CtlCryptoReq");
  }
}

void L1CtlCryptoReq::encode_text(Text_Buf& text_buf) const
{
field_algo.encode_text(text_buf);
field_key__len.encode_text(text_buf);
field_key.encode_text(text_buf);
}

void L1CtlCryptoReq::decode_text(Text_Buf& text_buf)
{
field_algo.decode_text(text_buf);
field_key__len.decode_text(text_buf);
field_key.decode_text(text_buf);
}

void L1CtlCryptoReq::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 L1CtlCryptoReq::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 L1CtlCryptoReq::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_field1 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_algo.RAW_decode(Osmocom__Types::uint8__t_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, L1CtlCryptoReq_key__len_descr_.raw->forceomit);
  decoded_field_length = field_key__len.RAW_decode(L1CtlCryptoReq_key__len_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());
  INTEGER tmp1 = field_key__len.convert_to_Integer(L1CtlCryptoReq_key__len_descr_);
  field_key__len = tmp1;
  value_of_length_field1 += tmp1.get_long_long_val() * 8;
  RAW_Force_Omit field_2_force_omit(2, force_omit, OCTETSTRING_descr_.raw->forceomit);
  decoded_field_length = field_key.RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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());
  value_of_length_field1 -= decoded_field_length;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int L1CtlCryptoReq::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, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, L1CtlCryptoReq_key__len_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, OCTETSTRING_descr_.raw);
  encoded_length += field_algo.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += 8;
  myleaf.body.node.nodes[1]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[1]->coding_descr = &L1CtlCryptoReq_key__len_descr_;
  myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[1]->length = 8;
  myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level;
  myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos;
  encoded_length += field_key.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct L1CtlCryptoReq_template::single_value_struct {
INTEGER_template field_algo;
INTEGER_template field_key__len;
OCTETSTRING_template field_key;
};

void L1CtlCryptoReq_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_algo = ANY_VALUE;
single_value->field_key__len = ANY_VALUE;
single_value->field_key = ANY_VALUE;
}
}
}

void L1CtlCryptoReq_template::copy_value(const L1CtlCryptoReq& other_value)
{
single_value = new single_value_struct;
if (other_value.algo().is_bound()) {
  single_value->field_algo = other_value.algo();
} else {
  single_value->field_algo.clean_up();
}
if (other_value.key__len().is_bound()) {
  single_value->field_key__len = other_value.key__len();
} else {
  single_value->field_key__len.clean_up();
}
if (other_value.key().is_bound()) {
  single_value->field_key = other_value.key();
} else {
  single_value->field_key.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1CtlCryptoReq_template::copy_template(const L1CtlCryptoReq_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.algo().get_selection()) {
single_value->field_algo = other_value.algo();
} else {
single_value->field_algo.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.key__len().get_selection()) {
single_value->field_key__len = other_value.key__len();
} else {
single_value->field_key__len.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.key().get_selection()) {
single_value->field_key = other_value.key();
} else {
single_value->field_key.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 L1CtlCryptoReq_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 L1CtlCryptoReq_template(*other_value.implication_.precondition);
implication_.implied_template = new L1CtlCryptoReq_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 @L1CTL_Types.L1CtlCryptoReq.");
break;
}
set_selection(other_value);
}

L1CtlCryptoReq_template::L1CtlCryptoReq_template()
{
}

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

L1CtlCryptoReq_template::L1CtlCryptoReq_template(const L1CtlCryptoReq& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1CtlCryptoReq_template::match(const L1CtlCryptoReq& 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.algo().is_bound()) return FALSE;
if(!single_value->field_algo.match(other_value.algo(), legacy))return FALSE;
if(!other_value.key__len().is_bound()) return FALSE;
if(!single_value->field_key__len.match(other_value.key__len(), legacy))return FALSE;
if(!other_value.key().is_bound()) return FALSE;
if(!single_value->field_key.match(other_value.key(), 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 @L1CTL_Types.L1CtlCryptoReq.");
}
return FALSE;
}

boolean L1CtlCryptoReq_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_algo.is_bound()
 || single_value->field_key__len.is_bound()
 || single_value->field_key.is_bound();
}

boolean L1CtlCryptoReq_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_algo.is_value()
 && single_value->field_key__len.is_value()
 && single_value->field_key.is_value();
}

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

L1CtlCryptoReq L1CtlCryptoReq_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 @L1CTL_Types.L1CtlCryptoReq.");
L1CtlCryptoReq ret_val;
if (single_value->field_algo.is_bound()) {
ret_val.algo() = single_value->field_algo.valueof();
}
if (single_value->field_key__len.is_bound()) {
ret_val.key__len() = single_value->field_key__len.valueof();
}
if (single_value->field_key.is_bound()) {
ret_val.key() = single_value->field_key.valueof();
}
return ret_val;
}

void L1CtlCryptoReq_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 @L1CTL_Types.L1CtlCryptoReq.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1CtlCryptoReq_template[list_length];
}

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

INTEGER_template& L1CtlCryptoReq_template::algo()
{
set_specific();
return single_value->field_algo;
}

const INTEGER_template& L1CtlCryptoReq_template::algo() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field algo of a non-specific template of type @L1CTL_Types.L1CtlCryptoReq.");
return single_value->field_algo;
}

INTEGER_template& L1CtlCryptoReq_template::key__len()
{
set_specific();
return single_value->field_key__len;
}

const INTEGER_template& L1CtlCryptoReq_template::key__len() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field key_len of a non-specific template of type @L1CTL_Types.L1CtlCryptoReq.");
return single_value->field_key__len;
}

OCTETSTRING_template& L1CtlCryptoReq_template::key()
{
set_specific();
return single_value->field_key;
}

const OCTETSTRING_template& L1CtlCryptoReq_template::key() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field key of a non-specific template of type @L1CTL_Types.L1CtlCryptoReq.");
return single_value->field_key;
}

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

void L1CtlCryptoReq_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ algo := ");
single_value->field_algo.log();
TTCN_Logger::log_event_str(", key_len := ");
single_value->field_key__len.log();
TTCN_Logger::log_event_str(", key := ");
single_value->field_key.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 L1CtlCryptoReq_template::log_match(const L1CtlCryptoReq& 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_algo.match(match_value.algo(), legacy)){
TTCN_Logger::log_logmatch_info(".algo");
single_value->field_algo.log_match(match_value.algo(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_key__len.match(match_value.key__len(), legacy)){
TTCN_Logger::log_logmatch_info(".key_len");
single_value->field_key__len.log_match(match_value.key__len(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_key.match(match_value.key(), legacy)){
TTCN_Logger::log_logmatch_info(".key");
single_value->field_key.log_match(match_value.key(), 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("{ algo := ");
single_value->field_algo.log_match(match_value.algo(), legacy);
TTCN_Logger::log_event_str(", key_len := ");
single_value->field_key__len.log_match(match_value.key__len(), legacy);
TTCN_Logger::log_event_str(", key := ");
single_value->field_key.log_match(match_value.key(), 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 L1CtlCryptoReq_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (algo().is_bound()) algo().set_implicit_omit();
if (key__len().is_bound()) key__len().set_implicit_omit();
if (key().is_bound()) key().set_implicit_omit();
}

void L1CtlCryptoReq_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_algo.encode_text(text_buf);
single_value->field_key__len.encode_text(text_buf);
single_value->field_key.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 @L1CTL_Types.L1CtlCryptoReq.");
}
}

void L1CtlCryptoReq_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_algo.decode_text(text_buf);
single_value->field_key__len.decode_text(text_buf);
single_value->field_key.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 L1CtlCryptoReq_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 @L1CTL_Types.L1CtlCryptoReq.");
}
}

void L1CtlCryptoReq_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: {
    L1CtlCryptoReq_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 @L1CTL_Types.L1CtlCryptoReq 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) algo().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) key__len().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) key().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(), "algo")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          algo().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(), "key_len")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          key__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(), "key")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          key().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 @L1CTL_Types.L1CtlCryptoReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1CtlCryptoReq_template* precondition = new L1CtlCryptoReq_template;
    precondition->set_param(*param.get_elem(0));
    L1CtlCryptoReq_template* implied_template = new L1CtlCryptoReq_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1CtlCryptoReq_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1CtlCryptoReq");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1CtlCryptoReq_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_algo.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1CtlCryptoReq");
single_value->field_key__len.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1CtlCryptoReq");
single_value->field_key.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1CtlCryptoReq");
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 : "@L1CTL_Types.L1CtlCryptoReq");
}

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

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

L1ctlTrafficReq::L1ctlTrafficReq()
{
}

L1ctlTrafficReq::L1ctlTrafficReq(const OCTETSTRING& par_data)
  :   field_data(par_data)
{
}

L1ctlTrafficReq::L1ctlTrafficReq(const L1ctlTrafficReq& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlTrafficReq.");
if (other_value.data().is_bound()) field_data = other_value.data();
else field_data.clean_up();
}

void L1ctlTrafficReq::clean_up()
{
field_data.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlTrafficReq::get_descriptor() const { return &L1ctlTrafficReq_descr_; }
L1ctlTrafficReq& L1ctlTrafficReq::operator=(const L1ctlTrafficReq& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlTrafficReq.");
  if (other_value.data().is_bound()) field_data = other_value.data();
  else field_data.clean_up();
}
return *this;
}

boolean L1ctlTrafficReq::operator==(const L1ctlTrafficReq& other_value) const
{
return field_data==other_value.field_data;
}

boolean L1ctlTrafficReq::is_bound() const
{
return (field_data.is_bound());
}
boolean L1ctlTrafficReq::is_value() const
{
return field_data.is_value();
}
void L1ctlTrafficReq::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ data := ");
field_data.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlTrafficReq::set_implicit_omit()
{
if (data().is_bound()) data().set_implicit_omit();
}

void L1ctlTrafficReq::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 @L1CTL_Types.L1ctlTrafficReq 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) data().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(), "data")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          data().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @L1CTL_Types.L1ctlTrafficReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlTrafficReq");
  }
}

void L1ctlTrafficReq::encode_text(Text_Buf& text_buf) const
{
field_data.encode_text(text_buf);
}

void L1ctlTrafficReq::decode_text(Text_Buf& text_buf)
{
field_data.decode_text(text_buf);
}

void L1ctlTrafficReq::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 L1ctlTrafficReq::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 L1ctlTrafficReq::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, L1ctlTrafficReq_data_descr_.raw->forceomit);
  decoded_field_length = field_data.RAW_decode(L1ctlTrafficReq_data_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 L1ctlTrafficReq::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, L1ctlTrafficReq_data_descr_.raw);
  encoded_length += field_data.RAW_encode(L1ctlTrafficReq_data_descr_, *myleaf.body.node.nodes[0]);
  return myleaf.length = encoded_length;
}

struct L1ctlTrafficReq_template::single_value_struct {
OCTETSTRING_template field_data;
};

void L1ctlTrafficReq_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_data = ANY_VALUE;
}
}
}

void L1ctlTrafficReq_template::copy_value(const L1ctlTrafficReq& other_value)
{
single_value = new single_value_struct;
if (other_value.data().is_bound()) {
  single_value->field_data = other_value.data();
} else {
  single_value->field_data.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlTrafficReq_template::copy_template(const L1ctlTrafficReq_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.data().get_selection()) {
single_value->field_data = other_value.data();
} else {
single_value->field_data.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new L1ctlTrafficReq_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 L1ctlTrafficReq_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlTrafficReq_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 @L1CTL_Types.L1ctlTrafficReq.");
break;
}
set_selection(other_value);
}

L1ctlTrafficReq_template::L1ctlTrafficReq_template()
{
}

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

L1ctlTrafficReq_template::L1ctlTrafficReq_template(const L1ctlTrafficReq& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlTrafficReq_template::match(const L1ctlTrafficReq& 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.data().is_bound()) return FALSE;
if(!single_value->field_data.match(other_value.data(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @L1CTL_Types.L1ctlTrafficReq.");
}
return FALSE;
}

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

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

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

L1ctlTrafficReq L1ctlTrafficReq_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 @L1CTL_Types.L1ctlTrafficReq.");
L1ctlTrafficReq ret_val;
if (single_value->field_data.is_bound()) {
ret_val.data() = single_value->field_data.valueof();
}
return ret_val;
}

void L1ctlTrafficReq_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 @L1CTL_Types.L1ctlTrafficReq.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlTrafficReq_template[list_length];
}

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

OCTETSTRING_template& L1ctlTrafficReq_template::data()
{
set_specific();
return single_value->field_data;
}

const OCTETSTRING_template& L1ctlTrafficReq_template::data() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field data of a non-specific template of type @L1CTL_Types.L1ctlTrafficReq.");
return single_value->field_data;
}

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

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

void L1ctlTrafficReq_template::log_match(const L1ctlTrafficReq& 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_data.match(match_value.data(), legacy)){
TTCN_Logger::log_logmatch_info(".data");
single_value->field_data.log_match(match_value.data(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ data := ");
single_value->field_data.log_match(match_value.data(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void L1ctlTrafficReq_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (data().is_bound()) data().set_implicit_omit();
}

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

void L1ctlTrafficReq_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_data.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new L1ctlTrafficReq_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 @L1CTL_Types.L1ctlTrafficReq.");
}
}

void L1ctlTrafficReq_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: {
    L1ctlTrafficReq_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 @L1CTL_Types.L1ctlTrafficReq 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) data().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(), "data")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          data().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @L1CTL_Types.L1ctlTrafficReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlTrafficReq_template* precondition = new L1ctlTrafficReq_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlTrafficReq_template* implied_template = new L1ctlTrafficReq_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlTrafficReq_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlTrafficReq");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlTrafficReq_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_data.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlTrafficReq");
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 : "@L1CTL_Types.L1ctlTrafficReq");
}

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

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

L1ctlGprsUlTbfCfgReq::L1ctlGprsUlTbfCfgReq()
{
}

L1ctlGprsUlTbfCfgReq::L1ctlGprsUlTbfCfgReq(const INTEGER& par_tbf__ref,
    const BITSTRING& par_slotmask,
    const OCTETSTRING& par_pad,
    const INTEGER& par_start__fn)
  :   field_tbf__ref(par_tbf__ref),
  field_slotmask(par_slotmask),
  field_pad(par_pad),
  field_start__fn(par_start__fn)
{
}

L1ctlGprsUlTbfCfgReq::L1ctlGprsUlTbfCfgReq(const L1ctlGprsUlTbfCfgReq& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlGprsUlTbfCfgReq.");
if (other_value.tbf__ref().is_bound()) field_tbf__ref = other_value.tbf__ref();
else field_tbf__ref.clean_up();
if (other_value.slotmask().is_bound()) field_slotmask = other_value.slotmask();
else field_slotmask.clean_up();
if (other_value.pad().is_bound()) field_pad = other_value.pad();
else field_pad.clean_up();
if (other_value.start__fn().is_bound()) field_start__fn = other_value.start__fn();
else field_start__fn.clean_up();
}

void L1ctlGprsUlTbfCfgReq::clean_up()
{
field_tbf__ref.clean_up();
field_slotmask.clean_up();
field_pad.clean_up();
field_start__fn.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlGprsUlTbfCfgReq::get_descriptor() const { return &L1ctlGprsUlTbfCfgReq_descr_; }
L1ctlGprsUlTbfCfgReq& L1ctlGprsUlTbfCfgReq::operator=(const L1ctlGprsUlTbfCfgReq& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlGprsUlTbfCfgReq.");
  if (other_value.tbf__ref().is_bound()) field_tbf__ref = other_value.tbf__ref();
  else field_tbf__ref.clean_up();
  if (other_value.slotmask().is_bound()) field_slotmask = other_value.slotmask();
  else field_slotmask.clean_up();
  if (other_value.pad().is_bound()) field_pad = other_value.pad();
  else field_pad.clean_up();
  if (other_value.start__fn().is_bound()) field_start__fn = other_value.start__fn();
  else field_start__fn.clean_up();
}
return *this;
}

boolean L1ctlGprsUlTbfCfgReq::operator==(const L1ctlGprsUlTbfCfgReq& other_value) const
{
return field_tbf__ref==other_value.field_tbf__ref
  && field_slotmask==other_value.field_slotmask
  && field_pad==other_value.field_pad
  && field_start__fn==other_value.field_start__fn;
}

boolean L1ctlGprsUlTbfCfgReq::is_bound() const
{
return (field_tbf__ref.is_bound())
  || (field_slotmask.is_bound())
  || (field_pad.is_bound())
  || (field_start__fn.is_bound());
}
boolean L1ctlGprsUlTbfCfgReq::is_value() const
{
return field_tbf__ref.is_value()
  && field_slotmask.is_value()
  && field_pad.is_value()
  && field_start__fn.is_value();
}
void L1ctlGprsUlTbfCfgReq::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ tbf_ref := ");
field_tbf__ref.log();
TTCN_Logger::log_event_str(", slotmask := ");
field_slotmask.log();
TTCN_Logger::log_event_str(", pad := ");
field_pad.log();
TTCN_Logger::log_event_str(", start_fn := ");
field_start__fn.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlGprsUlTbfCfgReq::set_implicit_omit()
{
if (tbf__ref().is_bound()) tbf__ref().set_implicit_omit();
if (slotmask().is_bound()) slotmask().set_implicit_omit();
if (pad().is_bound()) pad().set_implicit_omit();
if (start__fn().is_bound()) start__fn().set_implicit_omit();
}

void L1ctlGprsUlTbfCfgReq::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 @L1CTL_Types.L1ctlGprsUlTbfCfgReq 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) tbf__ref().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) slotmask().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) pad().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) start__fn().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(), "tbf_ref")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tbf__ref().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(), "slotmask")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          slotmask().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(), "pad")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pad().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(), "start_fn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          start__fn().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 @L1CTL_Types.L1ctlGprsUlTbfCfgReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlGprsUlTbfCfgReq");
  }
}

void L1ctlGprsUlTbfCfgReq::encode_text(Text_Buf& text_buf) const
{
field_tbf__ref.encode_text(text_buf);
field_slotmask.encode_text(text_buf);
field_pad.encode_text(text_buf);
field_start__fn.encode_text(text_buf);
}

void L1ctlGprsUlTbfCfgReq::decode_text(Text_Buf& text_buf)
{
field_tbf__ref.decode_text(text_buf);
field_slotmask.decode_text(text_buf);
field_pad.decode_text(text_buf);
field_start__fn.decode_text(text_buf);
}

void L1ctlGprsUlTbfCfgReq::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 L1ctlGprsUlTbfCfgReq::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 L1ctlGprsUlTbfCfgReq::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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_tbf__ref.RAW_decode(Osmocom__Types::uint8__t_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, L1ctlGprsUlTbfCfgReq_slotmask_descr_.raw->forceomit);
  decoded_field_length = field_slotmask.RAW_decode(L1ctlGprsUlTbfCfgReq_slotmask_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, L1ctlGprsUlTbfCfgReq_pad_descr_.raw->forceomit);
  decoded_field_length = field_pad.RAW_decode(L1ctlGprsUlTbfCfgReq_pad_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, Osmocom__Types::uint32__t_descr_.raw->forceomit);
  decoded_field_length = field_start__fn.RAW_decode(Osmocom__Types::uint32__t_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 L1ctlGprsUlTbfCfgReq::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, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, L1ctlGprsUlTbfCfgReq_slotmask_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, L1ctlGprsUlTbfCfgReq_pad_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, Osmocom__Types::uint32__t_descr_.raw);
  encoded_length += field_tbf__ref.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_slotmask.RAW_encode(L1ctlGprsUlTbfCfgReq_slotmask_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_pad.RAW_encode(L1ctlGprsUlTbfCfgReq_pad_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_start__fn.RAW_encode(Osmocom__Types::uint32__t_descr_, *myleaf.body.node.nodes[3]);
  return myleaf.length = encoded_length;
}

struct L1ctlGprsUlTbfCfgReq_template::single_value_struct {
INTEGER_template field_tbf__ref;
BITSTRING_template field_slotmask;
OCTETSTRING_template field_pad;
INTEGER_template field_start__fn;
};

void L1ctlGprsUlTbfCfgReq_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_tbf__ref = ANY_VALUE;
single_value->field_slotmask = ANY_VALUE;
single_value->field_pad = ANY_VALUE;
single_value->field_start__fn = ANY_VALUE;
}
}
}

void L1ctlGprsUlTbfCfgReq_template::copy_value(const L1ctlGprsUlTbfCfgReq& other_value)
{
single_value = new single_value_struct;
if (other_value.tbf__ref().is_bound()) {
  single_value->field_tbf__ref = other_value.tbf__ref();
} else {
  single_value->field_tbf__ref.clean_up();
}
if (other_value.slotmask().is_bound()) {
  single_value->field_slotmask = other_value.slotmask();
} else {
  single_value->field_slotmask.clean_up();
}
if (other_value.pad().is_bound()) {
  single_value->field_pad = other_value.pad();
} else {
  single_value->field_pad.clean_up();
}
if (other_value.start__fn().is_bound()) {
  single_value->field_start__fn = other_value.start__fn();
} else {
  single_value->field_start__fn.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlGprsUlTbfCfgReq_template::copy_template(const L1ctlGprsUlTbfCfgReq_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.tbf__ref().get_selection()) {
single_value->field_tbf__ref = other_value.tbf__ref();
} else {
single_value->field_tbf__ref.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.slotmask().get_selection()) {
single_value->field_slotmask = other_value.slotmask();
} else {
single_value->field_slotmask.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pad().get_selection()) {
single_value->field_pad = other_value.pad();
} else {
single_value->field_pad.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.start__fn().get_selection()) {
single_value->field_start__fn = other_value.start__fn();
} else {
single_value->field_start__fn.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 L1ctlGprsUlTbfCfgReq_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 L1ctlGprsUlTbfCfgReq_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlGprsUlTbfCfgReq_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 @L1CTL_Types.L1ctlGprsUlTbfCfgReq.");
break;
}
set_selection(other_value);
}

L1ctlGprsUlTbfCfgReq_template::L1ctlGprsUlTbfCfgReq_template()
{
}

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

L1ctlGprsUlTbfCfgReq_template::L1ctlGprsUlTbfCfgReq_template(const L1ctlGprsUlTbfCfgReq& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlGprsUlTbfCfgReq_template::match(const L1ctlGprsUlTbfCfgReq& 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.tbf__ref().is_bound()) return FALSE;
if(!single_value->field_tbf__ref.match(other_value.tbf__ref(), legacy))return FALSE;
if(!other_value.slotmask().is_bound()) return FALSE;
if(!single_value->field_slotmask.match(other_value.slotmask(), legacy))return FALSE;
if(!other_value.pad().is_bound()) return FALSE;
if(!single_value->field_pad.match(other_value.pad(), legacy))return FALSE;
if(!other_value.start__fn().is_bound()) return FALSE;
if(!single_value->field_start__fn.match(other_value.start__fn(), 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 @L1CTL_Types.L1ctlGprsUlTbfCfgReq.");
}
return FALSE;
}

boolean L1ctlGprsUlTbfCfgReq_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_tbf__ref.is_bound()
 || single_value->field_slotmask.is_bound()
 || single_value->field_pad.is_bound()
 || single_value->field_start__fn.is_bound();
}

boolean L1ctlGprsUlTbfCfgReq_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_tbf__ref.is_value()
 && single_value->field_slotmask.is_value()
 && single_value->field_pad.is_value()
 && single_value->field_start__fn.is_value();
}

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

L1ctlGprsUlTbfCfgReq L1ctlGprsUlTbfCfgReq_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 @L1CTL_Types.L1ctlGprsUlTbfCfgReq.");
L1ctlGprsUlTbfCfgReq ret_val;
if (single_value->field_tbf__ref.is_bound()) {
ret_val.tbf__ref() = single_value->field_tbf__ref.valueof();
}
if (single_value->field_slotmask.is_bound()) {
ret_val.slotmask() = single_value->field_slotmask.valueof();
}
if (single_value->field_pad.is_bound()) {
ret_val.pad() = single_value->field_pad.valueof();
}
if (single_value->field_start__fn.is_bound()) {
ret_val.start__fn() = single_value->field_start__fn.valueof();
}
return ret_val;
}

void L1ctlGprsUlTbfCfgReq_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 @L1CTL_Types.L1ctlGprsUlTbfCfgReq.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlGprsUlTbfCfgReq_template[list_length];
}

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

INTEGER_template& L1ctlGprsUlTbfCfgReq_template::tbf__ref()
{
set_specific();
return single_value->field_tbf__ref;
}

const INTEGER_template& L1ctlGprsUlTbfCfgReq_template::tbf__ref() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tbf_ref of a non-specific template of type @L1CTL_Types.L1ctlGprsUlTbfCfgReq.");
return single_value->field_tbf__ref;
}

BITSTRING_template& L1ctlGprsUlTbfCfgReq_template::slotmask()
{
set_specific();
return single_value->field_slotmask;
}

const BITSTRING_template& L1ctlGprsUlTbfCfgReq_template::slotmask() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field slotmask of a non-specific template of type @L1CTL_Types.L1ctlGprsUlTbfCfgReq.");
return single_value->field_slotmask;
}

OCTETSTRING_template& L1ctlGprsUlTbfCfgReq_template::pad()
{
set_specific();
return single_value->field_pad;
}

const OCTETSTRING_template& L1ctlGprsUlTbfCfgReq_template::pad() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pad of a non-specific template of type @L1CTL_Types.L1ctlGprsUlTbfCfgReq.");
return single_value->field_pad;
}

INTEGER_template& L1ctlGprsUlTbfCfgReq_template::start__fn()
{
set_specific();
return single_value->field_start__fn;
}

const INTEGER_template& L1ctlGprsUlTbfCfgReq_template::start__fn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field start_fn of a non-specific template of type @L1CTL_Types.L1ctlGprsUlTbfCfgReq.");
return single_value->field_start__fn;
}

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

void L1ctlGprsUlTbfCfgReq_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ tbf_ref := ");
single_value->field_tbf__ref.log();
TTCN_Logger::log_event_str(", slotmask := ");
single_value->field_slotmask.log();
TTCN_Logger::log_event_str(", pad := ");
single_value->field_pad.log();
TTCN_Logger::log_event_str(", start_fn := ");
single_value->field_start__fn.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 L1ctlGprsUlTbfCfgReq_template::log_match(const L1ctlGprsUlTbfCfgReq& 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_tbf__ref.match(match_value.tbf__ref(), legacy)){
TTCN_Logger::log_logmatch_info(".tbf_ref");
single_value->field_tbf__ref.log_match(match_value.tbf__ref(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_slotmask.match(match_value.slotmask(), legacy)){
TTCN_Logger::log_logmatch_info(".slotmask");
single_value->field_slotmask.log_match(match_value.slotmask(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pad.match(match_value.pad(), legacy)){
TTCN_Logger::log_logmatch_info(".pad");
single_value->field_pad.log_match(match_value.pad(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_start__fn.match(match_value.start__fn(), legacy)){
TTCN_Logger::log_logmatch_info(".start_fn");
single_value->field_start__fn.log_match(match_value.start__fn(), 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("{ tbf_ref := ");
single_value->field_tbf__ref.log_match(match_value.tbf__ref(), legacy);
TTCN_Logger::log_event_str(", slotmask := ");
single_value->field_slotmask.log_match(match_value.slotmask(), legacy);
TTCN_Logger::log_event_str(", pad := ");
single_value->field_pad.log_match(match_value.pad(), legacy);
TTCN_Logger::log_event_str(", start_fn := ");
single_value->field_start__fn.log_match(match_value.start__fn(), 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 L1ctlGprsUlTbfCfgReq_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (tbf__ref().is_bound()) tbf__ref().set_implicit_omit();
if (slotmask().is_bound()) slotmask().set_implicit_omit();
if (pad().is_bound()) pad().set_implicit_omit();
if (start__fn().is_bound()) start__fn().set_implicit_omit();
}

void L1ctlGprsUlTbfCfgReq_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_tbf__ref.encode_text(text_buf);
single_value->field_slotmask.encode_text(text_buf);
single_value->field_pad.encode_text(text_buf);
single_value->field_start__fn.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 @L1CTL_Types.L1ctlGprsUlTbfCfgReq.");
}
}

void L1ctlGprsUlTbfCfgReq_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_tbf__ref.decode_text(text_buf);
single_value->field_slotmask.decode_text(text_buf);
single_value->field_pad.decode_text(text_buf);
single_value->field_start__fn.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 L1ctlGprsUlTbfCfgReq_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 @L1CTL_Types.L1ctlGprsUlTbfCfgReq.");
}
}

void L1ctlGprsUlTbfCfgReq_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: {
    L1ctlGprsUlTbfCfgReq_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 @L1CTL_Types.L1ctlGprsUlTbfCfgReq 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) tbf__ref().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) slotmask().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) pad().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) start__fn().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(), "tbf_ref")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tbf__ref().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(), "slotmask")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          slotmask().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(), "pad")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pad().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(), "start_fn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          start__fn().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 @L1CTL_Types.L1ctlGprsUlTbfCfgReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlGprsUlTbfCfgReq_template* precondition = new L1ctlGprsUlTbfCfgReq_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlGprsUlTbfCfgReq_template* implied_template = new L1ctlGprsUlTbfCfgReq_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlGprsUlTbfCfgReq_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlGprsUlTbfCfgReq");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlGprsUlTbfCfgReq_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_tbf__ref.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsUlTbfCfgReq");
single_value->field_slotmask.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsUlTbfCfgReq");
single_value->field_pad.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsUlTbfCfgReq");
single_value->field_start__fn.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsUlTbfCfgReq");
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 : "@L1CTL_Types.L1ctlGprsUlTbfCfgReq");
}

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

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

L1ctlGprsDlTbfCfgReq::L1ctlGprsDlTbfCfgReq()
{
}

L1ctlGprsDlTbfCfgReq::L1ctlGprsDlTbfCfgReq(const INTEGER& par_tbf__ref,
    const BITSTRING& par_slotmask,
    const INTEGER& par_dl__tfi,
    const OCTETSTRING& par_pad,
    const INTEGER& par_start__fn)
  :   field_tbf__ref(par_tbf__ref),
  field_slotmask(par_slotmask),
  field_dl__tfi(par_dl__tfi),
  field_pad(par_pad),
  field_start__fn(par_start__fn)
{
}

L1ctlGprsDlTbfCfgReq::L1ctlGprsDlTbfCfgReq(const L1ctlGprsDlTbfCfgReq& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlGprsDlTbfCfgReq.");
if (other_value.tbf__ref().is_bound()) field_tbf__ref = other_value.tbf__ref();
else field_tbf__ref.clean_up();
if (other_value.slotmask().is_bound()) field_slotmask = other_value.slotmask();
else field_slotmask.clean_up();
if (other_value.dl__tfi().is_bound()) field_dl__tfi = other_value.dl__tfi();
else field_dl__tfi.clean_up();
if (other_value.pad().is_bound()) field_pad = other_value.pad();
else field_pad.clean_up();
if (other_value.start__fn().is_bound()) field_start__fn = other_value.start__fn();
else field_start__fn.clean_up();
}

void L1ctlGprsDlTbfCfgReq::clean_up()
{
field_tbf__ref.clean_up();
field_slotmask.clean_up();
field_dl__tfi.clean_up();
field_pad.clean_up();
field_start__fn.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlGprsDlTbfCfgReq::get_descriptor() const { return &L1ctlGprsDlTbfCfgReq_descr_; }
L1ctlGprsDlTbfCfgReq& L1ctlGprsDlTbfCfgReq::operator=(const L1ctlGprsDlTbfCfgReq& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlGprsDlTbfCfgReq.");
  if (other_value.tbf__ref().is_bound()) field_tbf__ref = other_value.tbf__ref();
  else field_tbf__ref.clean_up();
  if (other_value.slotmask().is_bound()) field_slotmask = other_value.slotmask();
  else field_slotmask.clean_up();
  if (other_value.dl__tfi().is_bound()) field_dl__tfi = other_value.dl__tfi();
  else field_dl__tfi.clean_up();
  if (other_value.pad().is_bound()) field_pad = other_value.pad();
  else field_pad.clean_up();
  if (other_value.start__fn().is_bound()) field_start__fn = other_value.start__fn();
  else field_start__fn.clean_up();
}
return *this;
}

boolean L1ctlGprsDlTbfCfgReq::operator==(const L1ctlGprsDlTbfCfgReq& other_value) const
{
return field_tbf__ref==other_value.field_tbf__ref
  && field_slotmask==other_value.field_slotmask
  && field_dl__tfi==other_value.field_dl__tfi
  && field_pad==other_value.field_pad
  && field_start__fn==other_value.field_start__fn;
}

boolean L1ctlGprsDlTbfCfgReq::is_bound() const
{
return (field_tbf__ref.is_bound())
  || (field_slotmask.is_bound())
  || (field_dl__tfi.is_bound())
  || (field_pad.is_bound())
  || (field_start__fn.is_bound());
}
boolean L1ctlGprsDlTbfCfgReq::is_value() const
{
return field_tbf__ref.is_value()
  && field_slotmask.is_value()
  && field_dl__tfi.is_value()
  && field_pad.is_value()
  && field_start__fn.is_value();
}
void L1ctlGprsDlTbfCfgReq::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ tbf_ref := ");
field_tbf__ref.log();
TTCN_Logger::log_event_str(", slotmask := ");
field_slotmask.log();
TTCN_Logger::log_event_str(", dl_tfi := ");
field_dl__tfi.log();
TTCN_Logger::log_event_str(", pad := ");
field_pad.log();
TTCN_Logger::log_event_str(", start_fn := ");
field_start__fn.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlGprsDlTbfCfgReq::set_implicit_omit()
{
if (tbf__ref().is_bound()) tbf__ref().set_implicit_omit();
if (slotmask().is_bound()) slotmask().set_implicit_omit();
if (dl__tfi().is_bound()) dl__tfi().set_implicit_omit();
if (pad().is_bound()) pad().set_implicit_omit();
if (start__fn().is_bound()) start__fn().set_implicit_omit();
}

void L1ctlGprsDlTbfCfgReq::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 @L1CTL_Types.L1ctlGprsDlTbfCfgReq 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) tbf__ref().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) slotmask().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) dl__tfi().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) pad().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) start__fn().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(), "tbf_ref")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tbf__ref().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(), "slotmask")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          slotmask().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(), "dl_tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          dl__tfi().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(), "pad")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pad().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(), "start_fn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          start__fn().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 @L1CTL_Types.L1ctlGprsDlTbfCfgReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlGprsDlTbfCfgReq");
  }
}

void L1ctlGprsDlTbfCfgReq::encode_text(Text_Buf& text_buf) const
{
field_tbf__ref.encode_text(text_buf);
field_slotmask.encode_text(text_buf);
field_dl__tfi.encode_text(text_buf);
field_pad.encode_text(text_buf);
field_start__fn.encode_text(text_buf);
}

void L1ctlGprsDlTbfCfgReq::decode_text(Text_Buf& text_buf)
{
field_tbf__ref.decode_text(text_buf);
field_slotmask.decode_text(text_buf);
field_dl__tfi.decode_text(text_buf);
field_pad.decode_text(text_buf);
field_start__fn.decode_text(text_buf);
}

void L1ctlGprsDlTbfCfgReq::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 L1ctlGprsDlTbfCfgReq::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 L1ctlGprsDlTbfCfgReq::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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_tbf__ref.RAW_decode(Osmocom__Types::uint8__t_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, L1ctlGprsDlTbfCfgReq_slotmask_descr_.raw->forceomit);
  decoded_field_length = field_slotmask.RAW_decode(L1ctlGprsDlTbfCfgReq_slotmask_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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_dl__tfi.RAW_decode(Osmocom__Types::uint8__t_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, L1ctlGprsDlTbfCfgReq_pad_descr_.raw->forceomit);
  decoded_field_length = field_pad.RAW_decode(L1ctlGprsDlTbfCfgReq_pad_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, Osmocom__Types::uint32__t_descr_.raw->forceomit);
  decoded_field_length = field_start__fn.RAW_decode(Osmocom__Types::uint32__t_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 L1ctlGprsDlTbfCfgReq::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, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, L1ctlGprsDlTbfCfgReq_slotmask_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, L1ctlGprsDlTbfCfgReq_pad_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, Osmocom__Types::uint32__t_descr_.raw);
  encoded_length += field_tbf__ref.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_slotmask.RAW_encode(L1ctlGprsDlTbfCfgReq_slotmask_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_dl__tfi.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_pad.RAW_encode(L1ctlGprsDlTbfCfgReq_pad_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_start__fn.RAW_encode(Osmocom__Types::uint32__t_descr_, *myleaf.body.node.nodes[4]);
  return myleaf.length = encoded_length;
}

struct L1ctlGprsDlTbfCfgReq_template::single_value_struct {
INTEGER_template field_tbf__ref;
BITSTRING_template field_slotmask;
INTEGER_template field_dl__tfi;
OCTETSTRING_template field_pad;
INTEGER_template field_start__fn;
};

void L1ctlGprsDlTbfCfgReq_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_tbf__ref = ANY_VALUE;
single_value->field_slotmask = ANY_VALUE;
single_value->field_dl__tfi = ANY_VALUE;
single_value->field_pad = ANY_VALUE;
single_value->field_start__fn = ANY_VALUE;
}
}
}

void L1ctlGprsDlTbfCfgReq_template::copy_value(const L1ctlGprsDlTbfCfgReq& other_value)
{
single_value = new single_value_struct;
if (other_value.tbf__ref().is_bound()) {
  single_value->field_tbf__ref = other_value.tbf__ref();
} else {
  single_value->field_tbf__ref.clean_up();
}
if (other_value.slotmask().is_bound()) {
  single_value->field_slotmask = other_value.slotmask();
} else {
  single_value->field_slotmask.clean_up();
}
if (other_value.dl__tfi().is_bound()) {
  single_value->field_dl__tfi = other_value.dl__tfi();
} else {
  single_value->field_dl__tfi.clean_up();
}
if (other_value.pad().is_bound()) {
  single_value->field_pad = other_value.pad();
} else {
  single_value->field_pad.clean_up();
}
if (other_value.start__fn().is_bound()) {
  single_value->field_start__fn = other_value.start__fn();
} else {
  single_value->field_start__fn.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlGprsDlTbfCfgReq_template::copy_template(const L1ctlGprsDlTbfCfgReq_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.tbf__ref().get_selection()) {
single_value->field_tbf__ref = other_value.tbf__ref();
} else {
single_value->field_tbf__ref.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.slotmask().get_selection()) {
single_value->field_slotmask = other_value.slotmask();
} else {
single_value->field_slotmask.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.dl__tfi().get_selection()) {
single_value->field_dl__tfi = other_value.dl__tfi();
} else {
single_value->field_dl__tfi.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pad().get_selection()) {
single_value->field_pad = other_value.pad();
} else {
single_value->field_pad.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.start__fn().get_selection()) {
single_value->field_start__fn = other_value.start__fn();
} else {
single_value->field_start__fn.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 L1ctlGprsDlTbfCfgReq_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 L1ctlGprsDlTbfCfgReq_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlGprsDlTbfCfgReq_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 @L1CTL_Types.L1ctlGprsDlTbfCfgReq.");
break;
}
set_selection(other_value);
}

L1ctlGprsDlTbfCfgReq_template::L1ctlGprsDlTbfCfgReq_template()
{
}

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

L1ctlGprsDlTbfCfgReq_template::L1ctlGprsDlTbfCfgReq_template(const L1ctlGprsDlTbfCfgReq& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlGprsDlTbfCfgReq_template::match(const L1ctlGprsDlTbfCfgReq& 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.tbf__ref().is_bound()) return FALSE;
if(!single_value->field_tbf__ref.match(other_value.tbf__ref(), legacy))return FALSE;
if(!other_value.slotmask().is_bound()) return FALSE;
if(!single_value->field_slotmask.match(other_value.slotmask(), legacy))return FALSE;
if(!other_value.dl__tfi().is_bound()) return FALSE;
if(!single_value->field_dl__tfi.match(other_value.dl__tfi(), legacy))return FALSE;
if(!other_value.pad().is_bound()) return FALSE;
if(!single_value->field_pad.match(other_value.pad(), legacy))return FALSE;
if(!other_value.start__fn().is_bound()) return FALSE;
if(!single_value->field_start__fn.match(other_value.start__fn(), 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 @L1CTL_Types.L1ctlGprsDlTbfCfgReq.");
}
return FALSE;
}

boolean L1ctlGprsDlTbfCfgReq_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_tbf__ref.is_bound()
 || single_value->field_slotmask.is_bound()
 || single_value->field_dl__tfi.is_bound()
 || single_value->field_pad.is_bound()
 || single_value->field_start__fn.is_bound();
}

boolean L1ctlGprsDlTbfCfgReq_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_tbf__ref.is_value()
 && single_value->field_slotmask.is_value()
 && single_value->field_dl__tfi.is_value()
 && single_value->field_pad.is_value()
 && single_value->field_start__fn.is_value();
}

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

L1ctlGprsDlTbfCfgReq L1ctlGprsDlTbfCfgReq_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 @L1CTL_Types.L1ctlGprsDlTbfCfgReq.");
L1ctlGprsDlTbfCfgReq ret_val;
if (single_value->field_tbf__ref.is_bound()) {
ret_val.tbf__ref() = single_value->field_tbf__ref.valueof();
}
if (single_value->field_slotmask.is_bound()) {
ret_val.slotmask() = single_value->field_slotmask.valueof();
}
if (single_value->field_dl__tfi.is_bound()) {
ret_val.dl__tfi() = single_value->field_dl__tfi.valueof();
}
if (single_value->field_pad.is_bound()) {
ret_val.pad() = single_value->field_pad.valueof();
}
if (single_value->field_start__fn.is_bound()) {
ret_val.start__fn() = single_value->field_start__fn.valueof();
}
return ret_val;
}

void L1ctlGprsDlTbfCfgReq_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 @L1CTL_Types.L1ctlGprsDlTbfCfgReq.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlGprsDlTbfCfgReq_template[list_length];
}

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

INTEGER_template& L1ctlGprsDlTbfCfgReq_template::tbf__ref()
{
set_specific();
return single_value->field_tbf__ref;
}

const INTEGER_template& L1ctlGprsDlTbfCfgReq_template::tbf__ref() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tbf_ref of a non-specific template of type @L1CTL_Types.L1ctlGprsDlTbfCfgReq.");
return single_value->field_tbf__ref;
}

BITSTRING_template& L1ctlGprsDlTbfCfgReq_template::slotmask()
{
set_specific();
return single_value->field_slotmask;
}

const BITSTRING_template& L1ctlGprsDlTbfCfgReq_template::slotmask() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field slotmask of a non-specific template of type @L1CTL_Types.L1ctlGprsDlTbfCfgReq.");
return single_value->field_slotmask;
}

INTEGER_template& L1ctlGprsDlTbfCfgReq_template::dl__tfi()
{
set_specific();
return single_value->field_dl__tfi;
}

const INTEGER_template& L1ctlGprsDlTbfCfgReq_template::dl__tfi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field dl_tfi of a non-specific template of type @L1CTL_Types.L1ctlGprsDlTbfCfgReq.");
return single_value->field_dl__tfi;
}

OCTETSTRING_template& L1ctlGprsDlTbfCfgReq_template::pad()
{
set_specific();
return single_value->field_pad;
}

const OCTETSTRING_template& L1ctlGprsDlTbfCfgReq_template::pad() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pad of a non-specific template of type @L1CTL_Types.L1ctlGprsDlTbfCfgReq.");
return single_value->field_pad;
}

INTEGER_template& L1ctlGprsDlTbfCfgReq_template::start__fn()
{
set_specific();
return single_value->field_start__fn;
}

const INTEGER_template& L1ctlGprsDlTbfCfgReq_template::start__fn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field start_fn of a non-specific template of type @L1CTL_Types.L1ctlGprsDlTbfCfgReq.");
return single_value->field_start__fn;
}

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

void L1ctlGprsDlTbfCfgReq_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ tbf_ref := ");
single_value->field_tbf__ref.log();
TTCN_Logger::log_event_str(", slotmask := ");
single_value->field_slotmask.log();
TTCN_Logger::log_event_str(", dl_tfi := ");
single_value->field_dl__tfi.log();
TTCN_Logger::log_event_str(", pad := ");
single_value->field_pad.log();
TTCN_Logger::log_event_str(", start_fn := ");
single_value->field_start__fn.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 L1ctlGprsDlTbfCfgReq_template::log_match(const L1ctlGprsDlTbfCfgReq& 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_tbf__ref.match(match_value.tbf__ref(), legacy)){
TTCN_Logger::log_logmatch_info(".tbf_ref");
single_value->field_tbf__ref.log_match(match_value.tbf__ref(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_slotmask.match(match_value.slotmask(), legacy)){
TTCN_Logger::log_logmatch_info(".slotmask");
single_value->field_slotmask.log_match(match_value.slotmask(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_dl__tfi.match(match_value.dl__tfi(), legacy)){
TTCN_Logger::log_logmatch_info(".dl_tfi");
single_value->field_dl__tfi.log_match(match_value.dl__tfi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pad.match(match_value.pad(), legacy)){
TTCN_Logger::log_logmatch_info(".pad");
single_value->field_pad.log_match(match_value.pad(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_start__fn.match(match_value.start__fn(), legacy)){
TTCN_Logger::log_logmatch_info(".start_fn");
single_value->field_start__fn.log_match(match_value.start__fn(), 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("{ tbf_ref := ");
single_value->field_tbf__ref.log_match(match_value.tbf__ref(), legacy);
TTCN_Logger::log_event_str(", slotmask := ");
single_value->field_slotmask.log_match(match_value.slotmask(), legacy);
TTCN_Logger::log_event_str(", dl_tfi := ");
single_value->field_dl__tfi.log_match(match_value.dl__tfi(), legacy);
TTCN_Logger::log_event_str(", pad := ");
single_value->field_pad.log_match(match_value.pad(), legacy);
TTCN_Logger::log_event_str(", start_fn := ");
single_value->field_start__fn.log_match(match_value.start__fn(), 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 L1ctlGprsDlTbfCfgReq_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (tbf__ref().is_bound()) tbf__ref().set_implicit_omit();
if (slotmask().is_bound()) slotmask().set_implicit_omit();
if (dl__tfi().is_bound()) dl__tfi().set_implicit_omit();
if (pad().is_bound()) pad().set_implicit_omit();
if (start__fn().is_bound()) start__fn().set_implicit_omit();
}

void L1ctlGprsDlTbfCfgReq_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_tbf__ref.encode_text(text_buf);
single_value->field_slotmask.encode_text(text_buf);
single_value->field_dl__tfi.encode_text(text_buf);
single_value->field_pad.encode_text(text_buf);
single_value->field_start__fn.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 @L1CTL_Types.L1ctlGprsDlTbfCfgReq.");
}
}

void L1ctlGprsDlTbfCfgReq_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_tbf__ref.decode_text(text_buf);
single_value->field_slotmask.decode_text(text_buf);
single_value->field_dl__tfi.decode_text(text_buf);
single_value->field_pad.decode_text(text_buf);
single_value->field_start__fn.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 L1ctlGprsDlTbfCfgReq_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 @L1CTL_Types.L1ctlGprsDlTbfCfgReq.");
}
}

void L1ctlGprsDlTbfCfgReq_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: {
    L1ctlGprsDlTbfCfgReq_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 @L1CTL_Types.L1ctlGprsDlTbfCfgReq 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) tbf__ref().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) slotmask().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) dl__tfi().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) pad().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) start__fn().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(), "tbf_ref")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tbf__ref().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(), "slotmask")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          slotmask().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(), "dl_tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          dl__tfi().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(), "pad")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pad().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(), "start_fn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          start__fn().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 @L1CTL_Types.L1ctlGprsDlTbfCfgReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlGprsDlTbfCfgReq_template* precondition = new L1ctlGprsDlTbfCfgReq_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlGprsDlTbfCfgReq_template* implied_template = new L1ctlGprsDlTbfCfgReq_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlGprsDlTbfCfgReq_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlGprsDlTbfCfgReq");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlGprsDlTbfCfgReq_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_tbf__ref.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsDlTbfCfgReq");
single_value->field_slotmask.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsDlTbfCfgReq");
single_value->field_dl__tfi.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsDlTbfCfgReq");
single_value->field_pad.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsDlTbfCfgReq");
single_value->field_start__fn.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsDlTbfCfgReq");
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 : "@L1CTL_Types.L1ctlGprsDlTbfCfgReq");
}

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

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

L1ctlGprsBlockHdr::L1ctlGprsBlockHdr()
{
}

L1ctlGprsBlockHdr::L1ctlGprsBlockHdr(const INTEGER& par_fn,
    const INTEGER& par_tn,
    const OCTETSTRING& par_pad)
  :   field_fn(par_fn),
  field_tn(par_tn),
  field_pad(par_pad)
{
}

L1ctlGprsBlockHdr::L1ctlGprsBlockHdr(const L1ctlGprsBlockHdr& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlGprsBlockHdr.");
if (other_value.fn().is_bound()) field_fn = other_value.fn();
else field_fn.clean_up();
if (other_value.tn().is_bound()) field_tn = other_value.tn();
else field_tn.clean_up();
if (other_value.pad().is_bound()) field_pad = other_value.pad();
else field_pad.clean_up();
}

void L1ctlGprsBlockHdr::clean_up()
{
field_fn.clean_up();
field_tn.clean_up();
field_pad.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlGprsBlockHdr::get_descriptor() const { return &L1ctlGprsBlockHdr_descr_; }
L1ctlGprsBlockHdr& L1ctlGprsBlockHdr::operator=(const L1ctlGprsBlockHdr& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlGprsBlockHdr.");
  if (other_value.fn().is_bound()) field_fn = other_value.fn();
  else field_fn.clean_up();
  if (other_value.tn().is_bound()) field_tn = other_value.tn();
  else field_tn.clean_up();
  if (other_value.pad().is_bound()) field_pad = other_value.pad();
  else field_pad.clean_up();
}
return *this;
}

boolean L1ctlGprsBlockHdr::operator==(const L1ctlGprsBlockHdr& other_value) const
{
return field_fn==other_value.field_fn
  && field_tn==other_value.field_tn
  && field_pad==other_value.field_pad;
}

boolean L1ctlGprsBlockHdr::is_bound() const
{
return (field_fn.is_bound())
  || (field_tn.is_bound())
  || (field_pad.is_bound());
}
boolean L1ctlGprsBlockHdr::is_value() const
{
return field_fn.is_value()
  && field_tn.is_value()
  && field_pad.is_value();
}
void L1ctlGprsBlockHdr::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ fn := ");
field_fn.log();
TTCN_Logger::log_event_str(", tn := ");
field_tn.log();
TTCN_Logger::log_event_str(", pad := ");
field_pad.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlGprsBlockHdr::set_implicit_omit()
{
if (fn().is_bound()) fn().set_implicit_omit();
if (tn().is_bound()) tn().set_implicit_omit();
if (pad().is_bound()) pad().set_implicit_omit();
}

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

void L1ctlGprsBlockHdr::encode_text(Text_Buf& text_buf) const
{
field_fn.encode_text(text_buf);
field_tn.encode_text(text_buf);
field_pad.encode_text(text_buf);
}

void L1ctlGprsBlockHdr::decode_text(Text_Buf& text_buf)
{
field_fn.decode_text(text_buf);
field_tn.decode_text(text_buf);
field_pad.decode_text(text_buf);
}

void L1ctlGprsBlockHdr::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 L1ctlGprsBlockHdr::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 L1ctlGprsBlockHdr::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, Osmocom__Types::uint32__t_descr_.raw->forceomit);
  decoded_field_length = field_fn.RAW_decode(Osmocom__Types::uint32__t_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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_tn.RAW_decode(Osmocom__Types::uint8__t_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, L1ctlGprsBlockHdr_pad_descr_.raw->forceomit);
  decoded_field_length = field_pad.RAW_decode(L1ctlGprsBlockHdr_pad_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 L1ctlGprsBlockHdr::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, Osmocom__Types::uint32__t_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, L1ctlGprsBlockHdr_pad_descr_.raw);
  encoded_length += field_fn.RAW_encode(Osmocom__Types::uint32__t_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_tn.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_pad.RAW_encode(L1ctlGprsBlockHdr_pad_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct L1ctlGprsBlockHdr_template::single_value_struct {
INTEGER_template field_fn;
INTEGER_template field_tn;
OCTETSTRING_template field_pad;
};

void L1ctlGprsBlockHdr_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_fn = ANY_VALUE;
single_value->field_tn = ANY_VALUE;
single_value->field_pad = ANY_VALUE;
}
}
}

void L1ctlGprsBlockHdr_template::copy_value(const L1ctlGprsBlockHdr& other_value)
{
single_value = new single_value_struct;
if (other_value.fn().is_bound()) {
  single_value->field_fn = other_value.fn();
} else {
  single_value->field_fn.clean_up();
}
if (other_value.tn().is_bound()) {
  single_value->field_tn = other_value.tn();
} else {
  single_value->field_tn.clean_up();
}
if (other_value.pad().is_bound()) {
  single_value->field_pad = other_value.pad();
} else {
  single_value->field_pad.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlGprsBlockHdr_template::copy_template(const L1ctlGprsBlockHdr_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.fn().get_selection()) {
single_value->field_fn = other_value.fn();
} else {
single_value->field_fn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tn().get_selection()) {
single_value->field_tn = other_value.tn();
} else {
single_value->field_tn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pad().get_selection()) {
single_value->field_pad = other_value.pad();
} else {
single_value->field_pad.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 L1ctlGprsBlockHdr_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 L1ctlGprsBlockHdr_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlGprsBlockHdr_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 @L1CTL_Types.L1ctlGprsBlockHdr.");
break;
}
set_selection(other_value);
}

L1ctlGprsBlockHdr_template::L1ctlGprsBlockHdr_template()
{
}

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

L1ctlGprsBlockHdr_template::L1ctlGprsBlockHdr_template(const L1ctlGprsBlockHdr& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlGprsBlockHdr_template::match(const L1ctlGprsBlockHdr& 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.fn().is_bound()) return FALSE;
if(!single_value->field_fn.match(other_value.fn(), legacy))return FALSE;
if(!other_value.tn().is_bound()) return FALSE;
if(!single_value->field_tn.match(other_value.tn(), legacy))return FALSE;
if(!other_value.pad().is_bound()) return FALSE;
if(!single_value->field_pad.match(other_value.pad(), 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 @L1CTL_Types.L1ctlGprsBlockHdr.");
}
return FALSE;
}

boolean L1ctlGprsBlockHdr_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_fn.is_bound()
 || single_value->field_tn.is_bound()
 || single_value->field_pad.is_bound();
}

boolean L1ctlGprsBlockHdr_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_fn.is_value()
 && single_value->field_tn.is_value()
 && single_value->field_pad.is_value();
}

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

L1ctlGprsBlockHdr L1ctlGprsBlockHdr_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 @L1CTL_Types.L1ctlGprsBlockHdr.");
L1ctlGprsBlockHdr ret_val;
if (single_value->field_fn.is_bound()) {
ret_val.fn() = single_value->field_fn.valueof();
}
if (single_value->field_tn.is_bound()) {
ret_val.tn() = single_value->field_tn.valueof();
}
if (single_value->field_pad.is_bound()) {
ret_val.pad() = single_value->field_pad.valueof();
}
return ret_val;
}

void L1ctlGprsBlockHdr_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 @L1CTL_Types.L1ctlGprsBlockHdr.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlGprsBlockHdr_template[list_length];
}

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

INTEGER_template& L1ctlGprsBlockHdr_template::fn()
{
set_specific();
return single_value->field_fn;
}

const INTEGER_template& L1ctlGprsBlockHdr_template::fn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field fn of a non-specific template of type @L1CTL_Types.L1ctlGprsBlockHdr.");
return single_value->field_fn;
}

INTEGER_template& L1ctlGprsBlockHdr_template::tn()
{
set_specific();
return single_value->field_tn;
}

const INTEGER_template& L1ctlGprsBlockHdr_template::tn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tn of a non-specific template of type @L1CTL_Types.L1ctlGprsBlockHdr.");
return single_value->field_tn;
}

OCTETSTRING_template& L1ctlGprsBlockHdr_template::pad()
{
set_specific();
return single_value->field_pad;
}

const OCTETSTRING_template& L1ctlGprsBlockHdr_template::pad() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pad of a non-specific template of type @L1CTL_Types.L1ctlGprsBlockHdr.");
return single_value->field_pad;
}

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

void L1ctlGprsBlockHdr_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ fn := ");
single_value->field_fn.log();
TTCN_Logger::log_event_str(", tn := ");
single_value->field_tn.log();
TTCN_Logger::log_event_str(", pad := ");
single_value->field_pad.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 L1ctlGprsBlockHdr_template::log_match(const L1ctlGprsBlockHdr& 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_fn.match(match_value.fn(), legacy)){
TTCN_Logger::log_logmatch_info(".fn");
single_value->field_fn.log_match(match_value.fn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tn.match(match_value.tn(), legacy)){
TTCN_Logger::log_logmatch_info(".tn");
single_value->field_tn.log_match(match_value.tn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pad.match(match_value.pad(), legacy)){
TTCN_Logger::log_logmatch_info(".pad");
single_value->field_pad.log_match(match_value.pad(), 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("{ fn := ");
single_value->field_fn.log_match(match_value.fn(), legacy);
TTCN_Logger::log_event_str(", tn := ");
single_value->field_tn.log_match(match_value.tn(), legacy);
TTCN_Logger::log_event_str(", pad := ");
single_value->field_pad.log_match(match_value.pad(), 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 L1ctlGprsBlockHdr_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (fn().is_bound()) fn().set_implicit_omit();
if (tn().is_bound()) tn().set_implicit_omit();
if (pad().is_bound()) pad().set_implicit_omit();
}

void L1ctlGprsBlockHdr_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_fn.encode_text(text_buf);
single_value->field_tn.encode_text(text_buf);
single_value->field_pad.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 @L1CTL_Types.L1ctlGprsBlockHdr.");
}
}

void L1ctlGprsBlockHdr_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_fn.decode_text(text_buf);
single_value->field_tn.decode_text(text_buf);
single_value->field_pad.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 L1ctlGprsBlockHdr_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 @L1CTL_Types.L1ctlGprsBlockHdr.");
}
}

void L1ctlGprsBlockHdr_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: {
    L1ctlGprsBlockHdr_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 @L1CTL_Types.L1ctlGprsBlockHdr 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) fn().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tn().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) pad().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(), "fn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fn().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(), "tn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tn().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(), "pad")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pad().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 @L1CTL_Types.L1ctlGprsBlockHdr: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlGprsBlockHdr_template* precondition = new L1ctlGprsBlockHdr_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlGprsBlockHdr_template* implied_template = new L1ctlGprsBlockHdr_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlGprsBlockHdr_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlGprsBlockHdr");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlGprsBlockHdr_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_fn.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsBlockHdr");
single_value->field_tn.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsBlockHdr");
single_value->field_pad.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsBlockHdr");
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 : "@L1CTL_Types.L1ctlGprsBlockHdr");
}

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

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

L1ctlGprsUlBlockReq::L1ctlGprsUlBlockReq()
{
}

L1ctlGprsUlBlockReq::L1ctlGprsUlBlockReq(const L1ctlGprsBlockHdr& par_hdr,
    const OCTETSTRING& par_data)
  :   field_hdr(par_hdr),
  field_data(par_data)
{
}

L1ctlGprsUlBlockReq::L1ctlGprsUlBlockReq(const L1ctlGprsUlBlockReq& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlGprsUlBlockReq.");
if (other_value.hdr().is_bound()) field_hdr = other_value.hdr();
else field_hdr.clean_up();
if (other_value.data().is_bound()) field_data = other_value.data();
else field_data.clean_up();
}

void L1ctlGprsUlBlockReq::clean_up()
{
field_hdr.clean_up();
field_data.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlGprsUlBlockReq::get_descriptor() const { return &L1ctlGprsUlBlockReq_descr_; }
L1ctlGprsUlBlockReq& L1ctlGprsUlBlockReq::operator=(const L1ctlGprsUlBlockReq& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlGprsUlBlockReq.");
  if (other_value.hdr().is_bound()) field_hdr = other_value.hdr();
  else field_hdr.clean_up();
  if (other_value.data().is_bound()) field_data = other_value.data();
  else field_data.clean_up();
}
return *this;
}

boolean L1ctlGprsUlBlockReq::operator==(const L1ctlGprsUlBlockReq& other_value) const
{
return field_hdr==other_value.field_hdr
  && field_data==other_value.field_data;
}

boolean L1ctlGprsUlBlockReq::is_bound() const
{
return (field_hdr.is_bound())
  || (field_data.is_bound());
}
boolean L1ctlGprsUlBlockReq::is_value() const
{
return field_hdr.is_value()
  && field_data.is_value();
}
void L1ctlGprsUlBlockReq::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ hdr := ");
field_hdr.log();
TTCN_Logger::log_event_str(", data := ");
field_data.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlGprsUlBlockReq::set_implicit_omit()
{
if (hdr().is_bound()) hdr().set_implicit_omit();
if (data().is_bound()) data().set_implicit_omit();
}

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

void L1ctlGprsUlBlockReq::encode_text(Text_Buf& text_buf) const
{
field_hdr.encode_text(text_buf);
field_data.encode_text(text_buf);
}

void L1ctlGprsUlBlockReq::decode_text(Text_Buf& text_buf)
{
field_hdr.decode_text(text_buf);
field_data.decode_text(text_buf);
}

void L1ctlGprsUlBlockReq::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 L1ctlGprsUlBlockReq::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 L1ctlGprsUlBlockReq::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, L1ctlGprsBlockHdr_descr_.raw->forceomit);
  decoded_field_length = field_hdr.RAW_decode(L1ctlGprsBlockHdr_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, L1ctlGprsUlBlockReq_data_descr_.raw->forceomit);
  decoded_field_length = field_data.RAW_decode(L1ctlGprsUlBlockReq_data_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

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

struct L1ctlGprsUlBlockReq_template::single_value_struct {
L1ctlGprsBlockHdr_template field_hdr;
OCTETSTRING_template field_data;
};

void L1ctlGprsUlBlockReq_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_hdr = ANY_VALUE;
single_value->field_data = ANY_VALUE;
}
}
}

void L1ctlGprsUlBlockReq_template::copy_value(const L1ctlGprsUlBlockReq& other_value)
{
single_value = new single_value_struct;
if (other_value.hdr().is_bound()) {
  single_value->field_hdr = other_value.hdr();
} else {
  single_value->field_hdr.clean_up();
}
if (other_value.data().is_bound()) {
  single_value->field_data = other_value.data();
} else {
  single_value->field_data.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlGprsUlBlockReq_template::copy_template(const L1ctlGprsUlBlockReq_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.hdr().get_selection()) {
single_value->field_hdr = other_value.hdr();
} else {
single_value->field_hdr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.data().get_selection()) {
single_value->field_data = other_value.data();
} else {
single_value->field_data.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new L1ctlGprsUlBlockReq_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 L1ctlGprsUlBlockReq_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlGprsUlBlockReq_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 @L1CTL_Types.L1ctlGprsUlBlockReq.");
break;
}
set_selection(other_value);
}

L1ctlGprsUlBlockReq_template::L1ctlGprsUlBlockReq_template()
{
}

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

L1ctlGprsUlBlockReq_template::L1ctlGprsUlBlockReq_template(const L1ctlGprsUlBlockReq& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlGprsUlBlockReq_template::match(const L1ctlGprsUlBlockReq& 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.hdr().is_bound()) return FALSE;
if(!single_value->field_hdr.match(other_value.hdr(), legacy))return FALSE;
if(!other_value.data().is_bound()) return FALSE;
if(!single_value->field_data.match(other_value.data(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @L1CTL_Types.L1ctlGprsUlBlockReq.");
}
return FALSE;
}

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

boolean L1ctlGprsUlBlockReq_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_hdr.is_value()
 && single_value->field_data.is_value();
}

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

L1ctlGprsUlBlockReq L1ctlGprsUlBlockReq_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 @L1CTL_Types.L1ctlGprsUlBlockReq.");
L1ctlGprsUlBlockReq ret_val;
if (single_value->field_hdr.is_bound()) {
ret_val.hdr() = single_value->field_hdr.valueof();
}
if (single_value->field_data.is_bound()) {
ret_val.data() = single_value->field_data.valueof();
}
return ret_val;
}

void L1ctlGprsUlBlockReq_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 @L1CTL_Types.L1ctlGprsUlBlockReq.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlGprsUlBlockReq_template[list_length];
}

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

L1ctlGprsBlockHdr_template& L1ctlGprsUlBlockReq_template::hdr()
{
set_specific();
return single_value->field_hdr;
}

const L1ctlGprsBlockHdr_template& L1ctlGprsUlBlockReq_template::hdr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field hdr of a non-specific template of type @L1CTL_Types.L1ctlGprsUlBlockReq.");
return single_value->field_hdr;
}

OCTETSTRING_template& L1ctlGprsUlBlockReq_template::data()
{
set_specific();
return single_value->field_data;
}

const OCTETSTRING_template& L1ctlGprsUlBlockReq_template::data() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field data of a non-specific template of type @L1CTL_Types.L1ctlGprsUlBlockReq.");
return single_value->field_data;
}

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

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

void L1ctlGprsUlBlockReq_template::log_match(const L1ctlGprsUlBlockReq& 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_hdr.match(match_value.hdr(), legacy)){
TTCN_Logger::log_logmatch_info(".hdr");
single_value->field_hdr.log_match(match_value.hdr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_data.match(match_value.data(), legacy)){
TTCN_Logger::log_logmatch_info(".data");
single_value->field_data.log_match(match_value.data(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ hdr := ");
single_value->field_hdr.log_match(match_value.hdr(), legacy);
TTCN_Logger::log_event_str(", data := ");
single_value->field_data.log_match(match_value.data(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void L1ctlGprsUlBlockReq_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (hdr().is_bound()) hdr().set_implicit_omit();
if (data().is_bound()) data().set_implicit_omit();
}

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

void L1ctlGprsUlBlockReq_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_hdr.decode_text(text_buf);
single_value->field_data.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new L1ctlGprsUlBlockReq_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 @L1CTL_Types.L1ctlGprsUlBlockReq.");
}
}

void L1ctlGprsUlBlockReq_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: {
    L1ctlGprsUlBlockReq_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @L1CTL_Types.L1ctlGprsUlBlockReq has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) hdr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) data().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          hdr().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(), "data")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          data().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @L1CTL_Types.L1ctlGprsUlBlockReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlGprsUlBlockReq_template* precondition = new L1ctlGprsUlBlockReq_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlGprsUlBlockReq_template* implied_template = new L1ctlGprsUlBlockReq_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlGprsUlBlockReq_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlGprsUlBlockReq");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlGprsUlBlockReq_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_hdr.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsUlBlockReq");
single_value->field_data.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsUlBlockReq");
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 : "@L1CTL_Types.L1ctlGprsUlBlockReq");
}

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

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

L1ctlGprsUlBlockCnf::L1ctlGprsUlBlockCnf()
{
}

L1ctlGprsUlBlockCnf::L1ctlGprsUlBlockCnf(const INTEGER& par_fn,
    const INTEGER& par_tn,
    const OCTETSTRING& par_data)
  :   field_fn(par_fn),
  field_tn(par_tn),
  field_data(par_data)
{
}

L1ctlGprsUlBlockCnf::L1ctlGprsUlBlockCnf(const L1ctlGprsUlBlockCnf& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlGprsUlBlockCnf.");
if (other_value.fn().is_bound()) field_fn = other_value.fn();
else field_fn.clean_up();
if (other_value.tn().is_bound()) field_tn = other_value.tn();
else field_tn.clean_up();
if (other_value.data().is_bound()) field_data = other_value.data();
else field_data.clean_up();
}

void L1ctlGprsUlBlockCnf::clean_up()
{
field_fn.clean_up();
field_tn.clean_up();
field_data.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlGprsUlBlockCnf::get_descriptor() const { return &L1ctlGprsUlBlockCnf_descr_; }
L1ctlGprsUlBlockCnf& L1ctlGprsUlBlockCnf::operator=(const L1ctlGprsUlBlockCnf& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlGprsUlBlockCnf.");
  if (other_value.fn().is_bound()) field_fn = other_value.fn();
  else field_fn.clean_up();
  if (other_value.tn().is_bound()) field_tn = other_value.tn();
  else field_tn.clean_up();
  if (other_value.data().is_bound()) field_data = other_value.data();
  else field_data.clean_up();
}
return *this;
}

boolean L1ctlGprsUlBlockCnf::operator==(const L1ctlGprsUlBlockCnf& other_value) const
{
return field_fn==other_value.field_fn
  && field_tn==other_value.field_tn
  && field_data==other_value.field_data;
}

boolean L1ctlGprsUlBlockCnf::is_bound() const
{
return (field_fn.is_bound())
  || (field_tn.is_bound())
  || (field_data.is_bound());
}
boolean L1ctlGprsUlBlockCnf::is_value() const
{
return field_fn.is_value()
  && field_tn.is_value()
  && field_data.is_value();
}
void L1ctlGprsUlBlockCnf::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ fn := ");
field_fn.log();
TTCN_Logger::log_event_str(", tn := ");
field_tn.log();
TTCN_Logger::log_event_str(", data := ");
field_data.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlGprsUlBlockCnf::set_implicit_omit()
{
if (fn().is_bound()) fn().set_implicit_omit();
if (tn().is_bound()) tn().set_implicit_omit();
if (data().is_bound()) data().set_implicit_omit();
}

void L1ctlGprsUlBlockCnf::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 @L1CTL_Types.L1ctlGprsUlBlockCnf 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) fn().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tn().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) data().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(), "fn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fn().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(), "tn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tn().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(), "data")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          data().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @L1CTL_Types.L1ctlGprsUlBlockCnf: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlGprsUlBlockCnf");
  }
}

void L1ctlGprsUlBlockCnf::encode_text(Text_Buf& text_buf) const
{
field_fn.encode_text(text_buf);
field_tn.encode_text(text_buf);
field_data.encode_text(text_buf);
}

void L1ctlGprsUlBlockCnf::decode_text(Text_Buf& text_buf)
{
field_fn.decode_text(text_buf);
field_tn.decode_text(text_buf);
field_data.decode_text(text_buf);
}

void L1ctlGprsUlBlockCnf::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 L1ctlGprsUlBlockCnf::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 L1ctlGprsUlBlockCnf::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, Osmocom__Types::uint32__t_descr_.raw->forceomit);
  decoded_field_length = field_fn.RAW_decode(Osmocom__Types::uint32__t_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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_tn.RAW_decode(Osmocom__Types::uint8__t_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_data.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 L1ctlGprsUlBlockCnf::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, Osmocom__Types::uint32__t_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, OCTETSTRING_descr_.raw);
  encoded_length += field_fn.RAW_encode(Osmocom__Types::uint32__t_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_tn.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_data.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct L1ctlGprsUlBlockCnf_template::single_value_struct {
INTEGER_template field_fn;
INTEGER_template field_tn;
OCTETSTRING_template field_data;
};

void L1ctlGprsUlBlockCnf_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_fn = ANY_VALUE;
single_value->field_tn = ANY_VALUE;
single_value->field_data = ANY_VALUE;
}
}
}

void L1ctlGprsUlBlockCnf_template::copy_value(const L1ctlGprsUlBlockCnf& other_value)
{
single_value = new single_value_struct;
if (other_value.fn().is_bound()) {
  single_value->field_fn = other_value.fn();
} else {
  single_value->field_fn.clean_up();
}
if (other_value.tn().is_bound()) {
  single_value->field_tn = other_value.tn();
} else {
  single_value->field_tn.clean_up();
}
if (other_value.data().is_bound()) {
  single_value->field_data = other_value.data();
} else {
  single_value->field_data.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlGprsUlBlockCnf_template::copy_template(const L1ctlGprsUlBlockCnf_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.fn().get_selection()) {
single_value->field_fn = other_value.fn();
} else {
single_value->field_fn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tn().get_selection()) {
single_value->field_tn = other_value.tn();
} else {
single_value->field_tn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.data().get_selection()) {
single_value->field_data = other_value.data();
} else {
single_value->field_data.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new L1ctlGprsUlBlockCnf_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 L1ctlGprsUlBlockCnf_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlGprsUlBlockCnf_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 @L1CTL_Types.L1ctlGprsUlBlockCnf.");
break;
}
set_selection(other_value);
}

L1ctlGprsUlBlockCnf_template::L1ctlGprsUlBlockCnf_template()
{
}

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

L1ctlGprsUlBlockCnf_template::L1ctlGprsUlBlockCnf_template(const L1ctlGprsUlBlockCnf& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlGprsUlBlockCnf_template::match(const L1ctlGprsUlBlockCnf& 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.fn().is_bound()) return FALSE;
if(!single_value->field_fn.match(other_value.fn(), legacy))return FALSE;
if(!other_value.tn().is_bound()) return FALSE;
if(!single_value->field_tn.match(other_value.tn(), legacy))return FALSE;
if(!other_value.data().is_bound()) return FALSE;
if(!single_value->field_data.match(other_value.data(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @L1CTL_Types.L1ctlGprsUlBlockCnf.");
}
return FALSE;
}

boolean L1ctlGprsUlBlockCnf_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_fn.is_bound()
 || single_value->field_tn.is_bound()
 || single_value->field_data.is_bound();
}

boolean L1ctlGprsUlBlockCnf_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_fn.is_value()
 && single_value->field_tn.is_value()
 && single_value->field_data.is_value();
}

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

L1ctlGprsUlBlockCnf L1ctlGprsUlBlockCnf_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 @L1CTL_Types.L1ctlGprsUlBlockCnf.");
L1ctlGprsUlBlockCnf ret_val;
if (single_value->field_fn.is_bound()) {
ret_val.fn() = single_value->field_fn.valueof();
}
if (single_value->field_tn.is_bound()) {
ret_val.tn() = single_value->field_tn.valueof();
}
if (single_value->field_data.is_bound()) {
ret_val.data() = single_value->field_data.valueof();
}
return ret_val;
}

void L1ctlGprsUlBlockCnf_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 @L1CTL_Types.L1ctlGprsUlBlockCnf.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlGprsUlBlockCnf_template[list_length];
}

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

INTEGER_template& L1ctlGprsUlBlockCnf_template::fn()
{
set_specific();
return single_value->field_fn;
}

const INTEGER_template& L1ctlGprsUlBlockCnf_template::fn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field fn of a non-specific template of type @L1CTL_Types.L1ctlGprsUlBlockCnf.");
return single_value->field_fn;
}

INTEGER_template& L1ctlGprsUlBlockCnf_template::tn()
{
set_specific();
return single_value->field_tn;
}

const INTEGER_template& L1ctlGprsUlBlockCnf_template::tn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tn of a non-specific template of type @L1CTL_Types.L1ctlGprsUlBlockCnf.");
return single_value->field_tn;
}

OCTETSTRING_template& L1ctlGprsUlBlockCnf_template::data()
{
set_specific();
return single_value->field_data;
}

const OCTETSTRING_template& L1ctlGprsUlBlockCnf_template::data() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field data of a non-specific template of type @L1CTL_Types.L1ctlGprsUlBlockCnf.");
return single_value->field_data;
}

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

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

void L1ctlGprsUlBlockCnf_template::log_match(const L1ctlGprsUlBlockCnf& 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_fn.match(match_value.fn(), legacy)){
TTCN_Logger::log_logmatch_info(".fn");
single_value->field_fn.log_match(match_value.fn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tn.match(match_value.tn(), legacy)){
TTCN_Logger::log_logmatch_info(".tn");
single_value->field_tn.log_match(match_value.tn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_data.match(match_value.data(), legacy)){
TTCN_Logger::log_logmatch_info(".data");
single_value->field_data.log_match(match_value.data(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ fn := ");
single_value->field_fn.log_match(match_value.fn(), legacy);
TTCN_Logger::log_event_str(", tn := ");
single_value->field_tn.log_match(match_value.tn(), legacy);
TTCN_Logger::log_event_str(", data := ");
single_value->field_data.log_match(match_value.data(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void L1ctlGprsUlBlockCnf_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (fn().is_bound()) fn().set_implicit_omit();
if (tn().is_bound()) tn().set_implicit_omit();
if (data().is_bound()) data().set_implicit_omit();
}

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

void L1ctlGprsUlBlockCnf_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_fn.decode_text(text_buf);
single_value->field_tn.decode_text(text_buf);
single_value->field_data.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new L1ctlGprsUlBlockCnf_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 @L1CTL_Types.L1ctlGprsUlBlockCnf.");
}
}

void L1ctlGprsUlBlockCnf_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: {
    L1ctlGprsUlBlockCnf_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 @L1CTL_Types.L1ctlGprsUlBlockCnf 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) fn().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tn().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) data().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(), "fn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fn().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(), "tn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tn().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(), "data")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          data().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @L1CTL_Types.L1ctlGprsUlBlockCnf: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlGprsUlBlockCnf_template* precondition = new L1ctlGprsUlBlockCnf_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlGprsUlBlockCnf_template* implied_template = new L1ctlGprsUlBlockCnf_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlGprsUlBlockCnf_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlGprsUlBlockCnf");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlGprsUlBlockCnf_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_fn.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsUlBlockCnf");
single_value->field_tn.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsUlBlockCnf");
single_value->field_data.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsUlBlockCnf");
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 : "@L1CTL_Types.L1ctlGprsUlBlockCnf");
}

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

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

L1ctlGprsDlBlockInd_meas::L1ctlGprsDlBlockInd_meas()
{
}

L1ctlGprsDlBlockInd_meas::L1ctlGprsDlBlockInd_meas(const INTEGER& par_ber10k,
    const INTEGER& par_ci__cb,
    const INTEGER& par_rx__level)
  :   field_ber10k(par_ber10k),
  field_ci__cb(par_ci__cb),
  field_rx__level(par_rx__level)
{
}

L1ctlGprsDlBlockInd_meas::L1ctlGprsDlBlockInd_meas(const L1ctlGprsDlBlockInd_meas& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlGprsDlBlockInd.meas.");
if (other_value.ber10k().is_bound()) field_ber10k = other_value.ber10k();
else field_ber10k.clean_up();
if (other_value.ci__cb().is_bound()) field_ci__cb = other_value.ci__cb();
else field_ci__cb.clean_up();
if (other_value.rx__level().is_bound()) field_rx__level = other_value.rx__level();
else field_rx__level.clean_up();
}

void L1ctlGprsDlBlockInd_meas::clean_up()
{
field_ber10k.clean_up();
field_ci__cb.clean_up();
field_rx__level.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlGprsDlBlockInd_meas::get_descriptor() const { return &L1ctlGprsDlBlockInd_meas_descr_; }
L1ctlGprsDlBlockInd_meas& L1ctlGprsDlBlockInd_meas::operator=(const L1ctlGprsDlBlockInd_meas& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlGprsDlBlockInd.meas.");
  if (other_value.ber10k().is_bound()) field_ber10k = other_value.ber10k();
  else field_ber10k.clean_up();
  if (other_value.ci__cb().is_bound()) field_ci__cb = other_value.ci__cb();
  else field_ci__cb.clean_up();
  if (other_value.rx__level().is_bound()) field_rx__level = other_value.rx__level();
  else field_rx__level.clean_up();
}
return *this;
}

boolean L1ctlGprsDlBlockInd_meas::operator==(const L1ctlGprsDlBlockInd_meas& other_value) const
{
return field_ber10k==other_value.field_ber10k
  && field_ci__cb==other_value.field_ci__cb
  && field_rx__level==other_value.field_rx__level;
}

boolean L1ctlGprsDlBlockInd_meas::is_bound() const
{
return (field_ber10k.is_bound())
  || (field_ci__cb.is_bound())
  || (field_rx__level.is_bound());
}
boolean L1ctlGprsDlBlockInd_meas::is_value() const
{
return field_ber10k.is_value()
  && field_ci__cb.is_value()
  && field_rx__level.is_value();
}
void L1ctlGprsDlBlockInd_meas::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ ber10k := ");
field_ber10k.log();
TTCN_Logger::log_event_str(", ci_cb := ");
field_ci__cb.log();
TTCN_Logger::log_event_str(", rx_level := ");
field_rx__level.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlGprsDlBlockInd_meas::set_implicit_omit()
{
if (ber10k().is_bound()) ber10k().set_implicit_omit();
if (ci__cb().is_bound()) ci__cb().set_implicit_omit();
if (rx__level().is_bound()) rx__level().set_implicit_omit();
}

void L1ctlGprsDlBlockInd_meas::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 @L1CTL_Types.L1ctlGprsDlBlockInd.meas 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) ber10k().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ci__cb().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rx__level().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(), "ber10k")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ber10k().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(), "ci_cb")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ci__cb().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(), "rx_level")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rx__level().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 @L1CTL_Types.L1ctlGprsDlBlockInd.meas: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlGprsDlBlockInd.meas");
  }
}

void L1ctlGprsDlBlockInd_meas::encode_text(Text_Buf& text_buf) const
{
field_ber10k.encode_text(text_buf);
field_ci__cb.encode_text(text_buf);
field_rx__level.encode_text(text_buf);
}

void L1ctlGprsDlBlockInd_meas::decode_text(Text_Buf& text_buf)
{
field_ber10k.decode_text(text_buf);
field_ci__cb.decode_text(text_buf);
field_rx__level.decode_text(text_buf);
}

void L1ctlGprsDlBlockInd_meas::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 L1ctlGprsDlBlockInd_meas::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 L1ctlGprsDlBlockInd_meas::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, Osmocom__Types::uint16__t_descr_.raw->forceomit);
  decoded_field_length = field_ber10k.RAW_decode(Osmocom__Types::uint16__t_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, Osmocom__Types::int16__t_descr_.raw->forceomit);
  decoded_field_length = field_ci__cb.RAW_decode(Osmocom__Types::int16__t_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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_rx__level.RAW_decode(Osmocom__Types::uint8__t_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 L1ctlGprsDlBlockInd_meas::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, Osmocom__Types::uint16__t_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Osmocom__Types::int16__t_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Osmocom__Types::uint8__t_descr_.raw);
  encoded_length += field_ber10k.RAW_encode(Osmocom__Types::uint16__t_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ci__cb.RAW_encode(Osmocom__Types::int16__t_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_rx__level.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct L1ctlGprsDlBlockInd_meas_template::single_value_struct {
INTEGER_template field_ber10k;
INTEGER_template field_ci__cb;
INTEGER_template field_rx__level;
};

void L1ctlGprsDlBlockInd_meas_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_ber10k = ANY_VALUE;
single_value->field_ci__cb = ANY_VALUE;
single_value->field_rx__level = ANY_VALUE;
}
}
}

void L1ctlGprsDlBlockInd_meas_template::copy_value(const L1ctlGprsDlBlockInd_meas& other_value)
{
single_value = new single_value_struct;
if (other_value.ber10k().is_bound()) {
  single_value->field_ber10k = other_value.ber10k();
} else {
  single_value->field_ber10k.clean_up();
}
if (other_value.ci__cb().is_bound()) {
  single_value->field_ci__cb = other_value.ci__cb();
} else {
  single_value->field_ci__cb.clean_up();
}
if (other_value.rx__level().is_bound()) {
  single_value->field_rx__level = other_value.rx__level();
} else {
  single_value->field_rx__level.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlGprsDlBlockInd_meas_template::copy_template(const L1ctlGprsDlBlockInd_meas_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.ber10k().get_selection()) {
single_value->field_ber10k = other_value.ber10k();
} else {
single_value->field_ber10k.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ci__cb().get_selection()) {
single_value->field_ci__cb = other_value.ci__cb();
} else {
single_value->field_ci__cb.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rx__level().get_selection()) {
single_value->field_rx__level = other_value.rx__level();
} else {
single_value->field_rx__level.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 L1ctlGprsDlBlockInd_meas_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 L1ctlGprsDlBlockInd_meas_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlGprsDlBlockInd_meas_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 @L1CTL_Types.L1ctlGprsDlBlockInd.meas.");
break;
}
set_selection(other_value);
}

L1ctlGprsDlBlockInd_meas_template::L1ctlGprsDlBlockInd_meas_template()
{
}

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

L1ctlGprsDlBlockInd_meas_template::L1ctlGprsDlBlockInd_meas_template(const L1ctlGprsDlBlockInd_meas& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlGprsDlBlockInd_meas_template::match(const L1ctlGprsDlBlockInd_meas& 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.ber10k().is_bound()) return FALSE;
if(!single_value->field_ber10k.match(other_value.ber10k(), legacy))return FALSE;
if(!other_value.ci__cb().is_bound()) return FALSE;
if(!single_value->field_ci__cb.match(other_value.ci__cb(), legacy))return FALSE;
if(!other_value.rx__level().is_bound()) return FALSE;
if(!single_value->field_rx__level.match(other_value.rx__level(), 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 @L1CTL_Types.L1ctlGprsDlBlockInd.meas.");
}
return FALSE;
}

boolean L1ctlGprsDlBlockInd_meas_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_ber10k.is_bound()
 || single_value->field_ci__cb.is_bound()
 || single_value->field_rx__level.is_bound();
}

boolean L1ctlGprsDlBlockInd_meas_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_ber10k.is_value()
 && single_value->field_ci__cb.is_value()
 && single_value->field_rx__level.is_value();
}

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

L1ctlGprsDlBlockInd_meas L1ctlGprsDlBlockInd_meas_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 @L1CTL_Types.L1ctlGprsDlBlockInd.meas.");
L1ctlGprsDlBlockInd_meas ret_val;
if (single_value->field_ber10k.is_bound()) {
ret_val.ber10k() = single_value->field_ber10k.valueof();
}
if (single_value->field_ci__cb.is_bound()) {
ret_val.ci__cb() = single_value->field_ci__cb.valueof();
}
if (single_value->field_rx__level.is_bound()) {
ret_val.rx__level() = single_value->field_rx__level.valueof();
}
return ret_val;
}

void L1ctlGprsDlBlockInd_meas_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 @L1CTL_Types.L1ctlGprsDlBlockInd.meas.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlGprsDlBlockInd_meas_template[list_length];
}

L1ctlGprsDlBlockInd_meas_template& L1ctlGprsDlBlockInd_meas_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 @L1CTL_Types.L1ctlGprsDlBlockInd.meas.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @L1CTL_Types.L1ctlGprsDlBlockInd.meas.");
return value_list.list_value[list_index];
}

INTEGER_template& L1ctlGprsDlBlockInd_meas_template::ber10k()
{
set_specific();
return single_value->field_ber10k;
}

const INTEGER_template& L1ctlGprsDlBlockInd_meas_template::ber10k() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ber10k of a non-specific template of type @L1CTL_Types.L1ctlGprsDlBlockInd.meas.");
return single_value->field_ber10k;
}

INTEGER_template& L1ctlGprsDlBlockInd_meas_template::ci__cb()
{
set_specific();
return single_value->field_ci__cb;
}

const INTEGER_template& L1ctlGprsDlBlockInd_meas_template::ci__cb() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ci_cb of a non-specific template of type @L1CTL_Types.L1ctlGprsDlBlockInd.meas.");
return single_value->field_ci__cb;
}

INTEGER_template& L1ctlGprsDlBlockInd_meas_template::rx__level()
{
set_specific();
return single_value->field_rx__level;
}

const INTEGER_template& L1ctlGprsDlBlockInd_meas_template::rx__level() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rx_level of a non-specific template of type @L1CTL_Types.L1ctlGprsDlBlockInd.meas.");
return single_value->field_rx__level;
}

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

void L1ctlGprsDlBlockInd_meas_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ ber10k := ");
single_value->field_ber10k.log();
TTCN_Logger::log_event_str(", ci_cb := ");
single_value->field_ci__cb.log();
TTCN_Logger::log_event_str(", rx_level := ");
single_value->field_rx__level.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 L1ctlGprsDlBlockInd_meas_template::log_match(const L1ctlGprsDlBlockInd_meas& 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_ber10k.match(match_value.ber10k(), legacy)){
TTCN_Logger::log_logmatch_info(".ber10k");
single_value->field_ber10k.log_match(match_value.ber10k(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ci__cb.match(match_value.ci__cb(), legacy)){
TTCN_Logger::log_logmatch_info(".ci_cb");
single_value->field_ci__cb.log_match(match_value.ci__cb(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rx__level.match(match_value.rx__level(), legacy)){
TTCN_Logger::log_logmatch_info(".rx_level");
single_value->field_rx__level.log_match(match_value.rx__level(), 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("{ ber10k := ");
single_value->field_ber10k.log_match(match_value.ber10k(), legacy);
TTCN_Logger::log_event_str(", ci_cb := ");
single_value->field_ci__cb.log_match(match_value.ci__cb(), legacy);
TTCN_Logger::log_event_str(", rx_level := ");
single_value->field_rx__level.log_match(match_value.rx__level(), 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 L1ctlGprsDlBlockInd_meas_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (ber10k().is_bound()) ber10k().set_implicit_omit();
if (ci__cb().is_bound()) ci__cb().set_implicit_omit();
if (rx__level().is_bound()) rx__level().set_implicit_omit();
}

void L1ctlGprsDlBlockInd_meas_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_ber10k.encode_text(text_buf);
single_value->field_ci__cb.encode_text(text_buf);
single_value->field_rx__level.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 @L1CTL_Types.L1ctlGprsDlBlockInd.meas.");
}
}

void L1ctlGprsDlBlockInd_meas_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_ber10k.decode_text(text_buf);
single_value->field_ci__cb.decode_text(text_buf);
single_value->field_rx__level.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 L1ctlGprsDlBlockInd_meas_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 @L1CTL_Types.L1ctlGprsDlBlockInd.meas.");
}
}

void L1ctlGprsDlBlockInd_meas_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: {
    L1ctlGprsDlBlockInd_meas_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 @L1CTL_Types.L1ctlGprsDlBlockInd.meas 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) ber10k().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ci__cb().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rx__level().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(), "ber10k")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ber10k().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(), "ci_cb")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ci__cb().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(), "rx_level")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rx__level().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 @L1CTL_Types.L1ctlGprsDlBlockInd.meas: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlGprsDlBlockInd_meas_template* precondition = new L1ctlGprsDlBlockInd_meas_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlGprsDlBlockInd_meas_template* implied_template = new L1ctlGprsDlBlockInd_meas_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlGprsDlBlockInd_meas_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlGprsDlBlockInd.meas");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlGprsDlBlockInd_meas_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_ber10k.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsDlBlockInd.meas");
single_value->field_ci__cb.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsDlBlockInd.meas");
single_value->field_rx__level.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsDlBlockInd.meas");
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 : "@L1CTL_Types.L1ctlGprsDlBlockInd.meas");
}

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

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

L1ctlGprsDlBlockInd::L1ctlGprsDlBlockInd()
{
}

L1ctlGprsDlBlockInd::L1ctlGprsDlBlockInd(const L1ctlGprsBlockHdr& par_hdr,
    const L1ctlGprsDlBlockInd_meas& par_meas,
    const INTEGER& par_usf,
    const OCTETSTRING& par_data)
  :   field_hdr(par_hdr),
  field_meas(par_meas),
  field_usf(par_usf),
  field_data(par_data)
{
}

L1ctlGprsDlBlockInd::L1ctlGprsDlBlockInd(const L1ctlGprsDlBlockInd& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @L1CTL_Types.L1ctlGprsDlBlockInd.");
if (other_value.hdr().is_bound()) field_hdr = other_value.hdr();
else field_hdr.clean_up();
if (other_value.meas().is_bound()) field_meas = other_value.meas();
else field_meas.clean_up();
if (other_value.usf().is_bound()) field_usf = other_value.usf();
else field_usf.clean_up();
if (other_value.data().is_bound()) field_data = other_value.data();
else field_data.clean_up();
}

void L1ctlGprsDlBlockInd::clean_up()
{
field_hdr.clean_up();
field_meas.clean_up();
field_usf.clean_up();
field_data.clean_up();
}

const TTCN_Typedescriptor_t* L1ctlGprsDlBlockInd::get_descriptor() const { return &L1ctlGprsDlBlockInd_descr_; }
L1ctlGprsDlBlockInd& L1ctlGprsDlBlockInd::operator=(const L1ctlGprsDlBlockInd& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @L1CTL_Types.L1ctlGprsDlBlockInd.");
  if (other_value.hdr().is_bound()) field_hdr = other_value.hdr();
  else field_hdr.clean_up();
  if (other_value.meas().is_bound()) field_meas = other_value.meas();
  else field_meas.clean_up();
  if (other_value.usf().is_bound()) field_usf = other_value.usf();
  else field_usf.clean_up();
  if (other_value.data().is_bound()) field_data = other_value.data();
  else field_data.clean_up();
}
return *this;
}

boolean L1ctlGprsDlBlockInd::operator==(const L1ctlGprsDlBlockInd& other_value) const
{
return field_hdr==other_value.field_hdr
  && field_meas==other_value.field_meas
  && field_usf==other_value.field_usf
  && field_data==other_value.field_data;
}

boolean L1ctlGprsDlBlockInd::is_bound() const
{
return (field_hdr.is_bound())
  || (field_meas.is_bound())
  || (field_usf.is_bound())
  || (field_data.is_bound());
}
boolean L1ctlGprsDlBlockInd::is_value() const
{
return field_hdr.is_value()
  && field_meas.is_value()
  && field_usf.is_value()
  && field_data.is_value();
}
void L1ctlGprsDlBlockInd::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ hdr := ");
field_hdr.log();
TTCN_Logger::log_event_str(", meas := ");
field_meas.log();
TTCN_Logger::log_event_str(", usf := ");
field_usf.log();
TTCN_Logger::log_event_str(", data := ");
field_data.log();
TTCN_Logger::log_event_str(" }");
}

void L1ctlGprsDlBlockInd::set_implicit_omit()
{
if (hdr().is_bound()) hdr().set_implicit_omit();
if (meas().is_bound()) meas().set_implicit_omit();
if (usf().is_bound()) usf().set_implicit_omit();
if (data().is_bound()) data().set_implicit_omit();
}

void L1ctlGprsDlBlockInd::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 @L1CTL_Types.L1ctlGprsDlBlockInd 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) hdr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) meas().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) usf().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) data().set_param(*param.get_elem(3));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          hdr().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(), "meas")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          meas().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(), "usf")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          usf().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(), "data")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          data().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @L1CTL_Types.L1ctlGprsDlBlockInd: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@L1CTL_Types.L1ctlGprsDlBlockInd");
  }
}

void L1ctlGprsDlBlockInd::encode_text(Text_Buf& text_buf) const
{
field_hdr.encode_text(text_buf);
field_meas.encode_text(text_buf);
field_usf.encode_text(text_buf);
field_data.encode_text(text_buf);
}

void L1ctlGprsDlBlockInd::decode_text(Text_Buf& text_buf)
{
field_hdr.decode_text(text_buf);
field_meas.decode_text(text_buf);
field_usf.decode_text(text_buf);
field_data.decode_text(text_buf);
}

void L1ctlGprsDlBlockInd::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 L1ctlGprsDlBlockInd::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 L1ctlGprsDlBlockInd::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, L1ctlGprsBlockHdr_descr_.raw->forceomit);
  decoded_field_length = field_hdr.RAW_decode(L1ctlGprsBlockHdr_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, L1ctlGprsDlBlockInd_meas_descr_.raw->forceomit);
  decoded_field_length = field_meas.RAW_decode(L1ctlGprsDlBlockInd_meas_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, Osmocom__Types::uint8__t_descr_.raw->forceomit);
  decoded_field_length = field_usf.RAW_decode(Osmocom__Types::uint8__t_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, L1ctlGprsDlBlockInd_data_descr_.raw->forceomit);
  decoded_field_length = field_data.RAW_decode(L1ctlGprsDlBlockInd_data_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 L1ctlGprsDlBlockInd::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, L1ctlGprsBlockHdr_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, L1ctlGprsDlBlockInd_meas_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Osmocom__Types::uint8__t_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, L1ctlGprsDlBlockInd_data_descr_.raw);
  encoded_length += field_hdr.RAW_encode(L1ctlGprsBlockHdr_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_meas.RAW_encode(L1ctlGprsDlBlockInd_meas_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_usf.RAW_encode(Osmocom__Types::uint8__t_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_data.RAW_encode(L1ctlGprsDlBlockInd_data_descr_, *myleaf.body.node.nodes[3]);
  return myleaf.length = encoded_length;
}

struct L1ctlGprsDlBlockInd_template::single_value_struct {
L1ctlGprsBlockHdr_template field_hdr;
L1ctlGprsDlBlockInd_meas_template field_meas;
INTEGER_template field_usf;
OCTETSTRING_template field_data;
};

void L1ctlGprsDlBlockInd_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_hdr = ANY_VALUE;
single_value->field_meas = ANY_VALUE;
single_value->field_usf = ANY_VALUE;
single_value->field_data = ANY_VALUE;
}
}
}

void L1ctlGprsDlBlockInd_template::copy_value(const L1ctlGprsDlBlockInd& other_value)
{
single_value = new single_value_struct;
if (other_value.hdr().is_bound()) {
  single_value->field_hdr = other_value.hdr();
} else {
  single_value->field_hdr.clean_up();
}
if (other_value.meas().is_bound()) {
  single_value->field_meas = other_value.meas();
} else {
  single_value->field_meas.clean_up();
}
if (other_value.usf().is_bound()) {
  single_value->field_usf = other_value.usf();
} else {
  single_value->field_usf.clean_up();
}
if (other_value.data().is_bound()) {
  single_value->field_data = other_value.data();
} else {
  single_value->field_data.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void L1ctlGprsDlBlockInd_template::copy_template(const L1ctlGprsDlBlockInd_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.hdr().get_selection()) {
single_value->field_hdr = other_value.hdr();
} else {
single_value->field_hdr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.meas().get_selection()) {
single_value->field_meas = other_value.meas();
} else {
single_value->field_meas.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.usf().get_selection()) {
single_value->field_usf = other_value.usf();
} else {
single_value->field_usf.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.data().get_selection()) {
single_value->field_data = other_value.data();
} else {
single_value->field_data.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new L1ctlGprsDlBlockInd_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 L1ctlGprsDlBlockInd_template(*other_value.implication_.precondition);
implication_.implied_template = new L1ctlGprsDlBlockInd_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 @L1CTL_Types.L1ctlGprsDlBlockInd.");
break;
}
set_selection(other_value);
}

L1ctlGprsDlBlockInd_template::L1ctlGprsDlBlockInd_template()
{
}

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

L1ctlGprsDlBlockInd_template::L1ctlGprsDlBlockInd_template(const L1ctlGprsDlBlockInd& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean L1ctlGprsDlBlockInd_template::match(const L1ctlGprsDlBlockInd& 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.hdr().is_bound()) return FALSE;
if(!single_value->field_hdr.match(other_value.hdr(), legacy))return FALSE;
if(!other_value.meas().is_bound()) return FALSE;
if(!single_value->field_meas.match(other_value.meas(), legacy))return FALSE;
if(!other_value.usf().is_bound()) return FALSE;
if(!single_value->field_usf.match(other_value.usf(), legacy))return FALSE;
if(!other_value.data().is_bound()) return FALSE;
if(!single_value->field_data.match(other_value.data(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @L1CTL_Types.L1ctlGprsDlBlockInd.");
}
return FALSE;
}

boolean L1ctlGprsDlBlockInd_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_hdr.is_bound()
 || single_value->field_meas.is_bound()
 || single_value->field_usf.is_bound()
 || single_value->field_data.is_bound();
}

boolean L1ctlGprsDlBlockInd_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_hdr.is_value()
 && single_value->field_meas.is_value()
 && single_value->field_usf.is_value()
 && single_value->field_data.is_value();
}

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

L1ctlGprsDlBlockInd L1ctlGprsDlBlockInd_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 @L1CTL_Types.L1ctlGprsDlBlockInd.");
L1ctlGprsDlBlockInd ret_val;
if (single_value->field_hdr.is_bound()) {
ret_val.hdr() = single_value->field_hdr.valueof();
}
if (single_value->field_meas.is_bound()) {
ret_val.meas() = single_value->field_meas.valueof();
}
if (single_value->field_usf.is_bound()) {
ret_val.usf() = single_value->field_usf.valueof();
}
if (single_value->field_data.is_bound()) {
ret_val.data() = single_value->field_data.valueof();
}
return ret_val;
}

void L1ctlGprsDlBlockInd_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 @L1CTL_Types.L1ctlGprsDlBlockInd.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new L1ctlGprsDlBlockInd_template[list_length];
}

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

L1ctlGprsBlockHdr_template& L1ctlGprsDlBlockInd_template::hdr()
{
set_specific();
return single_value->field_hdr;
}

const L1ctlGprsBlockHdr_template& L1ctlGprsDlBlockInd_template::hdr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field hdr of a non-specific template of type @L1CTL_Types.L1ctlGprsDlBlockInd.");
return single_value->field_hdr;
}

L1ctlGprsDlBlockInd_meas_template& L1ctlGprsDlBlockInd_template::meas()
{
set_specific();
return single_value->field_meas;
}

const L1ctlGprsDlBlockInd_meas_template& L1ctlGprsDlBlockInd_template::meas() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field meas of a non-specific template of type @L1CTL_Types.L1ctlGprsDlBlockInd.");
return single_value->field_meas;
}

INTEGER_template& L1ctlGprsDlBlockInd_template::usf()
{
set_specific();
return single_value->field_usf;
}

const INTEGER_template& L1ctlGprsDlBlockInd_template::usf() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field usf of a non-specific template of type @L1CTL_Types.L1ctlGprsDlBlockInd.");
return single_value->field_usf;
}

OCTETSTRING_template& L1ctlGprsDlBlockInd_template::data()
{
set_specific();
return single_value->field_data;
}

const OCTETSTRING_template& L1ctlGprsDlBlockInd_template::data() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field data of a non-specific template of type @L1CTL_Types.L1ctlGprsDlBlockInd.");
return single_value->field_data;
}

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

void L1ctlGprsDlBlockInd_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ hdr := ");
single_value->field_hdr.log();
TTCN_Logger::log_event_str(", meas := ");
single_value->field_meas.log();
TTCN_Logger::log_event_str(", usf := ");
single_value->field_usf.log();
TTCN_Logger::log_event_str(", data := ");
single_value->field_data.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void L1ctlGprsDlBlockInd_template::log_match(const L1ctlGprsDlBlockInd& 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_hdr.match(match_value.hdr(), legacy)){
TTCN_Logger::log_logmatch_info(".hdr");
single_value->field_hdr.log_match(match_value.hdr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_meas.match(match_value.meas(), legacy)){
TTCN_Logger::log_logmatch_info(".meas");
single_value->field_meas.log_match(match_value.meas(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_usf.match(match_value.usf(), legacy)){
TTCN_Logger::log_logmatch_info(".usf");
single_value->field_usf.log_match(match_value.usf(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_data.match(match_value.data(), legacy)){
TTCN_Logger::log_logmatch_info(".data");
single_value->field_data.log_match(match_value.data(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ hdr := ");
single_value->field_hdr.log_match(match_value.hdr(), legacy);
TTCN_Logger::log_event_str(", meas := ");
single_value->field_meas.log_match(match_value.meas(), legacy);
TTCN_Logger::log_event_str(", usf := ");
single_value->field_usf.log_match(match_value.usf(), legacy);
TTCN_Logger::log_event_str(", data := ");
single_value->field_data.log_match(match_value.data(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void L1ctlGprsDlBlockInd_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (hdr().is_bound()) hdr().set_implicit_omit();
if (meas().is_bound()) meas().set_implicit_omit();
if (usf().is_bound()) usf().set_implicit_omit();
if (data().is_bound()) data().set_implicit_omit();
}

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

void L1ctlGprsDlBlockInd_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_hdr.decode_text(text_buf);
single_value->field_meas.decode_text(text_buf);
single_value->field_usf.decode_text(text_buf);
single_value->field_data.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new L1ctlGprsDlBlockInd_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 @L1CTL_Types.L1ctlGprsDlBlockInd.");
}
}

void L1ctlGprsDlBlockInd_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: {
    L1ctlGprsDlBlockInd_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 @L1CTL_Types.L1ctlGprsDlBlockInd 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) hdr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) meas().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) usf().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) data().set_param(*param.get_elem(3));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          hdr().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(), "meas")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          meas().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(), "usf")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          usf().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(), "data")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          data().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @L1CTL_Types.L1ctlGprsDlBlockInd: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    L1ctlGprsDlBlockInd_template* precondition = new L1ctlGprsDlBlockInd_template;
    precondition->set_param(*param.get_elem(0));
    L1ctlGprsDlBlockInd_template* implied_template = new L1ctlGprsDlBlockInd_template;
    implied_template->set_param(*param.get_elem(1));
    *this = L1ctlGprsDlBlockInd_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@L1CTL_Types.L1ctlGprsDlBlockInd");
  }
  is_ifpresent = param.get_ifpresent();
}

void L1ctlGprsDlBlockInd_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_hdr.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsDlBlockInd");
single_value->field_meas.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsDlBlockInd");
single_value->field_usf.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsDlBlockInd");
single_value->field_data.check_restriction(t_res, t_name ? t_name : "@L1CTL_Types.L1ctlGprsDlBlockInd");
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 : "@L1CTL_Types.L1ctlGprsDlBlockInd");
}

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

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


} /* end of namespace */
