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

namespace RLCMAC__Types {

/* Literal string constants */

const unsigned char bs_0_bits[] = { 1 };
extern const BITSTRING bs_0(1, bs_0_bits);
const unsigned char module_checksum[] = { 0x4d, 0x68, 0xab, 0x53, 0x86, 0x57, 0x93, 0x5a, 0x09, 0x96, 0x26, 0x7c, 0xd3, 0x7e, 0x88, 0xd1 };

/* Global variable definitions */

const TTCN_RAWdescriptor_t MacPayloadType_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for MacPayloadType
const TTCN_Typedescriptor_t MacPayloadType_descr_ = { "@RLCMAC_Types.MacPayloadType", NULL, &MacPayloadType_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING MacPayloadType_default_coding("RAW");
const TTCN_RAWdescriptor_t MacRrbp_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for MacRrbp
const TTCN_Typedescriptor_t MacRrbp_descr_ = { "@RLCMAC_Types.MacRrbp", NULL, &MacRrbp_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING MacRrbp_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsHeaderType_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 EgprsHeaderType
const TTCN_Typedescriptor_t EgprsHeaderType_descr_ = { "@RLCMAC_Types.EgprsHeaderType", NULL, &EgprsHeaderType_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsHeaderType_default_coding("RAW");
const TTCN_RAWdescriptor_t CodingScheme_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 CodingScheme
const TTCN_Typedescriptor_t CodingScheme_descr_ = { "@RLCMAC_Types.CodingScheme", NULL, &CodingScheme_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING CodingScheme_default_coding("RAW");
const TTCN_RAWdescriptor_t CodingSchemeArray_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 CodingSchemeArray
const TTCN_Typedescriptor_t CodingSchemeArray_descr_ = { "@RLCMAC_Types.CodingSchemeArray", NULL, &CodingSchemeArray_raw_, NULL, NULL, NULL, NULL, NULL, &CodingSchemeArray_0_descr_, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_RAWdescriptor_t CodingSchemeArray_0_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 CodingSchemeArray_0
const TTCN_Typedescriptor_t CodingSchemeArray_0_descr_ = { "@RLCMAC_Types.CodingSchemeArray.<oftype>", NULL, &CodingSchemeArray_0_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING CodingSchemeArray_0_default_coding("RAW");
UNIVERSAL_CHARSTRING CodingSchemeArray_default_coding("RAW");
const TTCN_RAWdescriptor_t DlMacHeader_payload__type_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for DlMacHeader_payload__type
const TTCN_Typedescriptor_t DlMacHeader_payload__type_descr_ = { "@RLCMAC_Types.DlMacHeader.payload_type", NULL, &DlMacHeader_payload__type_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlMacHeader_payload__type_default_coding("RAW");
const TTCN_RAWdescriptor_t DlMacHeader_rrbp_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for DlMacHeader_rrbp
const TTCN_Typedescriptor_t DlMacHeader_rrbp_descr_ = { "@RLCMAC_Types.DlMacHeader.rrbp", NULL, &DlMacHeader_rrbp_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlMacHeader_rrbp_default_coding("RAW");
const TTCN_RAWdescriptor_t DlMacHeader_rrbp__valid_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       DlMacHeader_rrbp__valid_xer_ = { {"rrbp_valid>\n", "rrbp_valid>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int DlMacHeader_rrbp__valid_oer_ext_arr_[0] = {};
const int DlMacHeader_rrbp__valid_oer_p_[0] = {};
const TTCN_OERdescriptor_t DlMacHeader_rrbp__valid_oer_ = { -1, TRUE, -1, FALSE, 0, 0, DlMacHeader_rrbp__valid_oer_ext_arr_, 0, DlMacHeader_rrbp__valid_oer_p_};
const TTCN_Typedescriptor_t DlMacHeader_rrbp__valid_descr_ = { "@RLCMAC_Types.DlMacHeader.rrbp_valid", &BOOLEAN_ber_, &DlMacHeader_rrbp__valid_raw_, &BOOLEAN_text_, &DlMacHeader_rrbp__valid_xer_, &BOOLEAN_json_, &DlMacHeader_rrbp__valid_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlMacHeader_rrbp__valid_default_coding("RAW");
const TTCN_RAWdescriptor_t DlMacHeader_usf_raw_ = {3,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       DlMacHeader_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 DlMacHeader_usf_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t DlMacHeader_usf_descr_ = { "@RLCMAC_Types.DlMacHeader.usf", &INTEGER_ber_, &DlMacHeader_usf_raw_, &INTEGER_text_, &DlMacHeader_usf_xer_, &INTEGER_json_, &DlMacHeader_usf_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlMacHeader_usf_default_coding("RAW");
const TTCN_RAWdescriptor_t DlMacHeader_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 DlMacHeader
const TTCN_Typedescriptor_t DlMacHeader_descr_ = { "@RLCMAC_Types.DlMacHeader", NULL, &DlMacHeader_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlMacHeader_default_coding("RAW");
const TTCN_RAWdescriptor_t PowerReduction_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for PowerReduction
const TTCN_Typedescriptor_t PowerReduction_descr_ = { "@RLCMAC_Types.PowerReduction", NULL, &PowerReduction_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING PowerReduction_default_coding("RAW");
const TTCN_RAWdescriptor_t DirectionBit_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};
// No XER for DirectionBit
const TTCN_Typedescriptor_t DirectionBit_descr_ = { "@RLCMAC_Types.DirectionBit", NULL, &DirectionBit_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DirectionBit_default_coding("RAW");
const TTCN_RAWdescriptor_t TfiOctet_pr_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for TfiOctet_pr
const TTCN_Typedescriptor_t TfiOctet_pr_descr_ = { "@RLCMAC_Types.TfiOctet.pr", NULL, &TfiOctet_pr_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TfiOctet_pr_default_coding("RAW");
const TTCN_RAWdescriptor_t TfiOctet_tfi_raw_ = {5,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       TfiOctet_tfi_xer_ = { {"tfi>\n", "tfi>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t TfiOctet_tfi_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t TfiOctet_tfi_descr_ = { "@RLCMAC_Types.TfiOctet.tfi", &INTEGER_ber_, &TfiOctet_tfi_raw_, &INTEGER_text_, &TfiOctet_tfi_xer_, &INTEGER_json_, &TfiOctet_tfi_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TfiOctet_tfi_default_coding("RAW");
const TTCN_RAWdescriptor_t TfiOctet_d_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};
// No XER for TfiOctet_d
const TTCN_Typedescriptor_t TfiOctet_d_descr_ = { "@RLCMAC_Types.TfiOctet.d", NULL, &TfiOctet_d_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TfiOctet_d_default_coding("RAW");
const TTCN_RAWdescriptor_t TfiOctet_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 TfiOctet
const TTCN_Typedescriptor_t TfiOctet_descr_ = { "@RLCMAC_Types.TfiOctet", NULL, &TfiOctet_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TfiOctet_default_coding("RAW");
const TTCN_RAWdescriptor_t RbsnExtOctet_rbsn__e_raw_ = {3,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       RbsnExtOctet_rbsn__e_xer_ = { {"rbsn_e>\n", "rbsn_e>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t RbsnExtOctet_rbsn__e_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t RbsnExtOctet_rbsn__e_descr_ = { "@RLCMAC_Types.RbsnExtOctet.rbsn_e", &INTEGER_ber_, &RbsnExtOctet_rbsn__e_raw_, &INTEGER_text_, &RbsnExtOctet_rbsn__e_xer_, &INTEGER_json_, &RbsnExtOctet_rbsn__e_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RbsnExtOctet_rbsn__e_default_coding("RAW");
const TTCN_RAWdescriptor_t RbsnExtOctet_fs__e_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       RbsnExtOctet_fs__e_xer_ = { {"fs_e>\n", "fs_e>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t RbsnExtOctet_fs__e_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t RbsnExtOctet_fs__e_descr_ = { "@RLCMAC_Types.RbsnExtOctet.fs_e", &BITSTRING_ber_, &RbsnExtOctet_fs__e_raw_, NULL, &RbsnExtOctet_fs__e_xer_, &BITSTRING_json_, &RbsnExtOctet_fs__e_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RbsnExtOctet_fs__e_default_coding("RAW");
const TTCN_RAWdescriptor_t RbsnExtOctet_spare_raw_ = {4,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,4,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       RbsnExtOctet_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t RbsnExtOctet_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t RbsnExtOctet_spare_descr_ = { "@RLCMAC_Types.RbsnExtOctet.spare", &BITSTRING_ber_, &RbsnExtOctet_spare_raw_, NULL, &RbsnExtOctet_spare_xer_, &BITSTRING_json_, &RbsnExtOctet_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RbsnExtOctet_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t RbsnExtOctet_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 RbsnExtOctet
const TTCN_Typedescriptor_t RbsnExtOctet_descr_ = { "@RLCMAC_Types.RbsnExtOctet", NULL, &RbsnExtOctet_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RbsnExtOctet_default_coding("RAW");
const TTCN_RAWdescriptor_t DlCtrlOptOctets_rbsn_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       DlCtrlOptOctets_rbsn_xer_ = { {"rbsn>\n", "rbsn>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t DlCtrlOptOctets_rbsn_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t DlCtrlOptOctets_rbsn_descr_ = { "@RLCMAC_Types.DlCtrlOptOctets.rbsn", &BITSTRING_ber_, &DlCtrlOptOctets_rbsn_raw_, NULL, &DlCtrlOptOctets_rbsn_xer_, &BITSTRING_json_, &DlCtrlOptOctets_rbsn_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlCtrlOptOctets_rbsn_default_coding("RAW");
const TTCN_RAWdescriptor_t DlCtrlOptOctets_rti_raw_ = {5,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       DlCtrlOptOctets_rti_xer_ = { {"rti>\n", "rti>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t DlCtrlOptOctets_rti_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t DlCtrlOptOctets_rti_descr_ = { "@RLCMAC_Types.DlCtrlOptOctets.rti", &INTEGER_ber_, &DlCtrlOptOctets_rti_raw_, &INTEGER_text_, &DlCtrlOptOctets_rti_xer_, &INTEGER_json_, &DlCtrlOptOctets_rti_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlCtrlOptOctets_rti_default_coding("RAW");
const TTCN_RAWdescriptor_t DlCtrlOptOctets_fs_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       DlCtrlOptOctets_fs_xer_ = { {"fs>\n", "fs>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int DlCtrlOptOctets_fs_oer_ext_arr_[0] = {};
const int DlCtrlOptOctets_fs_oer_p_[0] = {};
const TTCN_OERdescriptor_t DlCtrlOptOctets_fs_oer_ = { -1, TRUE, -1, FALSE, 0, 0, DlCtrlOptOctets_fs_oer_ext_arr_, 0, DlCtrlOptOctets_fs_oer_p_};
const TTCN_Typedescriptor_t DlCtrlOptOctets_fs_descr_ = { "@RLCMAC_Types.DlCtrlOptOctets.fs", &BOOLEAN_ber_, &DlCtrlOptOctets_fs_raw_, &BOOLEAN_text_, &DlCtrlOptOctets_fs_xer_, &BOOLEAN_json_, &DlCtrlOptOctets_fs_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlCtrlOptOctets_fs_default_coding("RAW");
const TTCN_RAWdescriptor_t DlCtrlOptOctets_tfi__octet__present_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       DlCtrlOptOctets_tfi__octet__present_xer_ = { {"tfi_octet_present>\n", "tfi_octet_present>\n"}, {19, 19}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int DlCtrlOptOctets_tfi__octet__present_oer_ext_arr_[0] = {};
const int DlCtrlOptOctets_tfi__octet__present_oer_p_[0] = {};
const TTCN_OERdescriptor_t DlCtrlOptOctets_tfi__octet__present_oer_ = { -1, TRUE, -1, FALSE, 0, 0, DlCtrlOptOctets_tfi__octet__present_oer_ext_arr_, 0, DlCtrlOptOctets_tfi__octet__present_oer_p_};
const TTCN_Typedescriptor_t DlCtrlOptOctets_tfi__octet__present_descr_ = { "@RLCMAC_Types.DlCtrlOptOctets.tfi_octet_present", &BOOLEAN_ber_, &DlCtrlOptOctets_tfi__octet__present_raw_, &BOOLEAN_text_, &DlCtrlOptOctets_tfi__octet__present_xer_, &BOOLEAN_json_, &DlCtrlOptOctets_tfi__octet__present_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlCtrlOptOctets_tfi__octet__present_default_coding("RAW");
const TTCN_RAWdescriptor_t DlCtrlOptOctets_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 DlCtrlOptOctets
const TTCN_Typedescriptor_t DlCtrlOptOctets_descr_ = { "@RLCMAC_Types.DlCtrlOptOctets", NULL, &DlCtrlOptOctets_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_RAWdescriptor_t DlCtrlOptOctets_tfi_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 DlCtrlOptOctets_tfi
const TTCN_Typedescriptor_t DlCtrlOptOctets_tfi_descr_ = { "@RLCMAC_Types.DlCtrlOptOctets.tfi", NULL, &DlCtrlOptOctets_tfi_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlCtrlOptOctets_tfi_default_coding("RAW");
const TTCN_RAWdescriptor_t DlCtrlOptOctets_rbsn__ext_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 DlCtrlOptOctets_rbsn__ext
const TTCN_Typedescriptor_t DlCtrlOptOctets_rbsn__ext_descr_ = { "@RLCMAC_Types.DlCtrlOptOctets.rbsn_ext", NULL, &DlCtrlOptOctets_rbsn__ext_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlCtrlOptOctets_rbsn__ext_default_coding("RAW");
UNIVERSAL_CHARSTRING DlCtrlOptOctets_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacDlCtrlBlock_mac__hdr_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 RlcmacDlCtrlBlock_mac__hdr
const TTCN_Typedescriptor_t RlcmacDlCtrlBlock_mac__hdr_descr_ = { "@RLCMAC_Types.RlcmacDlCtrlBlock.mac_hdr", NULL, &RlcmacDlCtrlBlock_mac__hdr_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacDlCtrlBlock_mac__hdr_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacDlCtrlBlock_payload_raw_ = {0,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};
// No XER for RlcmacDlCtrlBlock_payload
const TTCN_Typedescriptor_t RlcmacDlCtrlBlock_payload_descr_ = { "@RLCMAC_Types.RlcmacDlCtrlBlock.payload", NULL, &RlcmacDlCtrlBlock_payload_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacDlCtrlBlock_payload_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacDlCtrlBlock_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 RlcmacDlCtrlBlock
const TTCN_Typedescriptor_t RlcmacDlCtrlBlock_descr_ = { "@RLCMAC_Types.RlcmacDlCtrlBlock", NULL, &RlcmacDlCtrlBlock_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_RAWdescriptor_t RlcmacDlCtrlBlock_opt_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 RlcmacDlCtrlBlock_opt
const TTCN_Typedescriptor_t RlcmacDlCtrlBlock_opt_descr_ = { "@RLCMAC_Types.RlcmacDlCtrlBlock.opt", NULL, &RlcmacDlCtrlBlock_opt_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacDlCtrlBlock_opt_default_coding("RAW");
UNIVERSAL_CHARSTRING RlcmacDlCtrlBlock_default_coding("RAW");
const TTCN_RAWdescriptor_t UlMacCtrlHeader_payload__type_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for UlMacCtrlHeader_payload__type
const TTCN_Typedescriptor_t UlMacCtrlHeader_payload__type_descr_ = { "@RLCMAC_Types.UlMacCtrlHeader.payload_type", NULL, &UlMacCtrlHeader_payload__type_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING UlMacCtrlHeader_payload__type_default_coding("RAW");
const TTCN_RAWdescriptor_t UlMacCtrlHeader_spare_raw_ = {5,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,5,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       UlMacCtrlHeader_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t UlMacCtrlHeader_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t UlMacCtrlHeader_spare_descr_ = { "@RLCMAC_Types.UlMacCtrlHeader.spare", &BITSTRING_ber_, &UlMacCtrlHeader_spare_raw_, NULL, &UlMacCtrlHeader_spare_xer_, &BITSTRING_json_, &UlMacCtrlHeader_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING UlMacCtrlHeader_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t UlMacCtrlHeader_retry_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       UlMacCtrlHeader_retry_xer_ = { {"retry>\n", "retry>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int UlMacCtrlHeader_retry_oer_ext_arr_[0] = {};
const int UlMacCtrlHeader_retry_oer_p_[0] = {};
const TTCN_OERdescriptor_t UlMacCtrlHeader_retry_oer_ = { -1, TRUE, -1, FALSE, 0, 0, UlMacCtrlHeader_retry_oer_ext_arr_, 0, UlMacCtrlHeader_retry_oer_p_};
const TTCN_Typedescriptor_t UlMacCtrlHeader_retry_descr_ = { "@RLCMAC_Types.UlMacCtrlHeader.retry", &BOOLEAN_ber_, &UlMacCtrlHeader_retry_raw_, &BOOLEAN_text_, &UlMacCtrlHeader_retry_xer_, &BOOLEAN_json_, &UlMacCtrlHeader_retry_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING UlMacCtrlHeader_retry_default_coding("RAW");
const TTCN_RAWdescriptor_t UlMacCtrlHeader_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 UlMacCtrlHeader
const TTCN_Typedescriptor_t UlMacCtrlHeader_descr_ = { "@RLCMAC_Types.UlMacCtrlHeader", NULL, &UlMacCtrlHeader_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING UlMacCtrlHeader_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacUlCtrlBlock_mac__hdr_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 RlcmacUlCtrlBlock_mac__hdr
const TTCN_Typedescriptor_t RlcmacUlCtrlBlock_mac__hdr_descr_ = { "@RLCMAC_Types.RlcmacUlCtrlBlock.mac_hdr", NULL, &RlcmacUlCtrlBlock_mac__hdr_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacUlCtrlBlock_mac__hdr_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacUlCtrlBlock_payload_raw_ = {0,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};
// No XER for RlcmacUlCtrlBlock_payload
const TTCN_Typedescriptor_t RlcmacUlCtrlBlock_payload_descr_ = { "@RLCMAC_Types.RlcmacUlCtrlBlock.payload", NULL, &RlcmacUlCtrlBlock_payload_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacUlCtrlBlock_payload_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacUlCtrlBlock_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 RlcmacUlCtrlBlock
const TTCN_Typedescriptor_t RlcmacUlCtrlBlock_descr_ = { "@RLCMAC_Types.RlcmacUlCtrlBlock", NULL, &RlcmacUlCtrlBlock_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacUlCtrlBlock_default_coding("RAW");
const TTCN_RAWdescriptor_t LlcBlockHdr_length__ind_raw_ = {6,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       LlcBlockHdr_length__ind_xer_ = { {"length_ind>\n", "length_ind>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t LlcBlockHdr_length__ind_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t LlcBlockHdr_length__ind_descr_ = { "@RLCMAC_Types.LlcBlockHdr.length_ind", &INTEGER_ber_, &LlcBlockHdr_length__ind_raw_, &INTEGER_text_, &LlcBlockHdr_length__ind_xer_, &INTEGER_json_, &LlcBlockHdr_length__ind_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LlcBlockHdr_length__ind_default_coding("RAW");
const TTCN_RAWdescriptor_t LlcBlockHdr_more_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       LlcBlockHdr_more_xer_ = { {"more>\n", "more>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int LlcBlockHdr_more_oer_ext_arr_[0] = {};
const int LlcBlockHdr_more_oer_p_[0] = {};
const TTCN_OERdescriptor_t LlcBlockHdr_more_oer_ = { -1, TRUE, -1, FALSE, 0, 0, LlcBlockHdr_more_oer_ext_arr_, 0, LlcBlockHdr_more_oer_p_};
const TTCN_Typedescriptor_t LlcBlockHdr_more_descr_ = { "@RLCMAC_Types.LlcBlockHdr.more", &BOOLEAN_ber_, &LlcBlockHdr_more_raw_, &BOOLEAN_text_, &LlcBlockHdr_more_xer_, &BOOLEAN_json_, &LlcBlockHdr_more_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LlcBlockHdr_more_default_coding("RAW");
const TTCN_RAWdescriptor_t LlcBlockHdr_e_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       LlcBlockHdr_e_xer_ = { {"e>\n", "e>\n"}, {3, 3}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int LlcBlockHdr_e_oer_ext_arr_[0] = {};
const int LlcBlockHdr_e_oer_p_[0] = {};
const TTCN_OERdescriptor_t LlcBlockHdr_e_oer_ = { -1, TRUE, -1, FALSE, 0, 0, LlcBlockHdr_e_oer_ext_arr_, 0, LlcBlockHdr_e_oer_p_};
const TTCN_Typedescriptor_t LlcBlockHdr_e_descr_ = { "@RLCMAC_Types.LlcBlockHdr.e", &BOOLEAN_ber_, &LlcBlockHdr_e_raw_, &BOOLEAN_text_, &LlcBlockHdr_e_xer_, &BOOLEAN_json_, &LlcBlockHdr_e_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LlcBlockHdr_e_default_coding("RAW");
const TTCN_RAWdescriptor_t LlcBlockHdr_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 LlcBlockHdr
const TTCN_Typedescriptor_t LlcBlockHdr_descr_ = { "@RLCMAC_Types.LlcBlockHdr", NULL, &LlcBlockHdr_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LlcBlockHdr_default_coding("RAW");
const TTCN_RAWdescriptor_t LlcBlock_payload_raw_ = {0,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       LlcBlock_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 LlcBlock_payload_oer_ext_arr_[0] = {};
const int LlcBlock_payload_oer_p_[0] = {};
const TTCN_OERdescriptor_t LlcBlock_payload_oer_ = { -1, TRUE, -1, FALSE, 0, 0, LlcBlock_payload_oer_ext_arr_, 0, LlcBlock_payload_oer_p_};
const TTCN_Typedescriptor_t LlcBlock_payload_descr_ = { "@RLCMAC_Types.LlcBlock.payload", &OCTETSTRING_ber_, &LlcBlock_payload_raw_, &OCTETSTRING_text_, &LlcBlock_payload_xer_, &OCTETSTRING_json_, &LlcBlock_payload_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LlcBlock_payload_default_coding("RAW");
const TTCN_RAWdescriptor_t LlcBlock_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 LlcBlock
const TTCN_Typedescriptor_t LlcBlock_descr_ = { "@RLCMAC_Types.LlcBlock", NULL, &LlcBlock_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_RAWdescriptor_t LlcBlock_hdr_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 LlcBlock_hdr
const TTCN_Typedescriptor_t LlcBlock_hdr_descr_ = { "@RLCMAC_Types.LlcBlock.hdr", NULL, &LlcBlock_hdr_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LlcBlock_hdr_default_coding("RAW");
UNIVERSAL_CHARSTRING LlcBlock_default_coding("RAW");
const TTCN_RAWdescriptor_t LlcBlocks_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 LlcBlocks
const TTCN_Typedescriptor_t LlcBlocks_descr_ = { "@RLCMAC_Types.LlcBlocks", NULL, &LlcBlocks_raw_, NULL, NULL, NULL, NULL, NULL, &LlcBlocks_0_descr_, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_RAWdescriptor_t LlcBlocks_0_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 LlcBlocks_0
const TTCN_Typedescriptor_t LlcBlocks_0_descr_ = { "@RLCMAC_Types.LlcBlocks.<oftype>", NULL, &LlcBlocks_0_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING LlcBlocks_0_default_coding("RAW");
UNIVERSAL_CHARSTRING LlcBlocks_default_coding("RAW");
const TTCN_RAWdescriptor_t DlMacHdrDataExt_pr_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for DlMacHdrDataExt_pr
const TTCN_Typedescriptor_t DlMacHdrDataExt_pr_descr_ = { "@RLCMAC_Types.DlMacHdrDataExt.pr", NULL, &DlMacHdrDataExt_pr_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlMacHdrDataExt_pr_default_coding("RAW");
const TTCN_RAWdescriptor_t DlMacHdrDataExt_spare_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       DlMacHdrDataExt_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t DlMacHdrDataExt_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t DlMacHdrDataExt_spare_descr_ = { "@RLCMAC_Types.DlMacHdrDataExt.spare", &BITSTRING_ber_, &DlMacHdrDataExt_spare_raw_, NULL, &DlMacHdrDataExt_spare_xer_, &BITSTRING_json_, &DlMacHdrDataExt_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlMacHdrDataExt_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t DlMacHdrDataExt_tfi_raw_ = {4,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       DlMacHdrDataExt_tfi_xer_ = { {"tfi>\n", "tfi>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t DlMacHdrDataExt_tfi_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t DlMacHdrDataExt_tfi_descr_ = { "@RLCMAC_Types.DlMacHdrDataExt.tfi", &INTEGER_ber_, &DlMacHdrDataExt_tfi_raw_, &INTEGER_text_, &DlMacHdrDataExt_tfi_xer_, &INTEGER_json_, &DlMacHdrDataExt_tfi_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlMacHdrDataExt_tfi_default_coding("RAW");
const TTCN_RAWdescriptor_t DlMacHdrDataExt_fbi_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       DlMacHdrDataExt_fbi_xer_ = { {"fbi>\n", "fbi>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int DlMacHdrDataExt_fbi_oer_ext_arr_[0] = {};
const int DlMacHdrDataExt_fbi_oer_p_[0] = {};
const TTCN_OERdescriptor_t DlMacHdrDataExt_fbi_oer_ = { -1, TRUE, -1, FALSE, 0, 0, DlMacHdrDataExt_fbi_oer_ext_arr_, 0, DlMacHdrDataExt_fbi_oer_p_};
const TTCN_Typedescriptor_t DlMacHdrDataExt_fbi_descr_ = { "@RLCMAC_Types.DlMacHdrDataExt.fbi", &BOOLEAN_ber_, &DlMacHdrDataExt_fbi_raw_, &BOOLEAN_text_, &DlMacHdrDataExt_fbi_xer_, &BOOLEAN_json_, &DlMacHdrDataExt_fbi_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlMacHdrDataExt_fbi_default_coding("RAW");
const TTCN_RAWdescriptor_t DlMacHdrDataExt_bsn_raw_ = {7,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       DlMacHdrDataExt_bsn_xer_ = { {"bsn>\n", "bsn>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t DlMacHdrDataExt_bsn_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t DlMacHdrDataExt_bsn_descr_ = { "@RLCMAC_Types.DlMacHdrDataExt.bsn", &INTEGER_ber_, &DlMacHdrDataExt_bsn_raw_, &INTEGER_text_, &DlMacHdrDataExt_bsn_xer_, &INTEGER_json_, &DlMacHdrDataExt_bsn_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlMacHdrDataExt_bsn_default_coding("RAW");
const TTCN_RAWdescriptor_t DlMacHdrDataExt_e_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       DlMacHdrDataExt_e_xer_ = { {"e>\n", "e>\n"}, {3, 3}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int DlMacHdrDataExt_e_oer_ext_arr_[0] = {};
const int DlMacHdrDataExt_e_oer_p_[0] = {};
const TTCN_OERdescriptor_t DlMacHdrDataExt_e_oer_ = { -1, TRUE, -1, FALSE, 0, 0, DlMacHdrDataExt_e_oer_ext_arr_, 0, DlMacHdrDataExt_e_oer_p_};
const TTCN_Typedescriptor_t DlMacHdrDataExt_e_descr_ = { "@RLCMAC_Types.DlMacHdrDataExt.e", &BOOLEAN_ber_, &DlMacHdrDataExt_e_raw_, &BOOLEAN_text_, &DlMacHdrDataExt_e_xer_, &BOOLEAN_json_, &DlMacHdrDataExt_e_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlMacHdrDataExt_e_default_coding("RAW");
const TTCN_RAWdescriptor_t DlMacHdrDataExt_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 DlMacHdrDataExt
const TTCN_Typedescriptor_t DlMacHdrDataExt_descr_ = { "@RLCMAC_Types.DlMacHdrDataExt", NULL, &DlMacHdrDataExt_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlMacHdrDataExt_default_coding("RAW");
const TTCN_RAWdescriptor_t DlMacDataHeader_mac__hdr_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 DlMacDataHeader_mac__hdr
const TTCN_Typedescriptor_t DlMacDataHeader_mac__hdr_descr_ = { "@RLCMAC_Types.DlMacDataHeader.mac_hdr", NULL, &DlMacDataHeader_mac__hdr_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlMacDataHeader_mac__hdr_default_coding("RAW");
const TTCN_RAWdescriptor_t DlMacDataHeader_hdr__ext_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 DlMacDataHeader_hdr__ext
const TTCN_Typedescriptor_t DlMacDataHeader_hdr__ext_descr_ = { "@RLCMAC_Types.DlMacDataHeader.hdr_ext", NULL, &DlMacDataHeader_hdr__ext_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlMacDataHeader_hdr__ext_default_coding("RAW");
const TTCN_RAWdescriptor_t DlMacDataHeader_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 DlMacDataHeader
const TTCN_Typedescriptor_t DlMacDataHeader_descr_ = { "@RLCMAC_Types.DlMacDataHeader", NULL, &DlMacDataHeader_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DlMacDataHeader_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacDlDataBlock_cs_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 RlcmacDlDataBlock_cs
const TTCN_Typedescriptor_t RlcmacDlDataBlock_cs_descr_ = { "@RLCMAC_Types.RlcmacDlDataBlock.cs", NULL, &RlcmacDlDataBlock_cs_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacDlDataBlock_cs_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacDlDataBlock_mac__hdr_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 RlcmacDlDataBlock_mac__hdr
const TTCN_Typedescriptor_t RlcmacDlDataBlock_mac__hdr_descr_ = { "@RLCMAC_Types.RlcmacDlDataBlock.mac_hdr", NULL, &RlcmacDlDataBlock_mac__hdr_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacDlDataBlock_mac__hdr_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacDlDataBlock_blocks_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 RlcmacDlDataBlock_blocks
const TTCN_Typedescriptor_t RlcmacDlDataBlock_blocks_descr_ = { "@RLCMAC_Types.RlcmacDlDataBlock.blocks", NULL, &RlcmacDlDataBlock_blocks_raw_, NULL, NULL, NULL, NULL, NULL, &LlcBlocks_0_descr_, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacDlDataBlock_blocks_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacDlDataBlock_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 RlcmacDlDataBlock
const TTCN_Typedescriptor_t RlcmacDlDataBlock_descr_ = { "@RLCMAC_Types.RlcmacDlDataBlock", NULL, &RlcmacDlDataBlock_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacDlDataBlock_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsLlcBlockHdr_length__ind_raw_ = {7,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       EgprsLlcBlockHdr_length__ind_xer_ = { {"length_ind>\n", "length_ind>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t EgprsLlcBlockHdr_length__ind_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t EgprsLlcBlockHdr_length__ind_descr_ = { "@RLCMAC_Types.EgprsLlcBlockHdr.length_ind", &INTEGER_ber_, &EgprsLlcBlockHdr_length__ind_raw_, &INTEGER_text_, &EgprsLlcBlockHdr_length__ind_xer_, &INTEGER_json_, &EgprsLlcBlockHdr_length__ind_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsLlcBlockHdr_length__ind_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsLlcBlockHdr_e_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       EgprsLlcBlockHdr_e_xer_ = { {"e>\n", "e>\n"}, {3, 3}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int EgprsLlcBlockHdr_e_oer_ext_arr_[0] = {};
const int EgprsLlcBlockHdr_e_oer_p_[0] = {};
const TTCN_OERdescriptor_t EgprsLlcBlockHdr_e_oer_ = { -1, TRUE, -1, FALSE, 0, 0, EgprsLlcBlockHdr_e_oer_ext_arr_, 0, EgprsLlcBlockHdr_e_oer_p_};
const TTCN_Typedescriptor_t EgprsLlcBlockHdr_e_descr_ = { "@RLCMAC_Types.EgprsLlcBlockHdr.e", &BOOLEAN_ber_, &EgprsLlcBlockHdr_e_raw_, &BOOLEAN_text_, &EgprsLlcBlockHdr_e_xer_, &BOOLEAN_json_, &EgprsLlcBlockHdr_e_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsLlcBlockHdr_e_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsLlcBlockHdr_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 EgprsLlcBlockHdr
const TTCN_Typedescriptor_t EgprsLlcBlockHdr_descr_ = { "@RLCMAC_Types.EgprsLlcBlockHdr", NULL, &EgprsLlcBlockHdr_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsLlcBlockHdr_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsLlcBlock_payload_raw_ = {0,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       EgprsLlcBlock_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 EgprsLlcBlock_payload_oer_ext_arr_[0] = {};
const int EgprsLlcBlock_payload_oer_p_[0] = {};
const TTCN_OERdescriptor_t EgprsLlcBlock_payload_oer_ = { -1, TRUE, -1, FALSE, 0, 0, EgprsLlcBlock_payload_oer_ext_arr_, 0, EgprsLlcBlock_payload_oer_p_};
const TTCN_Typedescriptor_t EgprsLlcBlock_payload_descr_ = { "@RLCMAC_Types.EgprsLlcBlock.payload", &OCTETSTRING_ber_, &EgprsLlcBlock_payload_raw_, &OCTETSTRING_text_, &EgprsLlcBlock_payload_xer_, &OCTETSTRING_json_, &EgprsLlcBlock_payload_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsLlcBlock_payload_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsLlcBlock_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 EgprsLlcBlock
const TTCN_Typedescriptor_t EgprsLlcBlock_descr_ = { "@RLCMAC_Types.EgprsLlcBlock", NULL, &EgprsLlcBlock_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_RAWdescriptor_t EgprsLlcBlock_hdr_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 EgprsLlcBlock_hdr
const TTCN_Typedescriptor_t EgprsLlcBlock_hdr_descr_ = { "@RLCMAC_Types.EgprsLlcBlock.hdr", NULL, &EgprsLlcBlock_hdr_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsLlcBlock_hdr_default_coding("RAW");
UNIVERSAL_CHARSTRING EgprsLlcBlock_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsLlcBlocks_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 EgprsLlcBlocks
const TTCN_Typedescriptor_t EgprsLlcBlocks_descr_ = { "@RLCMAC_Types.EgprsLlcBlocks", NULL, &EgprsLlcBlocks_raw_, NULL, NULL, NULL, NULL, NULL, &EgprsLlcBlocks_0_descr_, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_RAWdescriptor_t EgprsLlcBlocks_0_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 EgprsLlcBlocks_0
const TTCN_Typedescriptor_t EgprsLlcBlocks_0_descr_ = { "@RLCMAC_Types.EgprsLlcBlocks.<oftype>", NULL, &EgprsLlcBlocks_0_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsLlcBlocks_0_default_coding("RAW");
UNIVERSAL_CHARSTRING EgprsLlcBlocks_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsDlMacDataHeader_header__type_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 EgprsDlMacDataHeader_header__type
const TTCN_Typedescriptor_t EgprsDlMacDataHeader_header__type_descr_ = { "@RLCMAC_Types.EgprsDlMacDataHeader.header_type", NULL, &EgprsDlMacDataHeader_header__type_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsDlMacDataHeader_header__type_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsDlMacDataHeader_tfi_raw_ = {5,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       EgprsDlMacDataHeader_tfi_xer_ = { {"tfi>\n", "tfi>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t EgprsDlMacDataHeader_tfi_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t EgprsDlMacDataHeader_tfi_descr_ = { "@RLCMAC_Types.EgprsDlMacDataHeader.tfi", &INTEGER_ber_, &EgprsDlMacDataHeader_tfi_raw_, &INTEGER_text_, &EgprsDlMacDataHeader_tfi_xer_, &INTEGER_json_, &EgprsDlMacDataHeader_tfi_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsDlMacDataHeader_tfi_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsDlMacDataHeader_rrbp_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for EgprsDlMacDataHeader_rrbp
const TTCN_Typedescriptor_t EgprsDlMacDataHeader_rrbp_descr_ = { "@RLCMAC_Types.EgprsDlMacDataHeader.rrbp", NULL, &EgprsDlMacDataHeader_rrbp_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsDlMacDataHeader_rrbp_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsDlMacDataHeader_esp_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,2,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       EgprsDlMacDataHeader_esp_xer_ = { {"esp>\n", "esp>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t EgprsDlMacDataHeader_esp_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t EgprsDlMacDataHeader_esp_descr_ = { "@RLCMAC_Types.EgprsDlMacDataHeader.esp", &BITSTRING_ber_, &EgprsDlMacDataHeader_esp_raw_, NULL, &EgprsDlMacDataHeader_esp_xer_, &BITSTRING_json_, &EgprsDlMacDataHeader_esp_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsDlMacDataHeader_esp_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsDlMacDataHeader_usf_raw_ = {3,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       EgprsDlMacDataHeader_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 EgprsDlMacDataHeader_usf_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t EgprsDlMacDataHeader_usf_descr_ = { "@RLCMAC_Types.EgprsDlMacDataHeader.usf", &INTEGER_ber_, &EgprsDlMacDataHeader_usf_raw_, &INTEGER_text_, &EgprsDlMacDataHeader_usf_xer_, &INTEGER_json_, &EgprsDlMacDataHeader_usf_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsDlMacDataHeader_usf_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsDlMacDataHeader_bsn1_raw_ = {11,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       EgprsDlMacDataHeader_bsn1_xer_ = { {"bsn1>\n", "bsn1>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t EgprsDlMacDataHeader_bsn1_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t EgprsDlMacDataHeader_bsn1_descr_ = { "@RLCMAC_Types.EgprsDlMacDataHeader.bsn1", &INTEGER_ber_, &EgprsDlMacDataHeader_bsn1_raw_, &INTEGER_text_, &EgprsDlMacDataHeader_bsn1_xer_, &INTEGER_json_, &EgprsDlMacDataHeader_bsn1_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsDlMacDataHeader_bsn1_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsDlMacDataHeader_bsn2__offset_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       EgprsDlMacDataHeader_bsn2__offset_xer_ = { {"bsn2_offset>\n", "bsn2_offset>\n"}, {13, 13}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t EgprsDlMacDataHeader_bsn2__offset_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t EgprsDlMacDataHeader_bsn2__offset_descr_ = { "@RLCMAC_Types.EgprsDlMacDataHeader.bsn2_offset", &INTEGER_ber_, &EgprsDlMacDataHeader_bsn2__offset_raw_, &INTEGER_text_, &EgprsDlMacDataHeader_bsn2__offset_xer_, &INTEGER_json_, &EgprsDlMacDataHeader_bsn2__offset_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsDlMacDataHeader_bsn2__offset_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsDlMacDataHeader_pr_raw_ = {2,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       EgprsDlMacDataHeader_pr_xer_ = { {"pr>\n", "pr>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t EgprsDlMacDataHeader_pr_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t EgprsDlMacDataHeader_pr_descr_ = { "@RLCMAC_Types.EgprsDlMacDataHeader.pr", &INTEGER_ber_, &EgprsDlMacDataHeader_pr_raw_, &INTEGER_text_, &EgprsDlMacDataHeader_pr_xer_, &INTEGER_json_, &EgprsDlMacDataHeader_pr_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsDlMacDataHeader_pr_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsDlMacDataHeader_cps_raw_ = {4,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       EgprsDlMacDataHeader_cps_xer_ = { {"cps>\n", "cps>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t EgprsDlMacDataHeader_cps_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t EgprsDlMacDataHeader_cps_descr_ = { "@RLCMAC_Types.EgprsDlMacDataHeader.cps", &INTEGER_ber_, &EgprsDlMacDataHeader_cps_raw_, &INTEGER_text_, &EgprsDlMacDataHeader_cps_xer_, &INTEGER_json_, &EgprsDlMacDataHeader_cps_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsDlMacDataHeader_cps_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsDlMacDataHeader_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 EgprsDlMacDataHeader
const TTCN_Typedescriptor_t EgprsDlMacDataHeader_descr_ = { "@RLCMAC_Types.EgprsDlMacDataHeader", NULL, &EgprsDlMacDataHeader_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_RAWdescriptor_t EgprsDlMacDataHeader_spb_raw_ = {2,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       EgprsDlMacDataHeader_spb_xer_ = { {"spb>\n", "spb>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t EgprsDlMacDataHeader_spb_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t EgprsDlMacDataHeader_spb_descr_ = { "@RLCMAC_Types.EgprsDlMacDataHeader.spb", &INTEGER_ber_, &EgprsDlMacDataHeader_spb_raw_, &INTEGER_text_, &EgprsDlMacDataHeader_spb_xer_, &INTEGER_json_, &EgprsDlMacDataHeader_spb_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsDlMacDataHeader_spb_default_coding("RAW");
UNIVERSAL_CHARSTRING EgprsDlMacDataHeader_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacDlEgprsDataBlock_mcs_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 RlcmacDlEgprsDataBlock_mcs
const TTCN_Typedescriptor_t RlcmacDlEgprsDataBlock_mcs_descr_ = { "@RLCMAC_Types.RlcmacDlEgprsDataBlock.mcs", NULL, &RlcmacDlEgprsDataBlock_mcs_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacDlEgprsDataBlock_mcs_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacDlEgprsDataBlock_mac__hdr_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 RlcmacDlEgprsDataBlock_mac__hdr
const TTCN_Typedescriptor_t RlcmacDlEgprsDataBlock_mac__hdr_descr_ = { "@RLCMAC_Types.RlcmacDlEgprsDataBlock.mac_hdr", NULL, &RlcmacDlEgprsDataBlock_mac__hdr_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacDlEgprsDataBlock_mac__hdr_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacDlEgprsDataBlock_fbi_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       RlcmacDlEgprsDataBlock_fbi_xer_ = { {"fbi>\n", "fbi>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int RlcmacDlEgprsDataBlock_fbi_oer_ext_arr_[0] = {};
const int RlcmacDlEgprsDataBlock_fbi_oer_p_[0] = {};
const TTCN_OERdescriptor_t RlcmacDlEgprsDataBlock_fbi_oer_ = { -1, TRUE, -1, FALSE, 0, 0, RlcmacDlEgprsDataBlock_fbi_oer_ext_arr_, 0, RlcmacDlEgprsDataBlock_fbi_oer_p_};
const TTCN_Typedescriptor_t RlcmacDlEgprsDataBlock_fbi_descr_ = { "@RLCMAC_Types.RlcmacDlEgprsDataBlock.fbi", &BOOLEAN_ber_, &RlcmacDlEgprsDataBlock_fbi_raw_, &BOOLEAN_text_, &RlcmacDlEgprsDataBlock_fbi_xer_, &BOOLEAN_json_, &RlcmacDlEgprsDataBlock_fbi_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacDlEgprsDataBlock_fbi_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacDlEgprsDataBlock_e_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       RlcmacDlEgprsDataBlock_e_xer_ = { {"e>\n", "e>\n"}, {3, 3}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int RlcmacDlEgprsDataBlock_e_oer_ext_arr_[0] = {};
const int RlcmacDlEgprsDataBlock_e_oer_p_[0] = {};
const TTCN_OERdescriptor_t RlcmacDlEgprsDataBlock_e_oer_ = { -1, TRUE, -1, FALSE, 0, 0, RlcmacDlEgprsDataBlock_e_oer_ext_arr_, 0, RlcmacDlEgprsDataBlock_e_oer_p_};
const TTCN_Typedescriptor_t RlcmacDlEgprsDataBlock_e_descr_ = { "@RLCMAC_Types.RlcmacDlEgprsDataBlock.e", &BOOLEAN_ber_, &RlcmacDlEgprsDataBlock_e_raw_, &BOOLEAN_text_, &RlcmacDlEgprsDataBlock_e_xer_, &BOOLEAN_json_, &RlcmacDlEgprsDataBlock_e_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacDlEgprsDataBlock_e_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacDlEgprsDataBlock_blocks_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 RlcmacDlEgprsDataBlock_blocks
const TTCN_Typedescriptor_t RlcmacDlEgprsDataBlock_blocks_descr_ = { "@RLCMAC_Types.RlcmacDlEgprsDataBlock.blocks", NULL, &RlcmacDlEgprsDataBlock_blocks_raw_, NULL, NULL, NULL, NULL, NULL, &EgprsLlcBlocks_0_descr_, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacDlEgprsDataBlock_blocks_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacDlEgprsDataBlock_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 RlcmacDlEgprsDataBlock
const TTCN_Typedescriptor_t RlcmacDlEgprsDataBlock_descr_ = { "@RLCMAC_Types.RlcmacDlEgprsDataBlock", NULL, &RlcmacDlEgprsDataBlock_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacDlEgprsDataBlock_default_coding("RAW");
const TTCN_RAWdescriptor_t UlMacDataHeader_payload__type_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for UlMacDataHeader_payload__type
const TTCN_Typedescriptor_t UlMacDataHeader_payload__type_descr_ = { "@RLCMAC_Types.UlMacDataHeader.payload_type", NULL, &UlMacDataHeader_payload__type_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING UlMacDataHeader_payload__type_default_coding("RAW");
const TTCN_RAWdescriptor_t UlMacDataHeader_countdown_raw_ = {4,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       UlMacDataHeader_countdown_xer_ = { {"countdown>\n", "countdown>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t UlMacDataHeader_countdown_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t UlMacDataHeader_countdown_descr_ = { "@RLCMAC_Types.UlMacDataHeader.countdown", &INTEGER_ber_, &UlMacDataHeader_countdown_raw_, &INTEGER_text_, &UlMacDataHeader_countdown_xer_, &INTEGER_json_, &UlMacDataHeader_countdown_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING UlMacDataHeader_countdown_default_coding("RAW");
const TTCN_RAWdescriptor_t UlMacDataHeader_stall__ind_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       UlMacDataHeader_stall__ind_xer_ = { {"stall_ind>\n", "stall_ind>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int UlMacDataHeader_stall__ind_oer_ext_arr_[0] = {};
const int UlMacDataHeader_stall__ind_oer_p_[0] = {};
const TTCN_OERdescriptor_t UlMacDataHeader_stall__ind_oer_ = { -1, TRUE, -1, FALSE, 0, 0, UlMacDataHeader_stall__ind_oer_ext_arr_, 0, UlMacDataHeader_stall__ind_oer_p_};
const TTCN_Typedescriptor_t UlMacDataHeader_stall__ind_descr_ = { "@RLCMAC_Types.UlMacDataHeader.stall_ind", &BOOLEAN_ber_, &UlMacDataHeader_stall__ind_raw_, &BOOLEAN_text_, &UlMacDataHeader_stall__ind_xer_, &BOOLEAN_json_, &UlMacDataHeader_stall__ind_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING UlMacDataHeader_stall__ind_default_coding("RAW");
const TTCN_RAWdescriptor_t UlMacDataHeader_retry_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       UlMacDataHeader_retry_xer_ = { {"retry>\n", "retry>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int UlMacDataHeader_retry_oer_ext_arr_[0] = {};
const int UlMacDataHeader_retry_oer_p_[0] = {};
const TTCN_OERdescriptor_t UlMacDataHeader_retry_oer_ = { -1, TRUE, -1, FALSE, 0, 0, UlMacDataHeader_retry_oer_ext_arr_, 0, UlMacDataHeader_retry_oer_p_};
const TTCN_Typedescriptor_t UlMacDataHeader_retry_descr_ = { "@RLCMAC_Types.UlMacDataHeader.retry", &BOOLEAN_ber_, &UlMacDataHeader_retry_raw_, &BOOLEAN_text_, &UlMacDataHeader_retry_xer_, &BOOLEAN_json_, &UlMacDataHeader_retry_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING UlMacDataHeader_retry_default_coding("RAW");
const TTCN_RAWdescriptor_t UlMacDataHeader_spare_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       UlMacDataHeader_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t UlMacDataHeader_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t UlMacDataHeader_spare_descr_ = { "@RLCMAC_Types.UlMacDataHeader.spare", &BITSTRING_ber_, &UlMacDataHeader_spare_raw_, NULL, &UlMacDataHeader_spare_xer_, &BITSTRING_json_, &UlMacDataHeader_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING UlMacDataHeader_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t UlMacDataHeader_pfi__ind_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       UlMacDataHeader_pfi__ind_xer_ = { {"pfi_ind>\n", "pfi_ind>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int UlMacDataHeader_pfi__ind_oer_ext_arr_[0] = {};
const int UlMacDataHeader_pfi__ind_oer_p_[0] = {};
const TTCN_OERdescriptor_t UlMacDataHeader_pfi__ind_oer_ = { -1, TRUE, -1, FALSE, 0, 0, UlMacDataHeader_pfi__ind_oer_ext_arr_, 0, UlMacDataHeader_pfi__ind_oer_p_};
const TTCN_Typedescriptor_t UlMacDataHeader_pfi__ind_descr_ = { "@RLCMAC_Types.UlMacDataHeader.pfi_ind", &BOOLEAN_ber_, &UlMacDataHeader_pfi__ind_raw_, &BOOLEAN_text_, &UlMacDataHeader_pfi__ind_xer_, &BOOLEAN_json_, &UlMacDataHeader_pfi__ind_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING UlMacDataHeader_pfi__ind_default_coding("RAW");
const TTCN_RAWdescriptor_t UlMacDataHeader_tfi_raw_ = {5,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       UlMacDataHeader_tfi_xer_ = { {"tfi>\n", "tfi>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t UlMacDataHeader_tfi_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t UlMacDataHeader_tfi_descr_ = { "@RLCMAC_Types.UlMacDataHeader.tfi", &INTEGER_ber_, &UlMacDataHeader_tfi_raw_, &INTEGER_text_, &UlMacDataHeader_tfi_xer_, &INTEGER_json_, &UlMacDataHeader_tfi_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING UlMacDataHeader_tfi_default_coding("RAW");
const TTCN_RAWdescriptor_t UlMacDataHeader_tlli__ind_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       UlMacDataHeader_tlli__ind_xer_ = { {"tlli_ind>\n", "tlli_ind>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int UlMacDataHeader_tlli__ind_oer_ext_arr_[0] = {};
const int UlMacDataHeader_tlli__ind_oer_p_[0] = {};
const TTCN_OERdescriptor_t UlMacDataHeader_tlli__ind_oer_ = { -1, TRUE, -1, FALSE, 0, 0, UlMacDataHeader_tlli__ind_oer_ext_arr_, 0, UlMacDataHeader_tlli__ind_oer_p_};
const TTCN_Typedescriptor_t UlMacDataHeader_tlli__ind_descr_ = { "@RLCMAC_Types.UlMacDataHeader.tlli_ind", &BOOLEAN_ber_, &UlMacDataHeader_tlli__ind_raw_, &BOOLEAN_text_, &UlMacDataHeader_tlli__ind_xer_, &BOOLEAN_json_, &UlMacDataHeader_tlli__ind_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING UlMacDataHeader_tlli__ind_default_coding("RAW");
const TTCN_RAWdescriptor_t UlMacDataHeader_bsn_raw_ = {7,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       UlMacDataHeader_bsn_xer_ = { {"bsn>\n", "bsn>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t UlMacDataHeader_bsn_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t UlMacDataHeader_bsn_descr_ = { "@RLCMAC_Types.UlMacDataHeader.bsn", &INTEGER_ber_, &UlMacDataHeader_bsn_raw_, &INTEGER_text_, &UlMacDataHeader_bsn_xer_, &INTEGER_json_, &UlMacDataHeader_bsn_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING UlMacDataHeader_bsn_default_coding("RAW");
const TTCN_RAWdescriptor_t UlMacDataHeader_e_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       UlMacDataHeader_e_xer_ = { {"e>\n", "e>\n"}, {3, 3}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int UlMacDataHeader_e_oer_ext_arr_[0] = {};
const int UlMacDataHeader_e_oer_p_[0] = {};
const TTCN_OERdescriptor_t UlMacDataHeader_e_oer_ = { -1, TRUE, -1, FALSE, 0, 0, UlMacDataHeader_e_oer_ext_arr_, 0, UlMacDataHeader_e_oer_p_};
const TTCN_Typedescriptor_t UlMacDataHeader_e_descr_ = { "@RLCMAC_Types.UlMacDataHeader.e", &BOOLEAN_ber_, &UlMacDataHeader_e_raw_, &BOOLEAN_text_, &UlMacDataHeader_e_xer_, &BOOLEAN_json_, &UlMacDataHeader_e_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING UlMacDataHeader_e_default_coding("RAW");
const TTCN_RAWdescriptor_t UlMacDataHeader_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 UlMacDataHeader
const TTCN_Typedescriptor_t UlMacDataHeader_descr_ = { "@RLCMAC_Types.UlMacDataHeader", NULL, &UlMacDataHeader_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING UlMacDataHeader_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcMacUlPfi_pfi_raw_ = {7,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       RlcMacUlPfi_pfi_xer_ = { {"pfi>\n", "pfi>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t RlcMacUlPfi_pfi_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t RlcMacUlPfi_pfi_descr_ = { "@RLCMAC_Types.RlcMacUlPfi.pfi", &INTEGER_ber_, &RlcMacUlPfi_pfi_raw_, &INTEGER_text_, &RlcMacUlPfi_pfi_xer_, &INTEGER_json_, &RlcMacUlPfi_pfi_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcMacUlPfi_pfi_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcMacUlPfi_m_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       RlcMacUlPfi_m_xer_ = { {"m>\n", "m>\n"}, {3, 3}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int RlcMacUlPfi_m_oer_ext_arr_[0] = {};
const int RlcMacUlPfi_m_oer_p_[0] = {};
const TTCN_OERdescriptor_t RlcMacUlPfi_m_oer_ = { -1, TRUE, -1, FALSE, 0, 0, RlcMacUlPfi_m_oer_ext_arr_, 0, RlcMacUlPfi_m_oer_p_};
const TTCN_Typedescriptor_t RlcMacUlPfi_m_descr_ = { "@RLCMAC_Types.RlcMacUlPfi.m", &BOOLEAN_ber_, &RlcMacUlPfi_m_raw_, &BOOLEAN_text_, &RlcMacUlPfi_m_xer_, &BOOLEAN_json_, &RlcMacUlPfi_m_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcMacUlPfi_m_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcMacUlPfi_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 RlcMacUlPfi
const TTCN_Typedescriptor_t RlcMacUlPfi_descr_ = { "@RLCMAC_Types.RlcMacUlPfi", NULL, &RlcMacUlPfi_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcMacUlPfi_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsUlMacDataHeader_header__type_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 EgprsUlMacDataHeader_header__type
const TTCN_Typedescriptor_t EgprsUlMacDataHeader_header__type_descr_ = { "@RLCMAC_Types.EgprsUlMacDataHeader.header_type", NULL, &EgprsUlMacDataHeader_header__type_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsUlMacDataHeader_header__type_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsUlMacDataHeader_tfi_raw_ = {5,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       EgprsUlMacDataHeader_tfi_xer_ = { {"tfi>\n", "tfi>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t EgprsUlMacDataHeader_tfi_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t EgprsUlMacDataHeader_tfi_descr_ = { "@RLCMAC_Types.EgprsUlMacDataHeader.tfi", &INTEGER_ber_, &EgprsUlMacDataHeader_tfi_raw_, &INTEGER_text_, &EgprsUlMacDataHeader_tfi_xer_, &INTEGER_json_, &EgprsUlMacDataHeader_tfi_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsUlMacDataHeader_tfi_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsUlMacDataHeader_countdown_raw_ = {4,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       EgprsUlMacDataHeader_countdown_xer_ = { {"countdown>\n", "countdown>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t EgprsUlMacDataHeader_countdown_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t EgprsUlMacDataHeader_countdown_descr_ = { "@RLCMAC_Types.EgprsUlMacDataHeader.countdown", &INTEGER_ber_, &EgprsUlMacDataHeader_countdown_raw_, &INTEGER_text_, &EgprsUlMacDataHeader_countdown_xer_, &INTEGER_json_, &EgprsUlMacDataHeader_countdown_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsUlMacDataHeader_countdown_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsUlMacDataHeader_foi__si_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       EgprsUlMacDataHeader_foi__si_xer_ = { {"foi_si>\n", "foi_si>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t EgprsUlMacDataHeader_foi__si_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t EgprsUlMacDataHeader_foi__si_descr_ = { "@RLCMAC_Types.EgprsUlMacDataHeader.foi_si", &BITSTRING_ber_, &EgprsUlMacDataHeader_foi__si_raw_, NULL, &EgprsUlMacDataHeader_foi__si_xer_, &BITSTRING_json_, &EgprsUlMacDataHeader_foi__si_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsUlMacDataHeader_foi__si_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsUlMacDataHeader_r__ri_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       EgprsUlMacDataHeader_r__ri_xer_ = { {"r_ri>\n", "r_ri>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t EgprsUlMacDataHeader_r__ri_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t EgprsUlMacDataHeader_r__ri_descr_ = { "@RLCMAC_Types.EgprsUlMacDataHeader.r_ri", &BITSTRING_ber_, &EgprsUlMacDataHeader_r__ri_raw_, NULL, &EgprsUlMacDataHeader_r__ri_xer_, &BITSTRING_json_, &EgprsUlMacDataHeader_r__ri_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsUlMacDataHeader_r__ri_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsUlMacDataHeader_bsn1_raw_ = {11,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       EgprsUlMacDataHeader_bsn1_xer_ = { {"bsn1>\n", "bsn1>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t EgprsUlMacDataHeader_bsn1_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t EgprsUlMacDataHeader_bsn1_descr_ = { "@RLCMAC_Types.EgprsUlMacDataHeader.bsn1", &INTEGER_ber_, &EgprsUlMacDataHeader_bsn1_raw_, &INTEGER_text_, &EgprsUlMacDataHeader_bsn1_xer_, &INTEGER_json_, &EgprsUlMacDataHeader_bsn1_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsUlMacDataHeader_bsn1_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsUlMacDataHeader_bsn2__offset_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       EgprsUlMacDataHeader_bsn2__offset_xer_ = { {"bsn2_offset>\n", "bsn2_offset>\n"}, {13, 13}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t EgprsUlMacDataHeader_bsn2__offset_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t EgprsUlMacDataHeader_bsn2__offset_descr_ = { "@RLCMAC_Types.EgprsUlMacDataHeader.bsn2_offset", &INTEGER_ber_, &EgprsUlMacDataHeader_bsn2__offset_raw_, &INTEGER_text_, &EgprsUlMacDataHeader_bsn2__offset_xer_, &INTEGER_json_, &EgprsUlMacDataHeader_bsn2__offset_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsUlMacDataHeader_bsn2__offset_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsUlMacDataHeader_cps_raw_ = {4,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       EgprsUlMacDataHeader_cps_xer_ = { {"cps>\n", "cps>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t EgprsUlMacDataHeader_cps_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t EgprsUlMacDataHeader_cps_descr_ = { "@RLCMAC_Types.EgprsUlMacDataHeader.cps", &INTEGER_ber_, &EgprsUlMacDataHeader_cps_raw_, &INTEGER_text_, &EgprsUlMacDataHeader_cps_xer_, &INTEGER_json_, &EgprsUlMacDataHeader_cps_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsUlMacDataHeader_cps_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsUlMacDataHeader_pfi__ind_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       EgprsUlMacDataHeader_pfi__ind_xer_ = { {"pfi_ind>\n", "pfi_ind>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int EgprsUlMacDataHeader_pfi__ind_oer_ext_arr_[0] = {};
const int EgprsUlMacDataHeader_pfi__ind_oer_p_[0] = {};
const TTCN_OERdescriptor_t EgprsUlMacDataHeader_pfi__ind_oer_ = { -1, TRUE, -1, FALSE, 0, 0, EgprsUlMacDataHeader_pfi__ind_oer_ext_arr_, 0, EgprsUlMacDataHeader_pfi__ind_oer_p_};
const TTCN_Typedescriptor_t EgprsUlMacDataHeader_pfi__ind_descr_ = { "@RLCMAC_Types.EgprsUlMacDataHeader.pfi_ind", &BOOLEAN_ber_, &EgprsUlMacDataHeader_pfi__ind_raw_, &BOOLEAN_text_, &EgprsUlMacDataHeader_pfi__ind_xer_, &BOOLEAN_json_, &EgprsUlMacDataHeader_pfi__ind_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsUlMacDataHeader_pfi__ind_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsUlMacDataHeader_rsb_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       EgprsUlMacDataHeader_rsb_xer_ = { {"rsb>\n", "rsb>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t EgprsUlMacDataHeader_rsb_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t EgprsUlMacDataHeader_rsb_descr_ = { "@RLCMAC_Types.EgprsUlMacDataHeader.rsb", &BITSTRING_ber_, &EgprsUlMacDataHeader_rsb_raw_, NULL, &EgprsUlMacDataHeader_rsb_xer_, &BITSTRING_json_, &EgprsUlMacDataHeader_rsb_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsUlMacDataHeader_rsb_default_coding("RAW");
const TTCN_RAWdescriptor_t EgprsUlMacDataHeader_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 EgprsUlMacDataHeader
const TTCN_Typedescriptor_t EgprsUlMacDataHeader_descr_ = { "@RLCMAC_Types.EgprsUlMacDataHeader", NULL, &EgprsUlMacDataHeader_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_RAWdescriptor_t EgprsUlMacDataHeader_spb_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,2,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       EgprsUlMacDataHeader_spb_xer_ = { {"spb>\n", "spb>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t EgprsUlMacDataHeader_spb_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t EgprsUlMacDataHeader_spb_descr_ = { "@RLCMAC_Types.EgprsUlMacDataHeader.spb", &BITSTRING_ber_, &EgprsUlMacDataHeader_spb_raw_, NULL, &EgprsUlMacDataHeader_spb_xer_, &BITSTRING_json_, &EgprsUlMacDataHeader_spb_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING EgprsUlMacDataHeader_spb_default_coding("RAW");
UNIVERSAL_CHARSTRING EgprsUlMacDataHeader_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacUlEgprsDataBlock_mcs_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 RlcmacUlEgprsDataBlock_mcs
const TTCN_Typedescriptor_t RlcmacUlEgprsDataBlock_mcs_descr_ = { "@RLCMAC_Types.RlcmacUlEgprsDataBlock.mcs", NULL, &RlcmacUlEgprsDataBlock_mcs_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacUlEgprsDataBlock_mcs_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacUlEgprsDataBlock_mac__hdr_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 RlcmacUlEgprsDataBlock_mac__hdr
const TTCN_Typedescriptor_t RlcmacUlEgprsDataBlock_mac__hdr_descr_ = { "@RLCMAC_Types.RlcmacUlEgprsDataBlock.mac_hdr", NULL, &RlcmacUlEgprsDataBlock_mac__hdr_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacUlEgprsDataBlock_mac__hdr_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacUlEgprsDataBlock_tlli__ind_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       RlcmacUlEgprsDataBlock_tlli__ind_xer_ = { {"tlli_ind>\n", "tlli_ind>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int RlcmacUlEgprsDataBlock_tlli__ind_oer_ext_arr_[0] = {};
const int RlcmacUlEgprsDataBlock_tlli__ind_oer_p_[0] = {};
const TTCN_OERdescriptor_t RlcmacUlEgprsDataBlock_tlli__ind_oer_ = { -1, TRUE, -1, FALSE, 0, 0, RlcmacUlEgprsDataBlock_tlli__ind_oer_ext_arr_, 0, RlcmacUlEgprsDataBlock_tlli__ind_oer_p_};
const TTCN_Typedescriptor_t RlcmacUlEgprsDataBlock_tlli__ind_descr_ = { "@RLCMAC_Types.RlcmacUlEgprsDataBlock.tlli_ind", &BOOLEAN_ber_, &RlcmacUlEgprsDataBlock_tlli__ind_raw_, &BOOLEAN_text_, &RlcmacUlEgprsDataBlock_tlli__ind_xer_, &BOOLEAN_json_, &RlcmacUlEgprsDataBlock_tlli__ind_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacUlEgprsDataBlock_tlli__ind_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacUlEgprsDataBlock_e_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       RlcmacUlEgprsDataBlock_e_xer_ = { {"e>\n", "e>\n"}, {3, 3}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int RlcmacUlEgprsDataBlock_e_oer_ext_arr_[0] = {};
const int RlcmacUlEgprsDataBlock_e_oer_p_[0] = {};
const TTCN_OERdescriptor_t RlcmacUlEgprsDataBlock_e_oer_ = { -1, TRUE, -1, FALSE, 0, 0, RlcmacUlEgprsDataBlock_e_oer_ext_arr_, 0, RlcmacUlEgprsDataBlock_e_oer_p_};
const TTCN_Typedescriptor_t RlcmacUlEgprsDataBlock_e_descr_ = { "@RLCMAC_Types.RlcmacUlEgprsDataBlock.e", &BOOLEAN_ber_, &RlcmacUlEgprsDataBlock_e_raw_, &BOOLEAN_text_, &RlcmacUlEgprsDataBlock_e_xer_, &BOOLEAN_json_, &RlcmacUlEgprsDataBlock_e_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacUlEgprsDataBlock_e_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacUlEgprsDataBlock_blocks_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 RlcmacUlEgprsDataBlock_blocks
const TTCN_Typedescriptor_t RlcmacUlEgprsDataBlock_blocks_descr_ = { "@RLCMAC_Types.RlcmacUlEgprsDataBlock.blocks", NULL, &RlcmacUlEgprsDataBlock_blocks_raw_, NULL, NULL, NULL, NULL, NULL, &EgprsLlcBlocks_0_descr_, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacUlEgprsDataBlock_blocks_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacUlEgprsDataBlock_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 RlcmacUlEgprsDataBlock
const TTCN_Typedescriptor_t RlcmacUlEgprsDataBlock_descr_ = { "@RLCMAC_Types.RlcmacUlEgprsDataBlock", NULL, &RlcmacUlEgprsDataBlock_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_RAWdescriptor_t RlcmacUlEgprsDataBlock_tlli_raw_ = {32,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,4,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       RlcmacUlEgprsDataBlock_tlli_xer_ = { {"tlli>\n", "tlli>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int RlcmacUlEgprsDataBlock_tlli_oer_ext_arr_[0] = {};
const int RlcmacUlEgprsDataBlock_tlli_oer_p_[0] = {};
const TTCN_OERdescriptor_t RlcmacUlEgprsDataBlock_tlli_oer_ = { -1, TRUE, 4, FALSE, 0, 0, RlcmacUlEgprsDataBlock_tlli_oer_ext_arr_, 0, RlcmacUlEgprsDataBlock_tlli_oer_p_};
const TTCN_Typedescriptor_t RlcmacUlEgprsDataBlock_tlli_descr_ = { "@RLCMAC_Types.RlcmacUlEgprsDataBlock.tlli", &OCTETSTRING_ber_, &RlcmacUlEgprsDataBlock_tlli_raw_, &OCTETSTRING_text_, &RlcmacUlEgprsDataBlock_tlli_xer_, &OCTETSTRING_json_, &RlcmacUlEgprsDataBlock_tlli_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacUlEgprsDataBlock_tlli_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacUlEgprsDataBlock_pfi_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 RlcmacUlEgprsDataBlock_pfi
const TTCN_Typedescriptor_t RlcmacUlEgprsDataBlock_pfi_descr_ = { "@RLCMAC_Types.RlcmacUlEgprsDataBlock.pfi", NULL, &RlcmacUlEgprsDataBlock_pfi_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacUlEgprsDataBlock_pfi_default_coding("RAW");
UNIVERSAL_CHARSTRING RlcmacUlEgprsDataBlock_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacUlDataBlock_cs_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 RlcmacUlDataBlock_cs
const TTCN_Typedescriptor_t RlcmacUlDataBlock_cs_descr_ = { "@RLCMAC_Types.RlcmacUlDataBlock.cs", NULL, &RlcmacUlDataBlock_cs_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacUlDataBlock_cs_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacUlDataBlock_mac__hdr_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 RlcmacUlDataBlock_mac__hdr
const TTCN_Typedescriptor_t RlcmacUlDataBlock_mac__hdr_descr_ = { "@RLCMAC_Types.RlcmacUlDataBlock.mac_hdr", NULL, &RlcmacUlDataBlock_mac__hdr_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacUlDataBlock_mac__hdr_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacUlDataBlock_blocks_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 RlcmacUlDataBlock_blocks
const TTCN_Typedescriptor_t RlcmacUlDataBlock_blocks_descr_ = { "@RLCMAC_Types.RlcmacUlDataBlock.blocks", NULL, &RlcmacUlDataBlock_blocks_raw_, NULL, NULL, NULL, NULL, NULL, &LlcBlocks_0_descr_, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacUlDataBlock_blocks_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacUlDataBlock_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 RlcmacUlDataBlock
const TTCN_Typedescriptor_t RlcmacUlDataBlock_descr_ = { "@RLCMAC_Types.RlcmacUlDataBlock", NULL, &RlcmacUlDataBlock_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_RAWdescriptor_t RlcmacUlDataBlock_tlli_raw_ = {32,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,4,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       RlcmacUlDataBlock_tlli_xer_ = { {"tlli>\n", "tlli>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int RlcmacUlDataBlock_tlli_oer_ext_arr_[0] = {};
const int RlcmacUlDataBlock_tlli_oer_p_[0] = {};
const TTCN_OERdescriptor_t RlcmacUlDataBlock_tlli_oer_ = { -1, TRUE, 4, FALSE, 0, 0, RlcmacUlDataBlock_tlli_oer_ext_arr_, 0, RlcmacUlDataBlock_tlli_oer_p_};
const TTCN_Typedescriptor_t RlcmacUlDataBlock_tlli_descr_ = { "@RLCMAC_Types.RlcmacUlDataBlock.tlli", &OCTETSTRING_ber_, &RlcmacUlDataBlock_tlli_raw_, &OCTETSTRING_text_, &RlcmacUlDataBlock_tlli_xer_, &OCTETSTRING_json_, &RlcmacUlDataBlock_tlli_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacUlDataBlock_tlli_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacUlDataBlock_pfi_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 RlcmacUlDataBlock_pfi
const TTCN_Typedescriptor_t RlcmacUlDataBlock_pfi_descr_ = { "@RLCMAC_Types.RlcmacUlDataBlock.pfi", NULL, &RlcmacUlDataBlock_pfi_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacUlDataBlock_pfi_default_coding("RAW");
UNIVERSAL_CHARSTRING RlcmacUlDataBlock_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacUlBlock_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 RlcmacUlBlock
const TTCN_Typedescriptor_t RlcmacUlBlock_descr_ = { "@RLCMAC_Types.RlcmacUlBlock", NULL, &RlcmacUlBlock_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_RAWdescriptor_t RlcmacUlBlock_data_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for RlcmacUlBlock_data
const TTCN_Typedescriptor_t RlcmacUlBlock_data_descr_ = { "@RLCMAC_Types.RlcmacUlBlock.data", NULL, &RlcmacUlBlock_data_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacUlBlock_data_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacUlBlock_data__egprs_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 RlcmacUlBlock_data__egprs
const TTCN_Typedescriptor_t RlcmacUlBlock_data__egprs_descr_ = { "@RLCMAC_Types.RlcmacUlBlock.data_egprs", NULL, &RlcmacUlBlock_data__egprs_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacUlBlock_data__egprs_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacUlBlock_ctrl_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for RlcmacUlBlock_ctrl
const TTCN_Typedescriptor_t RlcmacUlBlock_ctrl_descr_ = { "@RLCMAC_Types.RlcmacUlBlock.ctrl", NULL, &RlcmacUlBlock_ctrl_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacUlBlock_ctrl_default_coding("RAW");
UNIVERSAL_CHARSTRING RlcmacUlBlock_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacDlBlock_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 RlcmacDlBlock
const TTCN_Typedescriptor_t RlcmacDlBlock_descr_ = { "@RLCMAC_Types.RlcmacDlBlock", NULL, &RlcmacDlBlock_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_RAWdescriptor_t RlcmacDlBlock_data_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for RlcmacDlBlock_data
const TTCN_Typedescriptor_t RlcmacDlBlock_data_descr_ = { "@RLCMAC_Types.RlcmacDlBlock.data", NULL, &RlcmacDlBlock_data_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacDlBlock_data_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacDlBlock_data__egprs_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 RlcmacDlBlock_data__egprs
const TTCN_Typedescriptor_t RlcmacDlBlock_data__egprs_descr_ = { "@RLCMAC_Types.RlcmacDlBlock.data_egprs", NULL, &RlcmacDlBlock_data__egprs_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacDlBlock_data__egprs_default_coding("RAW");
const TTCN_RAWdescriptor_t RlcmacDlBlock_ctrl_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
// No XER for RlcmacDlBlock_ctrl
const TTCN_Typedescriptor_t RlcmacDlBlock_ctrl_descr_ = { "@RLCMAC_Types.RlcmacDlBlock.ctrl", NULL, &RlcmacDlBlock_ctrl_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING RlcmacDlBlock_ctrl_default_coding("RAW");
UNIVERSAL_CHARSTRING RlcmacDlBlock_default_coding("RAW");
const TTCN_RAWdescriptor_t PTCCHTimingAdvanceIE_spare_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       PTCCHTimingAdvanceIE_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t PTCCHTimingAdvanceIE_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t PTCCHTimingAdvanceIE_spare_descr_ = { "@RLCMAC_Types.PTCCHTimingAdvanceIE.spare", &BITSTRING_ber_, &PTCCHTimingAdvanceIE_spare_raw_, NULL, &PTCCHTimingAdvanceIE_spare_xer_, &BITSTRING_json_, &PTCCHTimingAdvanceIE_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING PTCCHTimingAdvanceIE_spare_default_coding("RAW");
const TTCN_RAWdescriptor_t PTCCHTimingAdvanceIE_ta__val_raw_ = {7,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       PTCCHTimingAdvanceIE_ta__val_xer_ = { {"ta_val>\n", "ta_val>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t PTCCHTimingAdvanceIE_ta__val_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t PTCCHTimingAdvanceIE_ta__val_descr_ = { "@RLCMAC_Types.PTCCHTimingAdvanceIE.ta_val", &INTEGER_ber_, &PTCCHTimingAdvanceIE_ta__val_raw_, &INTEGER_text_, &PTCCHTimingAdvanceIE_ta__val_xer_, &INTEGER_json_, &PTCCHTimingAdvanceIE_ta__val_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING PTCCHTimingAdvanceIE_ta__val_default_coding("RAW");
const TTCN_RAWdescriptor_t PTCCHTimingAdvanceIE_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 PTCCHTimingAdvanceIE
const TTCN_Typedescriptor_t PTCCHTimingAdvanceIE_descr_ = { "@RLCMAC_Types.PTCCHTimingAdvanceIE", NULL, &PTCCHTimingAdvanceIE_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING PTCCHTimingAdvanceIE_default_coding("RAW");
const TTCN_RAWdescriptor_t PTCCHTimingAdvanceIEs_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 PTCCHTimingAdvanceIEs
const TTCN_Typedescriptor_t PTCCHTimingAdvanceIEs_descr_ = { "@RLCMAC_Types.PTCCHTimingAdvanceIEs", NULL, &PTCCHTimingAdvanceIEs_raw_, NULL, NULL, NULL, NULL, NULL, &PTCCHTimingAdvanceIEs_0_descr_, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_RAWdescriptor_t PTCCHTimingAdvanceIEs_0_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 PTCCHTimingAdvanceIEs_0
const TTCN_Typedescriptor_t PTCCHTimingAdvanceIEs_0_descr_ = { "@RLCMAC_Types.PTCCHTimingAdvanceIEs.<oftype>", NULL, &PTCCHTimingAdvanceIEs_0_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING PTCCHTimingAdvanceIEs_0_default_coding("RAW");
UNIVERSAL_CHARSTRING PTCCHTimingAdvanceIEs_default_coding("RAW");
const TTCN_RAWdescriptor_t PTCCHDownlinkMsg_ta__idx_raw_ = {16,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 PTCCHDownlinkMsg_ta__idx
const TTCN_Typedescriptor_t PTCCHDownlinkMsg_ta__idx_descr_ = { "@RLCMAC_Types.PTCCHDownlinkMsg.ta_idx", NULL, &PTCCHDownlinkMsg_ta__idx_raw_, NULL, NULL, NULL, NULL, NULL, &PTCCHTimingAdvanceIEs_0_descr_, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING PTCCHDownlinkMsg_ta__idx_default_coding("RAW");
const TTCN_RAWdescriptor_t PTCCHDownlinkMsg_padding_raw_ = {56,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false};
const XERdescriptor_t       PTCCHDownlinkMsg_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 PTCCHDownlinkMsg_padding_oer_ext_arr_[0] = {};
const int PTCCHDownlinkMsg_padding_oer_p_[0] = {};
const TTCN_OERdescriptor_t PTCCHDownlinkMsg_padding_oer_ = { -1, TRUE, 7, FALSE, 0, 0, PTCCHDownlinkMsg_padding_oer_ext_arr_, 0, PTCCHDownlinkMsg_padding_oer_p_};
const TTCN_Typedescriptor_t PTCCHDownlinkMsg_padding_descr_ = { "@RLCMAC_Types.PTCCHDownlinkMsg.padding", &OCTETSTRING_ber_, &PTCCHDownlinkMsg_padding_raw_, &OCTETSTRING_text_, &PTCCHDownlinkMsg_padding_xer_, &OCTETSTRING_json_, &PTCCHDownlinkMsg_padding_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING PTCCHDownlinkMsg_padding_default_coding("RAW");
const TTCN_RAWdescriptor_t PTCCHDownlinkMsg_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 PTCCHDownlinkMsg
const TTCN_Typedescriptor_t PTCCHDownlinkMsg_descr_ = { "@RLCMAC_Types.PTCCHDownlinkMsg", NULL, &PTCCHDownlinkMsg_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING PTCCHDownlinkMsg_default_coding("RAW");
TTCN_Module module_object("RLCMAC_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 */

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

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

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

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

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

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

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

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

boolean MacPayloadType::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 @RLCMAC_Types.MacPayloadType.");
return enum_value == other_value;
}

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

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

boolean MacPayloadType::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 @RLCMAC_Types.MacPayloadType.");
return enum_value < other_value;
}

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

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

boolean MacPayloadType::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 @RLCMAC_Types.MacPayloadType.");
return enum_value > other_value;
}

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

const char *MacPayloadType::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case MAC__PT__RLC__DATA: return "MAC_PT_RLC_DATA";
case MAC__PT__RLCMAC__NO__OPT: return "MAC_PT_RLCMAC_NO_OPT";
case MAC__PT__RLCMAC__OPT: return "MAC_PT_RLCMAC_OPT";
case MAC__PT__RESERVED: return "MAC_PT_RESERVED";
default:
return "<unknown>";
}
}

MacPayloadType::enum_type MacPayloadType::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, "MAC_PT_RLC_DATA")) return MAC__PT__RLC__DATA;
if (!strcmp(str_par, "MAC_PT_RLCMAC_NO_OPT")) return MAC__PT__RLCMAC__NO__OPT;
if (!strcmp(str_par, "MAC_PT_RLCMAC_OPT")) return MAC__PT__RLCMAC__OPT;
if (!strcmp(str_par, "MAC_PT_RESERVED")) return MAC__PT__RESERVED;
}
return UNKNOWN_VALUE;
}

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

int MacPayloadType::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 @RLCMAC_Types.MacPayloadType.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int MacPayloadType::enum2int(const MacPayloadType& 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 @RLCMAC_Types.MacPayloadType.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

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

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

void MacPayloadType::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 MacPayloadType::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", "@RLCMAC_Types.MacPayloadType");
  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 @RLCMAC_Types.MacPayloadType.");
  }
}

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

void MacPayloadType::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 @RLCMAC_Types.MacPayloadType.", enum_value);
}

void MacPayloadType::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 MacPayloadType::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 MacPayloadType::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 MacPayloadType::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 MacPayloadType_template::copy_template(const MacPayloadType_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 MacPayloadType_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 MacPayloadType_template(*other_value.implication_.precondition);
implication_.implied_template = new MacPayloadType_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 @RLCMAC_Types.MacPayloadType.");
}
}

MacPayloadType_template::MacPayloadType_template()
{
}

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

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

MacPayloadType_template::MacPayloadType_template(MacPayloadType::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

MacPayloadType_template& MacPayloadType_template::operator=(const OPTIONAL<MacPayloadType>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (MacPayloadType::enum_type)(const MacPayloadType&)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 @RLCMAC_Types.MacPayloadType.");
}
return *this;
}

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

boolean MacPayloadType_template::match(MacPayloadType::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 @RLCMAC_Types.MacPayloadType.");
}
return FALSE;
}

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

MacPayloadType::enum_type MacPayloadType_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 @RLCMAC_Types.MacPayloadType.");
return single_value;
}

void MacPayloadType_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 MacPayloadType_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @RLCMAC_Types.MacPayloadType.");
}
}

MacPayloadType_template& MacPayloadType_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 @RLCMAC_Types.MacPayloadType.");
if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @RLCMAC_Types.MacPayloadType.");
return value_list.list_value[list_index];
}

void MacPayloadType_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(MacPayloadType::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 MacPayloadType_template::log_match(const MacPayloadType& 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 MacPayloadType_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 @RLCMAC_Types.MacPayloadType.");
}
}

void MacPayloadType_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (MacPayloadType::enum_type)text_buf.pull_int().get_val();
if (!MacPayloadType::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @RLCMAC_Types.MacPayloadType.", 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 MacPayloadType_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 @RLCMAC_Types.MacPayloadType.");
}
}

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

boolean MacPayloadType_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 MacPayloadType_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: {
    MacPayloadType_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: {
    MacPayloadType::enum_type enum_val = MacPayloadType::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!MacPayloadType::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @RLCMAC_Types.MacPayloadType.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    MacPayloadType_template* precondition = new MacPayloadType_template;
    precondition->set_param(*m_p->get_elem(0));
    MacPayloadType_template* implied_template = new MacPayloadType_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = MacPayloadType_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@RLCMAC_Types.MacPayloadType");
  }
  is_ifpresent = param.get_ifpresent();
}

void MacPayloadType_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 : "@RLCMAC_Types.MacPayloadType");
}

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

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

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

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

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

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

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

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

boolean MacRrbp::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 @RLCMAC_Types.MacRrbp.");
return enum_value == other_value;
}

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

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

boolean MacRrbp::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 @RLCMAC_Types.MacRrbp.");
return enum_value < other_value;
}

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

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

boolean MacRrbp::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 @RLCMAC_Types.MacRrbp.");
return enum_value > other_value;
}

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

const char *MacRrbp::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case RRBP__Nplus13__mod__2715648: return "RRBP_Nplus13_mod_2715648";
case RRBP__Nplus17__or__18__mod__2715648: return "RRBP_Nplus17_or_18_mod_2715648";
case RRBP__Nplus21__or__22__mod__2715648: return "RRBP_Nplus21_or_22_mod_2715648";
case RRBP__Nplus26__mod__2715648: return "RRBP_Nplus26_mod_2715648";
default:
return "<unknown>";
}
}

MacRrbp::enum_type MacRrbp::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, "RRBP_Nplus13_mod_2715648")) return RRBP__Nplus13__mod__2715648;
if (!strcmp(str_par, "RRBP_Nplus17_or_18_mod_2715648")) return RRBP__Nplus17__or__18__mod__2715648;
if (!strcmp(str_par, "RRBP_Nplus21_or_22_mod_2715648")) return RRBP__Nplus21__or__22__mod__2715648;
if (!strcmp(str_par, "RRBP_Nplus26_mod_2715648")) return RRBP__Nplus26__mod__2715648;
}
return UNKNOWN_VALUE;
}

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

int MacRrbp::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 @RLCMAC_Types.MacRrbp.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int MacRrbp::enum2int(const MacRrbp& 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 @RLCMAC_Types.MacRrbp.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

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

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

void MacRrbp::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 MacRrbp::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", "@RLCMAC_Types.MacRrbp");
  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 @RLCMAC_Types.MacRrbp.");
  }
}

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

void MacRrbp::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 @RLCMAC_Types.MacRrbp.", enum_value);
}

void MacRrbp::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 MacRrbp::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 MacRrbp::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 MacRrbp::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 MacRrbp_template::copy_template(const MacRrbp_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 MacRrbp_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 MacRrbp_template(*other_value.implication_.precondition);
implication_.implied_template = new MacRrbp_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 @RLCMAC_Types.MacRrbp.");
}
}

MacRrbp_template::MacRrbp_template()
{
}

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

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

MacRrbp_template::MacRrbp_template(MacRrbp::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

MacRrbp_template& MacRrbp_template::operator=(const OPTIONAL<MacRrbp>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (MacRrbp::enum_type)(const MacRrbp&)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 @RLCMAC_Types.MacRrbp.");
}
return *this;
}

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

boolean MacRrbp_template::match(MacRrbp::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 @RLCMAC_Types.MacRrbp.");
}
return FALSE;
}

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

MacRrbp::enum_type MacRrbp_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 @RLCMAC_Types.MacRrbp.");
return single_value;
}

void MacRrbp_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 MacRrbp_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @RLCMAC_Types.MacRrbp.");
}
}

MacRrbp_template& MacRrbp_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 @RLCMAC_Types.MacRrbp.");
if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @RLCMAC_Types.MacRrbp.");
return value_list.list_value[list_index];
}

void MacRrbp_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(MacRrbp::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 MacRrbp_template::log_match(const MacRrbp& 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 MacRrbp_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 @RLCMAC_Types.MacRrbp.");
}
}

void MacRrbp_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (MacRrbp::enum_type)text_buf.pull_int().get_val();
if (!MacRrbp::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @RLCMAC_Types.MacRrbp.", 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 MacRrbp_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 @RLCMAC_Types.MacRrbp.");
}
}

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

boolean MacRrbp_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 MacRrbp_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: {
    MacRrbp_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: {
    MacRrbp::enum_type enum_val = MacRrbp::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!MacRrbp::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @RLCMAC_Types.MacRrbp.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    MacRrbp_template* precondition = new MacRrbp_template;
    precondition->set_param(*m_p->get_elem(0));
    MacRrbp_template* implied_template = new MacRrbp_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = MacRrbp_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@RLCMAC_Types.MacRrbp");
  }
  is_ifpresent = param.get_ifpresent();
}

void MacRrbp_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 : "@RLCMAC_Types.MacRrbp");
}

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

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

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

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

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

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

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

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

boolean EgprsHeaderType::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 @RLCMAC_Types.EgprsHeaderType.");
return enum_value == other_value;
}

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

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

boolean EgprsHeaderType::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 @RLCMAC_Types.EgprsHeaderType.");
return enum_value < other_value;
}

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

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

boolean EgprsHeaderType::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 @RLCMAC_Types.EgprsHeaderType.");
return enum_value > other_value;
}

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

const char *EgprsHeaderType::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case RLCMAC__HDR__TYPE__1: return "RLCMAC_HDR_TYPE_1";
case RLCMAC__HDR__TYPE__2: return "RLCMAC_HDR_TYPE_2";
case RLCMAC__HDR__TYPE__3: return "RLCMAC_HDR_TYPE_3";
default:
return "<unknown>";
}
}

EgprsHeaderType::enum_type EgprsHeaderType::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, "RLCMAC_HDR_TYPE_1")) return RLCMAC__HDR__TYPE__1;
if (!strcmp(str_par, "RLCMAC_HDR_TYPE_2")) return RLCMAC__HDR__TYPE__2;
if (!strcmp(str_par, "RLCMAC_HDR_TYPE_3")) return RLCMAC__HDR__TYPE__3;
}
return UNKNOWN_VALUE;
}

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

int EgprsHeaderType::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 @RLCMAC_Types.EgprsHeaderType.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int EgprsHeaderType::enum2int(const EgprsHeaderType& 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 @RLCMAC_Types.EgprsHeaderType.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

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

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

void EgprsHeaderType::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 EgprsHeaderType::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", "@RLCMAC_Types.EgprsHeaderType");
  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 @RLCMAC_Types.EgprsHeaderType.");
  }
}

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

void EgprsHeaderType::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 @RLCMAC_Types.EgprsHeaderType.", enum_value);
}

void EgprsHeaderType::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 EgprsHeaderType::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 EgprsHeaderType::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 EgprsHeaderType::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 EgprsHeaderType_template::copy_template(const EgprsHeaderType_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 EgprsHeaderType_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 EgprsHeaderType_template(*other_value.implication_.precondition);
implication_.implied_template = new EgprsHeaderType_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 @RLCMAC_Types.EgprsHeaderType.");
}
}

EgprsHeaderType_template::EgprsHeaderType_template()
{
}

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

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

EgprsHeaderType_template::EgprsHeaderType_template(EgprsHeaderType::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

EgprsHeaderType_template& EgprsHeaderType_template::operator=(const OPTIONAL<EgprsHeaderType>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (EgprsHeaderType::enum_type)(const EgprsHeaderType&)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 @RLCMAC_Types.EgprsHeaderType.");
}
return *this;
}

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

boolean EgprsHeaderType_template::match(EgprsHeaderType::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 @RLCMAC_Types.EgprsHeaderType.");
}
return FALSE;
}

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

EgprsHeaderType::enum_type EgprsHeaderType_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 @RLCMAC_Types.EgprsHeaderType.");
return single_value;
}

void EgprsHeaderType_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 EgprsHeaderType_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @RLCMAC_Types.EgprsHeaderType.");
}
}

EgprsHeaderType_template& EgprsHeaderType_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 @RLCMAC_Types.EgprsHeaderType.");
if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @RLCMAC_Types.EgprsHeaderType.");
return value_list.list_value[list_index];
}

void EgprsHeaderType_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(EgprsHeaderType::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 EgprsHeaderType_template::log_match(const EgprsHeaderType& 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 EgprsHeaderType_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 @RLCMAC_Types.EgprsHeaderType.");
}
}

void EgprsHeaderType_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (EgprsHeaderType::enum_type)text_buf.pull_int().get_val();
if (!EgprsHeaderType::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @RLCMAC_Types.EgprsHeaderType.", 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 EgprsHeaderType_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 @RLCMAC_Types.EgprsHeaderType.");
}
}

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

boolean EgprsHeaderType_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 EgprsHeaderType_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: {
    EgprsHeaderType_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: {
    EgprsHeaderType::enum_type enum_val = EgprsHeaderType::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!EgprsHeaderType::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @RLCMAC_Types.EgprsHeaderType.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    EgprsHeaderType_template* precondition = new EgprsHeaderType_template;
    precondition->set_param(*m_p->get_elem(0));
    EgprsHeaderType_template* implied_template = new EgprsHeaderType_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = EgprsHeaderType_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@RLCMAC_Types.EgprsHeaderType");
  }
  is_ifpresent = param.get_ifpresent();
}

void EgprsHeaderType_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 : "@RLCMAC_Types.EgprsHeaderType");
}

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

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

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

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

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

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

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

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

boolean CodingScheme::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 @RLCMAC_Types.CodingScheme.");
return enum_value == other_value;
}

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

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

boolean CodingScheme::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 @RLCMAC_Types.CodingScheme.");
return enum_value < other_value;
}

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

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

boolean CodingScheme::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 @RLCMAC_Types.CodingScheme.");
return enum_value > other_value;
}

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

const char *CodingScheme::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case CS__1: return "CS_1";
case CS__2: return "CS_2";
case CS__3: return "CS_3";
case CS__4: return "CS_4";
case MCS__0: return "MCS_0";
case MCS__1: return "MCS_1";
case MCS__2: return "MCS_2";
case MCS__3: return "MCS_3";
case MCS__4: return "MCS_4";
case MCS__5: return "MCS_5";
case MCS__6: return "MCS_6";
case MCS__7: return "MCS_7";
case MCS__8: return "MCS_8";
case MCS__9: return "MCS_9";
default:
return "<unknown>";
}
}

CodingScheme::enum_type CodingScheme::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, "CS_1")) return CS__1;
if (!strcmp(str_par, "CS_2")) return CS__2;
if (!strcmp(str_par, "CS_3")) return CS__3;
if (!strcmp(str_par, "CS_4")) return CS__4;
if (!strcmp(str_par, "MCS_0")) return MCS__0;
if (!strcmp(str_par, "MCS_1")) return MCS__1;
if (!strcmp(str_par, "MCS_2")) return MCS__2;
if (!strcmp(str_par, "MCS_3")) return MCS__3;
if (!strcmp(str_par, "MCS_4")) return MCS__4;
if (!strcmp(str_par, "MCS_5")) return MCS__5;
if (!strcmp(str_par, "MCS_6")) return MCS__6;
if (!strcmp(str_par, "MCS_7")) return MCS__7;
if (!strcmp(str_par, "MCS_8")) return MCS__8;
if (!strcmp(str_par, "MCS_9")) return MCS__9;
}
return UNKNOWN_VALUE;
}

boolean CodingScheme::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:
return TRUE;
default:
return FALSE;
}
}

int CodingScheme::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 @RLCMAC_Types.CodingScheme.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int CodingScheme::enum2int(const CodingScheme& 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 @RLCMAC_Types.CodingScheme.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

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

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

void CodingScheme::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 CodingScheme::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", "@RLCMAC_Types.CodingScheme");
  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 @RLCMAC_Types.CodingScheme.");
  }
}

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

void CodingScheme::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 @RLCMAC_Types.CodingScheme.", enum_value);
}

void CodingScheme::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 CodingScheme::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 CodingScheme::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 CodingScheme::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 CodingScheme_template::copy_template(const CodingScheme_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 CodingScheme_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 CodingScheme_template(*other_value.implication_.precondition);
implication_.implied_template = new CodingScheme_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 @RLCMAC_Types.CodingScheme.");
}
}

CodingScheme_template::CodingScheme_template()
{
}

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

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

CodingScheme_template::CodingScheme_template(CodingScheme::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

CodingScheme_template& CodingScheme_template::operator=(const OPTIONAL<CodingScheme>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (CodingScheme::enum_type)(const CodingScheme&)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 @RLCMAC_Types.CodingScheme.");
}
return *this;
}

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

boolean CodingScheme_template::match(CodingScheme::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 @RLCMAC_Types.CodingScheme.");
}
return FALSE;
}

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

CodingScheme::enum_type CodingScheme_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 @RLCMAC_Types.CodingScheme.");
return single_value;
}

void CodingScheme_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 CodingScheme_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @RLCMAC_Types.CodingScheme.");
}
}

CodingScheme_template& CodingScheme_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 @RLCMAC_Types.CodingScheme.");
if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @RLCMAC_Types.CodingScheme.");
return value_list.list_value[list_index];
}

void CodingScheme_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(CodingScheme::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 CodingScheme_template::log_match(const CodingScheme& 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 CodingScheme_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 @RLCMAC_Types.CodingScheme.");
}
}

void CodingScheme_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (CodingScheme::enum_type)text_buf.pull_int().get_val();
if (!CodingScheme::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @RLCMAC_Types.CodingScheme.", 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 CodingScheme_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 @RLCMAC_Types.CodingScheme.");
}
}

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

boolean CodingScheme_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 CodingScheme_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: {
    CodingScheme_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: {
    CodingScheme::enum_type enum_val = CodingScheme::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!CodingScheme::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @RLCMAC_Types.CodingScheme.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    CodingScheme_template* precondition = new CodingScheme_template;
    precondition->set_param(*m_p->get_elem(0));
    CodingScheme_template* implied_template = new CodingScheme_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = CodingScheme_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@RLCMAC_Types.CodingScheme");
  }
  is_ifpresent = param.get_ifpresent();
}

void CodingScheme_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 : "@RLCMAC_Types.CodingScheme");
}


const CodingScheme CodingSchemeArray::UNBOUND_ELEM;
CodingSchemeArray::CodingSchemeArray()
{
val_ptr = NULL;
}

CodingSchemeArray::CodingSchemeArray(null_type)
{
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
}

CodingSchemeArray::CodingSchemeArray(const CodingSchemeArray& other_value)
{
if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.CodingSchemeArray.");
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}

CodingSchemeArray::~CodingSchemeArray()
{
clean_up();
if (val_ptr != NULL) val_ptr = NULL;
}

void CodingSchemeArray::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.");
}
}

CodingSchemeArray& CodingSchemeArray::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;
}

CodingSchemeArray& CodingSchemeArray::operator=(const CodingSchemeArray& other_value)
{
if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @RLCMAC_Types.CodingSchemeArray.");
if (this != &other_value) {
clean_up();
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}
return *this;
}

boolean CodingSchemeArray::operator==(null_type) const
{
if (val_ptr == NULL)
TTCN_error("The left operand of comparison is an unbound value of type @RLCMAC_Types.CodingSchemeArray.");
return val_ptr->n_elements == 0 ;
}

boolean CodingSchemeArray::operator==(const CodingSchemeArray& other_value) const
{
if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @RLCMAC_Types.CodingSchemeArray.");
if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @RLCMAC_Types.CodingSchemeArray.");
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;
}

CodingScheme& CodingSchemeArray::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of type @RLCMAC_Types.CodingSchemeArray 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 = (CodingScheme**)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 CodingScheme(*(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 CodingScheme;
}
return *val_ptr->value_elements[index_value];
}

CodingScheme& CodingSchemeArray::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @RLCMAC_Types.CodingSchemeArray.");
return (*this)[(int)index_value];
}

const CodingScheme& CodingSchemeArray::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @RLCMAC_Types.CodingSchemeArray.");
if (index_value < 0) TTCN_error("Accessing an element of type @RLCMAC_Types.CodingSchemeArray using a negative index: %d.", index_value);
if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @RLCMAC_Types.CodingSchemeArray: 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 CodingScheme& CodingSchemeArray::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @RLCMAC_Types.CodingSchemeArray.");
return (*this)[(int)index_value];
}

CodingSchemeArray CodingSchemeArray::operator<<=(int rotate_count) const
{
return *this >>= (-rotate_count);
}

CodingSchemeArray CodingSchemeArray::operator<<=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate left operator.");
return *this >>= (int)(-rotate_count);
}

CodingSchemeArray CodingSchemeArray::operator>>=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate right operator.");
return *this >>= (int)rotate_count;
}

CodingSchemeArray CodingSchemeArray::operator>>=(int rotate_count) const
{
if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @RLCMAC_Types.CodingSchemeArray.");
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;
CodingSchemeArray 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 CodingScheme(*val_ptr->value_elements[i]);
}
}
return ret_val;
}

CodingSchemeArray CodingSchemeArray::operator+(const CodingSchemeArray& other_value) const
{
if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @RLCMAC_Types.CodingSchemeArray concatenation.");
if (val_ptr->n_elements == 0) return other_value;
if (other_value.val_ptr->n_elements == 0) return *this;
CodingSchemeArray 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 CodingScheme(*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 CodingScheme(*other_value.val_ptr->value_elements[i]);
}
}
return ret_val;
}

CodingSchemeArray CodingSchemeArray::substr(int index, int returncount) const
{
if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @RLCMAC_Types.CodingSchemeArray.");
check_substr_arguments(val_ptr->n_elements, index, returncount, "@RLCMAC_Types.CodingSchemeArray","element");
CodingSchemeArray 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 CodingScheme(*val_ptr->value_elements[i+index]);
}
}
return ret_val;
}

CodingSchemeArray CodingSchemeArray::replace(int index, int len, const CodingSchemeArray& repl) const
{
if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @RLCMAC_Types.CodingSchemeArray.");
if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @RLCMAC_Types.CodingSchemeArray.");
check_replace_arguments(val_ptr->n_elements, index, len, "@RLCMAC_Types.CodingSchemeArray","element");
CodingSchemeArray 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 CodingScheme(*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 CodingScheme(*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 CodingScheme(*val_ptr->value_elements[index+i+len]);
}
}
return ret_val;
}

CodingSchemeArray CodingSchemeArray::replace(int index, int len, const CodingSchemeArray_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 CodingSchemeArray::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @RLCMAC_Types.CodingSchemeArray.");
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 = (CodingScheme**)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 CodingScheme(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (CodingScheme**)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 @RLCMAC_Types.CodingSchemeArray: %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 = (CodingScheme**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}

boolean CodingSchemeArray::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 CodingSchemeArray::size_of() const
{
if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @RLCMAC_Types.CodingSchemeArray.");
return val_ptr->n_elements;
}

int CodingSchemeArray::lengthof() const
{
if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @RLCMAC_Types.CodingSchemeArray.");
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 CodingSchemeArray::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 CodingSchemeArray::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 CodingSchemeArray::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", "@RLCMAC_Types.CodingSchemeArray");
    }
    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", "@RLCMAC_Types.CodingSchemeArray");
    }
    break;
  default:
    TTCN_error("Internal error: Unknown operation type.");
  }
}

void CodingSchemeArray::encode_text(Text_Buf& text_buf) const
{
if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @RLCMAC_Types.CodingSchemeArray.");
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 CodingSchemeArray::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 @RLCMAC_Types.CodingSchemeArray.");
val_ptr->value_elements = (CodingScheme**)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 CodingScheme;
val_ptr->value_elements[elem_count]->decode_text(text_buf);
}
}

void CodingSchemeArray::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 CodingSchemeArray::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 CodingSchemeArray::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 CodingSchemeArray::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 CodingSchemeArray_template::copy_value(const CodingSchemeArray& other_value)
{
if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @RLCMAC_Types.CodingSchemeArray with an unbound value.");
single_value.n_elements = other_value.size_of();
single_value.value_elements = (CodingScheme_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 CodingScheme_template(other_value[elem_count]);
} else {
single_value.value_elements[elem_count] = new CodingScheme_template;
}
}
set_selection(SPECIFIC_VALUE);
}

void CodingSchemeArray_template::copy_template(const CodingSchemeArray_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 = (CodingScheme_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 CodingScheme_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new CodingScheme_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 CodingSchemeArray_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 CodingSchemeArray_template(*other_value.implication_.precondition);
implication_.implied_template = new CodingSchemeArray_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 @RLCMAC_Types.CodingSchemeArray.");
break;
}
set_selection(other_value);
}

boolean CodingSchemeArray_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 CodingSchemeArray_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const CodingSchemeArray*)value_ptr)[value_index], legacy);
else return ((const CodingSchemeArray_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit();
}

CodingSchemeArray_template::CodingSchemeArray_template()
{
}

CodingSchemeArray_template::CodingSchemeArray_template(template_sel other_value)
 : Base_Record_Of_Template(other_value)
{
check_single_selection(other_value);
}

CodingSchemeArray_template::CodingSchemeArray_template(null_type)
 : Base_Record_Of_Template(SPECIFIC_VALUE)
{
single_value.n_elements = 0;
single_value.value_elements = NULL;
}

CodingSchemeArray_template::CodingSchemeArray_template(const CodingSchemeArray& other_value)
{
copy_value(other_value);
}

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

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

CodingSchemeArray_template::CodingSchemeArray_template(Dynamic_Match_Interface<CodingSchemeArray>* p_dyn_match)
 : Base_Record_Of_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<CodingSchemeArray>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

CodingSchemeArray_template::CodingSchemeArray_template(const CodingSchemeArray_template& other_value)
 : Base_Record_Of_Template()
{
copy_template(other_value);
}

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

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

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

CodingSchemeArray_template& CodingSchemeArray_template::operator=(null_type)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value.n_elements = 0;
single_value.value_elements = NULL;
return *this;
}

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

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

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

CodingScheme_template& CodingSchemeArray_template::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @RLCMAC_Types.CodingSchemeArray 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 @RLCMAC_Types.CodingSchemeArray.");
    break;
}
return *single_value.value_elements[index_value];
}

CodingScheme_template& CodingSchemeArray_template::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @RLCMAC_Types.CodingSchemeArray.");
return (*this)[(int)index_value];
}

const CodingScheme_template& CodingSchemeArray_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @RLCMAC_Types.CodingSchemeArray using a negative index: %d.", index_value);
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @RLCMAC_Types.CodingSchemeArray.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @RLCMAC_Types.CodingSchemeArray: 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 CodingScheme_template& CodingSchemeArray_template::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @RLCMAC_Types.CodingSchemeArray.");
return (*this)[(int)index_value];
}

void CodingSchemeArray_template::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @RLCMAC_Types.CodingSchemeArray.");
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 = (CodingScheme_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 CodingScheme_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 CodingScheme_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 = (CodingScheme_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}

int CodingSchemeArray_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 CodingSchemeArray_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 @RLCMAC_Types.CodingSchemeArray 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 @RLCMAC_Types.CodingSchemeArray 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 @RLCMAC_Types.CodingSchemeArray 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 @RLCMAC_Types.CodingSchemeArray 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 @RLCMAC_Types.CodingSchemeArray 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 @RLCMAC_Types.CodingSchemeArray containing complemented list.", op_name);
default:
  TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @RLCMAC_Types.CodingSchemeArray.", op_name);
}
return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @RLCMAC_Types.CodingSchemeArray");
}

boolean CodingSchemeArray_template::match(const CodingSchemeArray& 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 @RLCMAC_Types.CodingSchemeArray.");
}
return FALSE;
}

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

CodingSchemeArray CodingSchemeArray_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 @RLCMAC_Types.CodingSchemeArray.");
CodingSchemeArray 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;
}

CodingSchemeArray CodingSchemeArray_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);
}

CodingSchemeArray CodingSchemeArray_template::replace(int index, int len, const CodingSchemeArray_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());
}

CodingSchemeArray CodingSchemeArray_template::replace(int index, int len, const CodingSchemeArray& 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 CodingSchemeArray_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 CodingSchemeArray_template[list_length];
break;
default:
TTCN_error("Internal error: Setting an invalid type for a template of type @RLCMAC_Types.CodingSchemeArray.");
}
set_selection(template_type);
}

CodingSchemeArray_template& CodingSchemeArray_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 @RLCMAC_Types.CodingSchemeArray.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @RLCMAC_Types.CodingSchemeArray.");
return value_list.list_value[list_index];
}

void CodingSchemeArray_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 CodingSchemeArray_template::log_match(const CodingSchemeArray& 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 CodingSchemeArray_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 @RLCMAC_Types.CodingSchemeArray.");
}
}

void CodingSchemeArray_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 @RLCMAC_Types.CodingSchemeArray.");
single_value.value_elements = (CodingScheme_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 CodingScheme_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 CodingSchemeArray_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 @RLCMAC_Types.CodingSchemeArray.");
}
}

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

boolean CodingSchemeArray_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 CodingSchemeArray_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 CodingSchemeArray_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: {
    CodingSchemeArray_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: {
    CodingSchemeArray_template* precondition = new CodingSchemeArray_template;
    precondition->set_param(*param.get_elem(0));
    CodingSchemeArray_template* implied_template = new CodingSchemeArray_template;
    implied_template->set_param(*param.get_elem(1));
    *this = CodingSchemeArray_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record of template", "@RLCMAC_Types.CodingSchemeArray");
  }
  is_ifpresent = param.get_ifpresent();
  set_length_range(param);
}

void CodingSchemeArray_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 : "@RLCMAC_Types.CodingSchemeArray");
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 : "@RLCMAC_Types.CodingSchemeArray");
}

boolean CodingSchemeArray_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);
}
}
DlMacHeader::DlMacHeader()
{
}

DlMacHeader::DlMacHeader(const MacPayloadType& par_payload__type,
    const MacRrbp& par_rrbp,
    const BOOLEAN& par_rrbp__valid,
    const INTEGER& par_usf)
  :   field_payload__type(par_payload__type),
  field_rrbp(par_rrbp),
  field_rrbp__valid(par_rrbp__valid),
  field_usf(par_usf)
{
}

DlMacHeader::DlMacHeader(const DlMacHeader& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.DlMacHeader.");
if (other_value.payload__type().is_bound()) field_payload__type = other_value.payload__type();
else field_payload__type.clean_up();
if (other_value.rrbp().is_bound()) field_rrbp = other_value.rrbp();
else field_rrbp.clean_up();
if (other_value.rrbp__valid().is_bound()) field_rrbp__valid = other_value.rrbp__valid();
else field_rrbp__valid.clean_up();
if (other_value.usf().is_bound()) field_usf = other_value.usf();
else field_usf.clean_up();
}

void DlMacHeader::clean_up()
{
field_payload__type.clean_up();
field_rrbp.clean_up();
field_rrbp__valid.clean_up();
field_usf.clean_up();
}

const TTCN_Typedescriptor_t* DlMacHeader::get_descriptor() const { return &DlMacHeader_descr_; }
DlMacHeader& DlMacHeader::operator=(const DlMacHeader& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.DlMacHeader.");
  if (other_value.payload__type().is_bound()) field_payload__type = other_value.payload__type();
  else field_payload__type.clean_up();
  if (other_value.rrbp().is_bound()) field_rrbp = other_value.rrbp();
  else field_rrbp.clean_up();
  if (other_value.rrbp__valid().is_bound()) field_rrbp__valid = other_value.rrbp__valid();
  else field_rrbp__valid.clean_up();
  if (other_value.usf().is_bound()) field_usf = other_value.usf();
  else field_usf.clean_up();
}
return *this;
}

boolean DlMacHeader::operator==(const DlMacHeader& other_value) const
{
return field_payload__type==other_value.field_payload__type
  && field_rrbp==other_value.field_rrbp
  && field_rrbp__valid==other_value.field_rrbp__valid
  && field_usf==other_value.field_usf;
}

boolean DlMacHeader::is_bound() const
{
return (field_payload__type.is_bound())
  || (field_rrbp.is_bound())
  || (field_rrbp__valid.is_bound())
  || (field_usf.is_bound());
}
boolean DlMacHeader::is_value() const
{
return field_payload__type.is_value()
  && field_rrbp.is_value()
  && field_rrbp__valid.is_value()
  && field_usf.is_value();
}
void DlMacHeader::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ payload_type := ");
field_payload__type.log();
TTCN_Logger::log_event_str(", rrbp := ");
field_rrbp.log();
TTCN_Logger::log_event_str(", rrbp_valid := ");
field_rrbp__valid.log();
TTCN_Logger::log_event_str(", usf := ");
field_usf.log();
TTCN_Logger::log_event_str(" }");
}

void DlMacHeader::set_implicit_omit()
{
if (payload__type().is_bound()) payload__type().set_implicit_omit();
if (rrbp().is_bound()) rrbp().set_implicit_omit();
if (rrbp__valid().is_bound()) rrbp__valid().set_implicit_omit();
if (usf().is_bound()) usf().set_implicit_omit();
}

void DlMacHeader::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 @RLCMAC_Types.DlMacHeader 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) payload__type().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) rrbp().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rrbp__valid().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) usf().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(), "payload_type")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          payload__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(), "rrbp")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rrbp().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rrbp_valid")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rrbp__valid().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @RLCMAC_Types.DlMacHeader: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.DlMacHeader");
  }
}

void DlMacHeader::encode_text(Text_Buf& text_buf) const
{
field_payload__type.encode_text(text_buf);
field_rrbp.encode_text(text_buf);
field_rrbp__valid.encode_text(text_buf);
field_usf.encode_text(text_buf);
}

void DlMacHeader::decode_text(Text_Buf& text_buf)
{
field_payload__type.decode_text(text_buf);
field_rrbp.decode_text(text_buf);
field_rrbp__valid.decode_text(text_buf);
field_usf.decode_text(text_buf);
}

void DlMacHeader::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 DlMacHeader::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 DlMacHeader::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, DlMacHeader_payload__type_descr_.raw->forceomit);
  decoded_field_length = field_payload__type.RAW_decode(DlMacHeader_payload__type_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, DlMacHeader_rrbp_descr_.raw->forceomit);
  decoded_field_length = field_rrbp.RAW_decode(DlMacHeader_rrbp_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, DlMacHeader_rrbp__valid_descr_.raw->forceomit);
  decoded_field_length = field_rrbp__valid.RAW_decode(DlMacHeader_rrbp__valid_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, DlMacHeader_usf_descr_.raw->forceomit);
  decoded_field_length = field_usf.RAW_decode(DlMacHeader_usf_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 DlMacHeader::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, DlMacHeader_payload__type_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, DlMacHeader_rrbp_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, DlMacHeader_rrbp__valid_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, DlMacHeader_usf_descr_.raw);
  encoded_length += field_payload__type.RAW_encode(DlMacHeader_payload__type_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_rrbp.RAW_encode(DlMacHeader_rrbp_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_rrbp__valid.RAW_encode(DlMacHeader_rrbp__valid_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_usf.RAW_encode(DlMacHeader_usf_descr_, *myleaf.body.node.nodes[3]);
  return myleaf.length = encoded_length;
}

struct DlMacHeader_template::single_value_struct {
MacPayloadType_template field_payload__type;
MacRrbp_template field_rrbp;
BOOLEAN_template field_rrbp__valid;
INTEGER_template field_usf;
};

void DlMacHeader_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__type = ANY_VALUE;
single_value->field_rrbp = ANY_VALUE;
single_value->field_rrbp__valid = ANY_VALUE;
single_value->field_usf = ANY_VALUE;
}
}
}

void DlMacHeader_template::copy_value(const DlMacHeader& other_value)
{
single_value = new single_value_struct;
if (other_value.payload__type().is_bound()) {
  single_value->field_payload__type = other_value.payload__type();
} else {
  single_value->field_payload__type.clean_up();
}
if (other_value.rrbp().is_bound()) {
  single_value->field_rrbp = other_value.rrbp();
} else {
  single_value->field_rrbp.clean_up();
}
if (other_value.rrbp__valid().is_bound()) {
  single_value->field_rrbp__valid = other_value.rrbp__valid();
} else {
  single_value->field_rrbp__valid.clean_up();
}
if (other_value.usf().is_bound()) {
  single_value->field_usf = other_value.usf();
} else {
  single_value->field_usf.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void DlMacHeader_template::copy_template(const DlMacHeader_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.payload__type().get_selection()) {
single_value->field_payload__type = other_value.payload__type();
} else {
single_value->field_payload__type.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rrbp().get_selection()) {
single_value->field_rrbp = other_value.rrbp();
} else {
single_value->field_rrbp.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rrbp__valid().get_selection()) {
single_value->field_rrbp__valid = other_value.rrbp__valid();
} else {
single_value->field_rrbp__valid.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.usf().get_selection()) {
single_value->field_usf = other_value.usf();
} else {
single_value->field_usf.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 DlMacHeader_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 DlMacHeader_template(*other_value.implication_.precondition);
implication_.implied_template = new DlMacHeader_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 @RLCMAC_Types.DlMacHeader.");
break;
}
set_selection(other_value);
}

DlMacHeader_template::DlMacHeader_template()
{
}

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

DlMacHeader_template::DlMacHeader_template(const DlMacHeader& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean DlMacHeader_template::match(const DlMacHeader& 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__type().is_bound()) return FALSE;
if(!single_value->field_payload__type.match(other_value.payload__type(), legacy))return FALSE;
if(!other_value.rrbp().is_bound()) return FALSE;
if(!single_value->field_rrbp.match(other_value.rrbp(), legacy))return FALSE;
if(!other_value.rrbp__valid().is_bound()) return FALSE;
if(!single_value->field_rrbp__valid.match(other_value.rrbp__valid(), legacy))return FALSE;
if(!other_value.usf().is_bound()) return FALSE;
if(!single_value->field_usf.match(other_value.usf(), 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 @RLCMAC_Types.DlMacHeader.");
}
return FALSE;
}

boolean DlMacHeader_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__type.is_bound()
 || single_value->field_rrbp.is_bound()
 || single_value->field_rrbp__valid.is_bound()
 || single_value->field_usf.is_bound();
}

boolean DlMacHeader_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_payload__type.is_value()
 && single_value->field_rrbp.is_value()
 && single_value->field_rrbp__valid.is_value()
 && single_value->field_usf.is_value();
}

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

DlMacHeader DlMacHeader_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 @RLCMAC_Types.DlMacHeader.");
DlMacHeader ret_val;
if (single_value->field_payload__type.is_bound()) {
ret_val.payload__type() = single_value->field_payload__type.valueof();
}
if (single_value->field_rrbp.is_bound()) {
ret_val.rrbp() = single_value->field_rrbp.valueof();
}
if (single_value->field_rrbp__valid.is_bound()) {
ret_val.rrbp__valid() = single_value->field_rrbp__valid.valueof();
}
if (single_value->field_usf.is_bound()) {
ret_val.usf() = single_value->field_usf.valueof();
}
return ret_val;
}

void DlMacHeader_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 @RLCMAC_Types.DlMacHeader.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new DlMacHeader_template[list_length];
}

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

MacPayloadType_template& DlMacHeader_template::payload__type()
{
set_specific();
return single_value->field_payload__type;
}

const MacPayloadType_template& DlMacHeader_template::payload__type() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field payload_type of a non-specific template of type @RLCMAC_Types.DlMacHeader.");
return single_value->field_payload__type;
}

MacRrbp_template& DlMacHeader_template::rrbp()
{
set_specific();
return single_value->field_rrbp;
}

const MacRrbp_template& DlMacHeader_template::rrbp() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rrbp of a non-specific template of type @RLCMAC_Types.DlMacHeader.");
return single_value->field_rrbp;
}

BOOLEAN_template& DlMacHeader_template::rrbp__valid()
{
set_specific();
return single_value->field_rrbp__valid;
}

const BOOLEAN_template& DlMacHeader_template::rrbp__valid() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rrbp_valid of a non-specific template of type @RLCMAC_Types.DlMacHeader.");
return single_value->field_rrbp__valid;
}

INTEGER_template& DlMacHeader_template::usf()
{
set_specific();
return single_value->field_usf;
}

const INTEGER_template& DlMacHeader_template::usf() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field usf of a non-specific template of type @RLCMAC_Types.DlMacHeader.");
return single_value->field_usf;
}

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

void DlMacHeader_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ payload_type := ");
single_value->field_payload__type.log();
TTCN_Logger::log_event_str(", rrbp := ");
single_value->field_rrbp.log();
TTCN_Logger::log_event_str(", rrbp_valid := ");
single_value->field_rrbp__valid.log();
TTCN_Logger::log_event_str(", usf := ");
single_value->field_usf.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 DlMacHeader_template::log_match(const DlMacHeader& 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__type.match(match_value.payload__type(), legacy)){
TTCN_Logger::log_logmatch_info(".payload_type");
single_value->field_payload__type.log_match(match_value.payload__type(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rrbp.match(match_value.rrbp(), legacy)){
TTCN_Logger::log_logmatch_info(".rrbp");
single_value->field_rrbp.log_match(match_value.rrbp(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rrbp__valid.match(match_value.rrbp__valid(), legacy)){
TTCN_Logger::log_logmatch_info(".rrbp_valid");
single_value->field_rrbp__valid.log_match(match_value.rrbp__valid(), 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);
}
}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_type := ");
single_value->field_payload__type.log_match(match_value.payload__type(), legacy);
TTCN_Logger::log_event_str(", rrbp := ");
single_value->field_rrbp.log_match(match_value.rrbp(), legacy);
TTCN_Logger::log_event_str(", rrbp_valid := ");
single_value->field_rrbp__valid.log_match(match_value.rrbp__valid(), legacy);
TTCN_Logger::log_event_str(", usf := ");
single_value->field_usf.log_match(match_value.usf(), 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 DlMacHeader_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (payload__type().is_bound()) payload__type().set_implicit_omit();
if (rrbp().is_bound()) rrbp().set_implicit_omit();
if (rrbp__valid().is_bound()) rrbp__valid().set_implicit_omit();
if (usf().is_bound()) usf().set_implicit_omit();
}

void DlMacHeader_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_payload__type.encode_text(text_buf);
single_value->field_rrbp.encode_text(text_buf);
single_value->field_rrbp__valid.encode_text(text_buf);
single_value->field_usf.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 @RLCMAC_Types.DlMacHeader.");
}
}

void DlMacHeader_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__type.decode_text(text_buf);
single_value->field_rrbp.decode_text(text_buf);
single_value->field_rrbp__valid.decode_text(text_buf);
single_value->field_usf.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 DlMacHeader_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 @RLCMAC_Types.DlMacHeader.");
}
}

void DlMacHeader_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: {
    DlMacHeader_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 @RLCMAC_Types.DlMacHeader 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) payload__type().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) rrbp().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rrbp__valid().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) usf().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(), "payload_type")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          payload__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(), "rrbp")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rrbp().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rrbp_valid")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rrbp__valid().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @RLCMAC_Types.DlMacHeader: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    DlMacHeader_template* precondition = new DlMacHeader_template;
    precondition->set_param(*param.get_elem(0));
    DlMacHeader_template* implied_template = new DlMacHeader_template;
    implied_template->set_param(*param.get_elem(1));
    *this = DlMacHeader_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.DlMacHeader");
  }
  is_ifpresent = param.get_ifpresent();
}

void DlMacHeader_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__type.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.DlMacHeader");
single_value->field_rrbp.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.DlMacHeader");
single_value->field_rrbp__valid.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.DlMacHeader");
single_value->field_usf.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.DlMacHeader");
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 : "@RLCMAC_Types.DlMacHeader");
}

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

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

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

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

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

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

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

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

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

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

boolean PowerReduction::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 @RLCMAC_Types.PowerReduction.");
return enum_value == other_value;
}

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

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

boolean PowerReduction::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 @RLCMAC_Types.PowerReduction.");
return enum_value < other_value;
}

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

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

boolean PowerReduction::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 @RLCMAC_Types.PowerReduction.");
return enum_value > other_value;
}

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

const char *PowerReduction::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case PWR__RED__0__to__3dB: return "PWR_RED_0_to_3dB";
case PWR__RED__3__to__7dB: return "PWR_RED_3_to_7dB";
case PWR__RED__7__to__10dB: return "PWR_RED_7_to_10dB";
case PWR__RED__RESERVED: return "PWR_RED_RESERVED";
default:
return "<unknown>";
}
}

PowerReduction::enum_type PowerReduction::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, "PWR_RED_0_to_3dB")) return PWR__RED__0__to__3dB;
if (!strcmp(str_par, "PWR_RED_3_to_7dB")) return PWR__RED__3__to__7dB;
if (!strcmp(str_par, "PWR_RED_7_to_10dB")) return PWR__RED__7__to__10dB;
if (!strcmp(str_par, "PWR_RED_RESERVED")) return PWR__RED__RESERVED;
}
return UNKNOWN_VALUE;
}

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

int PowerReduction::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 @RLCMAC_Types.PowerReduction.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int PowerReduction::enum2int(const PowerReduction& 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 @RLCMAC_Types.PowerReduction.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

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

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

void PowerReduction::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 PowerReduction::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", "@RLCMAC_Types.PowerReduction");
  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 @RLCMAC_Types.PowerReduction.");
  }
}

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

void PowerReduction::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 @RLCMAC_Types.PowerReduction.", enum_value);
}

void PowerReduction::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 PowerReduction::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 PowerReduction::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 PowerReduction::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 PowerReduction_template::copy_template(const PowerReduction_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 PowerReduction_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 PowerReduction_template(*other_value.implication_.precondition);
implication_.implied_template = new PowerReduction_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 @RLCMAC_Types.PowerReduction.");
}
}

PowerReduction_template::PowerReduction_template()
{
}

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

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

PowerReduction_template::PowerReduction_template(PowerReduction::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

PowerReduction_template& PowerReduction_template::operator=(const OPTIONAL<PowerReduction>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (PowerReduction::enum_type)(const PowerReduction&)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 @RLCMAC_Types.PowerReduction.");
}
return *this;
}

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

boolean PowerReduction_template::match(PowerReduction::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 @RLCMAC_Types.PowerReduction.");
}
return FALSE;
}

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

PowerReduction::enum_type PowerReduction_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 @RLCMAC_Types.PowerReduction.");
return single_value;
}

void PowerReduction_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 PowerReduction_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @RLCMAC_Types.PowerReduction.");
}
}

PowerReduction_template& PowerReduction_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 @RLCMAC_Types.PowerReduction.");
if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @RLCMAC_Types.PowerReduction.");
return value_list.list_value[list_index];
}

void PowerReduction_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(PowerReduction::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 PowerReduction_template::log_match(const PowerReduction& 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 PowerReduction_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 @RLCMAC_Types.PowerReduction.");
}
}

void PowerReduction_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (PowerReduction::enum_type)text_buf.pull_int().get_val();
if (!PowerReduction::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @RLCMAC_Types.PowerReduction.", 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 PowerReduction_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 @RLCMAC_Types.PowerReduction.");
}
}

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

boolean PowerReduction_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 PowerReduction_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: {
    PowerReduction_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: {
    PowerReduction::enum_type enum_val = PowerReduction::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!PowerReduction::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @RLCMAC_Types.PowerReduction.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    PowerReduction_template* precondition = new PowerReduction_template;
    precondition->set_param(*m_p->get_elem(0));
    PowerReduction_template* implied_template = new PowerReduction_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = PowerReduction_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@RLCMAC_Types.PowerReduction");
  }
  is_ifpresent = param.get_ifpresent();
}

void PowerReduction_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 : "@RLCMAC_Types.PowerReduction");
}

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

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

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

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

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

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

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

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

boolean DirectionBit::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 @RLCMAC_Types.DirectionBit.");
return enum_value == other_value;
}

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

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

boolean DirectionBit::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 @RLCMAC_Types.DirectionBit.");
return enum_value < other_value;
}

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

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

boolean DirectionBit::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 @RLCMAC_Types.DirectionBit.");
return enum_value > other_value;
}

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

const char *DirectionBit::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case DIR__UPLINK__TBF: return "DIR_UPLINK_TBF";
case DIR__DOWNLINK__TBF: return "DIR_DOWNLINK_TBF";
default:
return "<unknown>";
}
}

DirectionBit::enum_type DirectionBit::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, "DIR_UPLINK_TBF")) return DIR__UPLINK__TBF;
if (!strcmp(str_par, "DIR_DOWNLINK_TBF")) return DIR__DOWNLINK__TBF;
}
return UNKNOWN_VALUE;
}

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

int DirectionBit::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 @RLCMAC_Types.DirectionBit.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int DirectionBit::enum2int(const DirectionBit& 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 @RLCMAC_Types.DirectionBit.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

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

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

void DirectionBit::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 DirectionBit::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", "@RLCMAC_Types.DirectionBit");
  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 @RLCMAC_Types.DirectionBit.");
  }
}

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

void DirectionBit::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 @RLCMAC_Types.DirectionBit.", enum_value);
}

void DirectionBit::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 DirectionBit::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 DirectionBit::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 DirectionBit::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 DirectionBit_template::copy_template(const DirectionBit_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 DirectionBit_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 DirectionBit_template(*other_value.implication_.precondition);
implication_.implied_template = new DirectionBit_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 @RLCMAC_Types.DirectionBit.");
}
}

DirectionBit_template::DirectionBit_template()
{
}

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

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

DirectionBit_template::DirectionBit_template(DirectionBit::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

DirectionBit_template& DirectionBit_template::operator=(const OPTIONAL<DirectionBit>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (DirectionBit::enum_type)(const DirectionBit&)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 @RLCMAC_Types.DirectionBit.");
}
return *this;
}

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

boolean DirectionBit_template::match(DirectionBit::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 @RLCMAC_Types.DirectionBit.");
}
return FALSE;
}

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

DirectionBit::enum_type DirectionBit_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 @RLCMAC_Types.DirectionBit.");
return single_value;
}

void DirectionBit_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 DirectionBit_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @RLCMAC_Types.DirectionBit.");
}
}

DirectionBit_template& DirectionBit_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 @RLCMAC_Types.DirectionBit.");
if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @RLCMAC_Types.DirectionBit.");
return value_list.list_value[list_index];
}

void DirectionBit_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(DirectionBit::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 DirectionBit_template::log_match(const DirectionBit& 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 DirectionBit_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 @RLCMAC_Types.DirectionBit.");
}
}

void DirectionBit_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (DirectionBit::enum_type)text_buf.pull_int().get_val();
if (!DirectionBit::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @RLCMAC_Types.DirectionBit.", 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 DirectionBit_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 @RLCMAC_Types.DirectionBit.");
}
}

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

boolean DirectionBit_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 DirectionBit_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: {
    DirectionBit_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: {
    DirectionBit::enum_type enum_val = DirectionBit::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!DirectionBit::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @RLCMAC_Types.DirectionBit.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    DirectionBit_template* precondition = new DirectionBit_template;
    precondition->set_param(*m_p->get_elem(0));
    DirectionBit_template* implied_template = new DirectionBit_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = DirectionBit_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@RLCMAC_Types.DirectionBit");
  }
  is_ifpresent = param.get_ifpresent();
}

void DirectionBit_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 : "@RLCMAC_Types.DirectionBit");
}

TfiOctet::TfiOctet()
{
}

TfiOctet::TfiOctet(const PowerReduction& par_pr,
    const INTEGER& par_tfi,
    const DirectionBit& par_d)
  :   field_pr(par_pr),
  field_tfi(par_tfi),
  field_d(par_d)
{
}

TfiOctet::TfiOctet(const TfiOctet& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.TfiOctet.");
if (other_value.pr().is_bound()) field_pr = other_value.pr();
else field_pr.clean_up();
if (other_value.tfi().is_bound()) field_tfi = other_value.tfi();
else field_tfi.clean_up();
if (other_value.d().is_bound()) field_d = other_value.d();
else field_d.clean_up();
}

void TfiOctet::clean_up()
{
field_pr.clean_up();
field_tfi.clean_up();
field_d.clean_up();
}

const TTCN_Typedescriptor_t* TfiOctet::get_descriptor() const { return &TfiOctet_descr_; }
TfiOctet& TfiOctet::operator=(const TfiOctet& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.TfiOctet.");
  if (other_value.pr().is_bound()) field_pr = other_value.pr();
  else field_pr.clean_up();
  if (other_value.tfi().is_bound()) field_tfi = other_value.tfi();
  else field_tfi.clean_up();
  if (other_value.d().is_bound()) field_d = other_value.d();
  else field_d.clean_up();
}
return *this;
}

boolean TfiOctet::operator==(const TfiOctet& other_value) const
{
return field_pr==other_value.field_pr
  && field_tfi==other_value.field_tfi
  && field_d==other_value.field_d;
}

boolean TfiOctet::is_bound() const
{
return (field_pr.is_bound())
  || (field_tfi.is_bound())
  || (field_d.is_bound());
}
boolean TfiOctet::is_value() const
{
return field_pr.is_value()
  && field_tfi.is_value()
  && field_d.is_value();
}
void TfiOctet::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ pr := ");
field_pr.log();
TTCN_Logger::log_event_str(", tfi := ");
field_tfi.log();
TTCN_Logger::log_event_str(", d := ");
field_d.log();
TTCN_Logger::log_event_str(" }");
}

void TfiOctet::set_implicit_omit()
{
if (pr().is_bound()) pr().set_implicit_omit();
if (tfi().is_bound()) tfi().set_implicit_omit();
if (d().is_bound()) d().set_implicit_omit();
}

void TfiOctet::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 @RLCMAC_Types.TfiOctet 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) pr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tfi().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) d().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(), "pr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pr().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          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(), "d")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          d().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 @RLCMAC_Types.TfiOctet: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.TfiOctet");
  }
}

void TfiOctet::encode_text(Text_Buf& text_buf) const
{
field_pr.encode_text(text_buf);
field_tfi.encode_text(text_buf);
field_d.encode_text(text_buf);
}

void TfiOctet::decode_text(Text_Buf& text_buf)
{
field_pr.decode_text(text_buf);
field_tfi.decode_text(text_buf);
field_d.decode_text(text_buf);
}

void TfiOctet::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 TfiOctet::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 TfiOctet::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, TfiOctet_pr_descr_.raw->forceomit);
  decoded_field_length = field_pr.RAW_decode(TfiOctet_pr_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, TfiOctet_tfi_descr_.raw->forceomit);
  decoded_field_length = field_tfi.RAW_decode(TfiOctet_tfi_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, TfiOctet_d_descr_.raw->forceomit);
  decoded_field_length = field_d.RAW_decode(TfiOctet_d_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 TfiOctet::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, TfiOctet_pr_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, TfiOctet_tfi_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, TfiOctet_d_descr_.raw);
  encoded_length += field_pr.RAW_encode(TfiOctet_pr_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_tfi.RAW_encode(TfiOctet_tfi_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_d.RAW_encode(TfiOctet_d_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct TfiOctet_template::single_value_struct {
PowerReduction_template field_pr;
INTEGER_template field_tfi;
DirectionBit_template field_d;
};

void TfiOctet_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_pr = ANY_VALUE;
single_value->field_tfi = ANY_VALUE;
single_value->field_d = ANY_VALUE;
}
}
}

void TfiOctet_template::copy_value(const TfiOctet& other_value)
{
single_value = new single_value_struct;
if (other_value.pr().is_bound()) {
  single_value->field_pr = other_value.pr();
} else {
  single_value->field_pr.clean_up();
}
if (other_value.tfi().is_bound()) {
  single_value->field_tfi = other_value.tfi();
} else {
  single_value->field_tfi.clean_up();
}
if (other_value.d().is_bound()) {
  single_value->field_d = other_value.d();
} else {
  single_value->field_d.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void TfiOctet_template::copy_template(const TfiOctet_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.pr().get_selection()) {
single_value->field_pr = other_value.pr();
} else {
single_value->field_pr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tfi().get_selection()) {
single_value->field_tfi = other_value.tfi();
} else {
single_value->field_tfi.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.d().get_selection()) {
single_value->field_d = other_value.d();
} else {
single_value->field_d.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 TfiOctet_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 TfiOctet_template(*other_value.implication_.precondition);
implication_.implied_template = new TfiOctet_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 @RLCMAC_Types.TfiOctet.");
break;
}
set_selection(other_value);
}

TfiOctet_template::TfiOctet_template()
{
}

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

TfiOctet_template::TfiOctet_template(const TfiOctet& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean TfiOctet_template::match(const TfiOctet& 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.pr().is_bound()) return FALSE;
if(!single_value->field_pr.match(other_value.pr(), legacy))return FALSE;
if(!other_value.tfi().is_bound()) return FALSE;
if(!single_value->field_tfi.match(other_value.tfi(), legacy))return FALSE;
if(!other_value.d().is_bound()) return FALSE;
if(!single_value->field_d.match(other_value.d(), 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 @RLCMAC_Types.TfiOctet.");
}
return FALSE;
}

boolean TfiOctet_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_pr.is_bound()
 || single_value->field_tfi.is_bound()
 || single_value->field_d.is_bound();
}

boolean TfiOctet_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_pr.is_value()
 && single_value->field_tfi.is_value()
 && single_value->field_d.is_value();
}

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

TfiOctet TfiOctet_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 @RLCMAC_Types.TfiOctet.");
TfiOctet ret_val;
if (single_value->field_pr.is_bound()) {
ret_val.pr() = single_value->field_pr.valueof();
}
if (single_value->field_tfi.is_bound()) {
ret_val.tfi() = single_value->field_tfi.valueof();
}
if (single_value->field_d.is_bound()) {
ret_val.d() = single_value->field_d.valueof();
}
return ret_val;
}

void TfiOctet_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 @RLCMAC_Types.TfiOctet.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new TfiOctet_template[list_length];
}

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

PowerReduction_template& TfiOctet_template::pr()
{
set_specific();
return single_value->field_pr;
}

const PowerReduction_template& TfiOctet_template::pr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pr of a non-specific template of type @RLCMAC_Types.TfiOctet.");
return single_value->field_pr;
}

INTEGER_template& TfiOctet_template::tfi()
{
set_specific();
return single_value->field_tfi;
}

const INTEGER_template& TfiOctet_template::tfi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tfi of a non-specific template of type @RLCMAC_Types.TfiOctet.");
return single_value->field_tfi;
}

DirectionBit_template& TfiOctet_template::d()
{
set_specific();
return single_value->field_d;
}

const DirectionBit_template& TfiOctet_template::d() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field d of a non-specific template of type @RLCMAC_Types.TfiOctet.");
return single_value->field_d;
}

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

void TfiOctet_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ pr := ");
single_value->field_pr.log();
TTCN_Logger::log_event_str(", tfi := ");
single_value->field_tfi.log();
TTCN_Logger::log_event_str(", d := ");
single_value->field_d.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 TfiOctet_template::log_match(const TfiOctet& 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_pr.match(match_value.pr(), legacy)){
TTCN_Logger::log_logmatch_info(".pr");
single_value->field_pr.log_match(match_value.pr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tfi.match(match_value.tfi(), legacy)){
TTCN_Logger::log_logmatch_info(".tfi");
single_value->field_tfi.log_match(match_value.tfi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_d.match(match_value.d(), legacy)){
TTCN_Logger::log_logmatch_info(".d");
single_value->field_d.log_match(match_value.d(), 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("{ pr := ");
single_value->field_pr.log_match(match_value.pr(), legacy);
TTCN_Logger::log_event_str(", tfi := ");
single_value->field_tfi.log_match(match_value.tfi(), legacy);
TTCN_Logger::log_event_str(", d := ");
single_value->field_d.log_match(match_value.d(), 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 TfiOctet_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (pr().is_bound()) pr().set_implicit_omit();
if (tfi().is_bound()) tfi().set_implicit_omit();
if (d().is_bound()) d().set_implicit_omit();
}

void TfiOctet_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_pr.encode_text(text_buf);
single_value->field_tfi.encode_text(text_buf);
single_value->field_d.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 @RLCMAC_Types.TfiOctet.");
}
}

void TfiOctet_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_pr.decode_text(text_buf);
single_value->field_tfi.decode_text(text_buf);
single_value->field_d.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 TfiOctet_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 @RLCMAC_Types.TfiOctet.");
}
}

void TfiOctet_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: {
    TfiOctet_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 @RLCMAC_Types.TfiOctet 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) pr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tfi().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) d().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(), "pr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pr().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          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(), "d")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          d().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 @RLCMAC_Types.TfiOctet: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    TfiOctet_template* precondition = new TfiOctet_template;
    precondition->set_param(*param.get_elem(0));
    TfiOctet_template* implied_template = new TfiOctet_template;
    implied_template->set_param(*param.get_elem(1));
    *this = TfiOctet_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.TfiOctet");
  }
  is_ifpresent = param.get_ifpresent();
}

void TfiOctet_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_pr.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.TfiOctet");
single_value->field_tfi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.TfiOctet");
single_value->field_d.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.TfiOctet");
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 : "@RLCMAC_Types.TfiOctet");
}

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

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

RbsnExtOctet::RbsnExtOctet()
{
}

RbsnExtOctet::RbsnExtOctet(const INTEGER& par_rbsn__e,
    const BITSTRING& par_fs__e,
    const BITSTRING& par_spare)
  :   field_rbsn__e(par_rbsn__e),
  field_fs__e(par_fs__e),
  field_spare(par_spare)
{
}

RbsnExtOctet::RbsnExtOctet(const RbsnExtOctet& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.RbsnExtOctet.");
if (other_value.rbsn__e().is_bound()) field_rbsn__e = other_value.rbsn__e();
else field_rbsn__e.clean_up();
if (other_value.fs__e().is_bound()) field_fs__e = other_value.fs__e();
else field_fs__e.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
}

void RbsnExtOctet::clean_up()
{
field_rbsn__e.clean_up();
field_fs__e.clean_up();
field_spare.clean_up();
}

const TTCN_Typedescriptor_t* RbsnExtOctet::get_descriptor() const { return &RbsnExtOctet_descr_; }
RbsnExtOctet& RbsnExtOctet::operator=(const RbsnExtOctet& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.RbsnExtOctet.");
  if (other_value.rbsn__e().is_bound()) field_rbsn__e = other_value.rbsn__e();
  else field_rbsn__e.clean_up();
  if (other_value.fs__e().is_bound()) field_fs__e = other_value.fs__e();
  else field_fs__e.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
}
return *this;
}

boolean RbsnExtOctet::operator==(const RbsnExtOctet& other_value) const
{
return field_rbsn__e==other_value.field_rbsn__e
  && field_fs__e==other_value.field_fs__e
  && field_spare==other_value.field_spare;
}

boolean RbsnExtOctet::is_bound() const
{
return (field_rbsn__e.is_bound())
  || (field_fs__e.is_bound())
  || (field_spare.is_bound());
}
boolean RbsnExtOctet::is_value() const
{
return field_rbsn__e.is_value()
  && field_fs__e.is_value()
  && field_spare.is_value();
}
void RbsnExtOctet::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ rbsn_e := ");
field_rbsn__e.log();
TTCN_Logger::log_event_str(", fs_e := ");
field_fs__e.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(" }");
}

void RbsnExtOctet::set_implicit_omit()
{
if (rbsn__e().is_bound()) rbsn__e().set_implicit_omit();
if (fs__e().is_bound()) fs__e().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void RbsnExtOctet::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 @RLCMAC_Types.RbsnExtOctet 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) rbsn__e().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) fs__e().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "rbsn_e")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rbsn__e().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "fs_e")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fs__e().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @RLCMAC_Types.RbsnExtOctet: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.RbsnExtOctet");
  }
}

void RbsnExtOctet::encode_text(Text_Buf& text_buf) const
{
field_rbsn__e.encode_text(text_buf);
field_fs__e.encode_text(text_buf);
field_spare.encode_text(text_buf);
}

void RbsnExtOctet::decode_text(Text_Buf& text_buf)
{
field_rbsn__e.decode_text(text_buf);
field_fs__e.decode_text(text_buf);
field_spare.decode_text(text_buf);
}

void RbsnExtOctet::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 RbsnExtOctet::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 RbsnExtOctet::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, RbsnExtOctet_rbsn__e_descr_.raw->forceomit);
  decoded_field_length = field_rbsn__e.RAW_decode(RbsnExtOctet_rbsn__e_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, RbsnExtOctet_fs__e_descr_.raw->forceomit);
  decoded_field_length = field_fs__e.RAW_decode(RbsnExtOctet_fs__e_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, RbsnExtOctet_spare_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(RbsnExtOctet_spare_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 RbsnExtOctet::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, RbsnExtOctet_rbsn__e_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RbsnExtOctet_fs__e_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, RbsnExtOctet_spare_descr_.raw);
  encoded_length += field_rbsn__e.RAW_encode(RbsnExtOctet_rbsn__e_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_fs__e.RAW_encode(RbsnExtOctet_fs__e_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_spare.RAW_encode(RbsnExtOctet_spare_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct RbsnExtOctet_template::single_value_struct {
INTEGER_template field_rbsn__e;
BITSTRING_template field_fs__e;
BITSTRING_template field_spare;
};

void RbsnExtOctet_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_rbsn__e = ANY_VALUE;
single_value->field_fs__e = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
}
}
}

void RbsnExtOctet_template::copy_value(const RbsnExtOctet& other_value)
{
single_value = new single_value_struct;
if (other_value.rbsn__e().is_bound()) {
  single_value->field_rbsn__e = other_value.rbsn__e();
} else {
  single_value->field_rbsn__e.clean_up();
}
if (other_value.fs__e().is_bound()) {
  single_value->field_fs__e = other_value.fs__e();
} else {
  single_value->field_fs__e.clean_up();
}
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RbsnExtOctet_template::copy_template(const RbsnExtOctet_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.rbsn__e().get_selection()) {
single_value->field_rbsn__e = other_value.rbsn__e();
} else {
single_value->field_rbsn__e.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.fs__e().get_selection()) {
single_value->field_fs__e = other_value.fs__e();
} else {
single_value->field_fs__e.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new RbsnExtOctet_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 RbsnExtOctet_template(*other_value.implication_.precondition);
implication_.implied_template = new RbsnExtOctet_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 @RLCMAC_Types.RbsnExtOctet.");
break;
}
set_selection(other_value);
}

RbsnExtOctet_template::RbsnExtOctet_template()
{
}

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

RbsnExtOctet_template::RbsnExtOctet_template(const RbsnExtOctet& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean RbsnExtOctet_template::match(const RbsnExtOctet& 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.rbsn__e().is_bound()) return FALSE;
if(!single_value->field_rbsn__e.match(other_value.rbsn__e(), legacy))return FALSE;
if(!other_value.fs__e().is_bound()) return FALSE;
if(!single_value->field_fs__e.match(other_value.fs__e(), legacy))return FALSE;
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @RLCMAC_Types.RbsnExtOctet.");
}
return FALSE;
}

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

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

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

RbsnExtOctet RbsnExtOctet_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 @RLCMAC_Types.RbsnExtOctet.");
RbsnExtOctet ret_val;
if (single_value->field_rbsn__e.is_bound()) {
ret_val.rbsn__e() = single_value->field_rbsn__e.valueof();
}
if (single_value->field_fs__e.is_bound()) {
ret_val.fs__e() = single_value->field_fs__e.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
return ret_val;
}

void RbsnExtOctet_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 @RLCMAC_Types.RbsnExtOctet.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RbsnExtOctet_template[list_length];
}

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

INTEGER_template& RbsnExtOctet_template::rbsn__e()
{
set_specific();
return single_value->field_rbsn__e;
}

const INTEGER_template& RbsnExtOctet_template::rbsn__e() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rbsn_e of a non-specific template of type @RLCMAC_Types.RbsnExtOctet.");
return single_value->field_rbsn__e;
}

BITSTRING_template& RbsnExtOctet_template::fs__e()
{
set_specific();
return single_value->field_fs__e;
}

const BITSTRING_template& RbsnExtOctet_template::fs__e() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field fs_e of a non-specific template of type @RLCMAC_Types.RbsnExtOctet.");
return single_value->field_fs__e;
}

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

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

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

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

void RbsnExtOctet_template::log_match(const RbsnExtOctet& 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_rbsn__e.match(match_value.rbsn__e(), legacy)){
TTCN_Logger::log_logmatch_info(".rbsn_e");
single_value->field_rbsn__e.log_match(match_value.rbsn__e(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_fs__e.match(match_value.fs__e(), legacy)){
TTCN_Logger::log_logmatch_info(".fs_e");
single_value->field_fs__e.log_match(match_value.fs__e(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ rbsn_e := ");
single_value->field_rbsn__e.log_match(match_value.rbsn__e(), legacy);
TTCN_Logger::log_event_str(", fs_e := ");
single_value->field_fs__e.log_match(match_value.fs__e(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void RbsnExtOctet_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (rbsn__e().is_bound()) rbsn__e().set_implicit_omit();
if (fs__e().is_bound()) fs__e().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

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

void RbsnExtOctet_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_rbsn__e.decode_text(text_buf);
single_value->field_fs__e.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new RbsnExtOctet_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 @RLCMAC_Types.RbsnExtOctet.");
}
}

void RbsnExtOctet_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: {
    RbsnExtOctet_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 @RLCMAC_Types.RbsnExtOctet 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) rbsn__e().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) fs__e().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "rbsn_e")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rbsn__e().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "fs_e")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fs__e().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @RLCMAC_Types.RbsnExtOctet: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    RbsnExtOctet_template* precondition = new RbsnExtOctet_template;
    precondition->set_param(*param.get_elem(0));
    RbsnExtOctet_template* implied_template = new RbsnExtOctet_template;
    implied_template->set_param(*param.get_elem(1));
    *this = RbsnExtOctet_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.RbsnExtOctet");
  }
  is_ifpresent = param.get_ifpresent();
}

void RbsnExtOctet_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_rbsn__e.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RbsnExtOctet");
single_value->field_fs__e.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RbsnExtOctet");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RbsnExtOctet");
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 : "@RLCMAC_Types.RbsnExtOctet");
}

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

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

DlCtrlOptOctets::DlCtrlOptOctets()
{
}

DlCtrlOptOctets::DlCtrlOptOctets(const BITSTRING& par_rbsn,
    const INTEGER& par_rti,
    const BOOLEAN& par_fs,
    const BOOLEAN& par_tfi__octet__present,
    const OPTIONAL< TfiOctet >& par_tfi,
    const OPTIONAL< RbsnExtOctet >& par_rbsn__ext)
  :   field_rbsn(par_rbsn),
  field_rti(par_rti),
  field_fs(par_fs),
  field_tfi__octet__present(par_tfi__octet__present),
  field_tfi(par_tfi),
  field_rbsn__ext(par_rbsn__ext)
{
}

DlCtrlOptOctets::DlCtrlOptOctets(const DlCtrlOptOctets& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.DlCtrlOptOctets.");
if (other_value.rbsn().is_bound()) field_rbsn = other_value.rbsn();
else field_rbsn.clean_up();
if (other_value.rti().is_bound()) field_rti = other_value.rti();
else field_rti.clean_up();
if (other_value.fs().is_bound()) field_fs = other_value.fs();
else field_fs.clean_up();
if (other_value.tfi__octet__present().is_bound()) field_tfi__octet__present = other_value.tfi__octet__present();
else field_tfi__octet__present.clean_up();
if (other_value.tfi().is_bound()) field_tfi = other_value.tfi();
else field_tfi.clean_up();
if (other_value.rbsn__ext().is_bound()) field_rbsn__ext = other_value.rbsn__ext();
else field_rbsn__ext.clean_up();
}

void DlCtrlOptOctets::clean_up()
{
field_rbsn.clean_up();
field_rti.clean_up();
field_fs.clean_up();
field_tfi__octet__present.clean_up();
field_tfi.clean_up();
field_rbsn__ext.clean_up();
}

const TTCN_Typedescriptor_t* DlCtrlOptOctets::get_descriptor() const { return &DlCtrlOptOctets_descr_; }
DlCtrlOptOctets& DlCtrlOptOctets::operator=(const DlCtrlOptOctets& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.DlCtrlOptOctets.");
  if (other_value.rbsn().is_bound()) field_rbsn = other_value.rbsn();
  else field_rbsn.clean_up();
  if (other_value.rti().is_bound()) field_rti = other_value.rti();
  else field_rti.clean_up();
  if (other_value.fs().is_bound()) field_fs = other_value.fs();
  else field_fs.clean_up();
  if (other_value.tfi__octet__present().is_bound()) field_tfi__octet__present = other_value.tfi__octet__present();
  else field_tfi__octet__present.clean_up();
  if (other_value.tfi().is_bound()) field_tfi = other_value.tfi();
  else field_tfi.clean_up();
  if (other_value.rbsn__ext().is_bound()) field_rbsn__ext = other_value.rbsn__ext();
  else field_rbsn__ext.clean_up();
}
return *this;
}

boolean DlCtrlOptOctets::operator==(const DlCtrlOptOctets& other_value) const
{
return field_rbsn==other_value.field_rbsn
  && field_rti==other_value.field_rti
  && field_fs==other_value.field_fs
  && field_tfi__octet__present==other_value.field_tfi__octet__present
  && field_tfi==other_value.field_tfi
  && field_rbsn__ext==other_value.field_rbsn__ext;
}

boolean DlCtrlOptOctets::is_bound() const
{
return (field_rbsn.is_bound())
  || (field_rti.is_bound())
  || (field_fs.is_bound())
  || (field_tfi__octet__present.is_bound())
  || (OPTIONAL_OMIT == field_tfi.get_selection() || field_tfi.is_bound())
  || (OPTIONAL_OMIT == field_rbsn__ext.get_selection() || field_rbsn__ext.is_bound());
}
boolean DlCtrlOptOctets::is_value() const
{
return field_rbsn.is_value()
  && field_rti.is_value()
  && field_fs.is_value()
  && field_tfi__octet__present.is_value()
  && (OPTIONAL_OMIT == field_tfi.get_selection() || field_tfi.is_value())
  && (OPTIONAL_OMIT == field_rbsn__ext.get_selection() || field_rbsn__ext.is_value());
}
int DlCtrlOptOctets::size_of() const
{
  int ret_val = 4;
  if (field_tfi.ispresent()) ret_val++;
  if (field_rbsn__ext.ispresent()) ret_val++;
  return ret_val;
}

void DlCtrlOptOctets::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ rbsn := ");
field_rbsn.log();
TTCN_Logger::log_event_str(", rti := ");
field_rti.log();
TTCN_Logger::log_event_str(", fs := ");
field_fs.log();
TTCN_Logger::log_event_str(", tfi_octet_present := ");
field_tfi__octet__present.log();
TTCN_Logger::log_event_str(", tfi := ");
field_tfi.log();
TTCN_Logger::log_event_str(", rbsn_ext := ");
field_rbsn__ext.log();
TTCN_Logger::log_event_str(" }");
}

void DlCtrlOptOctets::set_implicit_omit()
{
if (rbsn().is_bound()) rbsn().set_implicit_omit();
if (rti().is_bound()) rti().set_implicit_omit();
if (fs().is_bound()) fs().set_implicit_omit();
if (tfi__octet__present().is_bound()) tfi__octet__present().set_implicit_omit();
if (!tfi().is_bound()) tfi() = OMIT_VALUE;
else tfi().set_implicit_omit();
if (!rbsn__ext().is_bound()) rbsn__ext() = OMIT_VALUE;
else rbsn__ext().set_implicit_omit();
}

void DlCtrlOptOctets::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 (6<param.get_size()) {
      param.error("record value of type @RLCMAC_Types.DlCtrlOptOctets has 6 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) rbsn().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) rti().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) fs().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) tfi__octet__present().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) tfi().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) rbsn__ext().set_param(*param.get_elem(5));
    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(), "rbsn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rbsn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rti")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rti().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "fs")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fs().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tfi_octet_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tfi__octet__present().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          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(), "rbsn_ext")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rbsn__ext().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 @RLCMAC_Types.DlCtrlOptOctets: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.DlCtrlOptOctets");
  }
}

void DlCtrlOptOctets::encode_text(Text_Buf& text_buf) const
{
field_rbsn.encode_text(text_buf);
field_rti.encode_text(text_buf);
field_fs.encode_text(text_buf);
field_tfi__octet__present.encode_text(text_buf);
field_tfi.encode_text(text_buf);
field_rbsn__ext.encode_text(text_buf);
}

void DlCtrlOptOctets::decode_text(Text_Buf& text_buf)
{
field_rbsn.decode_text(text_buf);
field_rti.decode_text(text_buf);
field_fs.decode_text(text_buf);
field_tfi__octet__present.decode_text(text_buf);
field_tfi.decode_text(text_buf);
field_rbsn__ext.decode_text(text_buf);
}

void DlCtrlOptOctets::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 DlCtrlOptOctets::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 DlCtrlOptOctets::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, DlCtrlOptOctets_rbsn_descr_.raw->forceomit);
  decoded_field_length = field_rbsn.RAW_decode(DlCtrlOptOctets_rbsn_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, DlCtrlOptOctets_rti_descr_.raw->forceomit);
  decoded_field_length = field_rti.RAW_decode(DlCtrlOptOctets_rti_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, DlCtrlOptOctets_fs_descr_.raw->forceomit);
  decoded_field_length = field_fs.RAW_decode(DlCtrlOptOctets_fs_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, DlCtrlOptOctets_tfi__octet__present_descr_.raw->forceomit);
  decoded_field_length = field_tfi__octet__present.RAW_decode(DlCtrlOptOctets_tfi__octet__present_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());
  if (limit > 0 && field_tfi__octet__present == TRUE){
  if (force_omit != NULL && (*force_omit)(4)) {
    field_tfi = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_4_force_omit(4, force_omit, DlCtrlOptOctets_tfi_descr_.raw->forceomit);
  decoded_field_length = field_tfi().RAW_decode(DlCtrlOptOctets_tfi_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit);
  if (decoded_field_length < 1) {
  field_tfi = 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_tfi=OMIT_VALUE;
  if (limit > 0 && (field_rbsn ==  bs_0 || field_fs == FALSE)){
  if (force_omit != NULL && (*force_omit)(5)) {
    field_rbsn__ext = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_5_force_omit(5, force_omit, DlCtrlOptOctets_rbsn__ext_descr_.raw->forceomit);
  decoded_field_length = field_rbsn__ext().RAW_decode(DlCtrlOptOctets_rbsn__ext_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 1) {
  field_rbsn__ext = 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_rbsn__ext=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int DlCtrlOptOctets::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 = 6;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(6);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, DlCtrlOptOctets_rbsn_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, DlCtrlOptOctets_rti_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, DlCtrlOptOctets_fs_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, DlCtrlOptOctets_tfi__octet__present_descr_.raw);
  if (field_tfi.ispresent()) {
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, DlCtrlOptOctets_tfi_descr_.raw);
  }
  else myleaf.body.node.nodes[4] = NULL;
  if (field_rbsn__ext.ispresent()) {
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, DlCtrlOptOctets_rbsn__ext_descr_.raw);
  }
  else myleaf.body.node.nodes[5] = NULL;
  encoded_length += field_rbsn.RAW_encode(DlCtrlOptOctets_rbsn_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_rti.RAW_encode(DlCtrlOptOctets_rti_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_fs.RAW_encode(DlCtrlOptOctets_fs_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_tfi__octet__present.RAW_encode(DlCtrlOptOctets_tfi__octet__present_descr_, *myleaf.body.node.nodes[3]);
  if (field_tfi.ispresent()) {
  encoded_length += field_tfi().RAW_encode(DlCtrlOptOctets_tfi_descr_, *myleaf.body.node.nodes[4]);
  }
  if (field_rbsn__ext.ispresent()) {
  encoded_length += field_rbsn__ext().RAW_encode(DlCtrlOptOctets_rbsn__ext_descr_, *myleaf.body.node.nodes[5]);
  }
  if (field_tfi.ispresent() && (field_tfi__octet__present != TRUE)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={3};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
  BOOLEAN new_val = TRUE;
  new_val.RAW_encode(DlCtrlOptOctets_tfi__octet__present_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);
  }
  }
  if (field_rbsn__ext.ispresent() && (field_rbsn !=  bs_0 && field_fs != FALSE)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={0};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
   bs_0.RAW_encode(DlCtrlOptOctets_rbsn_descr_,*temp_leaf);
  } else  {
  RAW_enc_tr_pos pr_pos1;
  pr_pos1.level=myleaf.curr_pos.level+1;
  int new_pos1[]={2};
  pr_pos1.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos1);
  temp_leaf = myleaf.get_node(pr_pos1);
  if(temp_leaf != NULL){
  BOOLEAN new_val = FALSE;
  new_val.RAW_encode(DlCtrlOptOctets_fs_descr_,*temp_leaf);
  } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  }
  free_tree_pos(pr_pos1.pos);
  }
  free_tree_pos(pr_pos0.pos);
  }
  }
  return myleaf.length = encoded_length;
}

struct DlCtrlOptOctets_template::single_value_struct {
BITSTRING_template field_rbsn;
INTEGER_template field_rti;
BOOLEAN_template field_fs;
BOOLEAN_template field_tfi__octet__present;
TfiOctet_template field_tfi;
RbsnExtOctet_template field_rbsn__ext;
};

void DlCtrlOptOctets_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_rbsn = ANY_VALUE;
single_value->field_rti = ANY_VALUE;
single_value->field_fs = ANY_VALUE;
single_value->field_tfi__octet__present = ANY_VALUE;
single_value->field_tfi = ANY_OR_OMIT;
single_value->field_rbsn__ext = ANY_OR_OMIT;
}
}
}

void DlCtrlOptOctets_template::copy_value(const DlCtrlOptOctets& other_value)
{
single_value = new single_value_struct;
if (other_value.rbsn().is_bound()) {
  single_value->field_rbsn = other_value.rbsn();
} else {
  single_value->field_rbsn.clean_up();
}
if (other_value.rti().is_bound()) {
  single_value->field_rti = other_value.rti();
} else {
  single_value->field_rti.clean_up();
}
if (other_value.fs().is_bound()) {
  single_value->field_fs = other_value.fs();
} else {
  single_value->field_fs.clean_up();
}
if (other_value.tfi__octet__present().is_bound()) {
  single_value->field_tfi__octet__present = other_value.tfi__octet__present();
} else {
  single_value->field_tfi__octet__present.clean_up();
}
if (other_value.tfi().is_bound()) {
  if (other_value.tfi().ispresent()) single_value->field_tfi = other_value.tfi()();
  else single_value->field_tfi = OMIT_VALUE;
} else {
  single_value->field_tfi.clean_up();
}
if (other_value.rbsn__ext().is_bound()) {
  if (other_value.rbsn__ext().ispresent()) single_value->field_rbsn__ext = other_value.rbsn__ext()();
  else single_value->field_rbsn__ext = OMIT_VALUE;
} else {
  single_value->field_rbsn__ext.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void DlCtrlOptOctets_template::copy_template(const DlCtrlOptOctets_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.rbsn().get_selection()) {
single_value->field_rbsn = other_value.rbsn();
} else {
single_value->field_rbsn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rti().get_selection()) {
single_value->field_rti = other_value.rti();
} else {
single_value->field_rti.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.fs().get_selection()) {
single_value->field_fs = other_value.fs();
} else {
single_value->field_fs.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tfi__octet__present().get_selection()) {
single_value->field_tfi__octet__present = other_value.tfi__octet__present();
} else {
single_value->field_tfi__octet__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tfi().get_selection()) {
single_value->field_tfi = other_value.tfi();
} else {
single_value->field_tfi.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rbsn__ext().get_selection()) {
single_value->field_rbsn__ext = other_value.rbsn__ext();
} else {
single_value->field_rbsn__ext.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 DlCtrlOptOctets_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 DlCtrlOptOctets_template(*other_value.implication_.precondition);
implication_.implied_template = new DlCtrlOptOctets_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 @RLCMAC_Types.DlCtrlOptOctets.");
break;
}
set_selection(other_value);
}

DlCtrlOptOctets_template::DlCtrlOptOctets_template()
{
}

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

DlCtrlOptOctets_template::DlCtrlOptOctets_template(const DlCtrlOptOctets& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean DlCtrlOptOctets_template::match(const DlCtrlOptOctets& 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.rbsn().is_bound()) return FALSE;
if(!single_value->field_rbsn.match(other_value.rbsn(), legacy))return FALSE;
if(!other_value.rti().is_bound()) return FALSE;
if(!single_value->field_rti.match(other_value.rti(), legacy))return FALSE;
if(!other_value.fs().is_bound()) return FALSE;
if(!single_value->field_fs.match(other_value.fs(), legacy))return FALSE;
if(!other_value.tfi__octet__present().is_bound()) return FALSE;
if(!single_value->field_tfi__octet__present.match(other_value.tfi__octet__present(), legacy))return FALSE;
if(!other_value.tfi().is_bound()) return FALSE;
if((other_value.tfi().ispresent() ? !single_value->field_tfi.match((const TfiOctet&)other_value.tfi(), legacy) : !single_value->field_tfi.match_omit(legacy)))return FALSE;
if(!other_value.rbsn__ext().is_bound()) return FALSE;
if((other_value.rbsn__ext().ispresent() ? !single_value->field_rbsn__ext.match((const RbsnExtOctet&)other_value.rbsn__ext(), legacy) : !single_value->field_rbsn__ext.match_omit(legacy)))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @RLCMAC_Types.DlCtrlOptOctets.");
}
return FALSE;
}

boolean DlCtrlOptOctets_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_rbsn.is_bound()
 || single_value->field_rti.is_bound()
 || single_value->field_fs.is_bound()
 || single_value->field_tfi__octet__present.is_bound()
 || (single_value->field_tfi.is_omit() || single_value->field_tfi.is_bound())
 || (single_value->field_rbsn__ext.is_omit() || single_value->field_rbsn__ext.is_bound());
}

boolean DlCtrlOptOctets_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_rbsn.is_value()
 && single_value->field_rti.is_value()
 && single_value->field_fs.is_value()
 && single_value->field_tfi__octet__present.is_value()
 && (single_value->field_tfi.is_omit() || single_value->field_tfi.is_value())
 && (single_value->field_rbsn__ext.is_omit() || single_value->field_rbsn__ext.is_value());
}

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

DlCtrlOptOctets DlCtrlOptOctets_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 @RLCMAC_Types.DlCtrlOptOctets.");
DlCtrlOptOctets ret_val;
if (single_value->field_rbsn.is_bound()) {
ret_val.rbsn() = single_value->field_rbsn.valueof();
}
if (single_value->field_rti.is_bound()) {
ret_val.rti() = single_value->field_rti.valueof();
}
if (single_value->field_fs.is_bound()) {
ret_val.fs() = single_value->field_fs.valueof();
}
if (single_value->field_tfi__octet__present.is_bound()) {
ret_val.tfi__octet__present() = single_value->field_tfi__octet__present.valueof();
}
if (single_value->field_tfi.is_omit()) ret_val.tfi() = OMIT_VALUE;
else if (single_value->field_tfi.is_bound()) {
ret_val.tfi() = single_value->field_tfi.valueof();
}
if (single_value->field_rbsn__ext.is_omit()) ret_val.rbsn__ext() = OMIT_VALUE;
else if (single_value->field_rbsn__ext.is_bound()) {
ret_val.rbsn__ext() = single_value->field_rbsn__ext.valueof();
}
return ret_val;
}

void DlCtrlOptOctets_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 @RLCMAC_Types.DlCtrlOptOctets.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new DlCtrlOptOctets_template[list_length];
}

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

BITSTRING_template& DlCtrlOptOctets_template::rbsn()
{
set_specific();
return single_value->field_rbsn;
}

const BITSTRING_template& DlCtrlOptOctets_template::rbsn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rbsn of a non-specific template of type @RLCMAC_Types.DlCtrlOptOctets.");
return single_value->field_rbsn;
}

INTEGER_template& DlCtrlOptOctets_template::rti()
{
set_specific();
return single_value->field_rti;
}

const INTEGER_template& DlCtrlOptOctets_template::rti() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rti of a non-specific template of type @RLCMAC_Types.DlCtrlOptOctets.");
return single_value->field_rti;
}

BOOLEAN_template& DlCtrlOptOctets_template::fs()
{
set_specific();
return single_value->field_fs;
}

const BOOLEAN_template& DlCtrlOptOctets_template::fs() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field fs of a non-specific template of type @RLCMAC_Types.DlCtrlOptOctets.");
return single_value->field_fs;
}

BOOLEAN_template& DlCtrlOptOctets_template::tfi__octet__present()
{
set_specific();
return single_value->field_tfi__octet__present;
}

const BOOLEAN_template& DlCtrlOptOctets_template::tfi__octet__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tfi_octet_present of a non-specific template of type @RLCMAC_Types.DlCtrlOptOctets.");
return single_value->field_tfi__octet__present;
}

TfiOctet_template& DlCtrlOptOctets_template::tfi()
{
set_specific();
return single_value->field_tfi;
}

const TfiOctet_template& DlCtrlOptOctets_template::tfi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tfi of a non-specific template of type @RLCMAC_Types.DlCtrlOptOctets.");
return single_value->field_tfi;
}

RbsnExtOctet_template& DlCtrlOptOctets_template::rbsn__ext()
{
set_specific();
return single_value->field_rbsn__ext;
}

const RbsnExtOctet_template& DlCtrlOptOctets_template::rbsn__ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rbsn_ext of a non-specific template of type @RLCMAC_Types.DlCtrlOptOctets.");
return single_value->field_rbsn__ext;
}

int DlCtrlOptOctets_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.DlCtrlOptOctets which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
  {    int ret_val = 4;
      if (single_value->field_tfi.is_present()) ret_val++;
      if (single_value->field_rbsn__ext.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 @RLCMAC_Types.DlCtrlOptOctets 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 @RLCMAC_Types.DlCtrlOptOctets containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.DlCtrlOptOctets containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.DlCtrlOptOctets containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.DlCtrlOptOctets containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.DlCtrlOptOctets containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.DlCtrlOptOctets containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.DlCtrlOptOctets containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @RLCMAC_Types.DlCtrlOptOctets.");
  }
  return 0;
}

void DlCtrlOptOctets_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ rbsn := ");
single_value->field_rbsn.log();
TTCN_Logger::log_event_str(", rti := ");
single_value->field_rti.log();
TTCN_Logger::log_event_str(", fs := ");
single_value->field_fs.log();
TTCN_Logger::log_event_str(", tfi_octet_present := ");
single_value->field_tfi__octet__present.log();
TTCN_Logger::log_event_str(", tfi := ");
single_value->field_tfi.log();
TTCN_Logger::log_event_str(", rbsn_ext := ");
single_value->field_rbsn__ext.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 DlCtrlOptOctets_template::log_match(const DlCtrlOptOctets& 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_rbsn.match(match_value.rbsn(), legacy)){
TTCN_Logger::log_logmatch_info(".rbsn");
single_value->field_rbsn.log_match(match_value.rbsn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rti.match(match_value.rti(), legacy)){
TTCN_Logger::log_logmatch_info(".rti");
single_value->field_rti.log_match(match_value.rti(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_fs.match(match_value.fs(), legacy)){
TTCN_Logger::log_logmatch_info(".fs");
single_value->field_fs.log_match(match_value.fs(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tfi__octet__present.match(match_value.tfi__octet__present(), legacy)){
TTCN_Logger::log_logmatch_info(".tfi_octet_present");
single_value->field_tfi__octet__present.log_match(match_value.tfi__octet__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.tfi().ispresent()){
if(!single_value->field_tfi.match(match_value.tfi(), legacy)){
TTCN_Logger::log_logmatch_info(".tfi");
single_value->field_tfi.log_match(match_value.tfi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_tfi.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".tfi := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_tfi.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.rbsn__ext().ispresent()){
if(!single_value->field_rbsn__ext.match(match_value.rbsn__ext(), legacy)){
TTCN_Logger::log_logmatch_info(".rbsn_ext");
single_value->field_rbsn__ext.log_match(match_value.rbsn__ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_rbsn__ext.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".rbsn_ext := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_rbsn__ext.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ rbsn := ");
single_value->field_rbsn.log_match(match_value.rbsn(), legacy);
TTCN_Logger::log_event_str(", rti := ");
single_value->field_rti.log_match(match_value.rti(), legacy);
TTCN_Logger::log_event_str(", fs := ");
single_value->field_fs.log_match(match_value.fs(), legacy);
TTCN_Logger::log_event_str(", tfi_octet_present := ");
single_value->field_tfi__octet__present.log_match(match_value.tfi__octet__present(), legacy);
TTCN_Logger::log_event_str(", tfi := ");
if (match_value.tfi().ispresent()) {
single_value->field_tfi.log_match(match_value.tfi(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_tfi.log();
if (single_value->field_tfi.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", rbsn_ext := ");
if (match_value.rbsn__ext().ispresent()) {
single_value->field_rbsn__ext.log_match(match_value.rbsn__ext(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_rbsn__ext.log();
if (single_value->field_rbsn__ext.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void DlCtrlOptOctets_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (rbsn().is_bound()) rbsn().set_implicit_omit();
if (rti().is_bound()) rti().set_implicit_omit();
if (fs().is_bound()) fs().set_implicit_omit();
if (tfi__octet__present().is_bound()) tfi__octet__present().set_implicit_omit();
if (!tfi().is_bound()) tfi() = OMIT_VALUE;
else tfi().set_implicit_omit();
if (!rbsn__ext().is_bound()) rbsn__ext() = OMIT_VALUE;
else rbsn__ext().set_implicit_omit();
}

void DlCtrlOptOctets_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_rbsn.encode_text(text_buf);
single_value->field_rti.encode_text(text_buf);
single_value->field_fs.encode_text(text_buf);
single_value->field_tfi__octet__present.encode_text(text_buf);
single_value->field_tfi.encode_text(text_buf);
single_value->field_rbsn__ext.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 @RLCMAC_Types.DlCtrlOptOctets.");
}
}

void DlCtrlOptOctets_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_rbsn.decode_text(text_buf);
single_value->field_rti.decode_text(text_buf);
single_value->field_fs.decode_text(text_buf);
single_value->field_tfi__octet__present.decode_text(text_buf);
single_value->field_tfi.decode_text(text_buf);
single_value->field_rbsn__ext.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 DlCtrlOptOctets_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 @RLCMAC_Types.DlCtrlOptOctets.");
}
}

void DlCtrlOptOctets_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: {
    DlCtrlOptOctets_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 (6<param.get_size()) {
      param.error("record template of type @RLCMAC_Types.DlCtrlOptOctets has 6 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) rbsn().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) rti().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) fs().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) tfi__octet__present().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) tfi().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) rbsn__ext().set_param(*param.get_elem(5));
    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(), "rbsn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rbsn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rti")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rti().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "fs")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fs().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tfi_octet_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tfi__octet__present().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          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(), "rbsn_ext")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rbsn__ext().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 @RLCMAC_Types.DlCtrlOptOctets: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    DlCtrlOptOctets_template* precondition = new DlCtrlOptOctets_template;
    precondition->set_param(*param.get_elem(0));
    DlCtrlOptOctets_template* implied_template = new DlCtrlOptOctets_template;
    implied_template->set_param(*param.get_elem(1));
    *this = DlCtrlOptOctets_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.DlCtrlOptOctets");
  }
  is_ifpresent = param.get_ifpresent();
}

void DlCtrlOptOctets_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_rbsn.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.DlCtrlOptOctets");
single_value->field_rti.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.DlCtrlOptOctets");
single_value->field_fs.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.DlCtrlOptOctets");
single_value->field_tfi__octet__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.DlCtrlOptOctets");
single_value->field_tfi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.DlCtrlOptOctets");
single_value->field_rbsn__ext.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.DlCtrlOptOctets");
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 : "@RLCMAC_Types.DlCtrlOptOctets");
}

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

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

RlcmacDlCtrlBlock::RlcmacDlCtrlBlock()
{
}

RlcmacDlCtrlBlock::RlcmacDlCtrlBlock(const DlMacHeader& par_mac__hdr,
    const OPTIONAL< DlCtrlOptOctets >& par_opt,
    const RLCMAC__CSN1__Types::RlcmacDlCtrlMsg& par_payload)
  :   field_mac__hdr(par_mac__hdr),
  field_opt(par_opt),
  field_payload(par_payload)
{
}

RlcmacDlCtrlBlock::RlcmacDlCtrlBlock(const RlcmacDlCtrlBlock& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.RlcmacDlCtrlBlock.");
if (other_value.mac__hdr().is_bound()) field_mac__hdr = other_value.mac__hdr();
else field_mac__hdr.clean_up();
if (other_value.opt().is_bound()) field_opt = other_value.opt();
else field_opt.clean_up();
if (other_value.payload().is_bound()) field_payload = other_value.payload();
else field_payload.clean_up();
}

void RlcmacDlCtrlBlock::clean_up()
{
field_mac__hdr.clean_up();
field_opt.clean_up();
field_payload.clean_up();
}

const TTCN_Typedescriptor_t* RlcmacDlCtrlBlock::get_descriptor() const { return &RlcmacDlCtrlBlock_descr_; }
RlcmacDlCtrlBlock& RlcmacDlCtrlBlock::operator=(const RlcmacDlCtrlBlock& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.RlcmacDlCtrlBlock.");
  if (other_value.mac__hdr().is_bound()) field_mac__hdr = other_value.mac__hdr();
  else field_mac__hdr.clean_up();
  if (other_value.opt().is_bound()) field_opt = other_value.opt();
  else field_opt.clean_up();
  if (other_value.payload().is_bound()) field_payload = other_value.payload();
  else field_payload.clean_up();
}
return *this;
}

boolean RlcmacDlCtrlBlock::operator==(const RlcmacDlCtrlBlock& other_value) const
{
return field_mac__hdr==other_value.field_mac__hdr
  && field_opt==other_value.field_opt
  && field_payload==other_value.field_payload;
}

boolean RlcmacDlCtrlBlock::is_bound() const
{
return (field_mac__hdr.is_bound())
  || (OPTIONAL_OMIT == field_opt.get_selection() || field_opt.is_bound())
  || (field_payload.is_bound());
}
boolean RlcmacDlCtrlBlock::is_value() const
{
return field_mac__hdr.is_value()
  && (OPTIONAL_OMIT == field_opt.get_selection() || field_opt.is_value())
  && field_payload.is_value();
}
int RlcmacDlCtrlBlock::size_of() const
{
  int ret_val = 2;
  if (field_opt.ispresent()) ret_val++;
  return ret_val;
}

void RlcmacDlCtrlBlock::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ mac_hdr := ");
field_mac__hdr.log();
TTCN_Logger::log_event_str(", opt := ");
field_opt.log();
TTCN_Logger::log_event_str(", payload := ");
field_payload.log();
TTCN_Logger::log_event_str(" }");
}

void RlcmacDlCtrlBlock::set_implicit_omit()
{
if (mac__hdr().is_bound()) mac__hdr().set_implicit_omit();
if (!opt().is_bound()) opt() = OMIT_VALUE;
else opt().set_implicit_omit();
if (payload().is_bound()) payload().set_implicit_omit();
}

void RlcmacDlCtrlBlock::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 @RLCMAC_Types.RlcmacDlCtrlBlock 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) mac__hdr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) opt().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) payload().set_param(*param.get_elem(2));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mac_hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mac__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(), "opt")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          opt().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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 @RLCMAC_Types.RlcmacDlCtrlBlock: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.RlcmacDlCtrlBlock");
  }
}

void RlcmacDlCtrlBlock::encode_text(Text_Buf& text_buf) const
{
field_mac__hdr.encode_text(text_buf);
field_opt.encode_text(text_buf);
field_payload.encode_text(text_buf);
}

void RlcmacDlCtrlBlock::decode_text(Text_Buf& text_buf)
{
field_mac__hdr.decode_text(text_buf);
field_opt.decode_text(text_buf);
field_payload.decode_text(text_buf);
}

void RlcmacDlCtrlBlock::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 RlcmacDlCtrlBlock::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 RlcmacDlCtrlBlock::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, RlcmacDlCtrlBlock_mac__hdr_descr_.raw->forceomit);
  decoded_field_length = field_mac__hdr.RAW_decode(RlcmacDlCtrlBlock_mac__hdr_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());
  if (limit > 0 && field_mac__hdr.payload__type() == MacPayloadType::MAC__PT__RLCMAC__OPT){
  if (force_omit != NULL && (*force_omit)(1)) {
    field_opt = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_1_force_omit(1, force_omit, RlcmacDlCtrlBlock_opt_descr_.raw->forceomit);
  decoded_field_length = field_opt().RAW_decode(RlcmacDlCtrlBlock_opt_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 1) {
  field_opt = 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_opt=OMIT_VALUE;
  RAW_Force_Omit field_2_force_omit(2, force_omit, RlcmacDlCtrlBlock_payload_descr_.raw->forceomit);
  decoded_field_length = field_payload.RAW_decode(RlcmacDlCtrlBlock_payload_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 RlcmacDlCtrlBlock::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, RlcmacDlCtrlBlock_mac__hdr_descr_.raw);
  if (field_opt.ispresent()) {
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RlcmacDlCtrlBlock_opt_descr_.raw);
  }
  else myleaf.body.node.nodes[1] = NULL;
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, RlcmacDlCtrlBlock_payload_descr_.raw);
  encoded_length += field_mac__hdr.RAW_encode(RlcmacDlCtrlBlock_mac__hdr_descr_, *myleaf.body.node.nodes[0]);
  if (field_opt.ispresent()) {
  encoded_length += field_opt().RAW_encode(RlcmacDlCtrlBlock_opt_descr_, *myleaf.body.node.nodes[1]);
  }
  encoded_length += field_payload.RAW_encode(RlcmacDlCtrlBlock_payload_descr_, *myleaf.body.node.nodes[2]);
  if (field_opt.ispresent() && (field_mac__hdr.payload__type() != MacPayloadType::MAC__PT__RLCMAC__OPT)) {
  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){
  MacPayloadType new_val = MacPayloadType::MAC__PT__RLCMAC__OPT;
  new_val.RAW_encode(DlMacHeader_payload__type_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);
  }
  }
  return myleaf.length = encoded_length;
}

struct RlcmacDlCtrlBlock_template::single_value_struct {
DlMacHeader_template field_mac__hdr;
DlCtrlOptOctets_template field_opt;
RLCMAC__CSN1__Types::RlcmacDlCtrlMsg_template field_payload;
};

void RlcmacDlCtrlBlock_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_mac__hdr = ANY_VALUE;
single_value->field_opt = ANY_OR_OMIT;
single_value->field_payload = ANY_VALUE;
}
}
}

void RlcmacDlCtrlBlock_template::copy_value(const RlcmacDlCtrlBlock& other_value)
{
single_value = new single_value_struct;
if (other_value.mac__hdr().is_bound()) {
  single_value->field_mac__hdr = other_value.mac__hdr();
} else {
  single_value->field_mac__hdr.clean_up();
}
if (other_value.opt().is_bound()) {
  if (other_value.opt().ispresent()) single_value->field_opt = other_value.opt()();
  else single_value->field_opt = OMIT_VALUE;
} else {
  single_value->field_opt.clean_up();
}
if (other_value.payload().is_bound()) {
  single_value->field_payload = other_value.payload();
} else {
  single_value->field_payload.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RlcmacDlCtrlBlock_template::copy_template(const RlcmacDlCtrlBlock_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.mac__hdr().get_selection()) {
single_value->field_mac__hdr = other_value.mac__hdr();
} else {
single_value->field_mac__hdr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.opt().get_selection()) {
single_value->field_opt = other_value.opt();
} else {
single_value->field_opt.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.payload().get_selection()) {
single_value->field_payload = other_value.payload();
} else {
single_value->field_payload.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new RlcmacDlCtrlBlock_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 RlcmacDlCtrlBlock_template(*other_value.implication_.precondition);
implication_.implied_template = new RlcmacDlCtrlBlock_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 @RLCMAC_Types.RlcmacDlCtrlBlock.");
break;
}
set_selection(other_value);
}

RlcmacDlCtrlBlock_template::RlcmacDlCtrlBlock_template()
{
}

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

RlcmacDlCtrlBlock_template::RlcmacDlCtrlBlock_template(const RlcmacDlCtrlBlock& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean RlcmacDlCtrlBlock_template::match(const RlcmacDlCtrlBlock& 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.mac__hdr().is_bound()) return FALSE;
if(!single_value->field_mac__hdr.match(other_value.mac__hdr(), legacy))return FALSE;
if(!other_value.opt().is_bound()) return FALSE;
if((other_value.opt().ispresent() ? !single_value->field_opt.match((const DlCtrlOptOctets&)other_value.opt(), legacy) : !single_value->field_opt.match_omit(legacy)))return FALSE;
if(!other_value.payload().is_bound()) return FALSE;
if(!single_value->field_payload.match(other_value.payload(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @RLCMAC_Types.RlcmacDlCtrlBlock.");
}
return FALSE;
}

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

boolean RlcmacDlCtrlBlock_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_mac__hdr.is_value()
 && (single_value->field_opt.is_omit() || single_value->field_opt.is_value())
 && single_value->field_payload.is_value();
}

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

RlcmacDlCtrlBlock RlcmacDlCtrlBlock_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 @RLCMAC_Types.RlcmacDlCtrlBlock.");
RlcmacDlCtrlBlock ret_val;
if (single_value->field_mac__hdr.is_bound()) {
ret_val.mac__hdr() = single_value->field_mac__hdr.valueof();
}
if (single_value->field_opt.is_omit()) ret_val.opt() = OMIT_VALUE;
else if (single_value->field_opt.is_bound()) {
ret_val.opt() = single_value->field_opt.valueof();
}
if (single_value->field_payload.is_bound()) {
ret_val.payload() = single_value->field_payload.valueof();
}
return ret_val;
}

void RlcmacDlCtrlBlock_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 @RLCMAC_Types.RlcmacDlCtrlBlock.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RlcmacDlCtrlBlock_template[list_length];
}

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

DlMacHeader_template& RlcmacDlCtrlBlock_template::mac__hdr()
{
set_specific();
return single_value->field_mac__hdr;
}

const DlMacHeader_template& RlcmacDlCtrlBlock_template::mac__hdr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mac_hdr of a non-specific template of type @RLCMAC_Types.RlcmacDlCtrlBlock.");
return single_value->field_mac__hdr;
}

DlCtrlOptOctets_template& RlcmacDlCtrlBlock_template::opt()
{
set_specific();
return single_value->field_opt;
}

const DlCtrlOptOctets_template& RlcmacDlCtrlBlock_template::opt() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field opt of a non-specific template of type @RLCMAC_Types.RlcmacDlCtrlBlock.");
return single_value->field_opt;
}

RLCMAC__CSN1__Types::RlcmacDlCtrlMsg_template& RlcmacDlCtrlBlock_template::payload()
{
set_specific();
return single_value->field_payload;
}

const RLCMAC__CSN1__Types::RlcmacDlCtrlMsg_template& RlcmacDlCtrlBlock_template::payload() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field payload of a non-specific template of type @RLCMAC_Types.RlcmacDlCtrlBlock.");
return single_value->field_payload;
}

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

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

void RlcmacDlCtrlBlock_template::log_match(const RlcmacDlCtrlBlock& 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_mac__hdr.match(match_value.mac__hdr(), legacy)){
TTCN_Logger::log_logmatch_info(".mac_hdr");
single_value->field_mac__hdr.log_match(match_value.mac__hdr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.opt().ispresent()){
if(!single_value->field_opt.match(match_value.opt(), legacy)){
TTCN_Logger::log_logmatch_info(".opt");
single_value->field_opt.log_match(match_value.opt(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_opt.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".opt := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_opt.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_payload.match(match_value.payload(), legacy)){
TTCN_Logger::log_logmatch_info(".payload");
single_value->field_payload.log_match(match_value.payload(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ mac_hdr := ");
single_value->field_mac__hdr.log_match(match_value.mac__hdr(), legacy);
TTCN_Logger::log_event_str(", opt := ");
if (match_value.opt().ispresent()) {
single_value->field_opt.log_match(match_value.opt(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_opt.log();
if (single_value->field_opt.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
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 RlcmacDlCtrlBlock_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (mac__hdr().is_bound()) mac__hdr().set_implicit_omit();
if (!opt().is_bound()) opt() = OMIT_VALUE;
else opt().set_implicit_omit();
if (payload().is_bound()) payload().set_implicit_omit();
}

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

void RlcmacDlCtrlBlock_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_mac__hdr.decode_text(text_buf);
single_value->field_opt.decode_text(text_buf);
single_value->field_payload.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new RlcmacDlCtrlBlock_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 @RLCMAC_Types.RlcmacDlCtrlBlock.");
}
}

void RlcmacDlCtrlBlock_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: {
    RlcmacDlCtrlBlock_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 @RLCMAC_Types.RlcmacDlCtrlBlock 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) mac__hdr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) opt().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) payload().set_param(*param.get_elem(2));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mac_hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mac__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(), "opt")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          opt().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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 @RLCMAC_Types.RlcmacDlCtrlBlock: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    RlcmacDlCtrlBlock_template* precondition = new RlcmacDlCtrlBlock_template;
    precondition->set_param(*param.get_elem(0));
    RlcmacDlCtrlBlock_template* implied_template = new RlcmacDlCtrlBlock_template;
    implied_template->set_param(*param.get_elem(1));
    *this = RlcmacDlCtrlBlock_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.RlcmacDlCtrlBlock");
  }
  is_ifpresent = param.get_ifpresent();
}

void RlcmacDlCtrlBlock_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_mac__hdr.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacDlCtrlBlock");
single_value->field_opt.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacDlCtrlBlock");
single_value->field_payload.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacDlCtrlBlock");
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 : "@RLCMAC_Types.RlcmacDlCtrlBlock");
}

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

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

UlMacCtrlHeader::UlMacCtrlHeader()
{
}

UlMacCtrlHeader::UlMacCtrlHeader(const MacPayloadType& par_payload__type,
    const BITSTRING& par_spare,
    const BOOLEAN& par_retry)
  :   field_payload__type(par_payload__type),
  field_spare(par_spare),
  field_retry(par_retry)
{
}

UlMacCtrlHeader::UlMacCtrlHeader(const UlMacCtrlHeader& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.UlMacCtrlHeader.");
if (other_value.payload__type().is_bound()) field_payload__type = other_value.payload__type();
else field_payload__type.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.retry().is_bound()) field_retry = other_value.retry();
else field_retry.clean_up();
}

void UlMacCtrlHeader::clean_up()
{
field_payload__type.clean_up();
field_spare.clean_up();
field_retry.clean_up();
}

const TTCN_Typedescriptor_t* UlMacCtrlHeader::get_descriptor() const { return &UlMacCtrlHeader_descr_; }
UlMacCtrlHeader& UlMacCtrlHeader::operator=(const UlMacCtrlHeader& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.UlMacCtrlHeader.");
  if (other_value.payload__type().is_bound()) field_payload__type = other_value.payload__type();
  else field_payload__type.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.retry().is_bound()) field_retry = other_value.retry();
  else field_retry.clean_up();
}
return *this;
}

boolean UlMacCtrlHeader::operator==(const UlMacCtrlHeader& other_value) const
{
return field_payload__type==other_value.field_payload__type
  && field_spare==other_value.field_spare
  && field_retry==other_value.field_retry;
}

boolean UlMacCtrlHeader::is_bound() const
{
return (field_payload__type.is_bound())
  || (field_spare.is_bound())
  || (field_retry.is_bound());
}
boolean UlMacCtrlHeader::is_value() const
{
return field_payload__type.is_value()
  && field_spare.is_value()
  && field_retry.is_value();
}
void UlMacCtrlHeader::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ payload_type := ");
field_payload__type.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(", retry := ");
field_retry.log();
TTCN_Logger::log_event_str(" }");
}

void UlMacCtrlHeader::set_implicit_omit()
{
if (payload__type().is_bound()) payload__type().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (retry().is_bound()) retry().set_implicit_omit();
}

void UlMacCtrlHeader::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 @RLCMAC_Types.UlMacCtrlHeader 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) payload__type().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) retry().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(), "payload_type")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          payload__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(), "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(), "retry")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          retry().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 @RLCMAC_Types.UlMacCtrlHeader: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.UlMacCtrlHeader");
  }
}

void UlMacCtrlHeader::encode_text(Text_Buf& text_buf) const
{
field_payload__type.encode_text(text_buf);
field_spare.encode_text(text_buf);
field_retry.encode_text(text_buf);
}

void UlMacCtrlHeader::decode_text(Text_Buf& text_buf)
{
field_payload__type.decode_text(text_buf);
field_spare.decode_text(text_buf);
field_retry.decode_text(text_buf);
}

void UlMacCtrlHeader::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 UlMacCtrlHeader::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 UlMacCtrlHeader::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, UlMacCtrlHeader_payload__type_descr_.raw->forceomit);
  decoded_field_length = field_payload__type.RAW_decode(UlMacCtrlHeader_payload__type_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, UlMacCtrlHeader_spare_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(UlMacCtrlHeader_spare_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_2_force_omit(2, force_omit, UlMacCtrlHeader_retry_descr_.raw->forceomit);
  decoded_field_length = field_retry.RAW_decode(UlMacCtrlHeader_retry_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 UlMacCtrlHeader::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, UlMacCtrlHeader_payload__type_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, UlMacCtrlHeader_spare_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, UlMacCtrlHeader_retry_descr_.raw);
  encoded_length += field_payload__type.RAW_encode(UlMacCtrlHeader_payload__type_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_spare.RAW_encode(UlMacCtrlHeader_spare_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_retry.RAW_encode(UlMacCtrlHeader_retry_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct UlMacCtrlHeader_template::single_value_struct {
MacPayloadType_template field_payload__type;
BITSTRING_template field_spare;
BOOLEAN_template field_retry;
};

void UlMacCtrlHeader_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__type = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
single_value->field_retry = ANY_VALUE;
}
}
}

void UlMacCtrlHeader_template::copy_value(const UlMacCtrlHeader& other_value)
{
single_value = new single_value_struct;
if (other_value.payload__type().is_bound()) {
  single_value->field_payload__type = other_value.payload__type();
} else {
  single_value->field_payload__type.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.retry().is_bound()) {
  single_value->field_retry = other_value.retry();
} else {
  single_value->field_retry.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void UlMacCtrlHeader_template::copy_template(const UlMacCtrlHeader_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.payload__type().get_selection()) {
single_value->field_payload__type = other_value.payload__type();
} else {
single_value->field_payload__type.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.retry().get_selection()) {
single_value->field_retry = other_value.retry();
} else {
single_value->field_retry.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 UlMacCtrlHeader_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 UlMacCtrlHeader_template(*other_value.implication_.precondition);
implication_.implied_template = new UlMacCtrlHeader_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 @RLCMAC_Types.UlMacCtrlHeader.");
break;
}
set_selection(other_value);
}

UlMacCtrlHeader_template::UlMacCtrlHeader_template()
{
}

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

UlMacCtrlHeader_template::UlMacCtrlHeader_template(const UlMacCtrlHeader& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean UlMacCtrlHeader_template::match(const UlMacCtrlHeader& 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__type().is_bound()) return FALSE;
if(!single_value->field_payload__type.match(other_value.payload__type(), 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.retry().is_bound()) return FALSE;
if(!single_value->field_retry.match(other_value.retry(), 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 @RLCMAC_Types.UlMacCtrlHeader.");
}
return FALSE;
}

boolean UlMacCtrlHeader_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__type.is_bound()
 || single_value->field_spare.is_bound()
 || single_value->field_retry.is_bound();
}

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

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

UlMacCtrlHeader UlMacCtrlHeader_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 @RLCMAC_Types.UlMacCtrlHeader.");
UlMacCtrlHeader ret_val;
if (single_value->field_payload__type.is_bound()) {
ret_val.payload__type() = single_value->field_payload__type.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_retry.is_bound()) {
ret_val.retry() = single_value->field_retry.valueof();
}
return ret_val;
}

void UlMacCtrlHeader_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 @RLCMAC_Types.UlMacCtrlHeader.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new UlMacCtrlHeader_template[list_length];
}

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

MacPayloadType_template& UlMacCtrlHeader_template::payload__type()
{
set_specific();
return single_value->field_payload__type;
}

const MacPayloadType_template& UlMacCtrlHeader_template::payload__type() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field payload_type of a non-specific template of type @RLCMAC_Types.UlMacCtrlHeader.");
return single_value->field_payload__type;
}

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

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

BOOLEAN_template& UlMacCtrlHeader_template::retry()
{
set_specific();
return single_value->field_retry;
}

const BOOLEAN_template& UlMacCtrlHeader_template::retry() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field retry of a non-specific template of type @RLCMAC_Types.UlMacCtrlHeader.");
return single_value->field_retry;
}

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

void UlMacCtrlHeader_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ payload_type := ");
single_value->field_payload__type.log();
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(", retry := ");
single_value->field_retry.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 UlMacCtrlHeader_template::log_match(const UlMacCtrlHeader& 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__type.match(match_value.payload__type(), legacy)){
TTCN_Logger::log_logmatch_info(".payload_type");
single_value->field_payload__type.log_match(match_value.payload__type(), 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_retry.match(match_value.retry(), legacy)){
TTCN_Logger::log_logmatch_info(".retry");
single_value->field_retry.log_match(match_value.retry(), 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_type := ");
single_value->field_payload__type.log_match(match_value.payload__type(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(", retry := ");
single_value->field_retry.log_match(match_value.retry(), 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 UlMacCtrlHeader_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (payload__type().is_bound()) payload__type().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (retry().is_bound()) retry().set_implicit_omit();
}

void UlMacCtrlHeader_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_payload__type.encode_text(text_buf);
single_value->field_spare.encode_text(text_buf);
single_value->field_retry.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 @RLCMAC_Types.UlMacCtrlHeader.");
}
}

void UlMacCtrlHeader_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__type.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
single_value->field_retry.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 UlMacCtrlHeader_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 @RLCMAC_Types.UlMacCtrlHeader.");
}
}

void UlMacCtrlHeader_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: {
    UlMacCtrlHeader_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 @RLCMAC_Types.UlMacCtrlHeader 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) payload__type().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) retry().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(), "payload_type")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          payload__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(), "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(), "retry")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          retry().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 @RLCMAC_Types.UlMacCtrlHeader: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    UlMacCtrlHeader_template* precondition = new UlMacCtrlHeader_template;
    precondition->set_param(*param.get_elem(0));
    UlMacCtrlHeader_template* implied_template = new UlMacCtrlHeader_template;
    implied_template->set_param(*param.get_elem(1));
    *this = UlMacCtrlHeader_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.UlMacCtrlHeader");
  }
  is_ifpresent = param.get_ifpresent();
}

void UlMacCtrlHeader_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__type.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.UlMacCtrlHeader");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.UlMacCtrlHeader");
single_value->field_retry.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.UlMacCtrlHeader");
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 : "@RLCMAC_Types.UlMacCtrlHeader");
}

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

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

RlcmacUlCtrlBlock::RlcmacUlCtrlBlock()
{
}

RlcmacUlCtrlBlock::RlcmacUlCtrlBlock(const UlMacCtrlHeader& par_mac__hdr,
    const RLCMAC__CSN1__Types::RlcmacUlCtrlMsg& par_payload)
  :   field_mac__hdr(par_mac__hdr),
  field_payload(par_payload)
{
}

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

void RlcmacUlCtrlBlock::clean_up()
{
field_mac__hdr.clean_up();
field_payload.clean_up();
}

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

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

boolean RlcmacUlCtrlBlock::is_bound() const
{
return (field_mac__hdr.is_bound())
  || (field_payload.is_bound());
}
boolean RlcmacUlCtrlBlock::is_value() const
{
return field_mac__hdr.is_value()
  && field_payload.is_value();
}
void RlcmacUlCtrlBlock::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ mac_hdr := ");
field_mac__hdr.log();
TTCN_Logger::log_event_str(", payload := ");
field_payload.log();
TTCN_Logger::log_event_str(" }");
}

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

void RlcmacUlCtrlBlock::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 @RLCMAC_Types.RlcmacUlCtrlBlock 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) mac__hdr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) 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(), "mac_hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mac__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(), "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 @RLCMAC_Types.RlcmacUlCtrlBlock: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.RlcmacUlCtrlBlock");
  }
}

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

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

void RlcmacUlCtrlBlock::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 RlcmacUlCtrlBlock::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 RlcmacUlCtrlBlock::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, RlcmacUlCtrlBlock_mac__hdr_descr_.raw->forceomit);
  decoded_field_length = field_mac__hdr.RAW_decode(RlcmacUlCtrlBlock_mac__hdr_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, RlcmacUlCtrlBlock_payload_descr_.raw->forceomit);
  decoded_field_length = field_payload.RAW_decode(RlcmacUlCtrlBlock_payload_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 RlcmacUlCtrlBlock::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, RlcmacUlCtrlBlock_mac__hdr_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RlcmacUlCtrlBlock_payload_descr_.raw);
  encoded_length += field_mac__hdr.RAW_encode(RlcmacUlCtrlBlock_mac__hdr_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_payload.RAW_encode(RlcmacUlCtrlBlock_payload_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct RlcmacUlCtrlBlock_template::single_value_struct {
UlMacCtrlHeader_template field_mac__hdr;
RLCMAC__CSN1__Types::RlcmacUlCtrlMsg_template field_payload;
};

void RlcmacUlCtrlBlock_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_mac__hdr = ANY_VALUE;
single_value->field_payload = ANY_VALUE;
}
}
}

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

void RlcmacUlCtrlBlock_template::copy_template(const RlcmacUlCtrlBlock_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.mac__hdr().get_selection()) {
single_value->field_mac__hdr = other_value.mac__hdr();
} else {
single_value->field_mac__hdr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.payload().get_selection()) {
single_value->field_payload = other_value.payload();
} else {
single_value->field_payload.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new RlcmacUlCtrlBlock_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 RlcmacUlCtrlBlock_template(*other_value.implication_.precondition);
implication_.implied_template = new RlcmacUlCtrlBlock_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 @RLCMAC_Types.RlcmacUlCtrlBlock.");
break;
}
set_selection(other_value);
}

RlcmacUlCtrlBlock_template::RlcmacUlCtrlBlock_template()
{
}

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

RlcmacUlCtrlBlock_template::RlcmacUlCtrlBlock_template(const RlcmacUlCtrlBlock& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean RlcmacUlCtrlBlock_template::match(const RlcmacUlCtrlBlock& 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.mac__hdr().is_bound()) return FALSE;
if(!single_value->field_mac__hdr.match(other_value.mac__hdr(), legacy))return FALSE;
if(!other_value.payload().is_bound()) return FALSE;
if(!single_value->field_payload.match(other_value.payload(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @RLCMAC_Types.RlcmacUlCtrlBlock.");
}
return FALSE;
}

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

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

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

RlcmacUlCtrlBlock RlcmacUlCtrlBlock_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 @RLCMAC_Types.RlcmacUlCtrlBlock.");
RlcmacUlCtrlBlock ret_val;
if (single_value->field_mac__hdr.is_bound()) {
ret_val.mac__hdr() = single_value->field_mac__hdr.valueof();
}
if (single_value->field_payload.is_bound()) {
ret_val.payload() = single_value->field_payload.valueof();
}
return ret_val;
}

void RlcmacUlCtrlBlock_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 @RLCMAC_Types.RlcmacUlCtrlBlock.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RlcmacUlCtrlBlock_template[list_length];
}

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

UlMacCtrlHeader_template& RlcmacUlCtrlBlock_template::mac__hdr()
{
set_specific();
return single_value->field_mac__hdr;
}

const UlMacCtrlHeader_template& RlcmacUlCtrlBlock_template::mac__hdr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mac_hdr of a non-specific template of type @RLCMAC_Types.RlcmacUlCtrlBlock.");
return single_value->field_mac__hdr;
}

RLCMAC__CSN1__Types::RlcmacUlCtrlMsg_template& RlcmacUlCtrlBlock_template::payload()
{
set_specific();
return single_value->field_payload;
}

const RLCMAC__CSN1__Types::RlcmacUlCtrlMsg_template& RlcmacUlCtrlBlock_template::payload() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field payload of a non-specific template of type @RLCMAC_Types.RlcmacUlCtrlBlock.");
return single_value->field_payload;
}

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

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

void RlcmacUlCtrlBlock_template::log_match(const RlcmacUlCtrlBlock& 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_mac__hdr.match(match_value.mac__hdr(), legacy)){
TTCN_Logger::log_logmatch_info(".mac_hdr");
single_value->field_mac__hdr.log_match(match_value.mac__hdr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_payload.match(match_value.payload(), legacy)){
TTCN_Logger::log_logmatch_info(".payload");
single_value->field_payload.log_match(match_value.payload(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ mac_hdr := ");
single_value->field_mac__hdr.log_match(match_value.mac__hdr(), legacy);
TTCN_Logger::log_event_str(", payload := ");
single_value->field_payload.log_match(match_value.payload(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void RlcmacUlCtrlBlock_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (mac__hdr().is_bound()) mac__hdr().set_implicit_omit();
if (payload().is_bound()) payload().set_implicit_omit();
}

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

void RlcmacUlCtrlBlock_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_mac__hdr.decode_text(text_buf);
single_value->field_payload.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new RlcmacUlCtrlBlock_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 @RLCMAC_Types.RlcmacUlCtrlBlock.");
}
}

void RlcmacUlCtrlBlock_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: {
    RlcmacUlCtrlBlock_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 @RLCMAC_Types.RlcmacUlCtrlBlock 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) mac__hdr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) 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(), "mac_hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mac__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(), "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 @RLCMAC_Types.RlcmacUlCtrlBlock: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    RlcmacUlCtrlBlock_template* precondition = new RlcmacUlCtrlBlock_template;
    precondition->set_param(*param.get_elem(0));
    RlcmacUlCtrlBlock_template* implied_template = new RlcmacUlCtrlBlock_template;
    implied_template->set_param(*param.get_elem(1));
    *this = RlcmacUlCtrlBlock_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.RlcmacUlCtrlBlock");
  }
  is_ifpresent = param.get_ifpresent();
}

void RlcmacUlCtrlBlock_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_mac__hdr.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacUlCtrlBlock");
single_value->field_payload.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacUlCtrlBlock");
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 : "@RLCMAC_Types.RlcmacUlCtrlBlock");
}

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

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

LlcBlockHdr::LlcBlockHdr()
{
}

LlcBlockHdr::LlcBlockHdr(const INTEGER& par_length__ind,
    const BOOLEAN& par_more,
    const BOOLEAN& par_e)
  :   field_length__ind(par_length__ind),
  field_more(par_more),
  field_e(par_e)
{
}

LlcBlockHdr::LlcBlockHdr(const LlcBlockHdr& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.LlcBlockHdr.");
if (other_value.length__ind().is_bound()) field_length__ind = other_value.length__ind();
else field_length__ind.clean_up();
if (other_value.more().is_bound()) field_more = other_value.more();
else field_more.clean_up();
if (other_value.e().is_bound()) field_e = other_value.e();
else field_e.clean_up();
}

void LlcBlockHdr::clean_up()
{
field_length__ind.clean_up();
field_more.clean_up();
field_e.clean_up();
}

const TTCN_Typedescriptor_t* LlcBlockHdr::get_descriptor() const { return &LlcBlockHdr_descr_; }
LlcBlockHdr& LlcBlockHdr::operator=(const LlcBlockHdr& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.LlcBlockHdr.");
  if (other_value.length__ind().is_bound()) field_length__ind = other_value.length__ind();
  else field_length__ind.clean_up();
  if (other_value.more().is_bound()) field_more = other_value.more();
  else field_more.clean_up();
  if (other_value.e().is_bound()) field_e = other_value.e();
  else field_e.clean_up();
}
return *this;
}

boolean LlcBlockHdr::operator==(const LlcBlockHdr& other_value) const
{
return field_length__ind==other_value.field_length__ind
  && field_more==other_value.field_more
  && field_e==other_value.field_e;
}

boolean LlcBlockHdr::is_bound() const
{
return (field_length__ind.is_bound())
  || (field_more.is_bound())
  || (field_e.is_bound());
}
boolean LlcBlockHdr::is_value() const
{
return field_length__ind.is_value()
  && field_more.is_value()
  && field_e.is_value();
}
void LlcBlockHdr::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ length_ind := ");
field_length__ind.log();
TTCN_Logger::log_event_str(", more := ");
field_more.log();
TTCN_Logger::log_event_str(", e := ");
field_e.log();
TTCN_Logger::log_event_str(" }");
}

void LlcBlockHdr::set_implicit_omit()
{
if (length__ind().is_bound()) length__ind().set_implicit_omit();
if (more().is_bound()) more().set_implicit_omit();
if (e().is_bound()) e().set_implicit_omit();
}

void LlcBlockHdr::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 @RLCMAC_Types.LlcBlockHdr 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) length__ind().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) more().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) e().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(), "length_ind")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          length__ind().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "more")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          more().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "e")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          e().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @RLCMAC_Types.LlcBlockHdr: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.LlcBlockHdr");
  }
}

void LlcBlockHdr::encode_text(Text_Buf& text_buf) const
{
field_length__ind.encode_text(text_buf);
field_more.encode_text(text_buf);
field_e.encode_text(text_buf);
}

void LlcBlockHdr::decode_text(Text_Buf& text_buf)
{
field_length__ind.decode_text(text_buf);
field_more.decode_text(text_buf);
field_e.decode_text(text_buf);
}

void LlcBlockHdr::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 LlcBlockHdr::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 LlcBlockHdr::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, LlcBlockHdr_length__ind_descr_.raw->forceomit);
  decoded_field_length = field_length__ind.RAW_decode(LlcBlockHdr_length__ind_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, LlcBlockHdr_more_descr_.raw->forceomit);
  decoded_field_length = field_more.RAW_decode(LlcBlockHdr_more_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, LlcBlockHdr_e_descr_.raw->forceomit);
  decoded_field_length = field_e.RAW_decode(LlcBlockHdr_e_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 LlcBlockHdr::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, LlcBlockHdr_length__ind_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, LlcBlockHdr_more_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, LlcBlockHdr_e_descr_.raw);
  encoded_length += field_length__ind.RAW_encode(LlcBlockHdr_length__ind_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_more.RAW_encode(LlcBlockHdr_more_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_e.RAW_encode(LlcBlockHdr_e_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct LlcBlockHdr_template::single_value_struct {
INTEGER_template field_length__ind;
BOOLEAN_template field_more;
BOOLEAN_template field_e;
};

void LlcBlockHdr_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_length__ind = ANY_VALUE;
single_value->field_more = ANY_VALUE;
single_value->field_e = ANY_VALUE;
}
}
}

void LlcBlockHdr_template::copy_value(const LlcBlockHdr& other_value)
{
single_value = new single_value_struct;
if (other_value.length__ind().is_bound()) {
  single_value->field_length__ind = other_value.length__ind();
} else {
  single_value->field_length__ind.clean_up();
}
if (other_value.more().is_bound()) {
  single_value->field_more = other_value.more();
} else {
  single_value->field_more.clean_up();
}
if (other_value.e().is_bound()) {
  single_value->field_e = other_value.e();
} else {
  single_value->field_e.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void LlcBlockHdr_template::copy_template(const LlcBlockHdr_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.length__ind().get_selection()) {
single_value->field_length__ind = other_value.length__ind();
} else {
single_value->field_length__ind.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.more().get_selection()) {
single_value->field_more = other_value.more();
} else {
single_value->field_more.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.e().get_selection()) {
single_value->field_e = other_value.e();
} else {
single_value->field_e.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 LlcBlockHdr_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 LlcBlockHdr_template(*other_value.implication_.precondition);
implication_.implied_template = new LlcBlockHdr_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 @RLCMAC_Types.LlcBlockHdr.");
break;
}
set_selection(other_value);
}

LlcBlockHdr_template::LlcBlockHdr_template()
{
}

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

LlcBlockHdr_template::LlcBlockHdr_template(const LlcBlockHdr& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean LlcBlockHdr_template::match(const LlcBlockHdr& 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.length__ind().is_bound()) return FALSE;
if(!single_value->field_length__ind.match(other_value.length__ind(), legacy))return FALSE;
if(!other_value.more().is_bound()) return FALSE;
if(!single_value->field_more.match(other_value.more(), legacy))return FALSE;
if(!other_value.e().is_bound()) return FALSE;
if(!single_value->field_e.match(other_value.e(), 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 @RLCMAC_Types.LlcBlockHdr.");
}
return FALSE;
}

boolean LlcBlockHdr_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_length__ind.is_bound()
 || single_value->field_more.is_bound()
 || single_value->field_e.is_bound();
}

boolean LlcBlockHdr_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_length__ind.is_value()
 && single_value->field_more.is_value()
 && single_value->field_e.is_value();
}

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

LlcBlockHdr LlcBlockHdr_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 @RLCMAC_Types.LlcBlockHdr.");
LlcBlockHdr ret_val;
if (single_value->field_length__ind.is_bound()) {
ret_val.length__ind() = single_value->field_length__ind.valueof();
}
if (single_value->field_more.is_bound()) {
ret_val.more() = single_value->field_more.valueof();
}
if (single_value->field_e.is_bound()) {
ret_val.e() = single_value->field_e.valueof();
}
return ret_val;
}

void LlcBlockHdr_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 @RLCMAC_Types.LlcBlockHdr.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new LlcBlockHdr_template[list_length];
}

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

INTEGER_template& LlcBlockHdr_template::length__ind()
{
set_specific();
return single_value->field_length__ind;
}

const INTEGER_template& LlcBlockHdr_template::length__ind() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field length_ind of a non-specific template of type @RLCMAC_Types.LlcBlockHdr.");
return single_value->field_length__ind;
}

BOOLEAN_template& LlcBlockHdr_template::more()
{
set_specific();
return single_value->field_more;
}

const BOOLEAN_template& LlcBlockHdr_template::more() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field more of a non-specific template of type @RLCMAC_Types.LlcBlockHdr.");
return single_value->field_more;
}

BOOLEAN_template& LlcBlockHdr_template::e()
{
set_specific();
return single_value->field_e;
}

const BOOLEAN_template& LlcBlockHdr_template::e() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field e of a non-specific template of type @RLCMAC_Types.LlcBlockHdr.");
return single_value->field_e;
}

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

void LlcBlockHdr_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ length_ind := ");
single_value->field_length__ind.log();
TTCN_Logger::log_event_str(", more := ");
single_value->field_more.log();
TTCN_Logger::log_event_str(", e := ");
single_value->field_e.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 LlcBlockHdr_template::log_match(const LlcBlockHdr& 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_length__ind.match(match_value.length__ind(), legacy)){
TTCN_Logger::log_logmatch_info(".length_ind");
single_value->field_length__ind.log_match(match_value.length__ind(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_more.match(match_value.more(), legacy)){
TTCN_Logger::log_logmatch_info(".more");
single_value->field_more.log_match(match_value.more(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_e.match(match_value.e(), legacy)){
TTCN_Logger::log_logmatch_info(".e");
single_value->field_e.log_match(match_value.e(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}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("{ length_ind := ");
single_value->field_length__ind.log_match(match_value.length__ind(), legacy);
TTCN_Logger::log_event_str(", more := ");
single_value->field_more.log_match(match_value.more(), legacy);
TTCN_Logger::log_event_str(", e := ");
single_value->field_e.log_match(match_value.e(), 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 LlcBlockHdr_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (length__ind().is_bound()) length__ind().set_implicit_omit();
if (more().is_bound()) more().set_implicit_omit();
if (e().is_bound()) e().set_implicit_omit();
}

void LlcBlockHdr_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_length__ind.encode_text(text_buf);
single_value->field_more.encode_text(text_buf);
single_value->field_e.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 @RLCMAC_Types.LlcBlockHdr.");
}
}

void LlcBlockHdr_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_length__ind.decode_text(text_buf);
single_value->field_more.decode_text(text_buf);
single_value->field_e.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 LlcBlockHdr_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 @RLCMAC_Types.LlcBlockHdr.");
}
}

void LlcBlockHdr_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: {
    LlcBlockHdr_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 @RLCMAC_Types.LlcBlockHdr 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) length__ind().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) more().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) e().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(), "length_ind")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          length__ind().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "more")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          more().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "e")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          e().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @RLCMAC_Types.LlcBlockHdr: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    LlcBlockHdr_template* precondition = new LlcBlockHdr_template;
    precondition->set_param(*param.get_elem(0));
    LlcBlockHdr_template* implied_template = new LlcBlockHdr_template;
    implied_template->set_param(*param.get_elem(1));
    *this = LlcBlockHdr_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.LlcBlockHdr");
  }
  is_ifpresent = param.get_ifpresent();
}

void LlcBlockHdr_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_length__ind.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.LlcBlockHdr");
single_value->field_more.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.LlcBlockHdr");
single_value->field_e.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.LlcBlockHdr");
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 : "@RLCMAC_Types.LlcBlockHdr");
}

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

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

LlcBlock::LlcBlock()
{
}

LlcBlock::LlcBlock(const OPTIONAL< LlcBlockHdr >& par_hdr,
    const OCTETSTRING& par_payload)
  :   field_hdr(par_hdr),
  field_payload(par_payload)
{
}

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

void LlcBlock::clean_up()
{
field_hdr.clean_up();
field_payload.clean_up();
}

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

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

boolean LlcBlock::is_bound() const
{
return (OPTIONAL_OMIT == field_hdr.get_selection() || field_hdr.is_bound())
  || (field_payload.is_bound());
}
boolean LlcBlock::is_value() const
{
return (OPTIONAL_OMIT == field_hdr.get_selection() || field_hdr.is_value())
  && field_payload.is_value();
}
int LlcBlock::size_of() const
{
  int ret_val = 1;
  if (field_hdr.ispresent()) ret_val++;
  return ret_val;
}

void LlcBlock::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(", payload := ");
field_payload.log();
TTCN_Logger::log_event_str(" }");
}

void LlcBlock::set_implicit_omit()
{
if (!hdr().is_bound()) hdr() = OMIT_VALUE;
else hdr().set_implicit_omit();
if (payload().is_bound()) payload().set_implicit_omit();
}

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

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

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

void LlcBlock::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 LlcBlock::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 LlcBlock::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_hdr = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_0_force_omit(0, force_omit, LlcBlock_hdr_descr_.raw->forceomit);
  decoded_field_length = field_hdr().RAW_decode(LlcBlock_hdr_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 1) {
  field_hdr = 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_hdr=OMIT_VALUE;
  RAW_Force_Omit field_1_force_omit(1, force_omit, LlcBlock_payload_descr_.raw->forceomit);
  decoded_field_length = field_payload.RAW_decode(LlcBlock_payload_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 LlcBlock::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_hdr.ispresent()) {
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, LlcBlock_hdr_descr_.raw);
  }
  else myleaf.body.node.nodes[0] = NULL;
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, LlcBlock_payload_descr_.raw);
  if (field_hdr.ispresent()) {
  encoded_length += field_hdr().RAW_encode(LlcBlock_hdr_descr_, *myleaf.body.node.nodes[0]);
  }
  encoded_length += field_payload.RAW_encode(LlcBlock_payload_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct LlcBlock_template::single_value_struct {
LlcBlockHdr_template field_hdr;
OCTETSTRING_template field_payload;
};

void LlcBlock_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_OR_OMIT;
single_value->field_payload = ANY_VALUE;
}
}
}

void LlcBlock_template::copy_value(const LlcBlock& other_value)
{
single_value = new single_value_struct;
if (other_value.hdr().is_bound()) {
  if (other_value.hdr().ispresent()) single_value->field_hdr = other_value.hdr()();
  else single_value->field_hdr = OMIT_VALUE;
} else {
  single_value->field_hdr.clean_up();
}
if (other_value.payload().is_bound()) {
  single_value->field_payload = other_value.payload();
} else {
  single_value->field_payload.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void LlcBlock_template::copy_template(const LlcBlock_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.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 LlcBlock_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 LlcBlock_template(*other_value.implication_.precondition);
implication_.implied_template = new LlcBlock_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 @RLCMAC_Types.LlcBlock.");
break;
}
set_selection(other_value);
}

LlcBlock_template::LlcBlock_template()
{
}

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

LlcBlock_template::LlcBlock_template(const LlcBlock& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean LlcBlock_template::match(const LlcBlock& 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((other_value.hdr().ispresent() ? !single_value->field_hdr.match((const LlcBlockHdr&)other_value.hdr(), legacy) : !single_value->field_hdr.match_omit(legacy)))return FALSE;
if(!other_value.payload().is_bound()) return FALSE;
if(!single_value->field_payload.match(other_value.payload(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @RLCMAC_Types.LlcBlock.");
}
return FALSE;
}

boolean LlcBlock_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_omit() || single_value->field_hdr.is_bound())
 || single_value->field_payload.is_bound();
}

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

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

LlcBlock LlcBlock_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 @RLCMAC_Types.LlcBlock.");
LlcBlock ret_val;
if (single_value->field_hdr.is_omit()) ret_val.hdr() = OMIT_VALUE;
else if (single_value->field_hdr.is_bound()) {
ret_val.hdr() = single_value->field_hdr.valueof();
}
if (single_value->field_payload.is_bound()) {
ret_val.payload() = single_value->field_payload.valueof();
}
return ret_val;
}

void LlcBlock_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 @RLCMAC_Types.LlcBlock.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new LlcBlock_template[list_length];
}

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

LlcBlockHdr_template& LlcBlock_template::hdr()
{
set_specific();
return single_value->field_hdr;
}

const LlcBlockHdr_template& LlcBlock_template::hdr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field hdr of a non-specific template of type @RLCMAC_Types.LlcBlock.");
return single_value->field_hdr;
}

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

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

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

void LlcBlock_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(", 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 LlcBlock_template::log_match(const LlcBlock& 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.hdr().ispresent()){
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);
}
} else {
if (!single_value->field_hdr.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".hdr := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_hdr.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_payload.match(match_value.payload(), legacy)){
TTCN_Logger::log_logmatch_info(".payload");
single_value->field_payload.log_match(match_value.payload(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ hdr := ");
if (match_value.hdr().ispresent()) {
single_value->field_hdr.log_match(match_value.hdr(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_hdr.log();
if (single_value->field_hdr.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
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 LlcBlock_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (!hdr().is_bound()) hdr() = OMIT_VALUE;
else hdr().set_implicit_omit();
if (payload().is_bound()) payload().set_implicit_omit();
}

void LlcBlock_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_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 @RLCMAC_Types.LlcBlock.");
}
}

void LlcBlock_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_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 LlcBlock_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 @RLCMAC_Types.LlcBlock.");
}
}

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

void LlcBlock_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 : "@RLCMAC_Types.LlcBlock");
single_value->field_payload.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.LlcBlock");
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 : "@RLCMAC_Types.LlcBlock");
}

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

boolean LlcBlock_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 LlcBlock LlcBlocks::UNBOUND_ELEM;
LlcBlocks::LlcBlocks()
{
val_ptr = NULL;
}

LlcBlocks::LlcBlocks(null_type)
{
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
}

LlcBlocks::LlcBlocks(const LlcBlocks& other_value)
{
if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.LlcBlocks.");
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}

LlcBlocks::~LlcBlocks()
{
clean_up();
if (val_ptr != NULL) val_ptr = NULL;
}

void LlcBlocks::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.");
}
}

LlcBlocks& LlcBlocks::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;
}

LlcBlocks& LlcBlocks::operator=(const LlcBlocks& other_value)
{
if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @RLCMAC_Types.LlcBlocks.");
if (this != &other_value) {
clean_up();
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}
return *this;
}

boolean LlcBlocks::operator==(null_type) const
{
if (val_ptr == NULL)
TTCN_error("The left operand of comparison is an unbound value of type @RLCMAC_Types.LlcBlocks.");
return val_ptr->n_elements == 0 ;
}

boolean LlcBlocks::operator==(const LlcBlocks& other_value) const
{
if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @RLCMAC_Types.LlcBlocks.");
if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @RLCMAC_Types.LlcBlocks.");
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;
}

LlcBlock& LlcBlocks::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of type @RLCMAC_Types.LlcBlocks 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 = (LlcBlock**)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 LlcBlock(*(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 LlcBlock;
}
return *val_ptr->value_elements[index_value];
}

LlcBlock& LlcBlocks::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @RLCMAC_Types.LlcBlocks.");
return (*this)[(int)index_value];
}

const LlcBlock& LlcBlocks::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @RLCMAC_Types.LlcBlocks.");
if (index_value < 0) TTCN_error("Accessing an element of type @RLCMAC_Types.LlcBlocks using a negative index: %d.", index_value);
if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @RLCMAC_Types.LlcBlocks: 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 LlcBlock& LlcBlocks::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @RLCMAC_Types.LlcBlocks.");
return (*this)[(int)index_value];
}

LlcBlocks LlcBlocks::operator<<=(int rotate_count) const
{
return *this >>= (-rotate_count);
}

LlcBlocks LlcBlocks::operator<<=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate left operator.");
return *this >>= (int)(-rotate_count);
}

LlcBlocks LlcBlocks::operator>>=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate right operator.");
return *this >>= (int)rotate_count;
}

LlcBlocks LlcBlocks::operator>>=(int rotate_count) const
{
if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @RLCMAC_Types.LlcBlocks.");
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;
LlcBlocks 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 LlcBlock(*val_ptr->value_elements[i]);
}
}
return ret_val;
}

LlcBlocks LlcBlocks::operator+(const LlcBlocks& other_value) const
{
if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @RLCMAC_Types.LlcBlocks concatenation.");
if (val_ptr->n_elements == 0) return other_value;
if (other_value.val_ptr->n_elements == 0) return *this;
LlcBlocks 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 LlcBlock(*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 LlcBlock(*other_value.val_ptr->value_elements[i]);
}
}
return ret_val;
}

LlcBlocks LlcBlocks::substr(int index, int returncount) const
{
if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @RLCMAC_Types.LlcBlocks.");
check_substr_arguments(val_ptr->n_elements, index, returncount, "@RLCMAC_Types.LlcBlocks","element");
LlcBlocks 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 LlcBlock(*val_ptr->value_elements[i+index]);
}
}
return ret_val;
}

LlcBlocks LlcBlocks::replace(int index, int len, const LlcBlocks& repl) const
{
if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @RLCMAC_Types.LlcBlocks.");
if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @RLCMAC_Types.LlcBlocks.");
check_replace_arguments(val_ptr->n_elements, index, len, "@RLCMAC_Types.LlcBlocks","element");
LlcBlocks 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 LlcBlock(*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 LlcBlock(*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 LlcBlock(*val_ptr->value_elements[index+i+len]);
}
}
return ret_val;
}

LlcBlocks LlcBlocks::replace(int index, int len, const LlcBlocks_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 LlcBlocks::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @RLCMAC_Types.LlcBlocks.");
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 = (LlcBlock**)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 LlcBlock(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (LlcBlock**)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 @RLCMAC_Types.LlcBlocks: %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 = (LlcBlock**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}

boolean LlcBlocks::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 LlcBlocks::size_of() const
{
if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @RLCMAC_Types.LlcBlocks.");
return val_ptr->n_elements;
}

int LlcBlocks::lengthof() const
{
if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @RLCMAC_Types.LlcBlocks.");
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 LlcBlocks::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 LlcBlocks::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 LlcBlocks::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", "@RLCMAC_Types.LlcBlocks");
    }
    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", "@RLCMAC_Types.LlcBlocks");
    }
    break;
  default:
    TTCN_error("Internal error: Unknown operation type.");
  }
}

void LlcBlocks::encode_text(Text_Buf& text_buf) const
{
if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @RLCMAC_Types.LlcBlocks.");
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 LlcBlocks::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 @RLCMAC_Types.LlcBlocks.");
val_ptr->value_elements = (LlcBlock**)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 LlcBlock;
val_ptr->value_elements[elem_count]->decode_text(text_buf);
}
}

void LlcBlocks::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 LlcBlocks::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 LlcBlocks::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 LlcBlocks::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 LlcBlocks_template::copy_value(const LlcBlocks& other_value)
{
if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @RLCMAC_Types.LlcBlocks with an unbound value.");
single_value.n_elements = other_value.size_of();
single_value.value_elements = (LlcBlock_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 LlcBlock_template(other_value[elem_count]);
} else {
single_value.value_elements[elem_count] = new LlcBlock_template;
}
}
set_selection(SPECIFIC_VALUE);
}

void LlcBlocks_template::copy_template(const LlcBlocks_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 = (LlcBlock_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 LlcBlock_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new LlcBlock_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 LlcBlocks_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 LlcBlocks_template(*other_value.implication_.precondition);
implication_.implied_template = new LlcBlocks_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 @RLCMAC_Types.LlcBlocks.");
break;
}
set_selection(other_value);
}

boolean LlcBlocks_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 LlcBlocks_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const LlcBlocks*)value_ptr)[value_index], legacy);
else return ((const LlcBlocks_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit();
}

LlcBlocks_template::LlcBlocks_template()
{
}

LlcBlocks_template::LlcBlocks_template(template_sel other_value)
 : Base_Record_Of_Template(other_value)
{
check_single_selection(other_value);
}

LlcBlocks_template::LlcBlocks_template(null_type)
 : Base_Record_Of_Template(SPECIFIC_VALUE)
{
single_value.n_elements = 0;
single_value.value_elements = NULL;
}

LlcBlocks_template::LlcBlocks_template(const LlcBlocks& other_value)
{
copy_value(other_value);
}

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

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

LlcBlocks_template::LlcBlocks_template(Dynamic_Match_Interface<LlcBlocks>* p_dyn_match)
 : Base_Record_Of_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<LlcBlocks>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

LlcBlocks_template::LlcBlocks_template(const LlcBlocks_template& other_value)
 : Base_Record_Of_Template()
{
copy_template(other_value);
}

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

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

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

LlcBlocks_template& LlcBlocks_template::operator=(null_type)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value.n_elements = 0;
single_value.value_elements = NULL;
return *this;
}

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

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

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

LlcBlock_template& LlcBlocks_template::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @RLCMAC_Types.LlcBlocks 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 @RLCMAC_Types.LlcBlocks.");
    break;
}
return *single_value.value_elements[index_value];
}

LlcBlock_template& LlcBlocks_template::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @RLCMAC_Types.LlcBlocks.");
return (*this)[(int)index_value];
}

const LlcBlock_template& LlcBlocks_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @RLCMAC_Types.LlcBlocks using a negative index: %d.", index_value);
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @RLCMAC_Types.LlcBlocks.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @RLCMAC_Types.LlcBlocks: 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 LlcBlock_template& LlcBlocks_template::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @RLCMAC_Types.LlcBlocks.");
return (*this)[(int)index_value];
}

void LlcBlocks_template::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @RLCMAC_Types.LlcBlocks.");
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 = (LlcBlock_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 LlcBlock_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 LlcBlock_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 = (LlcBlock_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}

int LlcBlocks_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 LlcBlocks_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 @RLCMAC_Types.LlcBlocks 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 @RLCMAC_Types.LlcBlocks 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 @RLCMAC_Types.LlcBlocks 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 @RLCMAC_Types.LlcBlocks 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 @RLCMAC_Types.LlcBlocks 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 @RLCMAC_Types.LlcBlocks containing complemented list.", op_name);
default:
  TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @RLCMAC_Types.LlcBlocks.", op_name);
}
return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @RLCMAC_Types.LlcBlocks");
}

boolean LlcBlocks_template::match(const LlcBlocks& 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 @RLCMAC_Types.LlcBlocks.");
}
return FALSE;
}

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

LlcBlocks LlcBlocks_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 @RLCMAC_Types.LlcBlocks.");
LlcBlocks 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;
}

LlcBlocks LlcBlocks_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);
}

LlcBlocks LlcBlocks_template::replace(int index, int len, const LlcBlocks_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());
}

LlcBlocks LlcBlocks_template::replace(int index, int len, const LlcBlocks& 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 LlcBlocks_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 LlcBlocks_template[list_length];
break;
default:
TTCN_error("Internal error: Setting an invalid type for a template of type @RLCMAC_Types.LlcBlocks.");
}
set_selection(template_type);
}

LlcBlocks_template& LlcBlocks_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 @RLCMAC_Types.LlcBlocks.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @RLCMAC_Types.LlcBlocks.");
return value_list.list_value[list_index];
}

void LlcBlocks_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 LlcBlocks_template::log_match(const LlcBlocks& 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 LlcBlocks_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 @RLCMAC_Types.LlcBlocks.");
}
}

void LlcBlocks_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 @RLCMAC_Types.LlcBlocks.");
single_value.value_elements = (LlcBlock_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 LlcBlock_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 LlcBlocks_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 @RLCMAC_Types.LlcBlocks.");
}
}

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

boolean LlcBlocks_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 LlcBlocks_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 LlcBlocks_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: {
    LlcBlocks_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: {
    LlcBlocks_template* precondition = new LlcBlocks_template;
    precondition->set_param(*param.get_elem(0));
    LlcBlocks_template* implied_template = new LlcBlocks_template;
    implied_template->set_param(*param.get_elem(1));
    *this = LlcBlocks_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record of template", "@RLCMAC_Types.LlcBlocks");
  }
  is_ifpresent = param.get_ifpresent();
  set_length_range(param);
}

void LlcBlocks_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 : "@RLCMAC_Types.LlcBlocks");
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 : "@RLCMAC_Types.LlcBlocks");
}

boolean LlcBlocks_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);
}
}
DlMacHdrDataExt::DlMacHdrDataExt()
{
}

DlMacHdrDataExt::DlMacHdrDataExt(const PowerReduction& par_pr,
    const BITSTRING& par_spare,
    const INTEGER& par_tfi,
    const BOOLEAN& par_fbi,
    const INTEGER& par_bsn,
    const BOOLEAN& par_e)
  :   field_pr(par_pr),
  field_spare(par_spare),
  field_tfi(par_tfi),
  field_fbi(par_fbi),
  field_bsn(par_bsn),
  field_e(par_e)
{
}

DlMacHdrDataExt::DlMacHdrDataExt(const DlMacHdrDataExt& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.DlMacHdrDataExt.");
if (other_value.pr().is_bound()) field_pr = other_value.pr();
else field_pr.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.tfi().is_bound()) field_tfi = other_value.tfi();
else field_tfi.clean_up();
if (other_value.fbi().is_bound()) field_fbi = other_value.fbi();
else field_fbi.clean_up();
if (other_value.bsn().is_bound()) field_bsn = other_value.bsn();
else field_bsn.clean_up();
if (other_value.e().is_bound()) field_e = other_value.e();
else field_e.clean_up();
}

void DlMacHdrDataExt::clean_up()
{
field_pr.clean_up();
field_spare.clean_up();
field_tfi.clean_up();
field_fbi.clean_up();
field_bsn.clean_up();
field_e.clean_up();
}

const TTCN_Typedescriptor_t* DlMacHdrDataExt::get_descriptor() const { return &DlMacHdrDataExt_descr_; }
DlMacHdrDataExt& DlMacHdrDataExt::operator=(const DlMacHdrDataExt& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.DlMacHdrDataExt.");
  if (other_value.pr().is_bound()) field_pr = other_value.pr();
  else field_pr.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.tfi().is_bound()) field_tfi = other_value.tfi();
  else field_tfi.clean_up();
  if (other_value.fbi().is_bound()) field_fbi = other_value.fbi();
  else field_fbi.clean_up();
  if (other_value.bsn().is_bound()) field_bsn = other_value.bsn();
  else field_bsn.clean_up();
  if (other_value.e().is_bound()) field_e = other_value.e();
  else field_e.clean_up();
}
return *this;
}

boolean DlMacHdrDataExt::operator==(const DlMacHdrDataExt& other_value) const
{
return field_pr==other_value.field_pr
  && field_spare==other_value.field_spare
  && field_tfi==other_value.field_tfi
  && field_fbi==other_value.field_fbi
  && field_bsn==other_value.field_bsn
  && field_e==other_value.field_e;
}

boolean DlMacHdrDataExt::is_bound() const
{
return (field_pr.is_bound())
  || (field_spare.is_bound())
  || (field_tfi.is_bound())
  || (field_fbi.is_bound())
  || (field_bsn.is_bound())
  || (field_e.is_bound());
}
boolean DlMacHdrDataExt::is_value() const
{
return field_pr.is_value()
  && field_spare.is_value()
  && field_tfi.is_value()
  && field_fbi.is_value()
  && field_bsn.is_value()
  && field_e.is_value();
}
void DlMacHdrDataExt::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ pr := ");
field_pr.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(", tfi := ");
field_tfi.log();
TTCN_Logger::log_event_str(", fbi := ");
field_fbi.log();
TTCN_Logger::log_event_str(", bsn := ");
field_bsn.log();
TTCN_Logger::log_event_str(", e := ");
field_e.log();
TTCN_Logger::log_event_str(" }");
}

void DlMacHdrDataExt::set_implicit_omit()
{
if (pr().is_bound()) pr().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (tfi().is_bound()) tfi().set_implicit_omit();
if (fbi().is_bound()) fbi().set_implicit_omit();
if (bsn().is_bound()) bsn().set_implicit_omit();
if (e().is_bound()) e().set_implicit_omit();
}

void DlMacHdrDataExt::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 (6<param.get_size()) {
      param.error("record value of type @RLCMAC_Types.DlMacHdrDataExt has 6 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) pr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) tfi().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) fbi().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) bsn().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) e().set_param(*param.get_elem(5));
    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(), "pr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pr().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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(), "tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          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(), "fbi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fbi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "bsn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bsn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "e")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          e().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @RLCMAC_Types.DlMacHdrDataExt: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.DlMacHdrDataExt");
  }
}

void DlMacHdrDataExt::encode_text(Text_Buf& text_buf) const
{
field_pr.encode_text(text_buf);
field_spare.encode_text(text_buf);
field_tfi.encode_text(text_buf);
field_fbi.encode_text(text_buf);
field_bsn.encode_text(text_buf);
field_e.encode_text(text_buf);
}

void DlMacHdrDataExt::decode_text(Text_Buf& text_buf)
{
field_pr.decode_text(text_buf);
field_spare.decode_text(text_buf);
field_tfi.decode_text(text_buf);
field_fbi.decode_text(text_buf);
field_bsn.decode_text(text_buf);
field_e.decode_text(text_buf);
}

void DlMacHdrDataExt::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 DlMacHdrDataExt::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 DlMacHdrDataExt::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, DlMacHdrDataExt_pr_descr_.raw->forceomit);
  decoded_field_length = field_pr.RAW_decode(DlMacHdrDataExt_pr_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, DlMacHdrDataExt_spare_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(DlMacHdrDataExt_spare_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_2_force_omit(2, force_omit, DlMacHdrDataExt_tfi_descr_.raw->forceomit);
  decoded_field_length = field_tfi.RAW_decode(DlMacHdrDataExt_tfi_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, DlMacHdrDataExt_fbi_descr_.raw->forceomit);
  decoded_field_length = field_fbi.RAW_decode(DlMacHdrDataExt_fbi_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, DlMacHdrDataExt_bsn_descr_.raw->forceomit);
  decoded_field_length = field_bsn.RAW_decode(DlMacHdrDataExt_bsn_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, DlMacHdrDataExt_e_descr_.raw->forceomit);
  decoded_field_length = field_e.RAW_decode(DlMacHdrDataExt_e_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());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int DlMacHdrDataExt::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 = 6;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(6);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, DlMacHdrDataExt_pr_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, DlMacHdrDataExt_spare_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, DlMacHdrDataExt_tfi_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, DlMacHdrDataExt_fbi_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, DlMacHdrDataExt_bsn_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, DlMacHdrDataExt_e_descr_.raw);
  encoded_length += field_pr.RAW_encode(DlMacHdrDataExt_pr_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_spare.RAW_encode(DlMacHdrDataExt_spare_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_tfi.RAW_encode(DlMacHdrDataExt_tfi_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_fbi.RAW_encode(DlMacHdrDataExt_fbi_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_bsn.RAW_encode(DlMacHdrDataExt_bsn_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_e.RAW_encode(DlMacHdrDataExt_e_descr_, *myleaf.body.node.nodes[5]);
  return myleaf.length = encoded_length;
}

struct DlMacHdrDataExt_template::single_value_struct {
PowerReduction_template field_pr;
BITSTRING_template field_spare;
INTEGER_template field_tfi;
BOOLEAN_template field_fbi;
INTEGER_template field_bsn;
BOOLEAN_template field_e;
};

void DlMacHdrDataExt_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_pr = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
single_value->field_tfi = ANY_VALUE;
single_value->field_fbi = ANY_VALUE;
single_value->field_bsn = ANY_VALUE;
single_value->field_e = ANY_VALUE;
}
}
}

void DlMacHdrDataExt_template::copy_value(const DlMacHdrDataExt& other_value)
{
single_value = new single_value_struct;
if (other_value.pr().is_bound()) {
  single_value->field_pr = other_value.pr();
} else {
  single_value->field_pr.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.tfi().is_bound()) {
  single_value->field_tfi = other_value.tfi();
} else {
  single_value->field_tfi.clean_up();
}
if (other_value.fbi().is_bound()) {
  single_value->field_fbi = other_value.fbi();
} else {
  single_value->field_fbi.clean_up();
}
if (other_value.bsn().is_bound()) {
  single_value->field_bsn = other_value.bsn();
} else {
  single_value->field_bsn.clean_up();
}
if (other_value.e().is_bound()) {
  single_value->field_e = other_value.e();
} else {
  single_value->field_e.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void DlMacHdrDataExt_template::copy_template(const DlMacHdrDataExt_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.pr().get_selection()) {
single_value->field_pr = other_value.pr();
} else {
single_value->field_pr.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.tfi().get_selection()) {
single_value->field_tfi = other_value.tfi();
} else {
single_value->field_tfi.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.fbi().get_selection()) {
single_value->field_fbi = other_value.fbi();
} else {
single_value->field_fbi.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.bsn().get_selection()) {
single_value->field_bsn = other_value.bsn();
} else {
single_value->field_bsn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.e().get_selection()) {
single_value->field_e = other_value.e();
} else {
single_value->field_e.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 DlMacHdrDataExt_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 DlMacHdrDataExt_template(*other_value.implication_.precondition);
implication_.implied_template = new DlMacHdrDataExt_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 @RLCMAC_Types.DlMacHdrDataExt.");
break;
}
set_selection(other_value);
}

DlMacHdrDataExt_template::DlMacHdrDataExt_template()
{
}

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

DlMacHdrDataExt_template::DlMacHdrDataExt_template(const DlMacHdrDataExt& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean DlMacHdrDataExt_template::match(const DlMacHdrDataExt& 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.pr().is_bound()) return FALSE;
if(!single_value->field_pr.match(other_value.pr(), 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.tfi().is_bound()) return FALSE;
if(!single_value->field_tfi.match(other_value.tfi(), legacy))return FALSE;
if(!other_value.fbi().is_bound()) return FALSE;
if(!single_value->field_fbi.match(other_value.fbi(), legacy))return FALSE;
if(!other_value.bsn().is_bound()) return FALSE;
if(!single_value->field_bsn.match(other_value.bsn(), legacy))return FALSE;
if(!other_value.e().is_bound()) return FALSE;
if(!single_value->field_e.match(other_value.e(), 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 @RLCMAC_Types.DlMacHdrDataExt.");
}
return FALSE;
}

boolean DlMacHdrDataExt_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_pr.is_bound()
 || single_value->field_spare.is_bound()
 || single_value->field_tfi.is_bound()
 || single_value->field_fbi.is_bound()
 || single_value->field_bsn.is_bound()
 || single_value->field_e.is_bound();
}

boolean DlMacHdrDataExt_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_pr.is_value()
 && single_value->field_spare.is_value()
 && single_value->field_tfi.is_value()
 && single_value->field_fbi.is_value()
 && single_value->field_bsn.is_value()
 && single_value->field_e.is_value();
}

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

DlMacHdrDataExt DlMacHdrDataExt_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 @RLCMAC_Types.DlMacHdrDataExt.");
DlMacHdrDataExt ret_val;
if (single_value->field_pr.is_bound()) {
ret_val.pr() = single_value->field_pr.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_tfi.is_bound()) {
ret_val.tfi() = single_value->field_tfi.valueof();
}
if (single_value->field_fbi.is_bound()) {
ret_val.fbi() = single_value->field_fbi.valueof();
}
if (single_value->field_bsn.is_bound()) {
ret_val.bsn() = single_value->field_bsn.valueof();
}
if (single_value->field_e.is_bound()) {
ret_val.e() = single_value->field_e.valueof();
}
return ret_val;
}

void DlMacHdrDataExt_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 @RLCMAC_Types.DlMacHdrDataExt.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new DlMacHdrDataExt_template[list_length];
}

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

PowerReduction_template& DlMacHdrDataExt_template::pr()
{
set_specific();
return single_value->field_pr;
}

const PowerReduction_template& DlMacHdrDataExt_template::pr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pr of a non-specific template of type @RLCMAC_Types.DlMacHdrDataExt.");
return single_value->field_pr;
}

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

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

INTEGER_template& DlMacHdrDataExt_template::tfi()
{
set_specific();
return single_value->field_tfi;
}

const INTEGER_template& DlMacHdrDataExt_template::tfi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tfi of a non-specific template of type @RLCMAC_Types.DlMacHdrDataExt.");
return single_value->field_tfi;
}

BOOLEAN_template& DlMacHdrDataExt_template::fbi()
{
set_specific();
return single_value->field_fbi;
}

const BOOLEAN_template& DlMacHdrDataExt_template::fbi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field fbi of a non-specific template of type @RLCMAC_Types.DlMacHdrDataExt.");
return single_value->field_fbi;
}

INTEGER_template& DlMacHdrDataExt_template::bsn()
{
set_specific();
return single_value->field_bsn;
}

const INTEGER_template& DlMacHdrDataExt_template::bsn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field bsn of a non-specific template of type @RLCMAC_Types.DlMacHdrDataExt.");
return single_value->field_bsn;
}

BOOLEAN_template& DlMacHdrDataExt_template::e()
{
set_specific();
return single_value->field_e;
}

const BOOLEAN_template& DlMacHdrDataExt_template::e() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field e of a non-specific template of type @RLCMAC_Types.DlMacHdrDataExt.");
return single_value->field_e;
}

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

void DlMacHdrDataExt_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ pr := ");
single_value->field_pr.log();
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(", tfi := ");
single_value->field_tfi.log();
TTCN_Logger::log_event_str(", fbi := ");
single_value->field_fbi.log();
TTCN_Logger::log_event_str(", bsn := ");
single_value->field_bsn.log();
TTCN_Logger::log_event_str(", e := ");
single_value->field_e.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 DlMacHdrDataExt_template::log_match(const DlMacHdrDataExt& 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_pr.match(match_value.pr(), legacy)){
TTCN_Logger::log_logmatch_info(".pr");
single_value->field_pr.log_match(match_value.pr(), 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_tfi.match(match_value.tfi(), legacy)){
TTCN_Logger::log_logmatch_info(".tfi");
single_value->field_tfi.log_match(match_value.tfi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_fbi.match(match_value.fbi(), legacy)){
TTCN_Logger::log_logmatch_info(".fbi");
single_value->field_fbi.log_match(match_value.fbi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_bsn.match(match_value.bsn(), legacy)){
TTCN_Logger::log_logmatch_info(".bsn");
single_value->field_bsn.log_match(match_value.bsn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_e.match(match_value.e(), legacy)){
TTCN_Logger::log_logmatch_info(".e");
single_value->field_e.log_match(match_value.e(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}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("{ pr := ");
single_value->field_pr.log_match(match_value.pr(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(", tfi := ");
single_value->field_tfi.log_match(match_value.tfi(), legacy);
TTCN_Logger::log_event_str(", fbi := ");
single_value->field_fbi.log_match(match_value.fbi(), legacy);
TTCN_Logger::log_event_str(", bsn := ");
single_value->field_bsn.log_match(match_value.bsn(), legacy);
TTCN_Logger::log_event_str(", e := ");
single_value->field_e.log_match(match_value.e(), 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 DlMacHdrDataExt_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (pr().is_bound()) pr().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (tfi().is_bound()) tfi().set_implicit_omit();
if (fbi().is_bound()) fbi().set_implicit_omit();
if (bsn().is_bound()) bsn().set_implicit_omit();
if (e().is_bound()) e().set_implicit_omit();
}

void DlMacHdrDataExt_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_pr.encode_text(text_buf);
single_value->field_spare.encode_text(text_buf);
single_value->field_tfi.encode_text(text_buf);
single_value->field_fbi.encode_text(text_buf);
single_value->field_bsn.encode_text(text_buf);
single_value->field_e.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 @RLCMAC_Types.DlMacHdrDataExt.");
}
}

void DlMacHdrDataExt_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_pr.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
single_value->field_tfi.decode_text(text_buf);
single_value->field_fbi.decode_text(text_buf);
single_value->field_bsn.decode_text(text_buf);
single_value->field_e.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 DlMacHdrDataExt_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 @RLCMAC_Types.DlMacHdrDataExt.");
}
}

void DlMacHdrDataExt_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: {
    DlMacHdrDataExt_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 (6<param.get_size()) {
      param.error("record template of type @RLCMAC_Types.DlMacHdrDataExt has 6 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) pr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) tfi().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) fbi().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) bsn().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) e().set_param(*param.get_elem(5));
    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(), "pr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pr().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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(), "tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          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(), "fbi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fbi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "bsn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bsn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "e")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          e().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @RLCMAC_Types.DlMacHdrDataExt: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    DlMacHdrDataExt_template* precondition = new DlMacHdrDataExt_template;
    precondition->set_param(*param.get_elem(0));
    DlMacHdrDataExt_template* implied_template = new DlMacHdrDataExt_template;
    implied_template->set_param(*param.get_elem(1));
    *this = DlMacHdrDataExt_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.DlMacHdrDataExt");
  }
  is_ifpresent = param.get_ifpresent();
}

void DlMacHdrDataExt_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_pr.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.DlMacHdrDataExt");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.DlMacHdrDataExt");
single_value->field_tfi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.DlMacHdrDataExt");
single_value->field_fbi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.DlMacHdrDataExt");
single_value->field_bsn.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.DlMacHdrDataExt");
single_value->field_e.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.DlMacHdrDataExt");
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 : "@RLCMAC_Types.DlMacHdrDataExt");
}

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

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

DlMacDataHeader::DlMacDataHeader()
{
}

DlMacDataHeader::DlMacDataHeader(const DlMacHeader& par_mac__hdr,
    const DlMacHdrDataExt& par_hdr__ext)
  :   field_mac__hdr(par_mac__hdr),
  field_hdr__ext(par_hdr__ext)
{
}

DlMacDataHeader::DlMacDataHeader(const DlMacDataHeader& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.DlMacDataHeader.");
if (other_value.mac__hdr().is_bound()) field_mac__hdr = other_value.mac__hdr();
else field_mac__hdr.clean_up();
if (other_value.hdr__ext().is_bound()) field_hdr__ext = other_value.hdr__ext();
else field_hdr__ext.clean_up();
}

void DlMacDataHeader::clean_up()
{
field_mac__hdr.clean_up();
field_hdr__ext.clean_up();
}

const TTCN_Typedescriptor_t* DlMacDataHeader::get_descriptor() const { return &DlMacDataHeader_descr_; }
DlMacDataHeader& DlMacDataHeader::operator=(const DlMacDataHeader& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.DlMacDataHeader.");
  if (other_value.mac__hdr().is_bound()) field_mac__hdr = other_value.mac__hdr();
  else field_mac__hdr.clean_up();
  if (other_value.hdr__ext().is_bound()) field_hdr__ext = other_value.hdr__ext();
  else field_hdr__ext.clean_up();
}
return *this;
}

boolean DlMacDataHeader::operator==(const DlMacDataHeader& other_value) const
{
return field_mac__hdr==other_value.field_mac__hdr
  && field_hdr__ext==other_value.field_hdr__ext;
}

boolean DlMacDataHeader::is_bound() const
{
return (field_mac__hdr.is_bound())
  || (field_hdr__ext.is_bound());
}
boolean DlMacDataHeader::is_value() const
{
return field_mac__hdr.is_value()
  && field_hdr__ext.is_value();
}
void DlMacDataHeader::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ mac_hdr := ");
field_mac__hdr.log();
TTCN_Logger::log_event_str(", hdr_ext := ");
field_hdr__ext.log();
TTCN_Logger::log_event_str(" }");
}

void DlMacDataHeader::set_implicit_omit()
{
if (mac__hdr().is_bound()) mac__hdr().set_implicit_omit();
if (hdr__ext().is_bound()) hdr__ext().set_implicit_omit();
}

void DlMacDataHeader::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 @RLCMAC_Types.DlMacDataHeader 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) mac__hdr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) hdr__ext().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(), "mac_hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mac__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(), "hdr_ext")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          hdr__ext().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 @RLCMAC_Types.DlMacDataHeader: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.DlMacDataHeader");
  }
}

void DlMacDataHeader::encode_text(Text_Buf& text_buf) const
{
field_mac__hdr.encode_text(text_buf);
field_hdr__ext.encode_text(text_buf);
}

void DlMacDataHeader::decode_text(Text_Buf& text_buf)
{
field_mac__hdr.decode_text(text_buf);
field_hdr__ext.decode_text(text_buf);
}

void DlMacDataHeader::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 DlMacDataHeader::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 DlMacDataHeader::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, DlMacDataHeader_mac__hdr_descr_.raw->forceomit);
  decoded_field_length = field_mac__hdr.RAW_decode(DlMacDataHeader_mac__hdr_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, DlMacDataHeader_hdr__ext_descr_.raw->forceomit);
  decoded_field_length = field_hdr__ext.RAW_decode(DlMacDataHeader_hdr__ext_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 DlMacDataHeader::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, DlMacDataHeader_mac__hdr_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, DlMacDataHeader_hdr__ext_descr_.raw);
  encoded_length += field_mac__hdr.RAW_encode(DlMacDataHeader_mac__hdr_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_hdr__ext.RAW_encode(DlMacDataHeader_hdr__ext_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct DlMacDataHeader_template::single_value_struct {
DlMacHeader_template field_mac__hdr;
DlMacHdrDataExt_template field_hdr__ext;
};

void DlMacDataHeader_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_mac__hdr = ANY_VALUE;
single_value->field_hdr__ext = ANY_VALUE;
}
}
}

void DlMacDataHeader_template::copy_value(const DlMacDataHeader& other_value)
{
single_value = new single_value_struct;
if (other_value.mac__hdr().is_bound()) {
  single_value->field_mac__hdr = other_value.mac__hdr();
} else {
  single_value->field_mac__hdr.clean_up();
}
if (other_value.hdr__ext().is_bound()) {
  single_value->field_hdr__ext = other_value.hdr__ext();
} else {
  single_value->field_hdr__ext.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void DlMacDataHeader_template::copy_template(const DlMacDataHeader_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.mac__hdr().get_selection()) {
single_value->field_mac__hdr = other_value.mac__hdr();
} else {
single_value->field_mac__hdr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.hdr__ext().get_selection()) {
single_value->field_hdr__ext = other_value.hdr__ext();
} else {
single_value->field_hdr__ext.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 DlMacDataHeader_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 DlMacDataHeader_template(*other_value.implication_.precondition);
implication_.implied_template = new DlMacDataHeader_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 @RLCMAC_Types.DlMacDataHeader.");
break;
}
set_selection(other_value);
}

DlMacDataHeader_template::DlMacDataHeader_template()
{
}

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

DlMacDataHeader_template::DlMacDataHeader_template(const DlMacDataHeader& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean DlMacDataHeader_template::match(const DlMacDataHeader& 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.mac__hdr().is_bound()) return FALSE;
if(!single_value->field_mac__hdr.match(other_value.mac__hdr(), legacy))return FALSE;
if(!other_value.hdr__ext().is_bound()) return FALSE;
if(!single_value->field_hdr__ext.match(other_value.hdr__ext(), 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 @RLCMAC_Types.DlMacDataHeader.");
}
return FALSE;
}

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

boolean DlMacDataHeader_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_mac__hdr.is_value()
 && single_value->field_hdr__ext.is_value();
}

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

DlMacDataHeader DlMacDataHeader_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 @RLCMAC_Types.DlMacDataHeader.");
DlMacDataHeader ret_val;
if (single_value->field_mac__hdr.is_bound()) {
ret_val.mac__hdr() = single_value->field_mac__hdr.valueof();
}
if (single_value->field_hdr__ext.is_bound()) {
ret_val.hdr__ext() = single_value->field_hdr__ext.valueof();
}
return ret_val;
}

void DlMacDataHeader_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 @RLCMAC_Types.DlMacDataHeader.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new DlMacDataHeader_template[list_length];
}

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

DlMacHeader_template& DlMacDataHeader_template::mac__hdr()
{
set_specific();
return single_value->field_mac__hdr;
}

const DlMacHeader_template& DlMacDataHeader_template::mac__hdr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mac_hdr of a non-specific template of type @RLCMAC_Types.DlMacDataHeader.");
return single_value->field_mac__hdr;
}

DlMacHdrDataExt_template& DlMacDataHeader_template::hdr__ext()
{
set_specific();
return single_value->field_hdr__ext;
}

const DlMacHdrDataExt_template& DlMacDataHeader_template::hdr__ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field hdr_ext of a non-specific template of type @RLCMAC_Types.DlMacDataHeader.");
return single_value->field_hdr__ext;
}

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

void DlMacDataHeader_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ mac_hdr := ");
single_value->field_mac__hdr.log();
TTCN_Logger::log_event_str(", hdr_ext := ");
single_value->field_hdr__ext.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 DlMacDataHeader_template::log_match(const DlMacDataHeader& 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_mac__hdr.match(match_value.mac__hdr(), legacy)){
TTCN_Logger::log_logmatch_info(".mac_hdr");
single_value->field_mac__hdr.log_match(match_value.mac__hdr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_hdr__ext.match(match_value.hdr__ext(), legacy)){
TTCN_Logger::log_logmatch_info(".hdr_ext");
single_value->field_hdr__ext.log_match(match_value.hdr__ext(), 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("{ mac_hdr := ");
single_value->field_mac__hdr.log_match(match_value.mac__hdr(), legacy);
TTCN_Logger::log_event_str(", hdr_ext := ");
single_value->field_hdr__ext.log_match(match_value.hdr__ext(), 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 DlMacDataHeader_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (mac__hdr().is_bound()) mac__hdr().set_implicit_omit();
if (hdr__ext().is_bound()) hdr__ext().set_implicit_omit();
}

void DlMacDataHeader_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_mac__hdr.encode_text(text_buf);
single_value->field_hdr__ext.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 @RLCMAC_Types.DlMacDataHeader.");
}
}

void DlMacDataHeader_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_mac__hdr.decode_text(text_buf);
single_value->field_hdr__ext.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 DlMacDataHeader_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 @RLCMAC_Types.DlMacDataHeader.");
}
}

void DlMacDataHeader_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: {
    DlMacDataHeader_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 @RLCMAC_Types.DlMacDataHeader 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) mac__hdr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) hdr__ext().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(), "mac_hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mac__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(), "hdr_ext")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          hdr__ext().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 @RLCMAC_Types.DlMacDataHeader: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    DlMacDataHeader_template* precondition = new DlMacDataHeader_template;
    precondition->set_param(*param.get_elem(0));
    DlMacDataHeader_template* implied_template = new DlMacDataHeader_template;
    implied_template->set_param(*param.get_elem(1));
    *this = DlMacDataHeader_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.DlMacDataHeader");
  }
  is_ifpresent = param.get_ifpresent();
}

void DlMacDataHeader_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_mac__hdr.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.DlMacDataHeader");
single_value->field_hdr__ext.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.DlMacDataHeader");
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 : "@RLCMAC_Types.DlMacDataHeader");
}

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

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

RlcmacDlDataBlock::RlcmacDlDataBlock()
{
}

RlcmacDlDataBlock::RlcmacDlDataBlock(const CodingScheme& par_cs,
    const DlMacDataHeader& par_mac__hdr,
    const LlcBlocks& par_blocks)
  :   field_cs(par_cs),
  field_mac__hdr(par_mac__hdr),
  field_blocks(par_blocks)
{
}

RlcmacDlDataBlock::RlcmacDlDataBlock(const RlcmacDlDataBlock& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.RlcmacDlDataBlock.");
if (other_value.cs().is_bound()) field_cs = other_value.cs();
else field_cs.clean_up();
if (other_value.mac__hdr().is_bound()) field_mac__hdr = other_value.mac__hdr();
else field_mac__hdr.clean_up();
if (other_value.blocks().is_bound()) field_blocks = other_value.blocks();
else field_blocks.clean_up();
}

void RlcmacDlDataBlock::clean_up()
{
field_cs.clean_up();
field_mac__hdr.clean_up();
field_blocks.clean_up();
}

const TTCN_Typedescriptor_t* RlcmacDlDataBlock::get_descriptor() const { return &RlcmacDlDataBlock_descr_; }
RlcmacDlDataBlock& RlcmacDlDataBlock::operator=(const RlcmacDlDataBlock& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.RlcmacDlDataBlock.");
  if (other_value.cs().is_bound()) field_cs = other_value.cs();
  else field_cs.clean_up();
  if (other_value.mac__hdr().is_bound()) field_mac__hdr = other_value.mac__hdr();
  else field_mac__hdr.clean_up();
  if (other_value.blocks().is_bound()) field_blocks = other_value.blocks();
  else field_blocks.clean_up();
}
return *this;
}

boolean RlcmacDlDataBlock::operator==(const RlcmacDlDataBlock& other_value) const
{
return field_cs==other_value.field_cs
  && field_mac__hdr==other_value.field_mac__hdr
  && field_blocks==other_value.field_blocks;
}

boolean RlcmacDlDataBlock::is_bound() const
{
return (field_cs.is_bound())
  || (field_mac__hdr.is_bound())
  || (field_blocks.is_bound());
}
boolean RlcmacDlDataBlock::is_value() const
{
return field_cs.is_value()
  && field_mac__hdr.is_value()
  && field_blocks.is_value();
}
void RlcmacDlDataBlock::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ cs := ");
field_cs.log();
TTCN_Logger::log_event_str(", mac_hdr := ");
field_mac__hdr.log();
TTCN_Logger::log_event_str(", blocks := ");
field_blocks.log();
TTCN_Logger::log_event_str(" }");
}

void RlcmacDlDataBlock::set_implicit_omit()
{
if (cs().is_bound()) cs().set_implicit_omit();
if (mac__hdr().is_bound()) mac__hdr().set_implicit_omit();
if (blocks().is_bound()) blocks().set_implicit_omit();
}

void RlcmacDlDataBlock::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 @RLCMAC_Types.RlcmacDlDataBlock 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) cs().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mac__hdr().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) blocks().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(), "cs")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cs().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mac_hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mac__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(), "blocks")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          blocks().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 @RLCMAC_Types.RlcmacDlDataBlock: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.RlcmacDlDataBlock");
  }
}

void RlcmacDlDataBlock::encode_text(Text_Buf& text_buf) const
{
field_cs.encode_text(text_buf);
field_mac__hdr.encode_text(text_buf);
field_blocks.encode_text(text_buf);
}

void RlcmacDlDataBlock::decode_text(Text_Buf& text_buf)
{
field_cs.decode_text(text_buf);
field_mac__hdr.decode_text(text_buf);
field_blocks.decode_text(text_buf);
}

void RlcmacDlDataBlock::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 RlcmacDlDataBlock::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 RlcmacDlDataBlock::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, RlcmacDlDataBlock_cs_descr_.raw->forceomit);
  decoded_field_length = field_cs.RAW_decode(RlcmacDlDataBlock_cs_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, RlcmacDlDataBlock_mac__hdr_descr_.raw->forceomit);
  decoded_field_length = field_mac__hdr.RAW_decode(RlcmacDlDataBlock_mac__hdr_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, RlcmacDlDataBlock_blocks_descr_.raw->forceomit);
  decoded_field_length = field_blocks.RAW_decode(RlcmacDlDataBlock_blocks_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 RlcmacDlDataBlock::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, RlcmacDlDataBlock_cs_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RlcmacDlDataBlock_mac__hdr_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, RlcmacDlDataBlock_blocks_descr_.raw);
  encoded_length += field_cs.RAW_encode(RlcmacDlDataBlock_cs_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_mac__hdr.RAW_encode(RlcmacDlDataBlock_mac__hdr_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_blocks.RAW_encode(RlcmacDlDataBlock_blocks_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct RlcmacDlDataBlock_template::single_value_struct {
CodingScheme_template field_cs;
DlMacDataHeader_template field_mac__hdr;
LlcBlocks_template field_blocks;
};

void RlcmacDlDataBlock_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_cs = ANY_VALUE;
single_value->field_mac__hdr = ANY_VALUE;
single_value->field_blocks = ANY_VALUE;
}
}
}

void RlcmacDlDataBlock_template::copy_value(const RlcmacDlDataBlock& other_value)
{
single_value = new single_value_struct;
if (other_value.cs().is_bound()) {
  single_value->field_cs = other_value.cs();
} else {
  single_value->field_cs.clean_up();
}
if (other_value.mac__hdr().is_bound()) {
  single_value->field_mac__hdr = other_value.mac__hdr();
} else {
  single_value->field_mac__hdr.clean_up();
}
if (other_value.blocks().is_bound()) {
  single_value->field_blocks = other_value.blocks();
} else {
  single_value->field_blocks.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RlcmacDlDataBlock_template::copy_template(const RlcmacDlDataBlock_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.cs().get_selection()) {
single_value->field_cs = other_value.cs();
} else {
single_value->field_cs.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.mac__hdr().get_selection()) {
single_value->field_mac__hdr = other_value.mac__hdr();
} else {
single_value->field_mac__hdr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.blocks().get_selection()) {
single_value->field_blocks = other_value.blocks();
} else {
single_value->field_blocks.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 RlcmacDlDataBlock_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 RlcmacDlDataBlock_template(*other_value.implication_.precondition);
implication_.implied_template = new RlcmacDlDataBlock_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 @RLCMAC_Types.RlcmacDlDataBlock.");
break;
}
set_selection(other_value);
}

RlcmacDlDataBlock_template::RlcmacDlDataBlock_template()
{
}

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

RlcmacDlDataBlock_template::RlcmacDlDataBlock_template(const RlcmacDlDataBlock& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean RlcmacDlDataBlock_template::match(const RlcmacDlDataBlock& 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.cs().is_bound()) return FALSE;
if(!single_value->field_cs.match(other_value.cs(), legacy))return FALSE;
if(!other_value.mac__hdr().is_bound()) return FALSE;
if(!single_value->field_mac__hdr.match(other_value.mac__hdr(), legacy))return FALSE;
if(!other_value.blocks().is_bound()) return FALSE;
if(!single_value->field_blocks.match(other_value.blocks(), 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 @RLCMAC_Types.RlcmacDlDataBlock.");
}
return FALSE;
}

boolean RlcmacDlDataBlock_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_cs.is_bound()
 || single_value->field_mac__hdr.is_bound()
 || single_value->field_blocks.is_bound();
}

boolean RlcmacDlDataBlock_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_cs.is_value()
 && single_value->field_mac__hdr.is_value()
 && single_value->field_blocks.is_value();
}

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

RlcmacDlDataBlock RlcmacDlDataBlock_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 @RLCMAC_Types.RlcmacDlDataBlock.");
RlcmacDlDataBlock ret_val;
if (single_value->field_cs.is_bound()) {
ret_val.cs() = single_value->field_cs.valueof();
}
if (single_value->field_mac__hdr.is_bound()) {
ret_val.mac__hdr() = single_value->field_mac__hdr.valueof();
}
if (single_value->field_blocks.is_bound()) {
ret_val.blocks() = single_value->field_blocks.valueof();
}
return ret_val;
}

void RlcmacDlDataBlock_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 @RLCMAC_Types.RlcmacDlDataBlock.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RlcmacDlDataBlock_template[list_length];
}

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

CodingScheme_template& RlcmacDlDataBlock_template::cs()
{
set_specific();
return single_value->field_cs;
}

const CodingScheme_template& RlcmacDlDataBlock_template::cs() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field cs of a non-specific template of type @RLCMAC_Types.RlcmacDlDataBlock.");
return single_value->field_cs;
}

DlMacDataHeader_template& RlcmacDlDataBlock_template::mac__hdr()
{
set_specific();
return single_value->field_mac__hdr;
}

const DlMacDataHeader_template& RlcmacDlDataBlock_template::mac__hdr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mac_hdr of a non-specific template of type @RLCMAC_Types.RlcmacDlDataBlock.");
return single_value->field_mac__hdr;
}

LlcBlocks_template& RlcmacDlDataBlock_template::blocks()
{
set_specific();
return single_value->field_blocks;
}

const LlcBlocks_template& RlcmacDlDataBlock_template::blocks() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field blocks of a non-specific template of type @RLCMAC_Types.RlcmacDlDataBlock.");
return single_value->field_blocks;
}

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

void RlcmacDlDataBlock_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ cs := ");
single_value->field_cs.log();
TTCN_Logger::log_event_str(", mac_hdr := ");
single_value->field_mac__hdr.log();
TTCN_Logger::log_event_str(", blocks := ");
single_value->field_blocks.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 RlcmacDlDataBlock_template::log_match(const RlcmacDlDataBlock& 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_cs.match(match_value.cs(), legacy)){
TTCN_Logger::log_logmatch_info(".cs");
single_value->field_cs.log_match(match_value.cs(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_mac__hdr.match(match_value.mac__hdr(), legacy)){
TTCN_Logger::log_logmatch_info(".mac_hdr");
single_value->field_mac__hdr.log_match(match_value.mac__hdr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_blocks.match(match_value.blocks(), legacy)){
TTCN_Logger::log_logmatch_info(".blocks");
single_value->field_blocks.log_match(match_value.blocks(), 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("{ cs := ");
single_value->field_cs.log_match(match_value.cs(), legacy);
TTCN_Logger::log_event_str(", mac_hdr := ");
single_value->field_mac__hdr.log_match(match_value.mac__hdr(), legacy);
TTCN_Logger::log_event_str(", blocks := ");
single_value->field_blocks.log_match(match_value.blocks(), 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 RlcmacDlDataBlock_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (cs().is_bound()) cs().set_implicit_omit();
if (mac__hdr().is_bound()) mac__hdr().set_implicit_omit();
if (blocks().is_bound()) blocks().set_implicit_omit();
}

void RlcmacDlDataBlock_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_cs.encode_text(text_buf);
single_value->field_mac__hdr.encode_text(text_buf);
single_value->field_blocks.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 @RLCMAC_Types.RlcmacDlDataBlock.");
}
}

void RlcmacDlDataBlock_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_cs.decode_text(text_buf);
single_value->field_mac__hdr.decode_text(text_buf);
single_value->field_blocks.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 RlcmacDlDataBlock_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 @RLCMAC_Types.RlcmacDlDataBlock.");
}
}

void RlcmacDlDataBlock_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: {
    RlcmacDlDataBlock_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 @RLCMAC_Types.RlcmacDlDataBlock 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) cs().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mac__hdr().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) blocks().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(), "cs")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cs().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mac_hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mac__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(), "blocks")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          blocks().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 @RLCMAC_Types.RlcmacDlDataBlock: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    RlcmacDlDataBlock_template* precondition = new RlcmacDlDataBlock_template;
    precondition->set_param(*param.get_elem(0));
    RlcmacDlDataBlock_template* implied_template = new RlcmacDlDataBlock_template;
    implied_template->set_param(*param.get_elem(1));
    *this = RlcmacDlDataBlock_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.RlcmacDlDataBlock");
  }
  is_ifpresent = param.get_ifpresent();
}

void RlcmacDlDataBlock_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_cs.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacDlDataBlock");
single_value->field_mac__hdr.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacDlDataBlock");
single_value->field_blocks.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacDlDataBlock");
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 : "@RLCMAC_Types.RlcmacDlDataBlock");
}

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

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

EgprsLlcBlockHdr::EgprsLlcBlockHdr()
{
}

EgprsLlcBlockHdr::EgprsLlcBlockHdr(const INTEGER& par_length__ind,
    const BOOLEAN& par_e)
  :   field_length__ind(par_length__ind),
  field_e(par_e)
{
}

EgprsLlcBlockHdr::EgprsLlcBlockHdr(const EgprsLlcBlockHdr& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.EgprsLlcBlockHdr.");
if (other_value.length__ind().is_bound()) field_length__ind = other_value.length__ind();
else field_length__ind.clean_up();
if (other_value.e().is_bound()) field_e = other_value.e();
else field_e.clean_up();
}

void EgprsLlcBlockHdr::clean_up()
{
field_length__ind.clean_up();
field_e.clean_up();
}

const TTCN_Typedescriptor_t* EgprsLlcBlockHdr::get_descriptor() const { return &EgprsLlcBlockHdr_descr_; }
EgprsLlcBlockHdr& EgprsLlcBlockHdr::operator=(const EgprsLlcBlockHdr& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.EgprsLlcBlockHdr.");
  if (other_value.length__ind().is_bound()) field_length__ind = other_value.length__ind();
  else field_length__ind.clean_up();
  if (other_value.e().is_bound()) field_e = other_value.e();
  else field_e.clean_up();
}
return *this;
}

boolean EgprsLlcBlockHdr::operator==(const EgprsLlcBlockHdr& other_value) const
{
return field_length__ind==other_value.field_length__ind
  && field_e==other_value.field_e;
}

boolean EgprsLlcBlockHdr::is_bound() const
{
return (field_length__ind.is_bound())
  || (field_e.is_bound());
}
boolean EgprsLlcBlockHdr::is_value() const
{
return field_length__ind.is_value()
  && field_e.is_value();
}
void EgprsLlcBlockHdr::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ length_ind := ");
field_length__ind.log();
TTCN_Logger::log_event_str(", e := ");
field_e.log();
TTCN_Logger::log_event_str(" }");
}

void EgprsLlcBlockHdr::set_implicit_omit()
{
if (length__ind().is_bound()) length__ind().set_implicit_omit();
if (e().is_bound()) e().set_implicit_omit();
}

void EgprsLlcBlockHdr::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 @RLCMAC_Types.EgprsLlcBlockHdr 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) length__ind().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) e().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(), "length_ind")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          length__ind().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "e")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          e().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @RLCMAC_Types.EgprsLlcBlockHdr: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.EgprsLlcBlockHdr");
  }
}

void EgprsLlcBlockHdr::encode_text(Text_Buf& text_buf) const
{
field_length__ind.encode_text(text_buf);
field_e.encode_text(text_buf);
}

void EgprsLlcBlockHdr::decode_text(Text_Buf& text_buf)
{
field_length__ind.decode_text(text_buf);
field_e.decode_text(text_buf);
}

void EgprsLlcBlockHdr::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 EgprsLlcBlockHdr::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 EgprsLlcBlockHdr::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, EgprsLlcBlockHdr_length__ind_descr_.raw->forceomit);
  decoded_field_length = field_length__ind.RAW_decode(EgprsLlcBlockHdr_length__ind_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, EgprsLlcBlockHdr_e_descr_.raw->forceomit);
  decoded_field_length = field_e.RAW_decode(EgprsLlcBlockHdr_e_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 EgprsLlcBlockHdr::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, EgprsLlcBlockHdr_length__ind_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, EgprsLlcBlockHdr_e_descr_.raw);
  encoded_length += field_length__ind.RAW_encode(EgprsLlcBlockHdr_length__ind_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_e.RAW_encode(EgprsLlcBlockHdr_e_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct EgprsLlcBlockHdr_template::single_value_struct {
INTEGER_template field_length__ind;
BOOLEAN_template field_e;
};

void EgprsLlcBlockHdr_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_length__ind = ANY_VALUE;
single_value->field_e = ANY_VALUE;
}
}
}

void EgprsLlcBlockHdr_template::copy_value(const EgprsLlcBlockHdr& other_value)
{
single_value = new single_value_struct;
if (other_value.length__ind().is_bound()) {
  single_value->field_length__ind = other_value.length__ind();
} else {
  single_value->field_length__ind.clean_up();
}
if (other_value.e().is_bound()) {
  single_value->field_e = other_value.e();
} else {
  single_value->field_e.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void EgprsLlcBlockHdr_template::copy_template(const EgprsLlcBlockHdr_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.length__ind().get_selection()) {
single_value->field_length__ind = other_value.length__ind();
} else {
single_value->field_length__ind.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.e().get_selection()) {
single_value->field_e = other_value.e();
} else {
single_value->field_e.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 EgprsLlcBlockHdr_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 EgprsLlcBlockHdr_template(*other_value.implication_.precondition);
implication_.implied_template = new EgprsLlcBlockHdr_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 @RLCMAC_Types.EgprsLlcBlockHdr.");
break;
}
set_selection(other_value);
}

EgprsLlcBlockHdr_template::EgprsLlcBlockHdr_template()
{
}

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

EgprsLlcBlockHdr_template::EgprsLlcBlockHdr_template(const EgprsLlcBlockHdr& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean EgprsLlcBlockHdr_template::match(const EgprsLlcBlockHdr& 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.length__ind().is_bound()) return FALSE;
if(!single_value->field_length__ind.match(other_value.length__ind(), legacy))return FALSE;
if(!other_value.e().is_bound()) return FALSE;
if(!single_value->field_e.match(other_value.e(), 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 @RLCMAC_Types.EgprsLlcBlockHdr.");
}
return FALSE;
}

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

boolean EgprsLlcBlockHdr_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_length__ind.is_value()
 && single_value->field_e.is_value();
}

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

EgprsLlcBlockHdr EgprsLlcBlockHdr_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 @RLCMAC_Types.EgprsLlcBlockHdr.");
EgprsLlcBlockHdr ret_val;
if (single_value->field_length__ind.is_bound()) {
ret_val.length__ind() = single_value->field_length__ind.valueof();
}
if (single_value->field_e.is_bound()) {
ret_val.e() = single_value->field_e.valueof();
}
return ret_val;
}

void EgprsLlcBlockHdr_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 @RLCMAC_Types.EgprsLlcBlockHdr.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new EgprsLlcBlockHdr_template[list_length];
}

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

INTEGER_template& EgprsLlcBlockHdr_template::length__ind()
{
set_specific();
return single_value->field_length__ind;
}

const INTEGER_template& EgprsLlcBlockHdr_template::length__ind() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field length_ind of a non-specific template of type @RLCMAC_Types.EgprsLlcBlockHdr.");
return single_value->field_length__ind;
}

BOOLEAN_template& EgprsLlcBlockHdr_template::e()
{
set_specific();
return single_value->field_e;
}

const BOOLEAN_template& EgprsLlcBlockHdr_template::e() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field e of a non-specific template of type @RLCMAC_Types.EgprsLlcBlockHdr.");
return single_value->field_e;
}

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

void EgprsLlcBlockHdr_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ length_ind := ");
single_value->field_length__ind.log();
TTCN_Logger::log_event_str(", e := ");
single_value->field_e.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 EgprsLlcBlockHdr_template::log_match(const EgprsLlcBlockHdr& 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_length__ind.match(match_value.length__ind(), legacy)){
TTCN_Logger::log_logmatch_info(".length_ind");
single_value->field_length__ind.log_match(match_value.length__ind(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_e.match(match_value.e(), legacy)){
TTCN_Logger::log_logmatch_info(".e");
single_value->field_e.log_match(match_value.e(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}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("{ length_ind := ");
single_value->field_length__ind.log_match(match_value.length__ind(), legacy);
TTCN_Logger::log_event_str(", e := ");
single_value->field_e.log_match(match_value.e(), 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 EgprsLlcBlockHdr_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (length__ind().is_bound()) length__ind().set_implicit_omit();
if (e().is_bound()) e().set_implicit_omit();
}

void EgprsLlcBlockHdr_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_length__ind.encode_text(text_buf);
single_value->field_e.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 @RLCMAC_Types.EgprsLlcBlockHdr.");
}
}

void EgprsLlcBlockHdr_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_length__ind.decode_text(text_buf);
single_value->field_e.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 EgprsLlcBlockHdr_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 @RLCMAC_Types.EgprsLlcBlockHdr.");
}
}

void EgprsLlcBlockHdr_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: {
    EgprsLlcBlockHdr_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 @RLCMAC_Types.EgprsLlcBlockHdr 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) length__ind().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) e().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(), "length_ind")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          length__ind().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "e")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          e().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @RLCMAC_Types.EgprsLlcBlockHdr: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    EgprsLlcBlockHdr_template* precondition = new EgprsLlcBlockHdr_template;
    precondition->set_param(*param.get_elem(0));
    EgprsLlcBlockHdr_template* implied_template = new EgprsLlcBlockHdr_template;
    implied_template->set_param(*param.get_elem(1));
    *this = EgprsLlcBlockHdr_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.EgprsLlcBlockHdr");
  }
  is_ifpresent = param.get_ifpresent();
}

void EgprsLlcBlockHdr_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_length__ind.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsLlcBlockHdr");
single_value->field_e.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsLlcBlockHdr");
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 : "@RLCMAC_Types.EgprsLlcBlockHdr");
}

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

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

EgprsLlcBlock::EgprsLlcBlock()
{
}

EgprsLlcBlock::EgprsLlcBlock(const OPTIONAL< EgprsLlcBlockHdr >& par_hdr,
    const OCTETSTRING& par_payload)
  :   field_hdr(par_hdr),
  field_payload(par_payload)
{
}

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

void EgprsLlcBlock::clean_up()
{
field_hdr.clean_up();
field_payload.clean_up();
}

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

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

boolean EgprsLlcBlock::is_bound() const
{
return (OPTIONAL_OMIT == field_hdr.get_selection() || field_hdr.is_bound())
  || (field_payload.is_bound());
}
boolean EgprsLlcBlock::is_value() const
{
return (OPTIONAL_OMIT == field_hdr.get_selection() || field_hdr.is_value())
  && field_payload.is_value();
}
int EgprsLlcBlock::size_of() const
{
  int ret_val = 1;
  if (field_hdr.ispresent()) ret_val++;
  return ret_val;
}

void EgprsLlcBlock::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(", payload := ");
field_payload.log();
TTCN_Logger::log_event_str(" }");
}

void EgprsLlcBlock::set_implicit_omit()
{
if (!hdr().is_bound()) hdr() = OMIT_VALUE;
else hdr().set_implicit_omit();
if (payload().is_bound()) payload().set_implicit_omit();
}

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

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

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

void EgprsLlcBlock::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 EgprsLlcBlock::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 EgprsLlcBlock::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_hdr = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_0_force_omit(0, force_omit, EgprsLlcBlock_hdr_descr_.raw->forceomit);
  decoded_field_length = field_hdr().RAW_decode(EgprsLlcBlock_hdr_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 1) {
  field_hdr = 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_hdr=OMIT_VALUE;
  RAW_Force_Omit field_1_force_omit(1, force_omit, EgprsLlcBlock_payload_descr_.raw->forceomit);
  decoded_field_length = field_payload.RAW_decode(EgprsLlcBlock_payload_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 EgprsLlcBlock::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_hdr.ispresent()) {
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, EgprsLlcBlock_hdr_descr_.raw);
  }
  else myleaf.body.node.nodes[0] = NULL;
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, EgprsLlcBlock_payload_descr_.raw);
  if (field_hdr.ispresent()) {
  encoded_length += field_hdr().RAW_encode(EgprsLlcBlock_hdr_descr_, *myleaf.body.node.nodes[0]);
  }
  encoded_length += field_payload.RAW_encode(EgprsLlcBlock_payload_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct EgprsLlcBlock_template::single_value_struct {
EgprsLlcBlockHdr_template field_hdr;
OCTETSTRING_template field_payload;
};

void EgprsLlcBlock_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_OR_OMIT;
single_value->field_payload = ANY_VALUE;
}
}
}

void EgprsLlcBlock_template::copy_value(const EgprsLlcBlock& other_value)
{
single_value = new single_value_struct;
if (other_value.hdr().is_bound()) {
  if (other_value.hdr().ispresent()) single_value->field_hdr = other_value.hdr()();
  else single_value->field_hdr = OMIT_VALUE;
} else {
  single_value->field_hdr.clean_up();
}
if (other_value.payload().is_bound()) {
  single_value->field_payload = other_value.payload();
} else {
  single_value->field_payload.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void EgprsLlcBlock_template::copy_template(const EgprsLlcBlock_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.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 EgprsLlcBlock_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 EgprsLlcBlock_template(*other_value.implication_.precondition);
implication_.implied_template = new EgprsLlcBlock_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 @RLCMAC_Types.EgprsLlcBlock.");
break;
}
set_selection(other_value);
}

EgprsLlcBlock_template::EgprsLlcBlock_template()
{
}

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

EgprsLlcBlock_template::EgprsLlcBlock_template(const EgprsLlcBlock& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean EgprsLlcBlock_template::match(const EgprsLlcBlock& 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((other_value.hdr().ispresent() ? !single_value->field_hdr.match((const EgprsLlcBlockHdr&)other_value.hdr(), legacy) : !single_value->field_hdr.match_omit(legacy)))return FALSE;
if(!other_value.payload().is_bound()) return FALSE;
if(!single_value->field_payload.match(other_value.payload(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @RLCMAC_Types.EgprsLlcBlock.");
}
return FALSE;
}

boolean EgprsLlcBlock_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_omit() || single_value->field_hdr.is_bound())
 || single_value->field_payload.is_bound();
}

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

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

EgprsLlcBlock EgprsLlcBlock_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 @RLCMAC_Types.EgprsLlcBlock.");
EgprsLlcBlock ret_val;
if (single_value->field_hdr.is_omit()) ret_val.hdr() = OMIT_VALUE;
else if (single_value->field_hdr.is_bound()) {
ret_val.hdr() = single_value->field_hdr.valueof();
}
if (single_value->field_payload.is_bound()) {
ret_val.payload() = single_value->field_payload.valueof();
}
return ret_val;
}

void EgprsLlcBlock_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 @RLCMAC_Types.EgprsLlcBlock.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new EgprsLlcBlock_template[list_length];
}

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

EgprsLlcBlockHdr_template& EgprsLlcBlock_template::hdr()
{
set_specific();
return single_value->field_hdr;
}

const EgprsLlcBlockHdr_template& EgprsLlcBlock_template::hdr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field hdr of a non-specific template of type @RLCMAC_Types.EgprsLlcBlock.");
return single_value->field_hdr;
}

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

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

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

void EgprsLlcBlock_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(", 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 EgprsLlcBlock_template::log_match(const EgprsLlcBlock& 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.hdr().ispresent()){
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);
}
} else {
if (!single_value->field_hdr.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".hdr := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_hdr.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_payload.match(match_value.payload(), legacy)){
TTCN_Logger::log_logmatch_info(".payload");
single_value->field_payload.log_match(match_value.payload(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ hdr := ");
if (match_value.hdr().ispresent()) {
single_value->field_hdr.log_match(match_value.hdr(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_hdr.log();
if (single_value->field_hdr.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
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 EgprsLlcBlock_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (!hdr().is_bound()) hdr() = OMIT_VALUE;
else hdr().set_implicit_omit();
if (payload().is_bound()) payload().set_implicit_omit();
}

void EgprsLlcBlock_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_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 @RLCMAC_Types.EgprsLlcBlock.");
}
}

void EgprsLlcBlock_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_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 EgprsLlcBlock_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 @RLCMAC_Types.EgprsLlcBlock.");
}
}

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

void EgprsLlcBlock_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 : "@RLCMAC_Types.EgprsLlcBlock");
single_value->field_payload.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsLlcBlock");
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 : "@RLCMAC_Types.EgprsLlcBlock");
}

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

boolean EgprsLlcBlock_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 EgprsLlcBlock EgprsLlcBlocks::UNBOUND_ELEM;
EgprsLlcBlocks::EgprsLlcBlocks()
{
val_ptr = NULL;
}

EgprsLlcBlocks::EgprsLlcBlocks(null_type)
{
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
}

EgprsLlcBlocks::EgprsLlcBlocks(const EgprsLlcBlocks& other_value)
{
if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.EgprsLlcBlocks.");
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}

EgprsLlcBlocks::~EgprsLlcBlocks()
{
clean_up();
if (val_ptr != NULL) val_ptr = NULL;
}

void EgprsLlcBlocks::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.");
}
}

EgprsLlcBlocks& EgprsLlcBlocks::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;
}

EgprsLlcBlocks& EgprsLlcBlocks::operator=(const EgprsLlcBlocks& other_value)
{
if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @RLCMAC_Types.EgprsLlcBlocks.");
if (this != &other_value) {
clean_up();
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}
return *this;
}

boolean EgprsLlcBlocks::operator==(null_type) const
{
if (val_ptr == NULL)
TTCN_error("The left operand of comparison is an unbound value of type @RLCMAC_Types.EgprsLlcBlocks.");
return val_ptr->n_elements == 0 ;
}

boolean EgprsLlcBlocks::operator==(const EgprsLlcBlocks& other_value) const
{
if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @RLCMAC_Types.EgprsLlcBlocks.");
if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @RLCMAC_Types.EgprsLlcBlocks.");
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;
}

EgprsLlcBlock& EgprsLlcBlocks::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of type @RLCMAC_Types.EgprsLlcBlocks 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 = (EgprsLlcBlock**)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 EgprsLlcBlock(*(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 EgprsLlcBlock;
}
return *val_ptr->value_elements[index_value];
}

EgprsLlcBlock& EgprsLlcBlocks::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @RLCMAC_Types.EgprsLlcBlocks.");
return (*this)[(int)index_value];
}

const EgprsLlcBlock& EgprsLlcBlocks::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @RLCMAC_Types.EgprsLlcBlocks.");
if (index_value < 0) TTCN_error("Accessing an element of type @RLCMAC_Types.EgprsLlcBlocks using a negative index: %d.", index_value);
if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @RLCMAC_Types.EgprsLlcBlocks: 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 EgprsLlcBlock& EgprsLlcBlocks::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @RLCMAC_Types.EgprsLlcBlocks.");
return (*this)[(int)index_value];
}

EgprsLlcBlocks EgprsLlcBlocks::operator<<=(int rotate_count) const
{
return *this >>= (-rotate_count);
}

EgprsLlcBlocks EgprsLlcBlocks::operator<<=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate left operator.");
return *this >>= (int)(-rotate_count);
}

EgprsLlcBlocks EgprsLlcBlocks::operator>>=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate right operator.");
return *this >>= (int)rotate_count;
}

EgprsLlcBlocks EgprsLlcBlocks::operator>>=(int rotate_count) const
{
if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @RLCMAC_Types.EgprsLlcBlocks.");
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;
EgprsLlcBlocks 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 EgprsLlcBlock(*val_ptr->value_elements[i]);
}
}
return ret_val;
}

EgprsLlcBlocks EgprsLlcBlocks::operator+(const EgprsLlcBlocks& other_value) const
{
if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @RLCMAC_Types.EgprsLlcBlocks concatenation.");
if (val_ptr->n_elements == 0) return other_value;
if (other_value.val_ptr->n_elements == 0) return *this;
EgprsLlcBlocks 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 EgprsLlcBlock(*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 EgprsLlcBlock(*other_value.val_ptr->value_elements[i]);
}
}
return ret_val;
}

EgprsLlcBlocks EgprsLlcBlocks::substr(int index, int returncount) const
{
if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @RLCMAC_Types.EgprsLlcBlocks.");
check_substr_arguments(val_ptr->n_elements, index, returncount, "@RLCMAC_Types.EgprsLlcBlocks","element");
EgprsLlcBlocks 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 EgprsLlcBlock(*val_ptr->value_elements[i+index]);
}
}
return ret_val;
}

EgprsLlcBlocks EgprsLlcBlocks::replace(int index, int len, const EgprsLlcBlocks& repl) const
{
if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @RLCMAC_Types.EgprsLlcBlocks.");
if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @RLCMAC_Types.EgprsLlcBlocks.");
check_replace_arguments(val_ptr->n_elements, index, len, "@RLCMAC_Types.EgprsLlcBlocks","element");
EgprsLlcBlocks 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 EgprsLlcBlock(*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 EgprsLlcBlock(*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 EgprsLlcBlock(*val_ptr->value_elements[index+i+len]);
}
}
return ret_val;
}

EgprsLlcBlocks EgprsLlcBlocks::replace(int index, int len, const EgprsLlcBlocks_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 EgprsLlcBlocks::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @RLCMAC_Types.EgprsLlcBlocks.");
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 = (EgprsLlcBlock**)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 EgprsLlcBlock(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (EgprsLlcBlock**)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 @RLCMAC_Types.EgprsLlcBlocks: %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 = (EgprsLlcBlock**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}

boolean EgprsLlcBlocks::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 EgprsLlcBlocks::size_of() const
{
if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @RLCMAC_Types.EgprsLlcBlocks.");
return val_ptr->n_elements;
}

int EgprsLlcBlocks::lengthof() const
{
if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @RLCMAC_Types.EgprsLlcBlocks.");
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 EgprsLlcBlocks::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 EgprsLlcBlocks::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 EgprsLlcBlocks::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", "@RLCMAC_Types.EgprsLlcBlocks");
    }
    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", "@RLCMAC_Types.EgprsLlcBlocks");
    }
    break;
  default:
    TTCN_error("Internal error: Unknown operation type.");
  }
}

void EgprsLlcBlocks::encode_text(Text_Buf& text_buf) const
{
if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @RLCMAC_Types.EgprsLlcBlocks.");
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 EgprsLlcBlocks::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 @RLCMAC_Types.EgprsLlcBlocks.");
val_ptr->value_elements = (EgprsLlcBlock**)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 EgprsLlcBlock;
val_ptr->value_elements[elem_count]->decode_text(text_buf);
}
}

void EgprsLlcBlocks::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 EgprsLlcBlocks::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 EgprsLlcBlocks::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 EgprsLlcBlocks::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 EgprsLlcBlocks_template::copy_value(const EgprsLlcBlocks& other_value)
{
if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @RLCMAC_Types.EgprsLlcBlocks with an unbound value.");
single_value.n_elements = other_value.size_of();
single_value.value_elements = (EgprsLlcBlock_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 EgprsLlcBlock_template(other_value[elem_count]);
} else {
single_value.value_elements[elem_count] = new EgprsLlcBlock_template;
}
}
set_selection(SPECIFIC_VALUE);
}

void EgprsLlcBlocks_template::copy_template(const EgprsLlcBlocks_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 = (EgprsLlcBlock_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 EgprsLlcBlock_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new EgprsLlcBlock_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 EgprsLlcBlocks_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 EgprsLlcBlocks_template(*other_value.implication_.precondition);
implication_.implied_template = new EgprsLlcBlocks_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 @RLCMAC_Types.EgprsLlcBlocks.");
break;
}
set_selection(other_value);
}

boolean EgprsLlcBlocks_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 EgprsLlcBlocks_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const EgprsLlcBlocks*)value_ptr)[value_index], legacy);
else return ((const EgprsLlcBlocks_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit();
}

EgprsLlcBlocks_template::EgprsLlcBlocks_template()
{
}

EgprsLlcBlocks_template::EgprsLlcBlocks_template(template_sel other_value)
 : Base_Record_Of_Template(other_value)
{
check_single_selection(other_value);
}

EgprsLlcBlocks_template::EgprsLlcBlocks_template(null_type)
 : Base_Record_Of_Template(SPECIFIC_VALUE)
{
single_value.n_elements = 0;
single_value.value_elements = NULL;
}

EgprsLlcBlocks_template::EgprsLlcBlocks_template(const EgprsLlcBlocks& other_value)
{
copy_value(other_value);
}

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

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

EgprsLlcBlocks_template::EgprsLlcBlocks_template(Dynamic_Match_Interface<EgprsLlcBlocks>* p_dyn_match)
 : Base_Record_Of_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<EgprsLlcBlocks>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

EgprsLlcBlocks_template::EgprsLlcBlocks_template(const EgprsLlcBlocks_template& other_value)
 : Base_Record_Of_Template()
{
copy_template(other_value);
}

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

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

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

EgprsLlcBlocks_template& EgprsLlcBlocks_template::operator=(null_type)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value.n_elements = 0;
single_value.value_elements = NULL;
return *this;
}

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

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

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

EgprsLlcBlock_template& EgprsLlcBlocks_template::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @RLCMAC_Types.EgprsLlcBlocks 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 @RLCMAC_Types.EgprsLlcBlocks.");
    break;
}
return *single_value.value_elements[index_value];
}

EgprsLlcBlock_template& EgprsLlcBlocks_template::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @RLCMAC_Types.EgprsLlcBlocks.");
return (*this)[(int)index_value];
}

const EgprsLlcBlock_template& EgprsLlcBlocks_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @RLCMAC_Types.EgprsLlcBlocks using a negative index: %d.", index_value);
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @RLCMAC_Types.EgprsLlcBlocks.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @RLCMAC_Types.EgprsLlcBlocks: 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 EgprsLlcBlock_template& EgprsLlcBlocks_template::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @RLCMAC_Types.EgprsLlcBlocks.");
return (*this)[(int)index_value];
}

void EgprsLlcBlocks_template::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @RLCMAC_Types.EgprsLlcBlocks.");
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 = (EgprsLlcBlock_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 EgprsLlcBlock_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 EgprsLlcBlock_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 = (EgprsLlcBlock_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}

int EgprsLlcBlocks_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 EgprsLlcBlocks_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 @RLCMAC_Types.EgprsLlcBlocks 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 @RLCMAC_Types.EgprsLlcBlocks 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 @RLCMAC_Types.EgprsLlcBlocks 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 @RLCMAC_Types.EgprsLlcBlocks 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 @RLCMAC_Types.EgprsLlcBlocks 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 @RLCMAC_Types.EgprsLlcBlocks containing complemented list.", op_name);
default:
  TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @RLCMAC_Types.EgprsLlcBlocks.", op_name);
}
return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @RLCMAC_Types.EgprsLlcBlocks");
}

boolean EgprsLlcBlocks_template::match(const EgprsLlcBlocks& 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 @RLCMAC_Types.EgprsLlcBlocks.");
}
return FALSE;
}

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

EgprsLlcBlocks EgprsLlcBlocks_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 @RLCMAC_Types.EgprsLlcBlocks.");
EgprsLlcBlocks 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;
}

EgprsLlcBlocks EgprsLlcBlocks_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);
}

EgprsLlcBlocks EgprsLlcBlocks_template::replace(int index, int len, const EgprsLlcBlocks_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());
}

EgprsLlcBlocks EgprsLlcBlocks_template::replace(int index, int len, const EgprsLlcBlocks& 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 EgprsLlcBlocks_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 EgprsLlcBlocks_template[list_length];
break;
default:
TTCN_error("Internal error: Setting an invalid type for a template of type @RLCMAC_Types.EgprsLlcBlocks.");
}
set_selection(template_type);
}

EgprsLlcBlocks_template& EgprsLlcBlocks_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 @RLCMAC_Types.EgprsLlcBlocks.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @RLCMAC_Types.EgprsLlcBlocks.");
return value_list.list_value[list_index];
}

void EgprsLlcBlocks_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 EgprsLlcBlocks_template::log_match(const EgprsLlcBlocks& 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 EgprsLlcBlocks_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 @RLCMAC_Types.EgprsLlcBlocks.");
}
}

void EgprsLlcBlocks_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 @RLCMAC_Types.EgprsLlcBlocks.");
single_value.value_elements = (EgprsLlcBlock_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 EgprsLlcBlock_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 EgprsLlcBlocks_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 @RLCMAC_Types.EgprsLlcBlocks.");
}
}

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

boolean EgprsLlcBlocks_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 EgprsLlcBlocks_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 EgprsLlcBlocks_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: {
    EgprsLlcBlocks_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: {
    EgprsLlcBlocks_template* precondition = new EgprsLlcBlocks_template;
    precondition->set_param(*param.get_elem(0));
    EgprsLlcBlocks_template* implied_template = new EgprsLlcBlocks_template;
    implied_template->set_param(*param.get_elem(1));
    *this = EgprsLlcBlocks_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record of template", "@RLCMAC_Types.EgprsLlcBlocks");
  }
  is_ifpresent = param.get_ifpresent();
  set_length_range(param);
}

void EgprsLlcBlocks_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 : "@RLCMAC_Types.EgprsLlcBlocks");
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 : "@RLCMAC_Types.EgprsLlcBlocks");
}

boolean EgprsLlcBlocks_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);
}
}
EgprsDlMacDataHeader::EgprsDlMacDataHeader()
{
}

EgprsDlMacDataHeader::EgprsDlMacDataHeader(const EgprsHeaderType& par_header__type,
    const INTEGER& par_tfi,
    const MacRrbp& par_rrbp,
    const BITSTRING& par_esp,
    const INTEGER& par_usf,
    const INTEGER& par_bsn1,
    const INTEGER& par_bsn2__offset,
    const INTEGER& par_pr,
    const OPTIONAL< INTEGER >& par_spb,
    const INTEGER& par_cps)
  :   field_header__type(par_header__type),
  field_tfi(par_tfi),
  field_rrbp(par_rrbp),
  field_esp(par_esp),
  field_usf(par_usf),
  field_bsn1(par_bsn1),
  field_bsn2__offset(par_bsn2__offset),
  field_pr(par_pr),
  field_spb(par_spb),
  field_cps(par_cps)
{
}

EgprsDlMacDataHeader::EgprsDlMacDataHeader(const EgprsDlMacDataHeader& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.EgprsDlMacDataHeader.");
if (other_value.header__type().is_bound()) field_header__type = other_value.header__type();
else field_header__type.clean_up();
if (other_value.tfi().is_bound()) field_tfi = other_value.tfi();
else field_tfi.clean_up();
if (other_value.rrbp().is_bound()) field_rrbp = other_value.rrbp();
else field_rrbp.clean_up();
if (other_value.esp().is_bound()) field_esp = other_value.esp();
else field_esp.clean_up();
if (other_value.usf().is_bound()) field_usf = other_value.usf();
else field_usf.clean_up();
if (other_value.bsn1().is_bound()) field_bsn1 = other_value.bsn1();
else field_bsn1.clean_up();
if (other_value.bsn2__offset().is_bound()) field_bsn2__offset = other_value.bsn2__offset();
else field_bsn2__offset.clean_up();
if (other_value.pr().is_bound()) field_pr = other_value.pr();
else field_pr.clean_up();
if (other_value.spb().is_bound()) field_spb = other_value.spb();
else field_spb.clean_up();
if (other_value.cps().is_bound()) field_cps = other_value.cps();
else field_cps.clean_up();
}

void EgprsDlMacDataHeader::clean_up()
{
field_header__type.clean_up();
field_tfi.clean_up();
field_rrbp.clean_up();
field_esp.clean_up();
field_usf.clean_up();
field_bsn1.clean_up();
field_bsn2__offset.clean_up();
field_pr.clean_up();
field_spb.clean_up();
field_cps.clean_up();
}

const TTCN_Typedescriptor_t* EgprsDlMacDataHeader::get_descriptor() const { return &EgprsDlMacDataHeader_descr_; }
EgprsDlMacDataHeader& EgprsDlMacDataHeader::operator=(const EgprsDlMacDataHeader& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.EgprsDlMacDataHeader.");
  if (other_value.header__type().is_bound()) field_header__type = other_value.header__type();
  else field_header__type.clean_up();
  if (other_value.tfi().is_bound()) field_tfi = other_value.tfi();
  else field_tfi.clean_up();
  if (other_value.rrbp().is_bound()) field_rrbp = other_value.rrbp();
  else field_rrbp.clean_up();
  if (other_value.esp().is_bound()) field_esp = other_value.esp();
  else field_esp.clean_up();
  if (other_value.usf().is_bound()) field_usf = other_value.usf();
  else field_usf.clean_up();
  if (other_value.bsn1().is_bound()) field_bsn1 = other_value.bsn1();
  else field_bsn1.clean_up();
  if (other_value.bsn2__offset().is_bound()) field_bsn2__offset = other_value.bsn2__offset();
  else field_bsn2__offset.clean_up();
  if (other_value.pr().is_bound()) field_pr = other_value.pr();
  else field_pr.clean_up();
  if (other_value.spb().is_bound()) field_spb = other_value.spb();
  else field_spb.clean_up();
  if (other_value.cps().is_bound()) field_cps = other_value.cps();
  else field_cps.clean_up();
}
return *this;
}

boolean EgprsDlMacDataHeader::operator==(const EgprsDlMacDataHeader& other_value) const
{
return field_header__type==other_value.field_header__type
  && field_tfi==other_value.field_tfi
  && field_rrbp==other_value.field_rrbp
  && field_esp==other_value.field_esp
  && field_usf==other_value.field_usf
  && field_bsn1==other_value.field_bsn1
  && field_bsn2__offset==other_value.field_bsn2__offset
  && field_pr==other_value.field_pr
  && field_spb==other_value.field_spb
  && field_cps==other_value.field_cps;
}

boolean EgprsDlMacDataHeader::is_bound() const
{
return (field_header__type.is_bound())
  || (field_tfi.is_bound())
  || (field_rrbp.is_bound())
  || (field_esp.is_bound())
  || (field_usf.is_bound())
  || (field_bsn1.is_bound())
  || (field_bsn2__offset.is_bound())
  || (field_pr.is_bound())
  || (OPTIONAL_OMIT == field_spb.get_selection() || field_spb.is_bound())
  || (field_cps.is_bound());
}
boolean EgprsDlMacDataHeader::is_value() const
{
return field_header__type.is_value()
  && field_tfi.is_value()
  && field_rrbp.is_value()
  && field_esp.is_value()
  && field_usf.is_value()
  && field_bsn1.is_value()
  && field_bsn2__offset.is_value()
  && field_pr.is_value()
  && (OPTIONAL_OMIT == field_spb.get_selection() || field_spb.is_value())
  && field_cps.is_value();
}
int EgprsDlMacDataHeader::size_of() const
{
  int ret_val = 9;
  if (field_spb.ispresent()) ret_val++;
  return ret_val;
}

void EgprsDlMacDataHeader::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ header_type := ");
field_header__type.log();
TTCN_Logger::log_event_str(", tfi := ");
field_tfi.log();
TTCN_Logger::log_event_str(", rrbp := ");
field_rrbp.log();
TTCN_Logger::log_event_str(", esp := ");
field_esp.log();
TTCN_Logger::log_event_str(", usf := ");
field_usf.log();
TTCN_Logger::log_event_str(", bsn1 := ");
field_bsn1.log();
TTCN_Logger::log_event_str(", bsn2_offset := ");
field_bsn2__offset.log();
TTCN_Logger::log_event_str(", pr := ");
field_pr.log();
TTCN_Logger::log_event_str(", spb := ");
field_spb.log();
TTCN_Logger::log_event_str(", cps := ");
field_cps.log();
TTCN_Logger::log_event_str(" }");
}

void EgprsDlMacDataHeader::set_implicit_omit()
{
if (header__type().is_bound()) header__type().set_implicit_omit();
if (tfi().is_bound()) tfi().set_implicit_omit();
if (rrbp().is_bound()) rrbp().set_implicit_omit();
if (esp().is_bound()) esp().set_implicit_omit();
if (usf().is_bound()) usf().set_implicit_omit();
if (bsn1().is_bound()) bsn1().set_implicit_omit();
if (bsn2__offset().is_bound()) bsn2__offset().set_implicit_omit();
if (pr().is_bound()) pr().set_implicit_omit();
if (!spb().is_bound()) spb() = OMIT_VALUE;
else spb().set_implicit_omit();
if (cps().is_bound()) cps().set_implicit_omit();
}

void EgprsDlMacDataHeader::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 (10<param.get_size()) {
      param.error("record value of type @RLCMAC_Types.EgprsDlMacDataHeader has 10 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) header__type().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tfi().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rrbp().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) esp().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) usf().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) bsn1().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) bsn2__offset().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) pr().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) spb().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) cps().set_param(*param.get_elem(9));
    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(), "header_type")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          header__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(), "tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          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(), "rrbp")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rrbp().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "esp")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          esp().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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(), "bsn1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bsn1().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "bsn2_offset")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bsn2__offset().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pr().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spb")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spb().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cps")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cps().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 @RLCMAC_Types.EgprsDlMacDataHeader: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.EgprsDlMacDataHeader");
  }
}

void EgprsDlMacDataHeader::encode_text(Text_Buf& text_buf) const
{
field_header__type.encode_text(text_buf);
field_tfi.encode_text(text_buf);
field_rrbp.encode_text(text_buf);
field_esp.encode_text(text_buf);
field_usf.encode_text(text_buf);
field_bsn1.encode_text(text_buf);
field_bsn2__offset.encode_text(text_buf);
field_pr.encode_text(text_buf);
field_spb.encode_text(text_buf);
field_cps.encode_text(text_buf);
}

void EgprsDlMacDataHeader::decode_text(Text_Buf& text_buf)
{
field_header__type.decode_text(text_buf);
field_tfi.decode_text(text_buf);
field_rrbp.decode_text(text_buf);
field_esp.decode_text(text_buf);
field_usf.decode_text(text_buf);
field_bsn1.decode_text(text_buf);
field_bsn2__offset.decode_text(text_buf);
field_pr.decode_text(text_buf);
field_spb.decode_text(text_buf);
field_cps.decode_text(text_buf);
}

void EgprsDlMacDataHeader::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 EgprsDlMacDataHeader::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 EgprsDlMacDataHeader::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, EgprsDlMacDataHeader_header__type_descr_.raw->forceomit);
  decoded_field_length = field_header__type.RAW_decode(EgprsDlMacDataHeader_header__type_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, EgprsDlMacDataHeader_tfi_descr_.raw->forceomit);
  decoded_field_length = field_tfi.RAW_decode(EgprsDlMacDataHeader_tfi_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, EgprsDlMacDataHeader_rrbp_descr_.raw->forceomit);
  decoded_field_length = field_rrbp.RAW_decode(EgprsDlMacDataHeader_rrbp_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, EgprsDlMacDataHeader_esp_descr_.raw->forceomit);
  decoded_field_length = field_esp.RAW_decode(EgprsDlMacDataHeader_esp_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, EgprsDlMacDataHeader_usf_descr_.raw->forceomit);
  decoded_field_length = field_usf.RAW_decode(EgprsDlMacDataHeader_usf_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, EgprsDlMacDataHeader_bsn1_descr_.raw->forceomit);
  decoded_field_length = field_bsn1.RAW_decode(EgprsDlMacDataHeader_bsn1_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, EgprsDlMacDataHeader_bsn2__offset_descr_.raw->forceomit);
  decoded_field_length = field_bsn2__offset.RAW_decode(EgprsDlMacDataHeader_bsn2__offset_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, EgprsDlMacDataHeader_pr_descr_.raw->forceomit);
  decoded_field_length = field_pr.RAW_decode(EgprsDlMacDataHeader_pr_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());
  if (limit > 0 && field_header__type == EgprsHeaderType::RLCMAC__HDR__TYPE__3){
  if (force_omit != NULL && (*force_omit)(8)) {
    field_spb = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_8_force_omit(8, force_omit, EgprsDlMacDataHeader_spb_descr_.raw->forceomit);
  decoded_field_length = field_spb().RAW_decode(EgprsDlMacDataHeader_spb_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_8_force_omit);
  if (decoded_field_length < 1) {
  field_spb = 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_spb=OMIT_VALUE;
  RAW_Force_Omit field_9_force_omit(9, force_omit, EgprsDlMacDataHeader_cps_descr_.raw->forceomit);
  decoded_field_length = field_cps.RAW_decode(EgprsDlMacDataHeader_cps_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_9_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int EgprsDlMacDataHeader::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 = 10;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(10);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, EgprsDlMacDataHeader_header__type_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, EgprsDlMacDataHeader_tfi_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, EgprsDlMacDataHeader_rrbp_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, EgprsDlMacDataHeader_esp_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, EgprsDlMacDataHeader_usf_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, EgprsDlMacDataHeader_bsn1_descr_.raw);
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, EgprsDlMacDataHeader_bsn2__offset_descr_.raw);
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, EgprsDlMacDataHeader_pr_descr_.raw);
  if (field_spb.ispresent()) {
  myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, EgprsDlMacDataHeader_spb_descr_.raw);
  }
  else myleaf.body.node.nodes[8] = NULL;
  myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, EgprsDlMacDataHeader_cps_descr_.raw);
  encoded_length += field_header__type.RAW_encode(EgprsDlMacDataHeader_header__type_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_tfi.RAW_encode(EgprsDlMacDataHeader_tfi_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_rrbp.RAW_encode(EgprsDlMacDataHeader_rrbp_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_esp.RAW_encode(EgprsDlMacDataHeader_esp_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_usf.RAW_encode(EgprsDlMacDataHeader_usf_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_bsn1.RAW_encode(EgprsDlMacDataHeader_bsn1_descr_, *myleaf.body.node.nodes[5]);
  encoded_length += field_bsn2__offset.RAW_encode(EgprsDlMacDataHeader_bsn2__offset_descr_, *myleaf.body.node.nodes[6]);
  encoded_length += field_pr.RAW_encode(EgprsDlMacDataHeader_pr_descr_, *myleaf.body.node.nodes[7]);
  if (field_spb.ispresent()) {
  encoded_length += field_spb().RAW_encode(EgprsDlMacDataHeader_spb_descr_, *myleaf.body.node.nodes[8]);
  }
  encoded_length += field_cps.RAW_encode(EgprsDlMacDataHeader_cps_descr_, *myleaf.body.node.nodes[9]);
  if (field_spb.ispresent() && (field_header__type != EgprsHeaderType::RLCMAC__HDR__TYPE__3)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={0};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
  EgprsHeaderType new_val = EgprsHeaderType::RLCMAC__HDR__TYPE__3;
  new_val.RAW_encode(EgprsDlMacDataHeader_header__type_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);
  }
  }
  return myleaf.length = encoded_length;
}

struct EgprsDlMacDataHeader_template::single_value_struct {
EgprsHeaderType_template field_header__type;
INTEGER_template field_tfi;
MacRrbp_template field_rrbp;
BITSTRING_template field_esp;
INTEGER_template field_usf;
INTEGER_template field_bsn1;
INTEGER_template field_bsn2__offset;
INTEGER_template field_pr;
INTEGER_template field_spb;
INTEGER_template field_cps;
};

void EgprsDlMacDataHeader_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_header__type = ANY_VALUE;
single_value->field_tfi = ANY_VALUE;
single_value->field_rrbp = ANY_VALUE;
single_value->field_esp = ANY_VALUE;
single_value->field_usf = ANY_VALUE;
single_value->field_bsn1 = ANY_VALUE;
single_value->field_bsn2__offset = ANY_VALUE;
single_value->field_pr = ANY_VALUE;
single_value->field_spb = ANY_OR_OMIT;
single_value->field_cps = ANY_VALUE;
}
}
}

void EgprsDlMacDataHeader_template::copy_value(const EgprsDlMacDataHeader& other_value)
{
single_value = new single_value_struct;
if (other_value.header__type().is_bound()) {
  single_value->field_header__type = other_value.header__type();
} else {
  single_value->field_header__type.clean_up();
}
if (other_value.tfi().is_bound()) {
  single_value->field_tfi = other_value.tfi();
} else {
  single_value->field_tfi.clean_up();
}
if (other_value.rrbp().is_bound()) {
  single_value->field_rrbp = other_value.rrbp();
} else {
  single_value->field_rrbp.clean_up();
}
if (other_value.esp().is_bound()) {
  single_value->field_esp = other_value.esp();
} else {
  single_value->field_esp.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.bsn1().is_bound()) {
  single_value->field_bsn1 = other_value.bsn1();
} else {
  single_value->field_bsn1.clean_up();
}
if (other_value.bsn2__offset().is_bound()) {
  single_value->field_bsn2__offset = other_value.bsn2__offset();
} else {
  single_value->field_bsn2__offset.clean_up();
}
if (other_value.pr().is_bound()) {
  single_value->field_pr = other_value.pr();
} else {
  single_value->field_pr.clean_up();
}
if (other_value.spb().is_bound()) {
  if (other_value.spb().ispresent()) single_value->field_spb = other_value.spb()();
  else single_value->field_spb = OMIT_VALUE;
} else {
  single_value->field_spb.clean_up();
}
if (other_value.cps().is_bound()) {
  single_value->field_cps = other_value.cps();
} else {
  single_value->field_cps.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void EgprsDlMacDataHeader_template::copy_template(const EgprsDlMacDataHeader_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.header__type().get_selection()) {
single_value->field_header__type = other_value.header__type();
} else {
single_value->field_header__type.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tfi().get_selection()) {
single_value->field_tfi = other_value.tfi();
} else {
single_value->field_tfi.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rrbp().get_selection()) {
single_value->field_rrbp = other_value.rrbp();
} else {
single_value->field_rrbp.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.esp().get_selection()) {
single_value->field_esp = other_value.esp();
} else {
single_value->field_esp.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.bsn1().get_selection()) {
single_value->field_bsn1 = other_value.bsn1();
} else {
single_value->field_bsn1.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.bsn2__offset().get_selection()) {
single_value->field_bsn2__offset = other_value.bsn2__offset();
} else {
single_value->field_bsn2__offset.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pr().get_selection()) {
single_value->field_pr = other_value.pr();
} else {
single_value->field_pr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spb().get_selection()) {
single_value->field_spb = other_value.spb();
} else {
single_value->field_spb.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.cps().get_selection()) {
single_value->field_cps = other_value.cps();
} else {
single_value->field_cps.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 EgprsDlMacDataHeader_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 EgprsDlMacDataHeader_template(*other_value.implication_.precondition);
implication_.implied_template = new EgprsDlMacDataHeader_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 @RLCMAC_Types.EgprsDlMacDataHeader.");
break;
}
set_selection(other_value);
}

EgprsDlMacDataHeader_template::EgprsDlMacDataHeader_template()
{
}

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

EgprsDlMacDataHeader_template::EgprsDlMacDataHeader_template(const EgprsDlMacDataHeader& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean EgprsDlMacDataHeader_template::match(const EgprsDlMacDataHeader& 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.header__type().is_bound()) return FALSE;
if(!single_value->field_header__type.match(other_value.header__type(), legacy))return FALSE;
if(!other_value.tfi().is_bound()) return FALSE;
if(!single_value->field_tfi.match(other_value.tfi(), legacy))return FALSE;
if(!other_value.rrbp().is_bound()) return FALSE;
if(!single_value->field_rrbp.match(other_value.rrbp(), legacy))return FALSE;
if(!other_value.esp().is_bound()) return FALSE;
if(!single_value->field_esp.match(other_value.esp(), 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.bsn1().is_bound()) return FALSE;
if(!single_value->field_bsn1.match(other_value.bsn1(), legacy))return FALSE;
if(!other_value.bsn2__offset().is_bound()) return FALSE;
if(!single_value->field_bsn2__offset.match(other_value.bsn2__offset(), legacy))return FALSE;
if(!other_value.pr().is_bound()) return FALSE;
if(!single_value->field_pr.match(other_value.pr(), legacy))return FALSE;
if(!other_value.spb().is_bound()) return FALSE;
if((other_value.spb().ispresent() ? !single_value->field_spb.match((const INTEGER&)other_value.spb(), legacy) : !single_value->field_spb.match_omit(legacy)))return FALSE;
if(!other_value.cps().is_bound()) return FALSE;
if(!single_value->field_cps.match(other_value.cps(), 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 @RLCMAC_Types.EgprsDlMacDataHeader.");
}
return FALSE;
}

boolean EgprsDlMacDataHeader_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_header__type.is_bound()
 || single_value->field_tfi.is_bound()
 || single_value->field_rrbp.is_bound()
 || single_value->field_esp.is_bound()
 || single_value->field_usf.is_bound()
 || single_value->field_bsn1.is_bound()
 || single_value->field_bsn2__offset.is_bound()
 || single_value->field_pr.is_bound()
 || (single_value->field_spb.is_omit() || single_value->field_spb.is_bound())
 || single_value->field_cps.is_bound();
}

boolean EgprsDlMacDataHeader_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_header__type.is_value()
 && single_value->field_tfi.is_value()
 && single_value->field_rrbp.is_value()
 && single_value->field_esp.is_value()
 && single_value->field_usf.is_value()
 && single_value->field_bsn1.is_value()
 && single_value->field_bsn2__offset.is_value()
 && single_value->field_pr.is_value()
 && (single_value->field_spb.is_omit() || single_value->field_spb.is_value())
 && single_value->field_cps.is_value();
}

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

EgprsDlMacDataHeader EgprsDlMacDataHeader_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 @RLCMAC_Types.EgprsDlMacDataHeader.");
EgprsDlMacDataHeader ret_val;
if (single_value->field_header__type.is_bound()) {
ret_val.header__type() = single_value->field_header__type.valueof();
}
if (single_value->field_tfi.is_bound()) {
ret_val.tfi() = single_value->field_tfi.valueof();
}
if (single_value->field_rrbp.is_bound()) {
ret_val.rrbp() = single_value->field_rrbp.valueof();
}
if (single_value->field_esp.is_bound()) {
ret_val.esp() = single_value->field_esp.valueof();
}
if (single_value->field_usf.is_bound()) {
ret_val.usf() = single_value->field_usf.valueof();
}
if (single_value->field_bsn1.is_bound()) {
ret_val.bsn1() = single_value->field_bsn1.valueof();
}
if (single_value->field_bsn2__offset.is_bound()) {
ret_val.bsn2__offset() = single_value->field_bsn2__offset.valueof();
}
if (single_value->field_pr.is_bound()) {
ret_val.pr() = single_value->field_pr.valueof();
}
if (single_value->field_spb.is_omit()) ret_val.spb() = OMIT_VALUE;
else if (single_value->field_spb.is_bound()) {
ret_val.spb() = single_value->field_spb.valueof();
}
if (single_value->field_cps.is_bound()) {
ret_val.cps() = single_value->field_cps.valueof();
}
return ret_val;
}

void EgprsDlMacDataHeader_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 @RLCMAC_Types.EgprsDlMacDataHeader.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new EgprsDlMacDataHeader_template[list_length];
}

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

EgprsHeaderType_template& EgprsDlMacDataHeader_template::header__type()
{
set_specific();
return single_value->field_header__type;
}

const EgprsHeaderType_template& EgprsDlMacDataHeader_template::header__type() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field header_type of a non-specific template of type @RLCMAC_Types.EgprsDlMacDataHeader.");
return single_value->field_header__type;
}

INTEGER_template& EgprsDlMacDataHeader_template::tfi()
{
set_specific();
return single_value->field_tfi;
}

const INTEGER_template& EgprsDlMacDataHeader_template::tfi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tfi of a non-specific template of type @RLCMAC_Types.EgprsDlMacDataHeader.");
return single_value->field_tfi;
}

MacRrbp_template& EgprsDlMacDataHeader_template::rrbp()
{
set_specific();
return single_value->field_rrbp;
}

const MacRrbp_template& EgprsDlMacDataHeader_template::rrbp() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rrbp of a non-specific template of type @RLCMAC_Types.EgprsDlMacDataHeader.");
return single_value->field_rrbp;
}

BITSTRING_template& EgprsDlMacDataHeader_template::esp()
{
set_specific();
return single_value->field_esp;
}

const BITSTRING_template& EgprsDlMacDataHeader_template::esp() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field esp of a non-specific template of type @RLCMAC_Types.EgprsDlMacDataHeader.");
return single_value->field_esp;
}

INTEGER_template& EgprsDlMacDataHeader_template::usf()
{
set_specific();
return single_value->field_usf;
}

const INTEGER_template& EgprsDlMacDataHeader_template::usf() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field usf of a non-specific template of type @RLCMAC_Types.EgprsDlMacDataHeader.");
return single_value->field_usf;
}

INTEGER_template& EgprsDlMacDataHeader_template::bsn1()
{
set_specific();
return single_value->field_bsn1;
}

const INTEGER_template& EgprsDlMacDataHeader_template::bsn1() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field bsn1 of a non-specific template of type @RLCMAC_Types.EgprsDlMacDataHeader.");
return single_value->field_bsn1;
}

INTEGER_template& EgprsDlMacDataHeader_template::bsn2__offset()
{
set_specific();
return single_value->field_bsn2__offset;
}

const INTEGER_template& EgprsDlMacDataHeader_template::bsn2__offset() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field bsn2_offset of a non-specific template of type @RLCMAC_Types.EgprsDlMacDataHeader.");
return single_value->field_bsn2__offset;
}

INTEGER_template& EgprsDlMacDataHeader_template::pr()
{
set_specific();
return single_value->field_pr;
}

const INTEGER_template& EgprsDlMacDataHeader_template::pr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pr of a non-specific template of type @RLCMAC_Types.EgprsDlMacDataHeader.");
return single_value->field_pr;
}

INTEGER_template& EgprsDlMacDataHeader_template::spb()
{
set_specific();
return single_value->field_spb;
}

const INTEGER_template& EgprsDlMacDataHeader_template::spb() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spb of a non-specific template of type @RLCMAC_Types.EgprsDlMacDataHeader.");
return single_value->field_spb;
}

INTEGER_template& EgprsDlMacDataHeader_template::cps()
{
set_specific();
return single_value->field_cps;
}

const INTEGER_template& EgprsDlMacDataHeader_template::cps() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field cps of a non-specific template of type @RLCMAC_Types.EgprsDlMacDataHeader.");
return single_value->field_cps;
}

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

void EgprsDlMacDataHeader_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ header_type := ");
single_value->field_header__type.log();
TTCN_Logger::log_event_str(", tfi := ");
single_value->field_tfi.log();
TTCN_Logger::log_event_str(", rrbp := ");
single_value->field_rrbp.log();
TTCN_Logger::log_event_str(", esp := ");
single_value->field_esp.log();
TTCN_Logger::log_event_str(", usf := ");
single_value->field_usf.log();
TTCN_Logger::log_event_str(", bsn1 := ");
single_value->field_bsn1.log();
TTCN_Logger::log_event_str(", bsn2_offset := ");
single_value->field_bsn2__offset.log();
TTCN_Logger::log_event_str(", pr := ");
single_value->field_pr.log();
TTCN_Logger::log_event_str(", spb := ");
single_value->field_spb.log();
TTCN_Logger::log_event_str(", cps := ");
single_value->field_cps.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 EgprsDlMacDataHeader_template::log_match(const EgprsDlMacDataHeader& 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_header__type.match(match_value.header__type(), legacy)){
TTCN_Logger::log_logmatch_info(".header_type");
single_value->field_header__type.log_match(match_value.header__type(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tfi.match(match_value.tfi(), legacy)){
TTCN_Logger::log_logmatch_info(".tfi");
single_value->field_tfi.log_match(match_value.tfi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rrbp.match(match_value.rrbp(), legacy)){
TTCN_Logger::log_logmatch_info(".rrbp");
single_value->field_rrbp.log_match(match_value.rrbp(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_esp.match(match_value.esp(), legacy)){
TTCN_Logger::log_logmatch_info(".esp");
single_value->field_esp.log_match(match_value.esp(), 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_bsn1.match(match_value.bsn1(), legacy)){
TTCN_Logger::log_logmatch_info(".bsn1");
single_value->field_bsn1.log_match(match_value.bsn1(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_bsn2__offset.match(match_value.bsn2__offset(), legacy)){
TTCN_Logger::log_logmatch_info(".bsn2_offset");
single_value->field_bsn2__offset.log_match(match_value.bsn2__offset(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pr.match(match_value.pr(), legacy)){
TTCN_Logger::log_logmatch_info(".pr");
single_value->field_pr.log_match(match_value.pr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.spb().ispresent()){
if(!single_value->field_spb.match(match_value.spb(), legacy)){
TTCN_Logger::log_logmatch_info(".spb");
single_value->field_spb.log_match(match_value.spb(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_spb.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".spb := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_spb.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_cps.match(match_value.cps(), legacy)){
TTCN_Logger::log_logmatch_info(".cps");
single_value->field_cps.log_match(match_value.cps(), 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("{ header_type := ");
single_value->field_header__type.log_match(match_value.header__type(), legacy);
TTCN_Logger::log_event_str(", tfi := ");
single_value->field_tfi.log_match(match_value.tfi(), legacy);
TTCN_Logger::log_event_str(", rrbp := ");
single_value->field_rrbp.log_match(match_value.rrbp(), legacy);
TTCN_Logger::log_event_str(", esp := ");
single_value->field_esp.log_match(match_value.esp(), legacy);
TTCN_Logger::log_event_str(", usf := ");
single_value->field_usf.log_match(match_value.usf(), legacy);
TTCN_Logger::log_event_str(", bsn1 := ");
single_value->field_bsn1.log_match(match_value.bsn1(), legacy);
TTCN_Logger::log_event_str(", bsn2_offset := ");
single_value->field_bsn2__offset.log_match(match_value.bsn2__offset(), legacy);
TTCN_Logger::log_event_str(", pr := ");
single_value->field_pr.log_match(match_value.pr(), legacy);
TTCN_Logger::log_event_str(", spb := ");
if (match_value.spb().ispresent()) {
single_value->field_spb.log_match(match_value.spb(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_spb.log();
if (single_value->field_spb.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", cps := ");
single_value->field_cps.log_match(match_value.cps(), 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 EgprsDlMacDataHeader_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (header__type().is_bound()) header__type().set_implicit_omit();
if (tfi().is_bound()) tfi().set_implicit_omit();
if (rrbp().is_bound()) rrbp().set_implicit_omit();
if (esp().is_bound()) esp().set_implicit_omit();
if (usf().is_bound()) usf().set_implicit_omit();
if (bsn1().is_bound()) bsn1().set_implicit_omit();
if (bsn2__offset().is_bound()) bsn2__offset().set_implicit_omit();
if (pr().is_bound()) pr().set_implicit_omit();
if (!spb().is_bound()) spb() = OMIT_VALUE;
else spb().set_implicit_omit();
if (cps().is_bound()) cps().set_implicit_omit();
}

void EgprsDlMacDataHeader_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_header__type.encode_text(text_buf);
single_value->field_tfi.encode_text(text_buf);
single_value->field_rrbp.encode_text(text_buf);
single_value->field_esp.encode_text(text_buf);
single_value->field_usf.encode_text(text_buf);
single_value->field_bsn1.encode_text(text_buf);
single_value->field_bsn2__offset.encode_text(text_buf);
single_value->field_pr.encode_text(text_buf);
single_value->field_spb.encode_text(text_buf);
single_value->field_cps.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 @RLCMAC_Types.EgprsDlMacDataHeader.");
}
}

void EgprsDlMacDataHeader_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_header__type.decode_text(text_buf);
single_value->field_tfi.decode_text(text_buf);
single_value->field_rrbp.decode_text(text_buf);
single_value->field_esp.decode_text(text_buf);
single_value->field_usf.decode_text(text_buf);
single_value->field_bsn1.decode_text(text_buf);
single_value->field_bsn2__offset.decode_text(text_buf);
single_value->field_pr.decode_text(text_buf);
single_value->field_spb.decode_text(text_buf);
single_value->field_cps.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 EgprsDlMacDataHeader_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 @RLCMAC_Types.EgprsDlMacDataHeader.");
}
}

void EgprsDlMacDataHeader_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: {
    EgprsDlMacDataHeader_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 (10<param.get_size()) {
      param.error("record template of type @RLCMAC_Types.EgprsDlMacDataHeader has 10 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) header__type().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tfi().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rrbp().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) esp().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) usf().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) bsn1().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) bsn2__offset().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) pr().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) spb().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) cps().set_param(*param.get_elem(9));
    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(), "header_type")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          header__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(), "tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          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(), "rrbp")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rrbp().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "esp")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          esp().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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(), "bsn1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bsn1().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "bsn2_offset")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bsn2__offset().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pr().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spb")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spb().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cps")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cps().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 @RLCMAC_Types.EgprsDlMacDataHeader: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    EgprsDlMacDataHeader_template* precondition = new EgprsDlMacDataHeader_template;
    precondition->set_param(*param.get_elem(0));
    EgprsDlMacDataHeader_template* implied_template = new EgprsDlMacDataHeader_template;
    implied_template->set_param(*param.get_elem(1));
    *this = EgprsDlMacDataHeader_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.EgprsDlMacDataHeader");
  }
  is_ifpresent = param.get_ifpresent();
}

void EgprsDlMacDataHeader_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_header__type.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsDlMacDataHeader");
single_value->field_tfi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsDlMacDataHeader");
single_value->field_rrbp.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsDlMacDataHeader");
single_value->field_esp.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsDlMacDataHeader");
single_value->field_usf.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsDlMacDataHeader");
single_value->field_bsn1.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsDlMacDataHeader");
single_value->field_bsn2__offset.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsDlMacDataHeader");
single_value->field_pr.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsDlMacDataHeader");
single_value->field_spb.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsDlMacDataHeader");
single_value->field_cps.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsDlMacDataHeader");
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 : "@RLCMAC_Types.EgprsDlMacDataHeader");
}

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

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

RlcmacDlEgprsDataBlock::RlcmacDlEgprsDataBlock()
{
}

RlcmacDlEgprsDataBlock::RlcmacDlEgprsDataBlock(const CodingScheme& par_mcs,
    const EgprsDlMacDataHeader& par_mac__hdr,
    const BOOLEAN& par_fbi,
    const BOOLEAN& par_e,
    const EgprsLlcBlocks& par_blocks)
  :   field_mcs(par_mcs),
  field_mac__hdr(par_mac__hdr),
  field_fbi(par_fbi),
  field_e(par_e),
  field_blocks(par_blocks)
{
}

RlcmacDlEgprsDataBlock::RlcmacDlEgprsDataBlock(const RlcmacDlEgprsDataBlock& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.RlcmacDlEgprsDataBlock.");
if (other_value.mcs().is_bound()) field_mcs = other_value.mcs();
else field_mcs.clean_up();
if (other_value.mac__hdr().is_bound()) field_mac__hdr = other_value.mac__hdr();
else field_mac__hdr.clean_up();
if (other_value.fbi().is_bound()) field_fbi = other_value.fbi();
else field_fbi.clean_up();
if (other_value.e().is_bound()) field_e = other_value.e();
else field_e.clean_up();
if (other_value.blocks().is_bound()) field_blocks = other_value.blocks();
else field_blocks.clean_up();
}

void RlcmacDlEgprsDataBlock::clean_up()
{
field_mcs.clean_up();
field_mac__hdr.clean_up();
field_fbi.clean_up();
field_e.clean_up();
field_blocks.clean_up();
}

const TTCN_Typedescriptor_t* RlcmacDlEgprsDataBlock::get_descriptor() const { return &RlcmacDlEgprsDataBlock_descr_; }
RlcmacDlEgprsDataBlock& RlcmacDlEgprsDataBlock::operator=(const RlcmacDlEgprsDataBlock& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.RlcmacDlEgprsDataBlock.");
  if (other_value.mcs().is_bound()) field_mcs = other_value.mcs();
  else field_mcs.clean_up();
  if (other_value.mac__hdr().is_bound()) field_mac__hdr = other_value.mac__hdr();
  else field_mac__hdr.clean_up();
  if (other_value.fbi().is_bound()) field_fbi = other_value.fbi();
  else field_fbi.clean_up();
  if (other_value.e().is_bound()) field_e = other_value.e();
  else field_e.clean_up();
  if (other_value.blocks().is_bound()) field_blocks = other_value.blocks();
  else field_blocks.clean_up();
}
return *this;
}

boolean RlcmacDlEgprsDataBlock::operator==(const RlcmacDlEgprsDataBlock& other_value) const
{
return field_mcs==other_value.field_mcs
  && field_mac__hdr==other_value.field_mac__hdr
  && field_fbi==other_value.field_fbi
  && field_e==other_value.field_e
  && field_blocks==other_value.field_blocks;
}

boolean RlcmacDlEgprsDataBlock::is_bound() const
{
return (field_mcs.is_bound())
  || (field_mac__hdr.is_bound())
  || (field_fbi.is_bound())
  || (field_e.is_bound())
  || (field_blocks.is_bound());
}
boolean RlcmacDlEgprsDataBlock::is_value() const
{
return field_mcs.is_value()
  && field_mac__hdr.is_value()
  && field_fbi.is_value()
  && field_e.is_value()
  && field_blocks.is_value();
}
void RlcmacDlEgprsDataBlock::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ mcs := ");
field_mcs.log();
TTCN_Logger::log_event_str(", mac_hdr := ");
field_mac__hdr.log();
TTCN_Logger::log_event_str(", fbi := ");
field_fbi.log();
TTCN_Logger::log_event_str(", e := ");
field_e.log();
TTCN_Logger::log_event_str(", blocks := ");
field_blocks.log();
TTCN_Logger::log_event_str(" }");
}

void RlcmacDlEgprsDataBlock::set_implicit_omit()
{
if (mcs().is_bound()) mcs().set_implicit_omit();
if (mac__hdr().is_bound()) mac__hdr().set_implicit_omit();
if (fbi().is_bound()) fbi().set_implicit_omit();
if (e().is_bound()) e().set_implicit_omit();
if (blocks().is_bound()) blocks().set_implicit_omit();
}

void RlcmacDlEgprsDataBlock::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 @RLCMAC_Types.RlcmacDlEgprsDataBlock 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) mcs().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mac__hdr().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) fbi().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) e().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) blocks().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(), "mcs")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mcs().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mac_hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mac__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(), "fbi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fbi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "e")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          e().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "blocks")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          blocks().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 @RLCMAC_Types.RlcmacDlEgprsDataBlock: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.RlcmacDlEgprsDataBlock");
  }
}

void RlcmacDlEgprsDataBlock::encode_text(Text_Buf& text_buf) const
{
field_mcs.encode_text(text_buf);
field_mac__hdr.encode_text(text_buf);
field_fbi.encode_text(text_buf);
field_e.encode_text(text_buf);
field_blocks.encode_text(text_buf);
}

void RlcmacDlEgprsDataBlock::decode_text(Text_Buf& text_buf)
{
field_mcs.decode_text(text_buf);
field_mac__hdr.decode_text(text_buf);
field_fbi.decode_text(text_buf);
field_e.decode_text(text_buf);
field_blocks.decode_text(text_buf);
}

void RlcmacDlEgprsDataBlock::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 RlcmacDlEgprsDataBlock::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 RlcmacDlEgprsDataBlock::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, RlcmacDlEgprsDataBlock_mcs_descr_.raw->forceomit);
  decoded_field_length = field_mcs.RAW_decode(RlcmacDlEgprsDataBlock_mcs_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, RlcmacDlEgprsDataBlock_mac__hdr_descr_.raw->forceomit);
  decoded_field_length = field_mac__hdr.RAW_decode(RlcmacDlEgprsDataBlock_mac__hdr_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, RlcmacDlEgprsDataBlock_fbi_descr_.raw->forceomit);
  decoded_field_length = field_fbi.RAW_decode(RlcmacDlEgprsDataBlock_fbi_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, RlcmacDlEgprsDataBlock_e_descr_.raw->forceomit);
  decoded_field_length = field_e.RAW_decode(RlcmacDlEgprsDataBlock_e_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_4_force_omit(4, force_omit, RlcmacDlEgprsDataBlock_blocks_descr_.raw->forceomit);
  decoded_field_length = field_blocks.RAW_decode(RlcmacDlEgprsDataBlock_blocks_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 RlcmacDlEgprsDataBlock::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, RlcmacDlEgprsDataBlock_mcs_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RlcmacDlEgprsDataBlock_mac__hdr_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, RlcmacDlEgprsDataBlock_fbi_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, RlcmacDlEgprsDataBlock_e_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, RlcmacDlEgprsDataBlock_blocks_descr_.raw);
  encoded_length += field_mcs.RAW_encode(RlcmacDlEgprsDataBlock_mcs_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_mac__hdr.RAW_encode(RlcmacDlEgprsDataBlock_mac__hdr_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_fbi.RAW_encode(RlcmacDlEgprsDataBlock_fbi_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_e.RAW_encode(RlcmacDlEgprsDataBlock_e_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_blocks.RAW_encode(RlcmacDlEgprsDataBlock_blocks_descr_, *myleaf.body.node.nodes[4]);
  return myleaf.length = encoded_length;
}

struct RlcmacDlEgprsDataBlock_template::single_value_struct {
CodingScheme_template field_mcs;
EgprsDlMacDataHeader_template field_mac__hdr;
BOOLEAN_template field_fbi;
BOOLEAN_template field_e;
EgprsLlcBlocks_template field_blocks;
};

void RlcmacDlEgprsDataBlock_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_mcs = ANY_VALUE;
single_value->field_mac__hdr = ANY_VALUE;
single_value->field_fbi = ANY_VALUE;
single_value->field_e = ANY_VALUE;
single_value->field_blocks = ANY_VALUE;
}
}
}

void RlcmacDlEgprsDataBlock_template::copy_value(const RlcmacDlEgprsDataBlock& other_value)
{
single_value = new single_value_struct;
if (other_value.mcs().is_bound()) {
  single_value->field_mcs = other_value.mcs();
} else {
  single_value->field_mcs.clean_up();
}
if (other_value.mac__hdr().is_bound()) {
  single_value->field_mac__hdr = other_value.mac__hdr();
} else {
  single_value->field_mac__hdr.clean_up();
}
if (other_value.fbi().is_bound()) {
  single_value->field_fbi = other_value.fbi();
} else {
  single_value->field_fbi.clean_up();
}
if (other_value.e().is_bound()) {
  single_value->field_e = other_value.e();
} else {
  single_value->field_e.clean_up();
}
if (other_value.blocks().is_bound()) {
  single_value->field_blocks = other_value.blocks();
} else {
  single_value->field_blocks.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RlcmacDlEgprsDataBlock_template::copy_template(const RlcmacDlEgprsDataBlock_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.mcs().get_selection()) {
single_value->field_mcs = other_value.mcs();
} else {
single_value->field_mcs.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.mac__hdr().get_selection()) {
single_value->field_mac__hdr = other_value.mac__hdr();
} else {
single_value->field_mac__hdr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.fbi().get_selection()) {
single_value->field_fbi = other_value.fbi();
} else {
single_value->field_fbi.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.e().get_selection()) {
single_value->field_e = other_value.e();
} else {
single_value->field_e.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.blocks().get_selection()) {
single_value->field_blocks = other_value.blocks();
} else {
single_value->field_blocks.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 RlcmacDlEgprsDataBlock_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 RlcmacDlEgprsDataBlock_template(*other_value.implication_.precondition);
implication_.implied_template = new RlcmacDlEgprsDataBlock_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 @RLCMAC_Types.RlcmacDlEgprsDataBlock.");
break;
}
set_selection(other_value);
}

RlcmacDlEgprsDataBlock_template::RlcmacDlEgprsDataBlock_template()
{
}

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

RlcmacDlEgprsDataBlock_template::RlcmacDlEgprsDataBlock_template(const RlcmacDlEgprsDataBlock& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean RlcmacDlEgprsDataBlock_template::match(const RlcmacDlEgprsDataBlock& 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.mcs().is_bound()) return FALSE;
if(!single_value->field_mcs.match(other_value.mcs(), legacy))return FALSE;
if(!other_value.mac__hdr().is_bound()) return FALSE;
if(!single_value->field_mac__hdr.match(other_value.mac__hdr(), legacy))return FALSE;
if(!other_value.fbi().is_bound()) return FALSE;
if(!single_value->field_fbi.match(other_value.fbi(), legacy))return FALSE;
if(!other_value.e().is_bound()) return FALSE;
if(!single_value->field_e.match(other_value.e(), legacy))return FALSE;
if(!other_value.blocks().is_bound()) return FALSE;
if(!single_value->field_blocks.match(other_value.blocks(), 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 @RLCMAC_Types.RlcmacDlEgprsDataBlock.");
}
return FALSE;
}

boolean RlcmacDlEgprsDataBlock_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_mcs.is_bound()
 || single_value->field_mac__hdr.is_bound()
 || single_value->field_fbi.is_bound()
 || single_value->field_e.is_bound()
 || single_value->field_blocks.is_bound();
}

boolean RlcmacDlEgprsDataBlock_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_mcs.is_value()
 && single_value->field_mac__hdr.is_value()
 && single_value->field_fbi.is_value()
 && single_value->field_e.is_value()
 && single_value->field_blocks.is_value();
}

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

RlcmacDlEgprsDataBlock RlcmacDlEgprsDataBlock_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 @RLCMAC_Types.RlcmacDlEgprsDataBlock.");
RlcmacDlEgprsDataBlock ret_val;
if (single_value->field_mcs.is_bound()) {
ret_val.mcs() = single_value->field_mcs.valueof();
}
if (single_value->field_mac__hdr.is_bound()) {
ret_val.mac__hdr() = single_value->field_mac__hdr.valueof();
}
if (single_value->field_fbi.is_bound()) {
ret_val.fbi() = single_value->field_fbi.valueof();
}
if (single_value->field_e.is_bound()) {
ret_val.e() = single_value->field_e.valueof();
}
if (single_value->field_blocks.is_bound()) {
ret_val.blocks() = single_value->field_blocks.valueof();
}
return ret_val;
}

void RlcmacDlEgprsDataBlock_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 @RLCMAC_Types.RlcmacDlEgprsDataBlock.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RlcmacDlEgprsDataBlock_template[list_length];
}

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

CodingScheme_template& RlcmacDlEgprsDataBlock_template::mcs()
{
set_specific();
return single_value->field_mcs;
}

const CodingScheme_template& RlcmacDlEgprsDataBlock_template::mcs() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mcs of a non-specific template of type @RLCMAC_Types.RlcmacDlEgprsDataBlock.");
return single_value->field_mcs;
}

EgprsDlMacDataHeader_template& RlcmacDlEgprsDataBlock_template::mac__hdr()
{
set_specific();
return single_value->field_mac__hdr;
}

const EgprsDlMacDataHeader_template& RlcmacDlEgprsDataBlock_template::mac__hdr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mac_hdr of a non-specific template of type @RLCMAC_Types.RlcmacDlEgprsDataBlock.");
return single_value->field_mac__hdr;
}

BOOLEAN_template& RlcmacDlEgprsDataBlock_template::fbi()
{
set_specific();
return single_value->field_fbi;
}

const BOOLEAN_template& RlcmacDlEgprsDataBlock_template::fbi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field fbi of a non-specific template of type @RLCMAC_Types.RlcmacDlEgprsDataBlock.");
return single_value->field_fbi;
}

BOOLEAN_template& RlcmacDlEgprsDataBlock_template::e()
{
set_specific();
return single_value->field_e;
}

const BOOLEAN_template& RlcmacDlEgprsDataBlock_template::e() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field e of a non-specific template of type @RLCMAC_Types.RlcmacDlEgprsDataBlock.");
return single_value->field_e;
}

EgprsLlcBlocks_template& RlcmacDlEgprsDataBlock_template::blocks()
{
set_specific();
return single_value->field_blocks;
}

const EgprsLlcBlocks_template& RlcmacDlEgprsDataBlock_template::blocks() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field blocks of a non-specific template of type @RLCMAC_Types.RlcmacDlEgprsDataBlock.");
return single_value->field_blocks;
}

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

void RlcmacDlEgprsDataBlock_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ mcs := ");
single_value->field_mcs.log();
TTCN_Logger::log_event_str(", mac_hdr := ");
single_value->field_mac__hdr.log();
TTCN_Logger::log_event_str(", fbi := ");
single_value->field_fbi.log();
TTCN_Logger::log_event_str(", e := ");
single_value->field_e.log();
TTCN_Logger::log_event_str(", blocks := ");
single_value->field_blocks.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 RlcmacDlEgprsDataBlock_template::log_match(const RlcmacDlEgprsDataBlock& 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_mcs.match(match_value.mcs(), legacy)){
TTCN_Logger::log_logmatch_info(".mcs");
single_value->field_mcs.log_match(match_value.mcs(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_mac__hdr.match(match_value.mac__hdr(), legacy)){
TTCN_Logger::log_logmatch_info(".mac_hdr");
single_value->field_mac__hdr.log_match(match_value.mac__hdr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_fbi.match(match_value.fbi(), legacy)){
TTCN_Logger::log_logmatch_info(".fbi");
single_value->field_fbi.log_match(match_value.fbi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_e.match(match_value.e(), legacy)){
TTCN_Logger::log_logmatch_info(".e");
single_value->field_e.log_match(match_value.e(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_blocks.match(match_value.blocks(), legacy)){
TTCN_Logger::log_logmatch_info(".blocks");
single_value->field_blocks.log_match(match_value.blocks(), 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("{ mcs := ");
single_value->field_mcs.log_match(match_value.mcs(), legacy);
TTCN_Logger::log_event_str(", mac_hdr := ");
single_value->field_mac__hdr.log_match(match_value.mac__hdr(), legacy);
TTCN_Logger::log_event_str(", fbi := ");
single_value->field_fbi.log_match(match_value.fbi(), legacy);
TTCN_Logger::log_event_str(", e := ");
single_value->field_e.log_match(match_value.e(), legacy);
TTCN_Logger::log_event_str(", blocks := ");
single_value->field_blocks.log_match(match_value.blocks(), 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 RlcmacDlEgprsDataBlock_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (mcs().is_bound()) mcs().set_implicit_omit();
if (mac__hdr().is_bound()) mac__hdr().set_implicit_omit();
if (fbi().is_bound()) fbi().set_implicit_omit();
if (e().is_bound()) e().set_implicit_omit();
if (blocks().is_bound()) blocks().set_implicit_omit();
}

void RlcmacDlEgprsDataBlock_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_mcs.encode_text(text_buf);
single_value->field_mac__hdr.encode_text(text_buf);
single_value->field_fbi.encode_text(text_buf);
single_value->field_e.encode_text(text_buf);
single_value->field_blocks.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 @RLCMAC_Types.RlcmacDlEgprsDataBlock.");
}
}

void RlcmacDlEgprsDataBlock_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_mcs.decode_text(text_buf);
single_value->field_mac__hdr.decode_text(text_buf);
single_value->field_fbi.decode_text(text_buf);
single_value->field_e.decode_text(text_buf);
single_value->field_blocks.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 RlcmacDlEgprsDataBlock_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 @RLCMAC_Types.RlcmacDlEgprsDataBlock.");
}
}

void RlcmacDlEgprsDataBlock_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: {
    RlcmacDlEgprsDataBlock_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 @RLCMAC_Types.RlcmacDlEgprsDataBlock 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) mcs().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mac__hdr().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) fbi().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) e().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) blocks().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(), "mcs")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mcs().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mac_hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mac__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(), "fbi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fbi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "e")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          e().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "blocks")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          blocks().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 @RLCMAC_Types.RlcmacDlEgprsDataBlock: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    RlcmacDlEgprsDataBlock_template* precondition = new RlcmacDlEgprsDataBlock_template;
    precondition->set_param(*param.get_elem(0));
    RlcmacDlEgprsDataBlock_template* implied_template = new RlcmacDlEgprsDataBlock_template;
    implied_template->set_param(*param.get_elem(1));
    *this = RlcmacDlEgprsDataBlock_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.RlcmacDlEgprsDataBlock");
  }
  is_ifpresent = param.get_ifpresent();
}

void RlcmacDlEgprsDataBlock_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_mcs.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacDlEgprsDataBlock");
single_value->field_mac__hdr.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacDlEgprsDataBlock");
single_value->field_fbi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacDlEgprsDataBlock");
single_value->field_e.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacDlEgprsDataBlock");
single_value->field_blocks.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacDlEgprsDataBlock");
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 : "@RLCMAC_Types.RlcmacDlEgprsDataBlock");
}

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

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

UlMacDataHeader::UlMacDataHeader()
{
}

UlMacDataHeader::UlMacDataHeader(const MacPayloadType& par_payload__type,
    const INTEGER& par_countdown,
    const BOOLEAN& par_stall__ind,
    const BOOLEAN& par_retry,
    const BITSTRING& par_spare,
    const BOOLEAN& par_pfi__ind,
    const INTEGER& par_tfi,
    const BOOLEAN& par_tlli__ind,
    const INTEGER& par_bsn,
    const BOOLEAN& par_e)
  :   field_payload__type(par_payload__type),
  field_countdown(par_countdown),
  field_stall__ind(par_stall__ind),
  field_retry(par_retry),
  field_spare(par_spare),
  field_pfi__ind(par_pfi__ind),
  field_tfi(par_tfi),
  field_tlli__ind(par_tlli__ind),
  field_bsn(par_bsn),
  field_e(par_e)
{
}

UlMacDataHeader::UlMacDataHeader(const UlMacDataHeader& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.UlMacDataHeader.");
if (other_value.payload__type().is_bound()) field_payload__type = other_value.payload__type();
else field_payload__type.clean_up();
if (other_value.countdown().is_bound()) field_countdown = other_value.countdown();
else field_countdown.clean_up();
if (other_value.stall__ind().is_bound()) field_stall__ind = other_value.stall__ind();
else field_stall__ind.clean_up();
if (other_value.retry().is_bound()) field_retry = other_value.retry();
else field_retry.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.pfi__ind().is_bound()) field_pfi__ind = other_value.pfi__ind();
else field_pfi__ind.clean_up();
if (other_value.tfi().is_bound()) field_tfi = other_value.tfi();
else field_tfi.clean_up();
if (other_value.tlli__ind().is_bound()) field_tlli__ind = other_value.tlli__ind();
else field_tlli__ind.clean_up();
if (other_value.bsn().is_bound()) field_bsn = other_value.bsn();
else field_bsn.clean_up();
if (other_value.e().is_bound()) field_e = other_value.e();
else field_e.clean_up();
}

void UlMacDataHeader::clean_up()
{
field_payload__type.clean_up();
field_countdown.clean_up();
field_stall__ind.clean_up();
field_retry.clean_up();
field_spare.clean_up();
field_pfi__ind.clean_up();
field_tfi.clean_up();
field_tlli__ind.clean_up();
field_bsn.clean_up();
field_e.clean_up();
}

const TTCN_Typedescriptor_t* UlMacDataHeader::get_descriptor() const { return &UlMacDataHeader_descr_; }
UlMacDataHeader& UlMacDataHeader::operator=(const UlMacDataHeader& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.UlMacDataHeader.");
  if (other_value.payload__type().is_bound()) field_payload__type = other_value.payload__type();
  else field_payload__type.clean_up();
  if (other_value.countdown().is_bound()) field_countdown = other_value.countdown();
  else field_countdown.clean_up();
  if (other_value.stall__ind().is_bound()) field_stall__ind = other_value.stall__ind();
  else field_stall__ind.clean_up();
  if (other_value.retry().is_bound()) field_retry = other_value.retry();
  else field_retry.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.pfi__ind().is_bound()) field_pfi__ind = other_value.pfi__ind();
  else field_pfi__ind.clean_up();
  if (other_value.tfi().is_bound()) field_tfi = other_value.tfi();
  else field_tfi.clean_up();
  if (other_value.tlli__ind().is_bound()) field_tlli__ind = other_value.tlli__ind();
  else field_tlli__ind.clean_up();
  if (other_value.bsn().is_bound()) field_bsn = other_value.bsn();
  else field_bsn.clean_up();
  if (other_value.e().is_bound()) field_e = other_value.e();
  else field_e.clean_up();
}
return *this;
}

boolean UlMacDataHeader::operator==(const UlMacDataHeader& other_value) const
{
return field_payload__type==other_value.field_payload__type
  && field_countdown==other_value.field_countdown
  && field_stall__ind==other_value.field_stall__ind
  && field_retry==other_value.field_retry
  && field_spare==other_value.field_spare
  && field_pfi__ind==other_value.field_pfi__ind
  && field_tfi==other_value.field_tfi
  && field_tlli__ind==other_value.field_tlli__ind
  && field_bsn==other_value.field_bsn
  && field_e==other_value.field_e;
}

boolean UlMacDataHeader::is_bound() const
{
return (field_payload__type.is_bound())
  || (field_countdown.is_bound())
  || (field_stall__ind.is_bound())
  || (field_retry.is_bound())
  || (field_spare.is_bound())
  || (field_pfi__ind.is_bound())
  || (field_tfi.is_bound())
  || (field_tlli__ind.is_bound())
  || (field_bsn.is_bound())
  || (field_e.is_bound());
}
boolean UlMacDataHeader::is_value() const
{
return field_payload__type.is_value()
  && field_countdown.is_value()
  && field_stall__ind.is_value()
  && field_retry.is_value()
  && field_spare.is_value()
  && field_pfi__ind.is_value()
  && field_tfi.is_value()
  && field_tlli__ind.is_value()
  && field_bsn.is_value()
  && field_e.is_value();
}
void UlMacDataHeader::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ payload_type := ");
field_payload__type.log();
TTCN_Logger::log_event_str(", countdown := ");
field_countdown.log();
TTCN_Logger::log_event_str(", stall_ind := ");
field_stall__ind.log();
TTCN_Logger::log_event_str(", retry := ");
field_retry.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(", pfi_ind := ");
field_pfi__ind.log();
TTCN_Logger::log_event_str(", tfi := ");
field_tfi.log();
TTCN_Logger::log_event_str(", tlli_ind := ");
field_tlli__ind.log();
TTCN_Logger::log_event_str(", bsn := ");
field_bsn.log();
TTCN_Logger::log_event_str(", e := ");
field_e.log();
TTCN_Logger::log_event_str(" }");
}

void UlMacDataHeader::set_implicit_omit()
{
if (payload__type().is_bound()) payload__type().set_implicit_omit();
if (countdown().is_bound()) countdown().set_implicit_omit();
if (stall__ind().is_bound()) stall__ind().set_implicit_omit();
if (retry().is_bound()) retry().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (pfi__ind().is_bound()) pfi__ind().set_implicit_omit();
if (tfi().is_bound()) tfi().set_implicit_omit();
if (tlli__ind().is_bound()) tlli__ind().set_implicit_omit();
if (bsn().is_bound()) bsn().set_implicit_omit();
if (e().is_bound()) e().set_implicit_omit();
}

void UlMacDataHeader::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 (10<param.get_size()) {
      param.error("record value of type @RLCMAC_Types.UlMacDataHeader has 10 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__type().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) countdown().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) stall__ind().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) retry().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) pfi__ind().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) tfi().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) tlli__ind().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) bsn().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) e().set_param(*param.get_elem(9));
    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_type")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          payload__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(), "countdown")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          countdown().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "stall_ind")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          stall__ind().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "retry")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          retry().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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(), "pfi_ind")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pfi__ind().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          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(), "tlli_ind")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tlli__ind().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "bsn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bsn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "e")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          e().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @RLCMAC_Types.UlMacDataHeader: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.UlMacDataHeader");
  }
}

void UlMacDataHeader::encode_text(Text_Buf& text_buf) const
{
field_payload__type.encode_text(text_buf);
field_countdown.encode_text(text_buf);
field_stall__ind.encode_text(text_buf);
field_retry.encode_text(text_buf);
field_spare.encode_text(text_buf);
field_pfi__ind.encode_text(text_buf);
field_tfi.encode_text(text_buf);
field_tlli__ind.encode_text(text_buf);
field_bsn.encode_text(text_buf);
field_e.encode_text(text_buf);
}

void UlMacDataHeader::decode_text(Text_Buf& text_buf)
{
field_payload__type.decode_text(text_buf);
field_countdown.decode_text(text_buf);
field_stall__ind.decode_text(text_buf);
field_retry.decode_text(text_buf);
field_spare.decode_text(text_buf);
field_pfi__ind.decode_text(text_buf);
field_tfi.decode_text(text_buf);
field_tlli__ind.decode_text(text_buf);
field_bsn.decode_text(text_buf);
field_e.decode_text(text_buf);
}

void UlMacDataHeader::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 UlMacDataHeader::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 UlMacDataHeader::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, UlMacDataHeader_payload__type_descr_.raw->forceomit);
  decoded_field_length = field_payload__type.RAW_decode(UlMacDataHeader_payload__type_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, UlMacDataHeader_countdown_descr_.raw->forceomit);
  decoded_field_length = field_countdown.RAW_decode(UlMacDataHeader_countdown_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, UlMacDataHeader_stall__ind_descr_.raw->forceomit);
  decoded_field_length = field_stall__ind.RAW_decode(UlMacDataHeader_stall__ind_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, UlMacDataHeader_retry_descr_.raw->forceomit);
  decoded_field_length = field_retry.RAW_decode(UlMacDataHeader_retry_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, UlMacDataHeader_spare_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(UlMacDataHeader_spare_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, UlMacDataHeader_pfi__ind_descr_.raw->forceomit);
  decoded_field_length = field_pfi__ind.RAW_decode(UlMacDataHeader_pfi__ind_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, UlMacDataHeader_tfi_descr_.raw->forceomit);
  decoded_field_length = field_tfi.RAW_decode(UlMacDataHeader_tfi_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, UlMacDataHeader_tlli__ind_descr_.raw->forceomit);
  decoded_field_length = field_tlli__ind.RAW_decode(UlMacDataHeader_tlli__ind_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, UlMacDataHeader_bsn_descr_.raw->forceomit);
  decoded_field_length = field_bsn.RAW_decode(UlMacDataHeader_bsn_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_8_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_9_force_omit(9, force_omit, UlMacDataHeader_e_descr_.raw->forceomit);
  decoded_field_length = field_e.RAW_decode(UlMacDataHeader_e_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_9_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int UlMacDataHeader::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 = 10;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(10);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, UlMacDataHeader_payload__type_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, UlMacDataHeader_countdown_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, UlMacDataHeader_stall__ind_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, UlMacDataHeader_retry_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, UlMacDataHeader_spare_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, UlMacDataHeader_pfi__ind_descr_.raw);
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, UlMacDataHeader_tfi_descr_.raw);
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, UlMacDataHeader_tlli__ind_descr_.raw);
  myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, UlMacDataHeader_bsn_descr_.raw);
  myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, UlMacDataHeader_e_descr_.raw);
  encoded_length += field_payload__type.RAW_encode(UlMacDataHeader_payload__type_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_countdown.RAW_encode(UlMacDataHeader_countdown_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_stall__ind.RAW_encode(UlMacDataHeader_stall__ind_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_retry.RAW_encode(UlMacDataHeader_retry_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_spare.RAW_encode(UlMacDataHeader_spare_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_pfi__ind.RAW_encode(UlMacDataHeader_pfi__ind_descr_, *myleaf.body.node.nodes[5]);
  encoded_length += field_tfi.RAW_encode(UlMacDataHeader_tfi_descr_, *myleaf.body.node.nodes[6]);
  encoded_length += field_tlli__ind.RAW_encode(UlMacDataHeader_tlli__ind_descr_, *myleaf.body.node.nodes[7]);
  encoded_length += field_bsn.RAW_encode(UlMacDataHeader_bsn_descr_, *myleaf.body.node.nodes[8]);
  encoded_length += field_e.RAW_encode(UlMacDataHeader_e_descr_, *myleaf.body.node.nodes[9]);
  return myleaf.length = encoded_length;
}

struct UlMacDataHeader_template::single_value_struct {
MacPayloadType_template field_payload__type;
INTEGER_template field_countdown;
BOOLEAN_template field_stall__ind;
BOOLEAN_template field_retry;
BITSTRING_template field_spare;
BOOLEAN_template field_pfi__ind;
INTEGER_template field_tfi;
BOOLEAN_template field_tlli__ind;
INTEGER_template field_bsn;
BOOLEAN_template field_e;
};

void UlMacDataHeader_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__type = ANY_VALUE;
single_value->field_countdown = ANY_VALUE;
single_value->field_stall__ind = ANY_VALUE;
single_value->field_retry = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
single_value->field_pfi__ind = ANY_VALUE;
single_value->field_tfi = ANY_VALUE;
single_value->field_tlli__ind = ANY_VALUE;
single_value->field_bsn = ANY_VALUE;
single_value->field_e = ANY_VALUE;
}
}
}

void UlMacDataHeader_template::copy_value(const UlMacDataHeader& other_value)
{
single_value = new single_value_struct;
if (other_value.payload__type().is_bound()) {
  single_value->field_payload__type = other_value.payload__type();
} else {
  single_value->field_payload__type.clean_up();
}
if (other_value.countdown().is_bound()) {
  single_value->field_countdown = other_value.countdown();
} else {
  single_value->field_countdown.clean_up();
}
if (other_value.stall__ind().is_bound()) {
  single_value->field_stall__ind = other_value.stall__ind();
} else {
  single_value->field_stall__ind.clean_up();
}
if (other_value.retry().is_bound()) {
  single_value->field_retry = other_value.retry();
} else {
  single_value->field_retry.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.pfi__ind().is_bound()) {
  single_value->field_pfi__ind = other_value.pfi__ind();
} else {
  single_value->field_pfi__ind.clean_up();
}
if (other_value.tfi().is_bound()) {
  single_value->field_tfi = other_value.tfi();
} else {
  single_value->field_tfi.clean_up();
}
if (other_value.tlli__ind().is_bound()) {
  single_value->field_tlli__ind = other_value.tlli__ind();
} else {
  single_value->field_tlli__ind.clean_up();
}
if (other_value.bsn().is_bound()) {
  single_value->field_bsn = other_value.bsn();
} else {
  single_value->field_bsn.clean_up();
}
if (other_value.e().is_bound()) {
  single_value->field_e = other_value.e();
} else {
  single_value->field_e.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void UlMacDataHeader_template::copy_template(const UlMacDataHeader_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.payload__type().get_selection()) {
single_value->field_payload__type = other_value.payload__type();
} else {
single_value->field_payload__type.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.countdown().get_selection()) {
single_value->field_countdown = other_value.countdown();
} else {
single_value->field_countdown.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.stall__ind().get_selection()) {
single_value->field_stall__ind = other_value.stall__ind();
} else {
single_value->field_stall__ind.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.retry().get_selection()) {
single_value->field_retry = other_value.retry();
} else {
single_value->field_retry.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.pfi__ind().get_selection()) {
single_value->field_pfi__ind = other_value.pfi__ind();
} else {
single_value->field_pfi__ind.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tfi().get_selection()) {
single_value->field_tfi = other_value.tfi();
} else {
single_value->field_tfi.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tlli__ind().get_selection()) {
single_value->field_tlli__ind = other_value.tlli__ind();
} else {
single_value->field_tlli__ind.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.bsn().get_selection()) {
single_value->field_bsn = other_value.bsn();
} else {
single_value->field_bsn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.e().get_selection()) {
single_value->field_e = other_value.e();
} else {
single_value->field_e.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 UlMacDataHeader_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 UlMacDataHeader_template(*other_value.implication_.precondition);
implication_.implied_template = new UlMacDataHeader_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 @RLCMAC_Types.UlMacDataHeader.");
break;
}
set_selection(other_value);
}

UlMacDataHeader_template::UlMacDataHeader_template()
{
}

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

UlMacDataHeader_template::UlMacDataHeader_template(const UlMacDataHeader& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean UlMacDataHeader_template::match(const UlMacDataHeader& 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__type().is_bound()) return FALSE;
if(!single_value->field_payload__type.match(other_value.payload__type(), legacy))return FALSE;
if(!other_value.countdown().is_bound()) return FALSE;
if(!single_value->field_countdown.match(other_value.countdown(), legacy))return FALSE;
if(!other_value.stall__ind().is_bound()) return FALSE;
if(!single_value->field_stall__ind.match(other_value.stall__ind(), legacy))return FALSE;
if(!other_value.retry().is_bound()) return FALSE;
if(!single_value->field_retry.match(other_value.retry(), 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.pfi__ind().is_bound()) return FALSE;
if(!single_value->field_pfi__ind.match(other_value.pfi__ind(), legacy))return FALSE;
if(!other_value.tfi().is_bound()) return FALSE;
if(!single_value->field_tfi.match(other_value.tfi(), legacy))return FALSE;
if(!other_value.tlli__ind().is_bound()) return FALSE;
if(!single_value->field_tlli__ind.match(other_value.tlli__ind(), legacy))return FALSE;
if(!other_value.bsn().is_bound()) return FALSE;
if(!single_value->field_bsn.match(other_value.bsn(), legacy))return FALSE;
if(!other_value.e().is_bound()) return FALSE;
if(!single_value->field_e.match(other_value.e(), 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 @RLCMAC_Types.UlMacDataHeader.");
}
return FALSE;
}

boolean UlMacDataHeader_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__type.is_bound()
 || single_value->field_countdown.is_bound()
 || single_value->field_stall__ind.is_bound()
 || single_value->field_retry.is_bound()
 || single_value->field_spare.is_bound()
 || single_value->field_pfi__ind.is_bound()
 || single_value->field_tfi.is_bound()
 || single_value->field_tlli__ind.is_bound()
 || single_value->field_bsn.is_bound()
 || single_value->field_e.is_bound();
}

boolean UlMacDataHeader_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_payload__type.is_value()
 && single_value->field_countdown.is_value()
 && single_value->field_stall__ind.is_value()
 && single_value->field_retry.is_value()
 && single_value->field_spare.is_value()
 && single_value->field_pfi__ind.is_value()
 && single_value->field_tfi.is_value()
 && single_value->field_tlli__ind.is_value()
 && single_value->field_bsn.is_value()
 && single_value->field_e.is_value();
}

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

UlMacDataHeader UlMacDataHeader_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 @RLCMAC_Types.UlMacDataHeader.");
UlMacDataHeader ret_val;
if (single_value->field_payload__type.is_bound()) {
ret_val.payload__type() = single_value->field_payload__type.valueof();
}
if (single_value->field_countdown.is_bound()) {
ret_val.countdown() = single_value->field_countdown.valueof();
}
if (single_value->field_stall__ind.is_bound()) {
ret_val.stall__ind() = single_value->field_stall__ind.valueof();
}
if (single_value->field_retry.is_bound()) {
ret_val.retry() = single_value->field_retry.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_pfi__ind.is_bound()) {
ret_val.pfi__ind() = single_value->field_pfi__ind.valueof();
}
if (single_value->field_tfi.is_bound()) {
ret_val.tfi() = single_value->field_tfi.valueof();
}
if (single_value->field_tlli__ind.is_bound()) {
ret_val.tlli__ind() = single_value->field_tlli__ind.valueof();
}
if (single_value->field_bsn.is_bound()) {
ret_val.bsn() = single_value->field_bsn.valueof();
}
if (single_value->field_e.is_bound()) {
ret_val.e() = single_value->field_e.valueof();
}
return ret_val;
}

void UlMacDataHeader_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 @RLCMAC_Types.UlMacDataHeader.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new UlMacDataHeader_template[list_length];
}

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

MacPayloadType_template& UlMacDataHeader_template::payload__type()
{
set_specific();
return single_value->field_payload__type;
}

const MacPayloadType_template& UlMacDataHeader_template::payload__type() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field payload_type of a non-specific template of type @RLCMAC_Types.UlMacDataHeader.");
return single_value->field_payload__type;
}

INTEGER_template& UlMacDataHeader_template::countdown()
{
set_specific();
return single_value->field_countdown;
}

const INTEGER_template& UlMacDataHeader_template::countdown() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field countdown of a non-specific template of type @RLCMAC_Types.UlMacDataHeader.");
return single_value->field_countdown;
}

BOOLEAN_template& UlMacDataHeader_template::stall__ind()
{
set_specific();
return single_value->field_stall__ind;
}

const BOOLEAN_template& UlMacDataHeader_template::stall__ind() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field stall_ind of a non-specific template of type @RLCMAC_Types.UlMacDataHeader.");
return single_value->field_stall__ind;
}

BOOLEAN_template& UlMacDataHeader_template::retry()
{
set_specific();
return single_value->field_retry;
}

const BOOLEAN_template& UlMacDataHeader_template::retry() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field retry of a non-specific template of type @RLCMAC_Types.UlMacDataHeader.");
return single_value->field_retry;
}

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

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

BOOLEAN_template& UlMacDataHeader_template::pfi__ind()
{
set_specific();
return single_value->field_pfi__ind;
}

const BOOLEAN_template& UlMacDataHeader_template::pfi__ind() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pfi_ind of a non-specific template of type @RLCMAC_Types.UlMacDataHeader.");
return single_value->field_pfi__ind;
}

INTEGER_template& UlMacDataHeader_template::tfi()
{
set_specific();
return single_value->field_tfi;
}

const INTEGER_template& UlMacDataHeader_template::tfi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tfi of a non-specific template of type @RLCMAC_Types.UlMacDataHeader.");
return single_value->field_tfi;
}

BOOLEAN_template& UlMacDataHeader_template::tlli__ind()
{
set_specific();
return single_value->field_tlli__ind;
}

const BOOLEAN_template& UlMacDataHeader_template::tlli__ind() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tlli_ind of a non-specific template of type @RLCMAC_Types.UlMacDataHeader.");
return single_value->field_tlli__ind;
}

INTEGER_template& UlMacDataHeader_template::bsn()
{
set_specific();
return single_value->field_bsn;
}

const INTEGER_template& UlMacDataHeader_template::bsn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field bsn of a non-specific template of type @RLCMAC_Types.UlMacDataHeader.");
return single_value->field_bsn;
}

BOOLEAN_template& UlMacDataHeader_template::e()
{
set_specific();
return single_value->field_e;
}

const BOOLEAN_template& UlMacDataHeader_template::e() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field e of a non-specific template of type @RLCMAC_Types.UlMacDataHeader.");
return single_value->field_e;
}

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

void UlMacDataHeader_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ payload_type := ");
single_value->field_payload__type.log();
TTCN_Logger::log_event_str(", countdown := ");
single_value->field_countdown.log();
TTCN_Logger::log_event_str(", stall_ind := ");
single_value->field_stall__ind.log();
TTCN_Logger::log_event_str(", retry := ");
single_value->field_retry.log();
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(", pfi_ind := ");
single_value->field_pfi__ind.log();
TTCN_Logger::log_event_str(", tfi := ");
single_value->field_tfi.log();
TTCN_Logger::log_event_str(", tlli_ind := ");
single_value->field_tlli__ind.log();
TTCN_Logger::log_event_str(", bsn := ");
single_value->field_bsn.log();
TTCN_Logger::log_event_str(", e := ");
single_value->field_e.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 UlMacDataHeader_template::log_match(const UlMacDataHeader& 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__type.match(match_value.payload__type(), legacy)){
TTCN_Logger::log_logmatch_info(".payload_type");
single_value->field_payload__type.log_match(match_value.payload__type(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_countdown.match(match_value.countdown(), legacy)){
TTCN_Logger::log_logmatch_info(".countdown");
single_value->field_countdown.log_match(match_value.countdown(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_stall__ind.match(match_value.stall__ind(), legacy)){
TTCN_Logger::log_logmatch_info(".stall_ind");
single_value->field_stall__ind.log_match(match_value.stall__ind(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_retry.match(match_value.retry(), legacy)){
TTCN_Logger::log_logmatch_info(".retry");
single_value->field_retry.log_match(match_value.retry(), 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_pfi__ind.match(match_value.pfi__ind(), legacy)){
TTCN_Logger::log_logmatch_info(".pfi_ind");
single_value->field_pfi__ind.log_match(match_value.pfi__ind(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tfi.match(match_value.tfi(), legacy)){
TTCN_Logger::log_logmatch_info(".tfi");
single_value->field_tfi.log_match(match_value.tfi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tlli__ind.match(match_value.tlli__ind(), legacy)){
TTCN_Logger::log_logmatch_info(".tlli_ind");
single_value->field_tlli__ind.log_match(match_value.tlli__ind(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_bsn.match(match_value.bsn(), legacy)){
TTCN_Logger::log_logmatch_info(".bsn");
single_value->field_bsn.log_match(match_value.bsn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_e.match(match_value.e(), legacy)){
TTCN_Logger::log_logmatch_info(".e");
single_value->field_e.log_match(match_value.e(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}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_type := ");
single_value->field_payload__type.log_match(match_value.payload__type(), legacy);
TTCN_Logger::log_event_str(", countdown := ");
single_value->field_countdown.log_match(match_value.countdown(), legacy);
TTCN_Logger::log_event_str(", stall_ind := ");
single_value->field_stall__ind.log_match(match_value.stall__ind(), legacy);
TTCN_Logger::log_event_str(", retry := ");
single_value->field_retry.log_match(match_value.retry(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(", pfi_ind := ");
single_value->field_pfi__ind.log_match(match_value.pfi__ind(), legacy);
TTCN_Logger::log_event_str(", tfi := ");
single_value->field_tfi.log_match(match_value.tfi(), legacy);
TTCN_Logger::log_event_str(", tlli_ind := ");
single_value->field_tlli__ind.log_match(match_value.tlli__ind(), legacy);
TTCN_Logger::log_event_str(", bsn := ");
single_value->field_bsn.log_match(match_value.bsn(), legacy);
TTCN_Logger::log_event_str(", e := ");
single_value->field_e.log_match(match_value.e(), 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 UlMacDataHeader_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (payload__type().is_bound()) payload__type().set_implicit_omit();
if (countdown().is_bound()) countdown().set_implicit_omit();
if (stall__ind().is_bound()) stall__ind().set_implicit_omit();
if (retry().is_bound()) retry().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (pfi__ind().is_bound()) pfi__ind().set_implicit_omit();
if (tfi().is_bound()) tfi().set_implicit_omit();
if (tlli__ind().is_bound()) tlli__ind().set_implicit_omit();
if (bsn().is_bound()) bsn().set_implicit_omit();
if (e().is_bound()) e().set_implicit_omit();
}

void UlMacDataHeader_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_payload__type.encode_text(text_buf);
single_value->field_countdown.encode_text(text_buf);
single_value->field_stall__ind.encode_text(text_buf);
single_value->field_retry.encode_text(text_buf);
single_value->field_spare.encode_text(text_buf);
single_value->field_pfi__ind.encode_text(text_buf);
single_value->field_tfi.encode_text(text_buf);
single_value->field_tlli__ind.encode_text(text_buf);
single_value->field_bsn.encode_text(text_buf);
single_value->field_e.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 @RLCMAC_Types.UlMacDataHeader.");
}
}

void UlMacDataHeader_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__type.decode_text(text_buf);
single_value->field_countdown.decode_text(text_buf);
single_value->field_stall__ind.decode_text(text_buf);
single_value->field_retry.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
single_value->field_pfi__ind.decode_text(text_buf);
single_value->field_tfi.decode_text(text_buf);
single_value->field_tlli__ind.decode_text(text_buf);
single_value->field_bsn.decode_text(text_buf);
single_value->field_e.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 UlMacDataHeader_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 @RLCMAC_Types.UlMacDataHeader.");
}
}

void UlMacDataHeader_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: {
    UlMacDataHeader_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 (10<param.get_size()) {
      param.error("record template of type @RLCMAC_Types.UlMacDataHeader has 10 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__type().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) countdown().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) stall__ind().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) retry().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) pfi__ind().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) tfi().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) tlli__ind().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) bsn().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) e().set_param(*param.get_elem(9));
    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_type")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          payload__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(), "countdown")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          countdown().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "stall_ind")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          stall__ind().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "retry")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          retry().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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(), "pfi_ind")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pfi__ind().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          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(), "tlli_ind")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tlli__ind().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "bsn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bsn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "e")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          e().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @RLCMAC_Types.UlMacDataHeader: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    UlMacDataHeader_template* precondition = new UlMacDataHeader_template;
    precondition->set_param(*param.get_elem(0));
    UlMacDataHeader_template* implied_template = new UlMacDataHeader_template;
    implied_template->set_param(*param.get_elem(1));
    *this = UlMacDataHeader_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.UlMacDataHeader");
  }
  is_ifpresent = param.get_ifpresent();
}

void UlMacDataHeader_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__type.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.UlMacDataHeader");
single_value->field_countdown.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.UlMacDataHeader");
single_value->field_stall__ind.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.UlMacDataHeader");
single_value->field_retry.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.UlMacDataHeader");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.UlMacDataHeader");
single_value->field_pfi__ind.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.UlMacDataHeader");
single_value->field_tfi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.UlMacDataHeader");
single_value->field_tlli__ind.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.UlMacDataHeader");
single_value->field_bsn.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.UlMacDataHeader");
single_value->field_e.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.UlMacDataHeader");
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 : "@RLCMAC_Types.UlMacDataHeader");
}

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

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

RlcMacUlPfi::RlcMacUlPfi()
{
}

RlcMacUlPfi::RlcMacUlPfi(const INTEGER& par_pfi,
    const BOOLEAN& par_m)
  :   field_pfi(par_pfi),
  field_m(par_m)
{
}

RlcMacUlPfi::RlcMacUlPfi(const RlcMacUlPfi& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.RlcMacUlPfi.");
if (other_value.pfi().is_bound()) field_pfi = other_value.pfi();
else field_pfi.clean_up();
if (other_value.m().is_bound()) field_m = other_value.m();
else field_m.clean_up();
}

void RlcMacUlPfi::clean_up()
{
field_pfi.clean_up();
field_m.clean_up();
}

const TTCN_Typedescriptor_t* RlcMacUlPfi::get_descriptor() const { return &RlcMacUlPfi_descr_; }
RlcMacUlPfi& RlcMacUlPfi::operator=(const RlcMacUlPfi& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.RlcMacUlPfi.");
  if (other_value.pfi().is_bound()) field_pfi = other_value.pfi();
  else field_pfi.clean_up();
  if (other_value.m().is_bound()) field_m = other_value.m();
  else field_m.clean_up();
}
return *this;
}

boolean RlcMacUlPfi::operator==(const RlcMacUlPfi& other_value) const
{
return field_pfi==other_value.field_pfi
  && field_m==other_value.field_m;
}

boolean RlcMacUlPfi::is_bound() const
{
return (field_pfi.is_bound())
  || (field_m.is_bound());
}
boolean RlcMacUlPfi::is_value() const
{
return field_pfi.is_value()
  && field_m.is_value();
}
void RlcMacUlPfi::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ pfi := ");
field_pfi.log();
TTCN_Logger::log_event_str(", m := ");
field_m.log();
TTCN_Logger::log_event_str(" }");
}

void RlcMacUlPfi::set_implicit_omit()
{
if (pfi().is_bound()) pfi().set_implicit_omit();
if (m().is_bound()) m().set_implicit_omit();
}

void RlcMacUlPfi::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 @RLCMAC_Types.RlcMacUlPfi 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) pfi().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) m().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(), "pfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pfi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "m")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          m().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @RLCMAC_Types.RlcMacUlPfi: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.RlcMacUlPfi");
  }
}

void RlcMacUlPfi::encode_text(Text_Buf& text_buf) const
{
field_pfi.encode_text(text_buf);
field_m.encode_text(text_buf);
}

void RlcMacUlPfi::decode_text(Text_Buf& text_buf)
{
field_pfi.decode_text(text_buf);
field_m.decode_text(text_buf);
}

void RlcMacUlPfi::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 RlcMacUlPfi::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 RlcMacUlPfi::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, RlcMacUlPfi_pfi_descr_.raw->forceomit);
  decoded_field_length = field_pfi.RAW_decode(RlcMacUlPfi_pfi_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, RlcMacUlPfi_m_descr_.raw->forceomit);
  decoded_field_length = field_m.RAW_decode(RlcMacUlPfi_m_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 RlcMacUlPfi::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, RlcMacUlPfi_pfi_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RlcMacUlPfi_m_descr_.raw);
  encoded_length += field_pfi.RAW_encode(RlcMacUlPfi_pfi_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_m.RAW_encode(RlcMacUlPfi_m_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct RlcMacUlPfi_template::single_value_struct {
INTEGER_template field_pfi;
BOOLEAN_template field_m;
};

void RlcMacUlPfi_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_pfi = ANY_VALUE;
single_value->field_m = ANY_VALUE;
}
}
}

void RlcMacUlPfi_template::copy_value(const RlcMacUlPfi& other_value)
{
single_value = new single_value_struct;
if (other_value.pfi().is_bound()) {
  single_value->field_pfi = other_value.pfi();
} else {
  single_value->field_pfi.clean_up();
}
if (other_value.m().is_bound()) {
  single_value->field_m = other_value.m();
} else {
  single_value->field_m.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RlcMacUlPfi_template::copy_template(const RlcMacUlPfi_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.pfi().get_selection()) {
single_value->field_pfi = other_value.pfi();
} else {
single_value->field_pfi.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.m().get_selection()) {
single_value->field_m = other_value.m();
} else {
single_value->field_m.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 RlcMacUlPfi_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 RlcMacUlPfi_template(*other_value.implication_.precondition);
implication_.implied_template = new RlcMacUlPfi_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 @RLCMAC_Types.RlcMacUlPfi.");
break;
}
set_selection(other_value);
}

RlcMacUlPfi_template::RlcMacUlPfi_template()
{
}

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

RlcMacUlPfi_template::RlcMacUlPfi_template(const RlcMacUlPfi& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean RlcMacUlPfi_template::match(const RlcMacUlPfi& 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.pfi().is_bound()) return FALSE;
if(!single_value->field_pfi.match(other_value.pfi(), legacy))return FALSE;
if(!other_value.m().is_bound()) return FALSE;
if(!single_value->field_m.match(other_value.m(), 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 @RLCMAC_Types.RlcMacUlPfi.");
}
return FALSE;
}

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

boolean RlcMacUlPfi_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_pfi.is_value()
 && single_value->field_m.is_value();
}

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

RlcMacUlPfi RlcMacUlPfi_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 @RLCMAC_Types.RlcMacUlPfi.");
RlcMacUlPfi ret_val;
if (single_value->field_pfi.is_bound()) {
ret_val.pfi() = single_value->field_pfi.valueof();
}
if (single_value->field_m.is_bound()) {
ret_val.m() = single_value->field_m.valueof();
}
return ret_val;
}

void RlcMacUlPfi_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 @RLCMAC_Types.RlcMacUlPfi.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RlcMacUlPfi_template[list_length];
}

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

INTEGER_template& RlcMacUlPfi_template::pfi()
{
set_specific();
return single_value->field_pfi;
}

const INTEGER_template& RlcMacUlPfi_template::pfi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pfi of a non-specific template of type @RLCMAC_Types.RlcMacUlPfi.");
return single_value->field_pfi;
}

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

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

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

void RlcMacUlPfi_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ pfi := ");
single_value->field_pfi.log();
TTCN_Logger::log_event_str(", m := ");
single_value->field_m.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 RlcMacUlPfi_template::log_match(const RlcMacUlPfi& 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_pfi.match(match_value.pfi(), legacy)){
TTCN_Logger::log_logmatch_info(".pfi");
single_value->field_pfi.log_match(match_value.pfi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_m.match(match_value.m(), legacy)){
TTCN_Logger::log_logmatch_info(".m");
single_value->field_m.log_match(match_value.m(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}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("{ pfi := ");
single_value->field_pfi.log_match(match_value.pfi(), legacy);
TTCN_Logger::log_event_str(", m := ");
single_value->field_m.log_match(match_value.m(), 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 RlcMacUlPfi_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (pfi().is_bound()) pfi().set_implicit_omit();
if (m().is_bound()) m().set_implicit_omit();
}

void RlcMacUlPfi_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_pfi.encode_text(text_buf);
single_value->field_m.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 @RLCMAC_Types.RlcMacUlPfi.");
}
}

void RlcMacUlPfi_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_pfi.decode_text(text_buf);
single_value->field_m.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 RlcMacUlPfi_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 @RLCMAC_Types.RlcMacUlPfi.");
}
}

void RlcMacUlPfi_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: {
    RlcMacUlPfi_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 @RLCMAC_Types.RlcMacUlPfi 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) pfi().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) m().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(), "pfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pfi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "m")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          m().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @RLCMAC_Types.RlcMacUlPfi: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    RlcMacUlPfi_template* precondition = new RlcMacUlPfi_template;
    precondition->set_param(*param.get_elem(0));
    RlcMacUlPfi_template* implied_template = new RlcMacUlPfi_template;
    implied_template->set_param(*param.get_elem(1));
    *this = RlcMacUlPfi_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.RlcMacUlPfi");
  }
  is_ifpresent = param.get_ifpresent();
}

void RlcMacUlPfi_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_pfi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcMacUlPfi");
single_value->field_m.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcMacUlPfi");
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 : "@RLCMAC_Types.RlcMacUlPfi");
}

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

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

EgprsUlMacDataHeader::EgprsUlMacDataHeader()
{
}

EgprsUlMacDataHeader::EgprsUlMacDataHeader(const EgprsHeaderType& par_header__type,
    const INTEGER& par_tfi,
    const INTEGER& par_countdown,
    const BITSTRING& par_foi__si,
    const BITSTRING& par_r__ri,
    const INTEGER& par_bsn1,
    const INTEGER& par_bsn2__offset,
    const INTEGER& par_cps,
    const BOOLEAN& par_pfi__ind,
    const BITSTRING& par_rsb,
    const OPTIONAL< BITSTRING >& par_spb)
  :   field_header__type(par_header__type),
  field_tfi(par_tfi),
  field_countdown(par_countdown),
  field_foi__si(par_foi__si),
  field_r__ri(par_r__ri),
  field_bsn1(par_bsn1),
  field_bsn2__offset(par_bsn2__offset),
  field_cps(par_cps),
  field_pfi__ind(par_pfi__ind),
  field_rsb(par_rsb),
  field_spb(par_spb)
{
}

EgprsUlMacDataHeader::EgprsUlMacDataHeader(const EgprsUlMacDataHeader& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.EgprsUlMacDataHeader.");
if (other_value.header__type().is_bound()) field_header__type = other_value.header__type();
else field_header__type.clean_up();
if (other_value.tfi().is_bound()) field_tfi = other_value.tfi();
else field_tfi.clean_up();
if (other_value.countdown().is_bound()) field_countdown = other_value.countdown();
else field_countdown.clean_up();
if (other_value.foi__si().is_bound()) field_foi__si = other_value.foi__si();
else field_foi__si.clean_up();
if (other_value.r__ri().is_bound()) field_r__ri = other_value.r__ri();
else field_r__ri.clean_up();
if (other_value.bsn1().is_bound()) field_bsn1 = other_value.bsn1();
else field_bsn1.clean_up();
if (other_value.bsn2__offset().is_bound()) field_bsn2__offset = other_value.bsn2__offset();
else field_bsn2__offset.clean_up();
if (other_value.cps().is_bound()) field_cps = other_value.cps();
else field_cps.clean_up();
if (other_value.pfi__ind().is_bound()) field_pfi__ind = other_value.pfi__ind();
else field_pfi__ind.clean_up();
if (other_value.rsb().is_bound()) field_rsb = other_value.rsb();
else field_rsb.clean_up();
if (other_value.spb().is_bound()) field_spb = other_value.spb();
else field_spb.clean_up();
}

void EgprsUlMacDataHeader::clean_up()
{
field_header__type.clean_up();
field_tfi.clean_up();
field_countdown.clean_up();
field_foi__si.clean_up();
field_r__ri.clean_up();
field_bsn1.clean_up();
field_bsn2__offset.clean_up();
field_cps.clean_up();
field_pfi__ind.clean_up();
field_rsb.clean_up();
field_spb.clean_up();
}

const TTCN_Typedescriptor_t* EgprsUlMacDataHeader::get_descriptor() const { return &EgprsUlMacDataHeader_descr_; }
EgprsUlMacDataHeader& EgprsUlMacDataHeader::operator=(const EgprsUlMacDataHeader& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.EgprsUlMacDataHeader.");
  if (other_value.header__type().is_bound()) field_header__type = other_value.header__type();
  else field_header__type.clean_up();
  if (other_value.tfi().is_bound()) field_tfi = other_value.tfi();
  else field_tfi.clean_up();
  if (other_value.countdown().is_bound()) field_countdown = other_value.countdown();
  else field_countdown.clean_up();
  if (other_value.foi__si().is_bound()) field_foi__si = other_value.foi__si();
  else field_foi__si.clean_up();
  if (other_value.r__ri().is_bound()) field_r__ri = other_value.r__ri();
  else field_r__ri.clean_up();
  if (other_value.bsn1().is_bound()) field_bsn1 = other_value.bsn1();
  else field_bsn1.clean_up();
  if (other_value.bsn2__offset().is_bound()) field_bsn2__offset = other_value.bsn2__offset();
  else field_bsn2__offset.clean_up();
  if (other_value.cps().is_bound()) field_cps = other_value.cps();
  else field_cps.clean_up();
  if (other_value.pfi__ind().is_bound()) field_pfi__ind = other_value.pfi__ind();
  else field_pfi__ind.clean_up();
  if (other_value.rsb().is_bound()) field_rsb = other_value.rsb();
  else field_rsb.clean_up();
  if (other_value.spb().is_bound()) field_spb = other_value.spb();
  else field_spb.clean_up();
}
return *this;
}

boolean EgprsUlMacDataHeader::operator==(const EgprsUlMacDataHeader& other_value) const
{
return field_header__type==other_value.field_header__type
  && field_tfi==other_value.field_tfi
  && field_countdown==other_value.field_countdown
  && field_foi__si==other_value.field_foi__si
  && field_r__ri==other_value.field_r__ri
  && field_bsn1==other_value.field_bsn1
  && field_bsn2__offset==other_value.field_bsn2__offset
  && field_cps==other_value.field_cps
  && field_pfi__ind==other_value.field_pfi__ind
  && field_rsb==other_value.field_rsb
  && field_spb==other_value.field_spb;
}

boolean EgprsUlMacDataHeader::is_bound() const
{
return (field_header__type.is_bound())
  || (field_tfi.is_bound())
  || (field_countdown.is_bound())
  || (field_foi__si.is_bound())
  || (field_r__ri.is_bound())
  || (field_bsn1.is_bound())
  || (field_bsn2__offset.is_bound())
  || (field_cps.is_bound())
  || (field_pfi__ind.is_bound())
  || (field_rsb.is_bound())
  || (OPTIONAL_OMIT == field_spb.get_selection() || field_spb.is_bound());
}
boolean EgprsUlMacDataHeader::is_value() const
{
return field_header__type.is_value()
  && field_tfi.is_value()
  && field_countdown.is_value()
  && field_foi__si.is_value()
  && field_r__ri.is_value()
  && field_bsn1.is_value()
  && field_bsn2__offset.is_value()
  && field_cps.is_value()
  && field_pfi__ind.is_value()
  && field_rsb.is_value()
  && (OPTIONAL_OMIT == field_spb.get_selection() || field_spb.is_value());
}
int EgprsUlMacDataHeader::size_of() const
{
  int ret_val = 10;
  if (field_spb.ispresent()) ret_val++;
  return ret_val;
}

void EgprsUlMacDataHeader::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ header_type := ");
field_header__type.log();
TTCN_Logger::log_event_str(", tfi := ");
field_tfi.log();
TTCN_Logger::log_event_str(", countdown := ");
field_countdown.log();
TTCN_Logger::log_event_str(", foi_si := ");
field_foi__si.log();
TTCN_Logger::log_event_str(", r_ri := ");
field_r__ri.log();
TTCN_Logger::log_event_str(", bsn1 := ");
field_bsn1.log();
TTCN_Logger::log_event_str(", bsn2_offset := ");
field_bsn2__offset.log();
TTCN_Logger::log_event_str(", cps := ");
field_cps.log();
TTCN_Logger::log_event_str(", pfi_ind := ");
field_pfi__ind.log();
TTCN_Logger::log_event_str(", rsb := ");
field_rsb.log();
TTCN_Logger::log_event_str(", spb := ");
field_spb.log();
TTCN_Logger::log_event_str(" }");
}

void EgprsUlMacDataHeader::set_implicit_omit()
{
if (header__type().is_bound()) header__type().set_implicit_omit();
if (tfi().is_bound()) tfi().set_implicit_omit();
if (countdown().is_bound()) countdown().set_implicit_omit();
if (foi__si().is_bound()) foi__si().set_implicit_omit();
if (r__ri().is_bound()) r__ri().set_implicit_omit();
if (bsn1().is_bound()) bsn1().set_implicit_omit();
if (bsn2__offset().is_bound()) bsn2__offset().set_implicit_omit();
if (cps().is_bound()) cps().set_implicit_omit();
if (pfi__ind().is_bound()) pfi__ind().set_implicit_omit();
if (rsb().is_bound()) rsb().set_implicit_omit();
if (!spb().is_bound()) spb() = OMIT_VALUE;
else spb().set_implicit_omit();
}

void EgprsUlMacDataHeader::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (11<param.get_size()) {
      param.error("record value of type @RLCMAC_Types.EgprsUlMacDataHeader has 11 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) header__type().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tfi().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) countdown().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) foi__si().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) r__ri().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) bsn1().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) bsn2__offset().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) cps().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) pfi__ind().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) rsb().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) spb().set_param(*param.get_elem(10));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "header_type")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          header__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(), "tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          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(), "countdown")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          countdown().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "foi_si")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          foi__si().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "r_ri")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          r__ri().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "bsn1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bsn1().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "bsn2_offset")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bsn2__offset().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cps")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cps().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pfi_ind")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pfi__ind().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rsb")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rsb().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spb")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spb().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 @RLCMAC_Types.EgprsUlMacDataHeader: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.EgprsUlMacDataHeader");
  }
}

void EgprsUlMacDataHeader::encode_text(Text_Buf& text_buf) const
{
field_header__type.encode_text(text_buf);
field_tfi.encode_text(text_buf);
field_countdown.encode_text(text_buf);
field_foi__si.encode_text(text_buf);
field_r__ri.encode_text(text_buf);
field_bsn1.encode_text(text_buf);
field_bsn2__offset.encode_text(text_buf);
field_cps.encode_text(text_buf);
field_pfi__ind.encode_text(text_buf);
field_rsb.encode_text(text_buf);
field_spb.encode_text(text_buf);
}

void EgprsUlMacDataHeader::decode_text(Text_Buf& text_buf)
{
field_header__type.decode_text(text_buf);
field_tfi.decode_text(text_buf);
field_countdown.decode_text(text_buf);
field_foi__si.decode_text(text_buf);
field_r__ri.decode_text(text_buf);
field_bsn1.decode_text(text_buf);
field_bsn2__offset.decode_text(text_buf);
field_cps.decode_text(text_buf);
field_pfi__ind.decode_text(text_buf);
field_rsb.decode_text(text_buf);
field_spb.decode_text(text_buf);
}

void EgprsUlMacDataHeader::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 EgprsUlMacDataHeader::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 EgprsUlMacDataHeader::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, EgprsUlMacDataHeader_header__type_descr_.raw->forceomit);
  decoded_field_length = field_header__type.RAW_decode(EgprsUlMacDataHeader_header__type_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, EgprsUlMacDataHeader_tfi_descr_.raw->forceomit);
  decoded_field_length = field_tfi.RAW_decode(EgprsUlMacDataHeader_tfi_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, EgprsUlMacDataHeader_countdown_descr_.raw->forceomit);
  decoded_field_length = field_countdown.RAW_decode(EgprsUlMacDataHeader_countdown_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, EgprsUlMacDataHeader_foi__si_descr_.raw->forceomit);
  decoded_field_length = field_foi__si.RAW_decode(EgprsUlMacDataHeader_foi__si_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, EgprsUlMacDataHeader_r__ri_descr_.raw->forceomit);
  decoded_field_length = field_r__ri.RAW_decode(EgprsUlMacDataHeader_r__ri_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, EgprsUlMacDataHeader_bsn1_descr_.raw->forceomit);
  decoded_field_length = field_bsn1.RAW_decode(EgprsUlMacDataHeader_bsn1_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, EgprsUlMacDataHeader_bsn2__offset_descr_.raw->forceomit);
  decoded_field_length = field_bsn2__offset.RAW_decode(EgprsUlMacDataHeader_bsn2__offset_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, EgprsUlMacDataHeader_cps_descr_.raw->forceomit);
  decoded_field_length = field_cps.RAW_decode(EgprsUlMacDataHeader_cps_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, EgprsUlMacDataHeader_pfi__ind_descr_.raw->forceomit);
  decoded_field_length = field_pfi__ind.RAW_decode(EgprsUlMacDataHeader_pfi__ind_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_8_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_9_force_omit(9, force_omit, EgprsUlMacDataHeader_rsb_descr_.raw->forceomit);
  decoded_field_length = field_rsb.RAW_decode(EgprsUlMacDataHeader_rsb_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_9_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (limit > 0 && field_header__type == EgprsHeaderType::RLCMAC__HDR__TYPE__3){
  if (force_omit != NULL && (*force_omit)(10)) {
    field_spb = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_10_force_omit(10, force_omit, EgprsUlMacDataHeader_spb_descr_.raw->forceomit);
  decoded_field_length = field_spb().RAW_decode(EgprsUlMacDataHeader_spb_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_10_force_omit);
  if (decoded_field_length < 1) {
  field_spb = 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_spb=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int EgprsUlMacDataHeader::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 11;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(11);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, EgprsUlMacDataHeader_header__type_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, EgprsUlMacDataHeader_tfi_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, EgprsUlMacDataHeader_countdown_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, EgprsUlMacDataHeader_foi__si_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, EgprsUlMacDataHeader_r__ri_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, EgprsUlMacDataHeader_bsn1_descr_.raw);
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, EgprsUlMacDataHeader_bsn2__offset_descr_.raw);
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, EgprsUlMacDataHeader_cps_descr_.raw);
  myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, EgprsUlMacDataHeader_pfi__ind_descr_.raw);
  myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, EgprsUlMacDataHeader_rsb_descr_.raw);
  if (field_spb.ispresent()) {
  myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 10, EgprsUlMacDataHeader_spb_descr_.raw);
  }
  else myleaf.body.node.nodes[10] = NULL;
  encoded_length += field_header__type.RAW_encode(EgprsUlMacDataHeader_header__type_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_tfi.RAW_encode(EgprsUlMacDataHeader_tfi_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_countdown.RAW_encode(EgprsUlMacDataHeader_countdown_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_foi__si.RAW_encode(EgprsUlMacDataHeader_foi__si_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_r__ri.RAW_encode(EgprsUlMacDataHeader_r__ri_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_bsn1.RAW_encode(EgprsUlMacDataHeader_bsn1_descr_, *myleaf.body.node.nodes[5]);
  encoded_length += field_bsn2__offset.RAW_encode(EgprsUlMacDataHeader_bsn2__offset_descr_, *myleaf.body.node.nodes[6]);
  encoded_length += field_cps.RAW_encode(EgprsUlMacDataHeader_cps_descr_, *myleaf.body.node.nodes[7]);
  encoded_length += field_pfi__ind.RAW_encode(EgprsUlMacDataHeader_pfi__ind_descr_, *myleaf.body.node.nodes[8]);
  encoded_length += field_rsb.RAW_encode(EgprsUlMacDataHeader_rsb_descr_, *myleaf.body.node.nodes[9]);
  if (field_spb.ispresent()) {
  encoded_length += field_spb().RAW_encode(EgprsUlMacDataHeader_spb_descr_, *myleaf.body.node.nodes[10]);
  }
  if (field_spb.ispresent() && (field_header__type != EgprsHeaderType::RLCMAC__HDR__TYPE__3)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={0};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
  EgprsHeaderType new_val = EgprsHeaderType::RLCMAC__HDR__TYPE__3;
  new_val.RAW_encode(EgprsUlMacDataHeader_header__type_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);
  }
  }
  return myleaf.length = encoded_length;
}

struct EgprsUlMacDataHeader_template::single_value_struct {
EgprsHeaderType_template field_header__type;
INTEGER_template field_tfi;
INTEGER_template field_countdown;
BITSTRING_template field_foi__si;
BITSTRING_template field_r__ri;
INTEGER_template field_bsn1;
INTEGER_template field_bsn2__offset;
INTEGER_template field_cps;
BOOLEAN_template field_pfi__ind;
BITSTRING_template field_rsb;
BITSTRING_template field_spb;
};

void EgprsUlMacDataHeader_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_header__type = ANY_VALUE;
single_value->field_tfi = ANY_VALUE;
single_value->field_countdown = ANY_VALUE;
single_value->field_foi__si = ANY_VALUE;
single_value->field_r__ri = ANY_VALUE;
single_value->field_bsn1 = ANY_VALUE;
single_value->field_bsn2__offset = ANY_VALUE;
single_value->field_cps = ANY_VALUE;
single_value->field_pfi__ind = ANY_VALUE;
single_value->field_rsb = ANY_VALUE;
single_value->field_spb = ANY_OR_OMIT;
}
}
}

void EgprsUlMacDataHeader_template::copy_value(const EgprsUlMacDataHeader& other_value)
{
single_value = new single_value_struct;
if (other_value.header__type().is_bound()) {
  single_value->field_header__type = other_value.header__type();
} else {
  single_value->field_header__type.clean_up();
}
if (other_value.tfi().is_bound()) {
  single_value->field_tfi = other_value.tfi();
} else {
  single_value->field_tfi.clean_up();
}
if (other_value.countdown().is_bound()) {
  single_value->field_countdown = other_value.countdown();
} else {
  single_value->field_countdown.clean_up();
}
if (other_value.foi__si().is_bound()) {
  single_value->field_foi__si = other_value.foi__si();
} else {
  single_value->field_foi__si.clean_up();
}
if (other_value.r__ri().is_bound()) {
  single_value->field_r__ri = other_value.r__ri();
} else {
  single_value->field_r__ri.clean_up();
}
if (other_value.bsn1().is_bound()) {
  single_value->field_bsn1 = other_value.bsn1();
} else {
  single_value->field_bsn1.clean_up();
}
if (other_value.bsn2__offset().is_bound()) {
  single_value->field_bsn2__offset = other_value.bsn2__offset();
} else {
  single_value->field_bsn2__offset.clean_up();
}
if (other_value.cps().is_bound()) {
  single_value->field_cps = other_value.cps();
} else {
  single_value->field_cps.clean_up();
}
if (other_value.pfi__ind().is_bound()) {
  single_value->field_pfi__ind = other_value.pfi__ind();
} else {
  single_value->field_pfi__ind.clean_up();
}
if (other_value.rsb().is_bound()) {
  single_value->field_rsb = other_value.rsb();
} else {
  single_value->field_rsb.clean_up();
}
if (other_value.spb().is_bound()) {
  if (other_value.spb().ispresent()) single_value->field_spb = other_value.spb()();
  else single_value->field_spb = OMIT_VALUE;
} else {
  single_value->field_spb.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void EgprsUlMacDataHeader_template::copy_template(const EgprsUlMacDataHeader_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.header__type().get_selection()) {
single_value->field_header__type = other_value.header__type();
} else {
single_value->field_header__type.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tfi().get_selection()) {
single_value->field_tfi = other_value.tfi();
} else {
single_value->field_tfi.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.countdown().get_selection()) {
single_value->field_countdown = other_value.countdown();
} else {
single_value->field_countdown.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.foi__si().get_selection()) {
single_value->field_foi__si = other_value.foi__si();
} else {
single_value->field_foi__si.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.r__ri().get_selection()) {
single_value->field_r__ri = other_value.r__ri();
} else {
single_value->field_r__ri.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.bsn1().get_selection()) {
single_value->field_bsn1 = other_value.bsn1();
} else {
single_value->field_bsn1.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.bsn2__offset().get_selection()) {
single_value->field_bsn2__offset = other_value.bsn2__offset();
} else {
single_value->field_bsn2__offset.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.cps().get_selection()) {
single_value->field_cps = other_value.cps();
} else {
single_value->field_cps.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pfi__ind().get_selection()) {
single_value->field_pfi__ind = other_value.pfi__ind();
} else {
single_value->field_pfi__ind.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rsb().get_selection()) {
single_value->field_rsb = other_value.rsb();
} else {
single_value->field_rsb.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spb().get_selection()) {
single_value->field_spb = other_value.spb();
} else {
single_value->field_spb.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 EgprsUlMacDataHeader_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 EgprsUlMacDataHeader_template(*other_value.implication_.precondition);
implication_.implied_template = new EgprsUlMacDataHeader_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 @RLCMAC_Types.EgprsUlMacDataHeader.");
break;
}
set_selection(other_value);
}

EgprsUlMacDataHeader_template::EgprsUlMacDataHeader_template()
{
}

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

EgprsUlMacDataHeader_template::EgprsUlMacDataHeader_template(const EgprsUlMacDataHeader& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean EgprsUlMacDataHeader_template::match(const EgprsUlMacDataHeader& 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.header__type().is_bound()) return FALSE;
if(!single_value->field_header__type.match(other_value.header__type(), legacy))return FALSE;
if(!other_value.tfi().is_bound()) return FALSE;
if(!single_value->field_tfi.match(other_value.tfi(), legacy))return FALSE;
if(!other_value.countdown().is_bound()) return FALSE;
if(!single_value->field_countdown.match(other_value.countdown(), legacy))return FALSE;
if(!other_value.foi__si().is_bound()) return FALSE;
if(!single_value->field_foi__si.match(other_value.foi__si(), legacy))return FALSE;
if(!other_value.r__ri().is_bound()) return FALSE;
if(!single_value->field_r__ri.match(other_value.r__ri(), legacy))return FALSE;
if(!other_value.bsn1().is_bound()) return FALSE;
if(!single_value->field_bsn1.match(other_value.bsn1(), legacy))return FALSE;
if(!other_value.bsn2__offset().is_bound()) return FALSE;
if(!single_value->field_bsn2__offset.match(other_value.bsn2__offset(), legacy))return FALSE;
if(!other_value.cps().is_bound()) return FALSE;
if(!single_value->field_cps.match(other_value.cps(), legacy))return FALSE;
if(!other_value.pfi__ind().is_bound()) return FALSE;
if(!single_value->field_pfi__ind.match(other_value.pfi__ind(), legacy))return FALSE;
if(!other_value.rsb().is_bound()) return FALSE;
if(!single_value->field_rsb.match(other_value.rsb(), legacy))return FALSE;
if(!other_value.spb().is_bound()) return FALSE;
if((other_value.spb().ispresent() ? !single_value->field_spb.match((const BITSTRING&)other_value.spb(), legacy) : !single_value->field_spb.match_omit(legacy)))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @RLCMAC_Types.EgprsUlMacDataHeader.");
}
return FALSE;
}

boolean EgprsUlMacDataHeader_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_header__type.is_bound()
 || single_value->field_tfi.is_bound()
 || single_value->field_countdown.is_bound()
 || single_value->field_foi__si.is_bound()
 || single_value->field_r__ri.is_bound()
 || single_value->field_bsn1.is_bound()
 || single_value->field_bsn2__offset.is_bound()
 || single_value->field_cps.is_bound()
 || single_value->field_pfi__ind.is_bound()
 || single_value->field_rsb.is_bound()
 || (single_value->field_spb.is_omit() || single_value->field_spb.is_bound());
}

boolean EgprsUlMacDataHeader_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_header__type.is_value()
 && single_value->field_tfi.is_value()
 && single_value->field_countdown.is_value()
 && single_value->field_foi__si.is_value()
 && single_value->field_r__ri.is_value()
 && single_value->field_bsn1.is_value()
 && single_value->field_bsn2__offset.is_value()
 && single_value->field_cps.is_value()
 && single_value->field_pfi__ind.is_value()
 && single_value->field_rsb.is_value()
 && (single_value->field_spb.is_omit() || single_value->field_spb.is_value());
}

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

EgprsUlMacDataHeader EgprsUlMacDataHeader_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 @RLCMAC_Types.EgprsUlMacDataHeader.");
EgprsUlMacDataHeader ret_val;
if (single_value->field_header__type.is_bound()) {
ret_val.header__type() = single_value->field_header__type.valueof();
}
if (single_value->field_tfi.is_bound()) {
ret_val.tfi() = single_value->field_tfi.valueof();
}
if (single_value->field_countdown.is_bound()) {
ret_val.countdown() = single_value->field_countdown.valueof();
}
if (single_value->field_foi__si.is_bound()) {
ret_val.foi__si() = single_value->field_foi__si.valueof();
}
if (single_value->field_r__ri.is_bound()) {
ret_val.r__ri() = single_value->field_r__ri.valueof();
}
if (single_value->field_bsn1.is_bound()) {
ret_val.bsn1() = single_value->field_bsn1.valueof();
}
if (single_value->field_bsn2__offset.is_bound()) {
ret_val.bsn2__offset() = single_value->field_bsn2__offset.valueof();
}
if (single_value->field_cps.is_bound()) {
ret_val.cps() = single_value->field_cps.valueof();
}
if (single_value->field_pfi__ind.is_bound()) {
ret_val.pfi__ind() = single_value->field_pfi__ind.valueof();
}
if (single_value->field_rsb.is_bound()) {
ret_val.rsb() = single_value->field_rsb.valueof();
}
if (single_value->field_spb.is_omit()) ret_val.spb() = OMIT_VALUE;
else if (single_value->field_spb.is_bound()) {
ret_val.spb() = single_value->field_spb.valueof();
}
return ret_val;
}

void EgprsUlMacDataHeader_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 @RLCMAC_Types.EgprsUlMacDataHeader.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new EgprsUlMacDataHeader_template[list_length];
}

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

EgprsHeaderType_template& EgprsUlMacDataHeader_template::header__type()
{
set_specific();
return single_value->field_header__type;
}

const EgprsHeaderType_template& EgprsUlMacDataHeader_template::header__type() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field header_type of a non-specific template of type @RLCMAC_Types.EgprsUlMacDataHeader.");
return single_value->field_header__type;
}

INTEGER_template& EgprsUlMacDataHeader_template::tfi()
{
set_specific();
return single_value->field_tfi;
}

const INTEGER_template& EgprsUlMacDataHeader_template::tfi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tfi of a non-specific template of type @RLCMAC_Types.EgprsUlMacDataHeader.");
return single_value->field_tfi;
}

INTEGER_template& EgprsUlMacDataHeader_template::countdown()
{
set_specific();
return single_value->field_countdown;
}

const INTEGER_template& EgprsUlMacDataHeader_template::countdown() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field countdown of a non-specific template of type @RLCMAC_Types.EgprsUlMacDataHeader.");
return single_value->field_countdown;
}

BITSTRING_template& EgprsUlMacDataHeader_template::foi__si()
{
set_specific();
return single_value->field_foi__si;
}

const BITSTRING_template& EgprsUlMacDataHeader_template::foi__si() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field foi_si of a non-specific template of type @RLCMAC_Types.EgprsUlMacDataHeader.");
return single_value->field_foi__si;
}

BITSTRING_template& EgprsUlMacDataHeader_template::r__ri()
{
set_specific();
return single_value->field_r__ri;
}

const BITSTRING_template& EgprsUlMacDataHeader_template::r__ri() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field r_ri of a non-specific template of type @RLCMAC_Types.EgprsUlMacDataHeader.");
return single_value->field_r__ri;
}

INTEGER_template& EgprsUlMacDataHeader_template::bsn1()
{
set_specific();
return single_value->field_bsn1;
}

const INTEGER_template& EgprsUlMacDataHeader_template::bsn1() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field bsn1 of a non-specific template of type @RLCMAC_Types.EgprsUlMacDataHeader.");
return single_value->field_bsn1;
}

INTEGER_template& EgprsUlMacDataHeader_template::bsn2__offset()
{
set_specific();
return single_value->field_bsn2__offset;
}

const INTEGER_template& EgprsUlMacDataHeader_template::bsn2__offset() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field bsn2_offset of a non-specific template of type @RLCMAC_Types.EgprsUlMacDataHeader.");
return single_value->field_bsn2__offset;
}

INTEGER_template& EgprsUlMacDataHeader_template::cps()
{
set_specific();
return single_value->field_cps;
}

const INTEGER_template& EgprsUlMacDataHeader_template::cps() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field cps of a non-specific template of type @RLCMAC_Types.EgprsUlMacDataHeader.");
return single_value->field_cps;
}

BOOLEAN_template& EgprsUlMacDataHeader_template::pfi__ind()
{
set_specific();
return single_value->field_pfi__ind;
}

const BOOLEAN_template& EgprsUlMacDataHeader_template::pfi__ind() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pfi_ind of a non-specific template of type @RLCMAC_Types.EgprsUlMacDataHeader.");
return single_value->field_pfi__ind;
}

BITSTRING_template& EgprsUlMacDataHeader_template::rsb()
{
set_specific();
return single_value->field_rsb;
}

const BITSTRING_template& EgprsUlMacDataHeader_template::rsb() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rsb of a non-specific template of type @RLCMAC_Types.EgprsUlMacDataHeader.");
return single_value->field_rsb;
}

BITSTRING_template& EgprsUlMacDataHeader_template::spb()
{
set_specific();
return single_value->field_spb;
}

const BITSTRING_template& EgprsUlMacDataHeader_template::spb() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spb of a non-specific template of type @RLCMAC_Types.EgprsUlMacDataHeader.");
return single_value->field_spb;
}

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

void EgprsUlMacDataHeader_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ header_type := ");
single_value->field_header__type.log();
TTCN_Logger::log_event_str(", tfi := ");
single_value->field_tfi.log();
TTCN_Logger::log_event_str(", countdown := ");
single_value->field_countdown.log();
TTCN_Logger::log_event_str(", foi_si := ");
single_value->field_foi__si.log();
TTCN_Logger::log_event_str(", r_ri := ");
single_value->field_r__ri.log();
TTCN_Logger::log_event_str(", bsn1 := ");
single_value->field_bsn1.log();
TTCN_Logger::log_event_str(", bsn2_offset := ");
single_value->field_bsn2__offset.log();
TTCN_Logger::log_event_str(", cps := ");
single_value->field_cps.log();
TTCN_Logger::log_event_str(", pfi_ind := ");
single_value->field_pfi__ind.log();
TTCN_Logger::log_event_str(", rsb := ");
single_value->field_rsb.log();
TTCN_Logger::log_event_str(", spb := ");
single_value->field_spb.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 EgprsUlMacDataHeader_template::log_match(const EgprsUlMacDataHeader& 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_header__type.match(match_value.header__type(), legacy)){
TTCN_Logger::log_logmatch_info(".header_type");
single_value->field_header__type.log_match(match_value.header__type(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tfi.match(match_value.tfi(), legacy)){
TTCN_Logger::log_logmatch_info(".tfi");
single_value->field_tfi.log_match(match_value.tfi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_countdown.match(match_value.countdown(), legacy)){
TTCN_Logger::log_logmatch_info(".countdown");
single_value->field_countdown.log_match(match_value.countdown(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_foi__si.match(match_value.foi__si(), legacy)){
TTCN_Logger::log_logmatch_info(".foi_si");
single_value->field_foi__si.log_match(match_value.foi__si(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_r__ri.match(match_value.r__ri(), legacy)){
TTCN_Logger::log_logmatch_info(".r_ri");
single_value->field_r__ri.log_match(match_value.r__ri(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_bsn1.match(match_value.bsn1(), legacy)){
TTCN_Logger::log_logmatch_info(".bsn1");
single_value->field_bsn1.log_match(match_value.bsn1(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_bsn2__offset.match(match_value.bsn2__offset(), legacy)){
TTCN_Logger::log_logmatch_info(".bsn2_offset");
single_value->field_bsn2__offset.log_match(match_value.bsn2__offset(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_cps.match(match_value.cps(), legacy)){
TTCN_Logger::log_logmatch_info(".cps");
single_value->field_cps.log_match(match_value.cps(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pfi__ind.match(match_value.pfi__ind(), legacy)){
TTCN_Logger::log_logmatch_info(".pfi_ind");
single_value->field_pfi__ind.log_match(match_value.pfi__ind(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rsb.match(match_value.rsb(), legacy)){
TTCN_Logger::log_logmatch_info(".rsb");
single_value->field_rsb.log_match(match_value.rsb(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.spb().ispresent()){
if(!single_value->field_spb.match(match_value.spb(), legacy)){
TTCN_Logger::log_logmatch_info(".spb");
single_value->field_spb.log_match(match_value.spb(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_spb.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".spb := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_spb.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ header_type := ");
single_value->field_header__type.log_match(match_value.header__type(), legacy);
TTCN_Logger::log_event_str(", tfi := ");
single_value->field_tfi.log_match(match_value.tfi(), legacy);
TTCN_Logger::log_event_str(", countdown := ");
single_value->field_countdown.log_match(match_value.countdown(), legacy);
TTCN_Logger::log_event_str(", foi_si := ");
single_value->field_foi__si.log_match(match_value.foi__si(), legacy);
TTCN_Logger::log_event_str(", r_ri := ");
single_value->field_r__ri.log_match(match_value.r__ri(), legacy);
TTCN_Logger::log_event_str(", bsn1 := ");
single_value->field_bsn1.log_match(match_value.bsn1(), legacy);
TTCN_Logger::log_event_str(", bsn2_offset := ");
single_value->field_bsn2__offset.log_match(match_value.bsn2__offset(), legacy);
TTCN_Logger::log_event_str(", cps := ");
single_value->field_cps.log_match(match_value.cps(), legacy);
TTCN_Logger::log_event_str(", pfi_ind := ");
single_value->field_pfi__ind.log_match(match_value.pfi__ind(), legacy);
TTCN_Logger::log_event_str(", rsb := ");
single_value->field_rsb.log_match(match_value.rsb(), legacy);
TTCN_Logger::log_event_str(", spb := ");
if (match_value.spb().ispresent()) {
single_value->field_spb.log_match(match_value.spb(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_spb.log();
if (single_value->field_spb.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void EgprsUlMacDataHeader_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (header__type().is_bound()) header__type().set_implicit_omit();
if (tfi().is_bound()) tfi().set_implicit_omit();
if (countdown().is_bound()) countdown().set_implicit_omit();
if (foi__si().is_bound()) foi__si().set_implicit_omit();
if (r__ri().is_bound()) r__ri().set_implicit_omit();
if (bsn1().is_bound()) bsn1().set_implicit_omit();
if (bsn2__offset().is_bound()) bsn2__offset().set_implicit_omit();
if (cps().is_bound()) cps().set_implicit_omit();
if (pfi__ind().is_bound()) pfi__ind().set_implicit_omit();
if (rsb().is_bound()) rsb().set_implicit_omit();
if (!spb().is_bound()) spb() = OMIT_VALUE;
else spb().set_implicit_omit();
}

void EgprsUlMacDataHeader_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_header__type.encode_text(text_buf);
single_value->field_tfi.encode_text(text_buf);
single_value->field_countdown.encode_text(text_buf);
single_value->field_foi__si.encode_text(text_buf);
single_value->field_r__ri.encode_text(text_buf);
single_value->field_bsn1.encode_text(text_buf);
single_value->field_bsn2__offset.encode_text(text_buf);
single_value->field_cps.encode_text(text_buf);
single_value->field_pfi__ind.encode_text(text_buf);
single_value->field_rsb.encode_text(text_buf);
single_value->field_spb.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 @RLCMAC_Types.EgprsUlMacDataHeader.");
}
}

void EgprsUlMacDataHeader_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_header__type.decode_text(text_buf);
single_value->field_tfi.decode_text(text_buf);
single_value->field_countdown.decode_text(text_buf);
single_value->field_foi__si.decode_text(text_buf);
single_value->field_r__ri.decode_text(text_buf);
single_value->field_bsn1.decode_text(text_buf);
single_value->field_bsn2__offset.decode_text(text_buf);
single_value->field_cps.decode_text(text_buf);
single_value->field_pfi__ind.decode_text(text_buf);
single_value->field_rsb.decode_text(text_buf);
single_value->field_spb.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 EgprsUlMacDataHeader_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 @RLCMAC_Types.EgprsUlMacDataHeader.");
}
}

void EgprsUlMacDataHeader_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: {
    EgprsUlMacDataHeader_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (11<param.get_size()) {
      param.error("record template of type @RLCMAC_Types.EgprsUlMacDataHeader has 11 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) header__type().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tfi().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) countdown().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) foi__si().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) r__ri().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) bsn1().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) bsn2__offset().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) cps().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) pfi__ind().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) rsb().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) spb().set_param(*param.get_elem(10));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "header_type")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          header__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(), "tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          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(), "countdown")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          countdown().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "foi_si")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          foi__si().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "r_ri")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          r__ri().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "bsn1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bsn1().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "bsn2_offset")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bsn2__offset().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cps")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cps().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pfi_ind")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pfi__ind().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rsb")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rsb().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spb")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spb().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 @RLCMAC_Types.EgprsUlMacDataHeader: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    EgprsUlMacDataHeader_template* precondition = new EgprsUlMacDataHeader_template;
    precondition->set_param(*param.get_elem(0));
    EgprsUlMacDataHeader_template* implied_template = new EgprsUlMacDataHeader_template;
    implied_template->set_param(*param.get_elem(1));
    *this = EgprsUlMacDataHeader_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.EgprsUlMacDataHeader");
  }
  is_ifpresent = param.get_ifpresent();
}

void EgprsUlMacDataHeader_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_header__type.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsUlMacDataHeader");
single_value->field_tfi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsUlMacDataHeader");
single_value->field_countdown.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsUlMacDataHeader");
single_value->field_foi__si.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsUlMacDataHeader");
single_value->field_r__ri.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsUlMacDataHeader");
single_value->field_bsn1.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsUlMacDataHeader");
single_value->field_bsn2__offset.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsUlMacDataHeader");
single_value->field_cps.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsUlMacDataHeader");
single_value->field_pfi__ind.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsUlMacDataHeader");
single_value->field_rsb.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsUlMacDataHeader");
single_value->field_spb.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.EgprsUlMacDataHeader");
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 : "@RLCMAC_Types.EgprsUlMacDataHeader");
}

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

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

RlcmacUlEgprsDataBlock::RlcmacUlEgprsDataBlock()
{
}

RlcmacUlEgprsDataBlock::RlcmacUlEgprsDataBlock(const CodingScheme& par_mcs,
    const EgprsUlMacDataHeader& par_mac__hdr,
    const BOOLEAN& par_tlli__ind,
    const BOOLEAN& par_e,
    const OPTIONAL< OCTETSTRING >& par_tlli,
    const OPTIONAL< RlcMacUlPfi >& par_pfi,
    const EgprsLlcBlocks& par_blocks)
  :   field_mcs(par_mcs),
  field_mac__hdr(par_mac__hdr),
  field_tlli__ind(par_tlli__ind),
  field_e(par_e),
  field_tlli(par_tlli),
  field_pfi(par_pfi),
  field_blocks(par_blocks)
{
}

RlcmacUlEgprsDataBlock::RlcmacUlEgprsDataBlock(const RlcmacUlEgprsDataBlock& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.RlcmacUlEgprsDataBlock.");
if (other_value.mcs().is_bound()) field_mcs = other_value.mcs();
else field_mcs.clean_up();
if (other_value.mac__hdr().is_bound()) field_mac__hdr = other_value.mac__hdr();
else field_mac__hdr.clean_up();
if (other_value.tlli__ind().is_bound()) field_tlli__ind = other_value.tlli__ind();
else field_tlli__ind.clean_up();
if (other_value.e().is_bound()) field_e = other_value.e();
else field_e.clean_up();
if (other_value.tlli().is_bound()) field_tlli = other_value.tlli();
else field_tlli.clean_up();
if (other_value.pfi().is_bound()) field_pfi = other_value.pfi();
else field_pfi.clean_up();
if (other_value.blocks().is_bound()) field_blocks = other_value.blocks();
else field_blocks.clean_up();
}

void RlcmacUlEgprsDataBlock::clean_up()
{
field_mcs.clean_up();
field_mac__hdr.clean_up();
field_tlli__ind.clean_up();
field_e.clean_up();
field_tlli.clean_up();
field_pfi.clean_up();
field_blocks.clean_up();
}

const TTCN_Typedescriptor_t* RlcmacUlEgprsDataBlock::get_descriptor() const { return &RlcmacUlEgprsDataBlock_descr_; }
RlcmacUlEgprsDataBlock& RlcmacUlEgprsDataBlock::operator=(const RlcmacUlEgprsDataBlock& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.RlcmacUlEgprsDataBlock.");
  if (other_value.mcs().is_bound()) field_mcs = other_value.mcs();
  else field_mcs.clean_up();
  if (other_value.mac__hdr().is_bound()) field_mac__hdr = other_value.mac__hdr();
  else field_mac__hdr.clean_up();
  if (other_value.tlli__ind().is_bound()) field_tlli__ind = other_value.tlli__ind();
  else field_tlli__ind.clean_up();
  if (other_value.e().is_bound()) field_e = other_value.e();
  else field_e.clean_up();
  if (other_value.tlli().is_bound()) field_tlli = other_value.tlli();
  else field_tlli.clean_up();
  if (other_value.pfi().is_bound()) field_pfi = other_value.pfi();
  else field_pfi.clean_up();
  if (other_value.blocks().is_bound()) field_blocks = other_value.blocks();
  else field_blocks.clean_up();
}
return *this;
}

boolean RlcmacUlEgprsDataBlock::operator==(const RlcmacUlEgprsDataBlock& other_value) const
{
return field_mcs==other_value.field_mcs
  && field_mac__hdr==other_value.field_mac__hdr
  && field_tlli__ind==other_value.field_tlli__ind
  && field_e==other_value.field_e
  && field_tlli==other_value.field_tlli
  && field_pfi==other_value.field_pfi
  && field_blocks==other_value.field_blocks;
}

boolean RlcmacUlEgprsDataBlock::is_bound() const
{
return (field_mcs.is_bound())
  || (field_mac__hdr.is_bound())
  || (field_tlli__ind.is_bound())
  || (field_e.is_bound())
  || (OPTIONAL_OMIT == field_tlli.get_selection() || field_tlli.is_bound())
  || (OPTIONAL_OMIT == field_pfi.get_selection() || field_pfi.is_bound())
  || (field_blocks.is_bound());
}
boolean RlcmacUlEgprsDataBlock::is_value() const
{
return field_mcs.is_value()
  && field_mac__hdr.is_value()
  && field_tlli__ind.is_value()
  && field_e.is_value()
  && (OPTIONAL_OMIT == field_tlli.get_selection() || field_tlli.is_value())
  && (OPTIONAL_OMIT == field_pfi.get_selection() || field_pfi.is_value())
  && field_blocks.is_value();
}
int RlcmacUlEgprsDataBlock::size_of() const
{
  int ret_val = 5;
  if (field_tlli.ispresent()) ret_val++;
  if (field_pfi.ispresent()) ret_val++;
  return ret_val;
}

void RlcmacUlEgprsDataBlock::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ mcs := ");
field_mcs.log();
TTCN_Logger::log_event_str(", mac_hdr := ");
field_mac__hdr.log();
TTCN_Logger::log_event_str(", tlli_ind := ");
field_tlli__ind.log();
TTCN_Logger::log_event_str(", e := ");
field_e.log();
TTCN_Logger::log_event_str(", tlli := ");
field_tlli.log();
TTCN_Logger::log_event_str(", pfi := ");
field_pfi.log();
TTCN_Logger::log_event_str(", blocks := ");
field_blocks.log();
TTCN_Logger::log_event_str(" }");
}

void RlcmacUlEgprsDataBlock::set_implicit_omit()
{
if (mcs().is_bound()) mcs().set_implicit_omit();
if (mac__hdr().is_bound()) mac__hdr().set_implicit_omit();
if (tlli__ind().is_bound()) tlli__ind().set_implicit_omit();
if (e().is_bound()) e().set_implicit_omit();
if (!tlli().is_bound()) tlli() = OMIT_VALUE;
else tlli().set_implicit_omit();
if (!pfi().is_bound()) pfi() = OMIT_VALUE;
else pfi().set_implicit_omit();
if (blocks().is_bound()) blocks().set_implicit_omit();
}

void RlcmacUlEgprsDataBlock::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 @RLCMAC_Types.RlcmacUlEgprsDataBlock 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) mcs().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mac__hdr().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) tlli__ind().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) e().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) tlli().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) pfi().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) blocks().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(), "mcs")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mcs().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mac_hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mac__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(), "tlli_ind")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tlli__ind().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "e")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          e().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tlli")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tlli().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pfi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "blocks")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          blocks().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 @RLCMAC_Types.RlcmacUlEgprsDataBlock: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.RlcmacUlEgprsDataBlock");
  }
}

void RlcmacUlEgprsDataBlock::encode_text(Text_Buf& text_buf) const
{
field_mcs.encode_text(text_buf);
field_mac__hdr.encode_text(text_buf);
field_tlli__ind.encode_text(text_buf);
field_e.encode_text(text_buf);
field_tlli.encode_text(text_buf);
field_pfi.encode_text(text_buf);
field_blocks.encode_text(text_buf);
}

void RlcmacUlEgprsDataBlock::decode_text(Text_Buf& text_buf)
{
field_mcs.decode_text(text_buf);
field_mac__hdr.decode_text(text_buf);
field_tlli__ind.decode_text(text_buf);
field_e.decode_text(text_buf);
field_tlli.decode_text(text_buf);
field_pfi.decode_text(text_buf);
field_blocks.decode_text(text_buf);
}

void RlcmacUlEgprsDataBlock::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 RlcmacUlEgprsDataBlock::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 RlcmacUlEgprsDataBlock::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, RlcmacUlEgprsDataBlock_mcs_descr_.raw->forceomit);
  decoded_field_length = field_mcs.RAW_decode(RlcmacUlEgprsDataBlock_mcs_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, RlcmacUlEgprsDataBlock_mac__hdr_descr_.raw->forceomit);
  decoded_field_length = field_mac__hdr.RAW_decode(RlcmacUlEgprsDataBlock_mac__hdr_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, RlcmacUlEgprsDataBlock_tlli__ind_descr_.raw->forceomit);
  decoded_field_length = field_tlli__ind.RAW_decode(RlcmacUlEgprsDataBlock_tlli__ind_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, RlcmacUlEgprsDataBlock_e_descr_.raw->forceomit);
  decoded_field_length = field_e.RAW_decode(RlcmacUlEgprsDataBlock_e_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (limit > 0){
  if (force_omit != NULL && (*force_omit)(4)) {
    field_tlli = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_4_force_omit(4, force_omit, RlcmacUlEgprsDataBlock_tlli_descr_.raw->forceomit);
  decoded_field_length = field_tlli().RAW_decode(RlcmacUlEgprsDataBlock_tlli_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit);
  if (decoded_field_length < 1) {
  field_tlli = 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_tlli=OMIT_VALUE;
  if (limit > 0){
  if (force_omit != NULL && (*force_omit)(5)) {
    field_pfi = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_5_force_omit(5, force_omit, RlcmacUlEgprsDataBlock_pfi_descr_.raw->forceomit);
  decoded_field_length = field_pfi().RAW_decode(RlcmacUlEgprsDataBlock_pfi_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 1) {
  field_pfi = 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_pfi=OMIT_VALUE;
  RAW_Force_Omit field_6_force_omit(6, force_omit, RlcmacUlEgprsDataBlock_blocks_descr_.raw->forceomit);
  decoded_field_length = field_blocks.RAW_decode(RlcmacUlEgprsDataBlock_blocks_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 RlcmacUlEgprsDataBlock::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, RlcmacUlEgprsDataBlock_mcs_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RlcmacUlEgprsDataBlock_mac__hdr_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, RlcmacUlEgprsDataBlock_tlli__ind_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, RlcmacUlEgprsDataBlock_e_descr_.raw);
  if (field_tlli.ispresent()) {
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, RlcmacUlEgprsDataBlock_tlli_descr_.raw);
  }
  else myleaf.body.node.nodes[4] = NULL;
  if (field_pfi.ispresent()) {
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, RlcmacUlEgprsDataBlock_pfi_descr_.raw);
  }
  else myleaf.body.node.nodes[5] = NULL;
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, RlcmacUlEgprsDataBlock_blocks_descr_.raw);
  encoded_length += field_mcs.RAW_encode(RlcmacUlEgprsDataBlock_mcs_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_mac__hdr.RAW_encode(RlcmacUlEgprsDataBlock_mac__hdr_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_tlli__ind.RAW_encode(RlcmacUlEgprsDataBlock_tlli__ind_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_e.RAW_encode(RlcmacUlEgprsDataBlock_e_descr_, *myleaf.body.node.nodes[3]);
  if (field_tlli.ispresent()) {
  encoded_length += field_tlli().RAW_encode(RlcmacUlEgprsDataBlock_tlli_descr_, *myleaf.body.node.nodes[4]);
  }
  if (field_pfi.ispresent()) {
  encoded_length += field_pfi().RAW_encode(RlcmacUlEgprsDataBlock_pfi_descr_, *myleaf.body.node.nodes[5]);
  }
  encoded_length += field_blocks.RAW_encode(RlcmacUlEgprsDataBlock_blocks_descr_, *myleaf.body.node.nodes[6]);
  return myleaf.length = encoded_length;
}

struct RlcmacUlEgprsDataBlock_template::single_value_struct {
CodingScheme_template field_mcs;
EgprsUlMacDataHeader_template field_mac__hdr;
BOOLEAN_template field_tlli__ind;
BOOLEAN_template field_e;
OCTETSTRING_template field_tlli;
RlcMacUlPfi_template field_pfi;
EgprsLlcBlocks_template field_blocks;
};

void RlcmacUlEgprsDataBlock_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_mcs = ANY_VALUE;
single_value->field_mac__hdr = ANY_VALUE;
single_value->field_tlli__ind = ANY_VALUE;
single_value->field_e = ANY_VALUE;
single_value->field_tlli = ANY_OR_OMIT;
single_value->field_pfi = ANY_OR_OMIT;
single_value->field_blocks = ANY_VALUE;
}
}
}

void RlcmacUlEgprsDataBlock_template::copy_value(const RlcmacUlEgprsDataBlock& other_value)
{
single_value = new single_value_struct;
if (other_value.mcs().is_bound()) {
  single_value->field_mcs = other_value.mcs();
} else {
  single_value->field_mcs.clean_up();
}
if (other_value.mac__hdr().is_bound()) {
  single_value->field_mac__hdr = other_value.mac__hdr();
} else {
  single_value->field_mac__hdr.clean_up();
}
if (other_value.tlli__ind().is_bound()) {
  single_value->field_tlli__ind = other_value.tlli__ind();
} else {
  single_value->field_tlli__ind.clean_up();
}
if (other_value.e().is_bound()) {
  single_value->field_e = other_value.e();
} else {
  single_value->field_e.clean_up();
}
if (other_value.tlli().is_bound()) {
  if (other_value.tlli().ispresent()) single_value->field_tlli = other_value.tlli()();
  else single_value->field_tlli = OMIT_VALUE;
} else {
  single_value->field_tlli.clean_up();
}
if (other_value.pfi().is_bound()) {
  if (other_value.pfi().ispresent()) single_value->field_pfi = other_value.pfi()();
  else single_value->field_pfi = OMIT_VALUE;
} else {
  single_value->field_pfi.clean_up();
}
if (other_value.blocks().is_bound()) {
  single_value->field_blocks = other_value.blocks();
} else {
  single_value->field_blocks.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RlcmacUlEgprsDataBlock_template::copy_template(const RlcmacUlEgprsDataBlock_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.mcs().get_selection()) {
single_value->field_mcs = other_value.mcs();
} else {
single_value->field_mcs.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.mac__hdr().get_selection()) {
single_value->field_mac__hdr = other_value.mac__hdr();
} else {
single_value->field_mac__hdr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tlli__ind().get_selection()) {
single_value->field_tlli__ind = other_value.tlli__ind();
} else {
single_value->field_tlli__ind.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.e().get_selection()) {
single_value->field_e = other_value.e();
} else {
single_value->field_e.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tlli().get_selection()) {
single_value->field_tlli = other_value.tlli();
} else {
single_value->field_tlli.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pfi().get_selection()) {
single_value->field_pfi = other_value.pfi();
} else {
single_value->field_pfi.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.blocks().get_selection()) {
single_value->field_blocks = other_value.blocks();
} else {
single_value->field_blocks.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 RlcmacUlEgprsDataBlock_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 RlcmacUlEgprsDataBlock_template(*other_value.implication_.precondition);
implication_.implied_template = new RlcmacUlEgprsDataBlock_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 @RLCMAC_Types.RlcmacUlEgprsDataBlock.");
break;
}
set_selection(other_value);
}

RlcmacUlEgprsDataBlock_template::RlcmacUlEgprsDataBlock_template()
{
}

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

RlcmacUlEgprsDataBlock_template::RlcmacUlEgprsDataBlock_template(const RlcmacUlEgprsDataBlock& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean RlcmacUlEgprsDataBlock_template::match(const RlcmacUlEgprsDataBlock& 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.mcs().is_bound()) return FALSE;
if(!single_value->field_mcs.match(other_value.mcs(), legacy))return FALSE;
if(!other_value.mac__hdr().is_bound()) return FALSE;
if(!single_value->field_mac__hdr.match(other_value.mac__hdr(), legacy))return FALSE;
if(!other_value.tlli__ind().is_bound()) return FALSE;
if(!single_value->field_tlli__ind.match(other_value.tlli__ind(), legacy))return FALSE;
if(!other_value.e().is_bound()) return FALSE;
if(!single_value->field_e.match(other_value.e(), legacy))return FALSE;
if(!other_value.tlli().is_bound()) return FALSE;
if((other_value.tlli().ispresent() ? !single_value->field_tlli.match((const OCTETSTRING&)other_value.tlli(), legacy) : !single_value->field_tlli.match_omit(legacy)))return FALSE;
if(!other_value.pfi().is_bound()) return FALSE;
if((other_value.pfi().ispresent() ? !single_value->field_pfi.match((const RlcMacUlPfi&)other_value.pfi(), legacy) : !single_value->field_pfi.match_omit(legacy)))return FALSE;
if(!other_value.blocks().is_bound()) return FALSE;
if(!single_value->field_blocks.match(other_value.blocks(), 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 @RLCMAC_Types.RlcmacUlEgprsDataBlock.");
}
return FALSE;
}

boolean RlcmacUlEgprsDataBlock_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_mcs.is_bound()
 || single_value->field_mac__hdr.is_bound()
 || single_value->field_tlli__ind.is_bound()
 || single_value->field_e.is_bound()
 || (single_value->field_tlli.is_omit() || single_value->field_tlli.is_bound())
 || (single_value->field_pfi.is_omit() || single_value->field_pfi.is_bound())
 || single_value->field_blocks.is_bound();
}

boolean RlcmacUlEgprsDataBlock_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_mcs.is_value()
 && single_value->field_mac__hdr.is_value()
 && single_value->field_tlli__ind.is_value()
 && single_value->field_e.is_value()
 && (single_value->field_tlli.is_omit() || single_value->field_tlli.is_value())
 && (single_value->field_pfi.is_omit() || single_value->field_pfi.is_value())
 && single_value->field_blocks.is_value();
}

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

RlcmacUlEgprsDataBlock RlcmacUlEgprsDataBlock_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 @RLCMAC_Types.RlcmacUlEgprsDataBlock.");
RlcmacUlEgprsDataBlock ret_val;
if (single_value->field_mcs.is_bound()) {
ret_val.mcs() = single_value->field_mcs.valueof();
}
if (single_value->field_mac__hdr.is_bound()) {
ret_val.mac__hdr() = single_value->field_mac__hdr.valueof();
}
if (single_value->field_tlli__ind.is_bound()) {
ret_val.tlli__ind() = single_value->field_tlli__ind.valueof();
}
if (single_value->field_e.is_bound()) {
ret_val.e() = single_value->field_e.valueof();
}
if (single_value->field_tlli.is_omit()) ret_val.tlli() = OMIT_VALUE;
else if (single_value->field_tlli.is_bound()) {
ret_val.tlli() = single_value->field_tlli.valueof();
}
if (single_value->field_pfi.is_omit()) ret_val.pfi() = OMIT_VALUE;
else if (single_value->field_pfi.is_bound()) {
ret_val.pfi() = single_value->field_pfi.valueof();
}
if (single_value->field_blocks.is_bound()) {
ret_val.blocks() = single_value->field_blocks.valueof();
}
return ret_val;
}

void RlcmacUlEgprsDataBlock_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 @RLCMAC_Types.RlcmacUlEgprsDataBlock.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RlcmacUlEgprsDataBlock_template[list_length];
}

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

CodingScheme_template& RlcmacUlEgprsDataBlock_template::mcs()
{
set_specific();
return single_value->field_mcs;
}

const CodingScheme_template& RlcmacUlEgprsDataBlock_template::mcs() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mcs of a non-specific template of type @RLCMAC_Types.RlcmacUlEgprsDataBlock.");
return single_value->field_mcs;
}

EgprsUlMacDataHeader_template& RlcmacUlEgprsDataBlock_template::mac__hdr()
{
set_specific();
return single_value->field_mac__hdr;
}

const EgprsUlMacDataHeader_template& RlcmacUlEgprsDataBlock_template::mac__hdr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mac_hdr of a non-specific template of type @RLCMAC_Types.RlcmacUlEgprsDataBlock.");
return single_value->field_mac__hdr;
}

BOOLEAN_template& RlcmacUlEgprsDataBlock_template::tlli__ind()
{
set_specific();
return single_value->field_tlli__ind;
}

const BOOLEAN_template& RlcmacUlEgprsDataBlock_template::tlli__ind() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tlli_ind of a non-specific template of type @RLCMAC_Types.RlcmacUlEgprsDataBlock.");
return single_value->field_tlli__ind;
}

BOOLEAN_template& RlcmacUlEgprsDataBlock_template::e()
{
set_specific();
return single_value->field_e;
}

const BOOLEAN_template& RlcmacUlEgprsDataBlock_template::e() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field e of a non-specific template of type @RLCMAC_Types.RlcmacUlEgprsDataBlock.");
return single_value->field_e;
}

OCTETSTRING_template& RlcmacUlEgprsDataBlock_template::tlli()
{
set_specific();
return single_value->field_tlli;
}

const OCTETSTRING_template& RlcmacUlEgprsDataBlock_template::tlli() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tlli of a non-specific template of type @RLCMAC_Types.RlcmacUlEgprsDataBlock.");
return single_value->field_tlli;
}

RlcMacUlPfi_template& RlcmacUlEgprsDataBlock_template::pfi()
{
set_specific();
return single_value->field_pfi;
}

const RlcMacUlPfi_template& RlcmacUlEgprsDataBlock_template::pfi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pfi of a non-specific template of type @RLCMAC_Types.RlcmacUlEgprsDataBlock.");
return single_value->field_pfi;
}

EgprsLlcBlocks_template& RlcmacUlEgprsDataBlock_template::blocks()
{
set_specific();
return single_value->field_blocks;
}

const EgprsLlcBlocks_template& RlcmacUlEgprsDataBlock_template::blocks() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field blocks of a non-specific template of type @RLCMAC_Types.RlcmacUlEgprsDataBlock.");
return single_value->field_blocks;
}

int RlcmacUlEgprsDataBlock_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.RlcmacUlEgprsDataBlock which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
  {    int ret_val = 5;
      if (single_value->field_tlli.is_present()) ret_val++;
      if (single_value->field_pfi.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 @RLCMAC_Types.RlcmacUlEgprsDataBlock 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 @RLCMAC_Types.RlcmacUlEgprsDataBlock containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.RlcmacUlEgprsDataBlock containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.RlcmacUlEgprsDataBlock containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.RlcmacUlEgprsDataBlock containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.RlcmacUlEgprsDataBlock containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.RlcmacUlEgprsDataBlock containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.RlcmacUlEgprsDataBlock containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @RLCMAC_Types.RlcmacUlEgprsDataBlock.");
  }
  return 0;
}

void RlcmacUlEgprsDataBlock_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ mcs := ");
single_value->field_mcs.log();
TTCN_Logger::log_event_str(", mac_hdr := ");
single_value->field_mac__hdr.log();
TTCN_Logger::log_event_str(", tlli_ind := ");
single_value->field_tlli__ind.log();
TTCN_Logger::log_event_str(", e := ");
single_value->field_e.log();
TTCN_Logger::log_event_str(", tlli := ");
single_value->field_tlli.log();
TTCN_Logger::log_event_str(", pfi := ");
single_value->field_pfi.log();
TTCN_Logger::log_event_str(", blocks := ");
single_value->field_blocks.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 RlcmacUlEgprsDataBlock_template::log_match(const RlcmacUlEgprsDataBlock& 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_mcs.match(match_value.mcs(), legacy)){
TTCN_Logger::log_logmatch_info(".mcs");
single_value->field_mcs.log_match(match_value.mcs(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_mac__hdr.match(match_value.mac__hdr(), legacy)){
TTCN_Logger::log_logmatch_info(".mac_hdr");
single_value->field_mac__hdr.log_match(match_value.mac__hdr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tlli__ind.match(match_value.tlli__ind(), legacy)){
TTCN_Logger::log_logmatch_info(".tlli_ind");
single_value->field_tlli__ind.log_match(match_value.tlli__ind(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_e.match(match_value.e(), legacy)){
TTCN_Logger::log_logmatch_info(".e");
single_value->field_e.log_match(match_value.e(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.tlli().ispresent()){
if(!single_value->field_tlli.match(match_value.tlli(), legacy)){
TTCN_Logger::log_logmatch_info(".tlli");
single_value->field_tlli.log_match(match_value.tlli(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_tlli.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".tlli := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_tlli.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.pfi().ispresent()){
if(!single_value->field_pfi.match(match_value.pfi(), legacy)){
TTCN_Logger::log_logmatch_info(".pfi");
single_value->field_pfi.log_match(match_value.pfi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_pfi.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".pfi := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_pfi.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_blocks.match(match_value.blocks(), legacy)){
TTCN_Logger::log_logmatch_info(".blocks");
single_value->field_blocks.log_match(match_value.blocks(), 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("{ mcs := ");
single_value->field_mcs.log_match(match_value.mcs(), legacy);
TTCN_Logger::log_event_str(", mac_hdr := ");
single_value->field_mac__hdr.log_match(match_value.mac__hdr(), legacy);
TTCN_Logger::log_event_str(", tlli_ind := ");
single_value->field_tlli__ind.log_match(match_value.tlli__ind(), legacy);
TTCN_Logger::log_event_str(", e := ");
single_value->field_e.log_match(match_value.e(), legacy);
TTCN_Logger::log_event_str(", tlli := ");
if (match_value.tlli().ispresent()) {
single_value->field_tlli.log_match(match_value.tlli(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_tlli.log();
if (single_value->field_tlli.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", pfi := ");
if (match_value.pfi().ispresent()) {
single_value->field_pfi.log_match(match_value.pfi(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_pfi.log();
if (single_value->field_pfi.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", blocks := ");
single_value->field_blocks.log_match(match_value.blocks(), 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 RlcmacUlEgprsDataBlock_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (mcs().is_bound()) mcs().set_implicit_omit();
if (mac__hdr().is_bound()) mac__hdr().set_implicit_omit();
if (tlli__ind().is_bound()) tlli__ind().set_implicit_omit();
if (e().is_bound()) e().set_implicit_omit();
if (!tlli().is_bound()) tlli() = OMIT_VALUE;
else tlli().set_implicit_omit();
if (!pfi().is_bound()) pfi() = OMIT_VALUE;
else pfi().set_implicit_omit();
if (blocks().is_bound()) blocks().set_implicit_omit();
}

void RlcmacUlEgprsDataBlock_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_mcs.encode_text(text_buf);
single_value->field_mac__hdr.encode_text(text_buf);
single_value->field_tlli__ind.encode_text(text_buf);
single_value->field_e.encode_text(text_buf);
single_value->field_tlli.encode_text(text_buf);
single_value->field_pfi.encode_text(text_buf);
single_value->field_blocks.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 @RLCMAC_Types.RlcmacUlEgprsDataBlock.");
}
}

void RlcmacUlEgprsDataBlock_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_mcs.decode_text(text_buf);
single_value->field_mac__hdr.decode_text(text_buf);
single_value->field_tlli__ind.decode_text(text_buf);
single_value->field_e.decode_text(text_buf);
single_value->field_tlli.decode_text(text_buf);
single_value->field_pfi.decode_text(text_buf);
single_value->field_blocks.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 RlcmacUlEgprsDataBlock_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 @RLCMAC_Types.RlcmacUlEgprsDataBlock.");
}
}

void RlcmacUlEgprsDataBlock_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: {
    RlcmacUlEgprsDataBlock_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 @RLCMAC_Types.RlcmacUlEgprsDataBlock 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) mcs().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mac__hdr().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) tlli__ind().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) e().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) tlli().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) pfi().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) blocks().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(), "mcs")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mcs().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mac_hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mac__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(), "tlli_ind")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tlli__ind().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "e")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          e().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tlli")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tlli().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pfi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "blocks")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          blocks().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 @RLCMAC_Types.RlcmacUlEgprsDataBlock: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    RlcmacUlEgprsDataBlock_template* precondition = new RlcmacUlEgprsDataBlock_template;
    precondition->set_param(*param.get_elem(0));
    RlcmacUlEgprsDataBlock_template* implied_template = new RlcmacUlEgprsDataBlock_template;
    implied_template->set_param(*param.get_elem(1));
    *this = RlcmacUlEgprsDataBlock_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.RlcmacUlEgprsDataBlock");
  }
  is_ifpresent = param.get_ifpresent();
}

void RlcmacUlEgprsDataBlock_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_mcs.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacUlEgprsDataBlock");
single_value->field_mac__hdr.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacUlEgprsDataBlock");
single_value->field_tlli__ind.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacUlEgprsDataBlock");
single_value->field_e.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacUlEgprsDataBlock");
single_value->field_tlli.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacUlEgprsDataBlock");
single_value->field_pfi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacUlEgprsDataBlock");
single_value->field_blocks.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacUlEgprsDataBlock");
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 : "@RLCMAC_Types.RlcmacUlEgprsDataBlock");
}

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

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

RlcmacUlDataBlock::RlcmacUlDataBlock()
{
}

RlcmacUlDataBlock::RlcmacUlDataBlock(const CodingScheme& par_cs,
    const UlMacDataHeader& par_mac__hdr,
    const OPTIONAL< OCTETSTRING >& par_tlli,
    const OPTIONAL< RlcMacUlPfi >& par_pfi,
    const LlcBlocks& par_blocks)
  :   field_cs(par_cs),
  field_mac__hdr(par_mac__hdr),
  field_tlli(par_tlli),
  field_pfi(par_pfi),
  field_blocks(par_blocks)
{
}

RlcmacUlDataBlock::RlcmacUlDataBlock(const RlcmacUlDataBlock& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.RlcmacUlDataBlock.");
if (other_value.cs().is_bound()) field_cs = other_value.cs();
else field_cs.clean_up();
if (other_value.mac__hdr().is_bound()) field_mac__hdr = other_value.mac__hdr();
else field_mac__hdr.clean_up();
if (other_value.tlli().is_bound()) field_tlli = other_value.tlli();
else field_tlli.clean_up();
if (other_value.pfi().is_bound()) field_pfi = other_value.pfi();
else field_pfi.clean_up();
if (other_value.blocks().is_bound()) field_blocks = other_value.blocks();
else field_blocks.clean_up();
}

void RlcmacUlDataBlock::clean_up()
{
field_cs.clean_up();
field_mac__hdr.clean_up();
field_tlli.clean_up();
field_pfi.clean_up();
field_blocks.clean_up();
}

const TTCN_Typedescriptor_t* RlcmacUlDataBlock::get_descriptor() const { return &RlcmacUlDataBlock_descr_; }
RlcmacUlDataBlock& RlcmacUlDataBlock::operator=(const RlcmacUlDataBlock& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.RlcmacUlDataBlock.");
  if (other_value.cs().is_bound()) field_cs = other_value.cs();
  else field_cs.clean_up();
  if (other_value.mac__hdr().is_bound()) field_mac__hdr = other_value.mac__hdr();
  else field_mac__hdr.clean_up();
  if (other_value.tlli().is_bound()) field_tlli = other_value.tlli();
  else field_tlli.clean_up();
  if (other_value.pfi().is_bound()) field_pfi = other_value.pfi();
  else field_pfi.clean_up();
  if (other_value.blocks().is_bound()) field_blocks = other_value.blocks();
  else field_blocks.clean_up();
}
return *this;
}

boolean RlcmacUlDataBlock::operator==(const RlcmacUlDataBlock& other_value) const
{
return field_cs==other_value.field_cs
  && field_mac__hdr==other_value.field_mac__hdr
  && field_tlli==other_value.field_tlli
  && field_pfi==other_value.field_pfi
  && field_blocks==other_value.field_blocks;
}

boolean RlcmacUlDataBlock::is_bound() const
{
return (field_cs.is_bound())
  || (field_mac__hdr.is_bound())
  || (OPTIONAL_OMIT == field_tlli.get_selection() || field_tlli.is_bound())
  || (OPTIONAL_OMIT == field_pfi.get_selection() || field_pfi.is_bound())
  || (field_blocks.is_bound());
}
boolean RlcmacUlDataBlock::is_value() const
{
return field_cs.is_value()
  && field_mac__hdr.is_value()
  && (OPTIONAL_OMIT == field_tlli.get_selection() || field_tlli.is_value())
  && (OPTIONAL_OMIT == field_pfi.get_selection() || field_pfi.is_value())
  && field_blocks.is_value();
}
int RlcmacUlDataBlock::size_of() const
{
  int ret_val = 3;
  if (field_tlli.ispresent()) ret_val++;
  if (field_pfi.ispresent()) ret_val++;
  return ret_val;
}

void RlcmacUlDataBlock::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ cs := ");
field_cs.log();
TTCN_Logger::log_event_str(", mac_hdr := ");
field_mac__hdr.log();
TTCN_Logger::log_event_str(", tlli := ");
field_tlli.log();
TTCN_Logger::log_event_str(", pfi := ");
field_pfi.log();
TTCN_Logger::log_event_str(", blocks := ");
field_blocks.log();
TTCN_Logger::log_event_str(" }");
}

void RlcmacUlDataBlock::set_implicit_omit()
{
if (cs().is_bound()) cs().set_implicit_omit();
if (mac__hdr().is_bound()) mac__hdr().set_implicit_omit();
if (!tlli().is_bound()) tlli() = OMIT_VALUE;
else tlli().set_implicit_omit();
if (!pfi().is_bound()) pfi() = OMIT_VALUE;
else pfi().set_implicit_omit();
if (blocks().is_bound()) blocks().set_implicit_omit();
}

void RlcmacUlDataBlock::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 @RLCMAC_Types.RlcmacUlDataBlock 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) cs().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mac__hdr().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) tlli().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) pfi().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) blocks().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(), "cs")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cs().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mac_hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mac__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(), "tlli")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tlli().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pfi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "blocks")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          blocks().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 @RLCMAC_Types.RlcmacUlDataBlock: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.RlcmacUlDataBlock");
  }
}

void RlcmacUlDataBlock::encode_text(Text_Buf& text_buf) const
{
field_cs.encode_text(text_buf);
field_mac__hdr.encode_text(text_buf);
field_tlli.encode_text(text_buf);
field_pfi.encode_text(text_buf);
field_blocks.encode_text(text_buf);
}

void RlcmacUlDataBlock::decode_text(Text_Buf& text_buf)
{
field_cs.decode_text(text_buf);
field_mac__hdr.decode_text(text_buf);
field_tlli.decode_text(text_buf);
field_pfi.decode_text(text_buf);
field_blocks.decode_text(text_buf);
}

void RlcmacUlDataBlock::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 RlcmacUlDataBlock::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 RlcmacUlDataBlock::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, RlcmacUlDataBlock_cs_descr_.raw->forceomit);
  decoded_field_length = field_cs.RAW_decode(RlcmacUlDataBlock_cs_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, RlcmacUlDataBlock_mac__hdr_descr_.raw->forceomit);
  decoded_field_length = field_mac__hdr.RAW_decode(RlcmacUlDataBlock_mac__hdr_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (limit > 0 && field_mac__hdr.tlli__ind() == TRUE){
  if (force_omit != NULL && (*force_omit)(2)) {
    field_tlli = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_2_force_omit(2, force_omit, RlcmacUlDataBlock_tlli_descr_.raw->forceomit);
  decoded_field_length = field_tlli().RAW_decode(RlcmacUlDataBlock_tlli_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 1) {
  field_tlli = 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_tlli=OMIT_VALUE;
  if (limit > 0 && field_mac__hdr.pfi__ind() == TRUE){
  if (force_omit != NULL && (*force_omit)(3)) {
    field_pfi = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_3_force_omit(3, force_omit, RlcmacUlDataBlock_pfi_descr_.raw->forceomit);
  decoded_field_length = field_pfi().RAW_decode(RlcmacUlDataBlock_pfi_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 1) {
  field_pfi = 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_pfi=OMIT_VALUE;
  RAW_Force_Omit field_4_force_omit(4, force_omit, RlcmacUlDataBlock_blocks_descr_.raw->forceomit);
  decoded_field_length = field_blocks.RAW_decode(RlcmacUlDataBlock_blocks_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 RlcmacUlDataBlock::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, RlcmacUlDataBlock_cs_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RlcmacUlDataBlock_mac__hdr_descr_.raw);
  if (field_tlli.ispresent()) {
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, RlcmacUlDataBlock_tlli_descr_.raw);
  }
  else myleaf.body.node.nodes[2] = NULL;
  if (field_pfi.ispresent()) {
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, RlcmacUlDataBlock_pfi_descr_.raw);
  }
  else myleaf.body.node.nodes[3] = NULL;
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, RlcmacUlDataBlock_blocks_descr_.raw);
  encoded_length += field_cs.RAW_encode(RlcmacUlDataBlock_cs_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_mac__hdr.RAW_encode(RlcmacUlDataBlock_mac__hdr_descr_, *myleaf.body.node.nodes[1]);
  if (field_tlli.ispresent()) {
  encoded_length += field_tlli().RAW_encode(RlcmacUlDataBlock_tlli_descr_, *myleaf.body.node.nodes[2]);
  }
  if (field_pfi.ispresent()) {
  encoded_length += field_pfi().RAW_encode(RlcmacUlDataBlock_pfi_descr_, *myleaf.body.node.nodes[3]);
  }
  encoded_length += field_blocks.RAW_encode(RlcmacUlDataBlock_blocks_descr_, *myleaf.body.node.nodes[4]);
  if (field_tlli.ispresent() && (field_mac__hdr.tlli__ind() != TRUE)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+2;
  int new_pos0[]={1,7};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,2,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
  BOOLEAN new_val = TRUE;
  new_val.RAW_encode(UlMacDataHeader_tlli__ind_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);
  }
  }
  if (field_pfi.ispresent() && (field_mac__hdr.pfi__ind() != TRUE)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+2;
  int new_pos0[]={1,5};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,2,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
  BOOLEAN new_val = TRUE;
  new_val.RAW_encode(UlMacDataHeader_pfi__ind_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);
  }
  }
  return myleaf.length = encoded_length;
}

struct RlcmacUlDataBlock_template::single_value_struct {
CodingScheme_template field_cs;
UlMacDataHeader_template field_mac__hdr;
OCTETSTRING_template field_tlli;
RlcMacUlPfi_template field_pfi;
LlcBlocks_template field_blocks;
};

void RlcmacUlDataBlock_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_cs = ANY_VALUE;
single_value->field_mac__hdr = ANY_VALUE;
single_value->field_tlli = ANY_OR_OMIT;
single_value->field_pfi = ANY_OR_OMIT;
single_value->field_blocks = ANY_VALUE;
}
}
}

void RlcmacUlDataBlock_template::copy_value(const RlcmacUlDataBlock& other_value)
{
single_value = new single_value_struct;
if (other_value.cs().is_bound()) {
  single_value->field_cs = other_value.cs();
} else {
  single_value->field_cs.clean_up();
}
if (other_value.mac__hdr().is_bound()) {
  single_value->field_mac__hdr = other_value.mac__hdr();
} else {
  single_value->field_mac__hdr.clean_up();
}
if (other_value.tlli().is_bound()) {
  if (other_value.tlli().ispresent()) single_value->field_tlli = other_value.tlli()();
  else single_value->field_tlli = OMIT_VALUE;
} else {
  single_value->field_tlli.clean_up();
}
if (other_value.pfi().is_bound()) {
  if (other_value.pfi().ispresent()) single_value->field_pfi = other_value.pfi()();
  else single_value->field_pfi = OMIT_VALUE;
} else {
  single_value->field_pfi.clean_up();
}
if (other_value.blocks().is_bound()) {
  single_value->field_blocks = other_value.blocks();
} else {
  single_value->field_blocks.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RlcmacUlDataBlock_template::copy_template(const RlcmacUlDataBlock_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.cs().get_selection()) {
single_value->field_cs = other_value.cs();
} else {
single_value->field_cs.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.mac__hdr().get_selection()) {
single_value->field_mac__hdr = other_value.mac__hdr();
} else {
single_value->field_mac__hdr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tlli().get_selection()) {
single_value->field_tlli = other_value.tlli();
} else {
single_value->field_tlli.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pfi().get_selection()) {
single_value->field_pfi = other_value.pfi();
} else {
single_value->field_pfi.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.blocks().get_selection()) {
single_value->field_blocks = other_value.blocks();
} else {
single_value->field_blocks.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 RlcmacUlDataBlock_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 RlcmacUlDataBlock_template(*other_value.implication_.precondition);
implication_.implied_template = new RlcmacUlDataBlock_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 @RLCMAC_Types.RlcmacUlDataBlock.");
break;
}
set_selection(other_value);
}

RlcmacUlDataBlock_template::RlcmacUlDataBlock_template()
{
}

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

RlcmacUlDataBlock_template::RlcmacUlDataBlock_template(const RlcmacUlDataBlock& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean RlcmacUlDataBlock_template::match(const RlcmacUlDataBlock& 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.cs().is_bound()) return FALSE;
if(!single_value->field_cs.match(other_value.cs(), legacy))return FALSE;
if(!other_value.mac__hdr().is_bound()) return FALSE;
if(!single_value->field_mac__hdr.match(other_value.mac__hdr(), legacy))return FALSE;
if(!other_value.tlli().is_bound()) return FALSE;
if((other_value.tlli().ispresent() ? !single_value->field_tlli.match((const OCTETSTRING&)other_value.tlli(), legacy) : !single_value->field_tlli.match_omit(legacy)))return FALSE;
if(!other_value.pfi().is_bound()) return FALSE;
if((other_value.pfi().ispresent() ? !single_value->field_pfi.match((const RlcMacUlPfi&)other_value.pfi(), legacy) : !single_value->field_pfi.match_omit(legacy)))return FALSE;
if(!other_value.blocks().is_bound()) return FALSE;
if(!single_value->field_blocks.match(other_value.blocks(), 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 @RLCMAC_Types.RlcmacUlDataBlock.");
}
return FALSE;
}

boolean RlcmacUlDataBlock_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_cs.is_bound()
 || single_value->field_mac__hdr.is_bound()
 || (single_value->field_tlli.is_omit() || single_value->field_tlli.is_bound())
 || (single_value->field_pfi.is_omit() || single_value->field_pfi.is_bound())
 || single_value->field_blocks.is_bound();
}

boolean RlcmacUlDataBlock_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_cs.is_value()
 && single_value->field_mac__hdr.is_value()
 && (single_value->field_tlli.is_omit() || single_value->field_tlli.is_value())
 && (single_value->field_pfi.is_omit() || single_value->field_pfi.is_value())
 && single_value->field_blocks.is_value();
}

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

RlcmacUlDataBlock RlcmacUlDataBlock_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 @RLCMAC_Types.RlcmacUlDataBlock.");
RlcmacUlDataBlock ret_val;
if (single_value->field_cs.is_bound()) {
ret_val.cs() = single_value->field_cs.valueof();
}
if (single_value->field_mac__hdr.is_bound()) {
ret_val.mac__hdr() = single_value->field_mac__hdr.valueof();
}
if (single_value->field_tlli.is_omit()) ret_val.tlli() = OMIT_VALUE;
else if (single_value->field_tlli.is_bound()) {
ret_val.tlli() = single_value->field_tlli.valueof();
}
if (single_value->field_pfi.is_omit()) ret_val.pfi() = OMIT_VALUE;
else if (single_value->field_pfi.is_bound()) {
ret_val.pfi() = single_value->field_pfi.valueof();
}
if (single_value->field_blocks.is_bound()) {
ret_val.blocks() = single_value->field_blocks.valueof();
}
return ret_val;
}

void RlcmacUlDataBlock_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 @RLCMAC_Types.RlcmacUlDataBlock.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RlcmacUlDataBlock_template[list_length];
}

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

CodingScheme_template& RlcmacUlDataBlock_template::cs()
{
set_specific();
return single_value->field_cs;
}

const CodingScheme_template& RlcmacUlDataBlock_template::cs() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field cs of a non-specific template of type @RLCMAC_Types.RlcmacUlDataBlock.");
return single_value->field_cs;
}

UlMacDataHeader_template& RlcmacUlDataBlock_template::mac__hdr()
{
set_specific();
return single_value->field_mac__hdr;
}

const UlMacDataHeader_template& RlcmacUlDataBlock_template::mac__hdr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mac_hdr of a non-specific template of type @RLCMAC_Types.RlcmacUlDataBlock.");
return single_value->field_mac__hdr;
}

OCTETSTRING_template& RlcmacUlDataBlock_template::tlli()
{
set_specific();
return single_value->field_tlli;
}

const OCTETSTRING_template& RlcmacUlDataBlock_template::tlli() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tlli of a non-specific template of type @RLCMAC_Types.RlcmacUlDataBlock.");
return single_value->field_tlli;
}

RlcMacUlPfi_template& RlcmacUlDataBlock_template::pfi()
{
set_specific();
return single_value->field_pfi;
}

const RlcMacUlPfi_template& RlcmacUlDataBlock_template::pfi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pfi of a non-specific template of type @RLCMAC_Types.RlcmacUlDataBlock.");
return single_value->field_pfi;
}

LlcBlocks_template& RlcmacUlDataBlock_template::blocks()
{
set_specific();
return single_value->field_blocks;
}

const LlcBlocks_template& RlcmacUlDataBlock_template::blocks() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field blocks of a non-specific template of type @RLCMAC_Types.RlcmacUlDataBlock.");
return single_value->field_blocks;
}

int RlcmacUlDataBlock_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.RlcmacUlDataBlock which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
  {    int ret_val = 3;
      if (single_value->field_tlli.is_present()) ret_val++;
      if (single_value->field_pfi.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 @RLCMAC_Types.RlcmacUlDataBlock 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 @RLCMAC_Types.RlcmacUlDataBlock containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.RlcmacUlDataBlock containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.RlcmacUlDataBlock containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.RlcmacUlDataBlock containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.RlcmacUlDataBlock containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.RlcmacUlDataBlock containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_Types.RlcmacUlDataBlock containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @RLCMAC_Types.RlcmacUlDataBlock.");
  }
  return 0;
}

void RlcmacUlDataBlock_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ cs := ");
single_value->field_cs.log();
TTCN_Logger::log_event_str(", mac_hdr := ");
single_value->field_mac__hdr.log();
TTCN_Logger::log_event_str(", tlli := ");
single_value->field_tlli.log();
TTCN_Logger::log_event_str(", pfi := ");
single_value->field_pfi.log();
TTCN_Logger::log_event_str(", blocks := ");
single_value->field_blocks.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 RlcmacUlDataBlock_template::log_match(const RlcmacUlDataBlock& 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_cs.match(match_value.cs(), legacy)){
TTCN_Logger::log_logmatch_info(".cs");
single_value->field_cs.log_match(match_value.cs(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_mac__hdr.match(match_value.mac__hdr(), legacy)){
TTCN_Logger::log_logmatch_info(".mac_hdr");
single_value->field_mac__hdr.log_match(match_value.mac__hdr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.tlli().ispresent()){
if(!single_value->field_tlli.match(match_value.tlli(), legacy)){
TTCN_Logger::log_logmatch_info(".tlli");
single_value->field_tlli.log_match(match_value.tlli(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_tlli.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".tlli := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_tlli.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.pfi().ispresent()){
if(!single_value->field_pfi.match(match_value.pfi(), legacy)){
TTCN_Logger::log_logmatch_info(".pfi");
single_value->field_pfi.log_match(match_value.pfi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_pfi.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".pfi := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_pfi.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_blocks.match(match_value.blocks(), legacy)){
TTCN_Logger::log_logmatch_info(".blocks");
single_value->field_blocks.log_match(match_value.blocks(), 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("{ cs := ");
single_value->field_cs.log_match(match_value.cs(), legacy);
TTCN_Logger::log_event_str(", mac_hdr := ");
single_value->field_mac__hdr.log_match(match_value.mac__hdr(), legacy);
TTCN_Logger::log_event_str(", tlli := ");
if (match_value.tlli().ispresent()) {
single_value->field_tlli.log_match(match_value.tlli(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_tlli.log();
if (single_value->field_tlli.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", pfi := ");
if (match_value.pfi().ispresent()) {
single_value->field_pfi.log_match(match_value.pfi(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_pfi.log();
if (single_value->field_pfi.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", blocks := ");
single_value->field_blocks.log_match(match_value.blocks(), 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 RlcmacUlDataBlock_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (cs().is_bound()) cs().set_implicit_omit();
if (mac__hdr().is_bound()) mac__hdr().set_implicit_omit();
if (!tlli().is_bound()) tlli() = OMIT_VALUE;
else tlli().set_implicit_omit();
if (!pfi().is_bound()) pfi() = OMIT_VALUE;
else pfi().set_implicit_omit();
if (blocks().is_bound()) blocks().set_implicit_omit();
}

void RlcmacUlDataBlock_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_cs.encode_text(text_buf);
single_value->field_mac__hdr.encode_text(text_buf);
single_value->field_tlli.encode_text(text_buf);
single_value->field_pfi.encode_text(text_buf);
single_value->field_blocks.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 @RLCMAC_Types.RlcmacUlDataBlock.");
}
}

void RlcmacUlDataBlock_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_cs.decode_text(text_buf);
single_value->field_mac__hdr.decode_text(text_buf);
single_value->field_tlli.decode_text(text_buf);
single_value->field_pfi.decode_text(text_buf);
single_value->field_blocks.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 RlcmacUlDataBlock_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 @RLCMAC_Types.RlcmacUlDataBlock.");
}
}

void RlcmacUlDataBlock_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: {
    RlcmacUlDataBlock_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 @RLCMAC_Types.RlcmacUlDataBlock 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) cs().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mac__hdr().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) tlli().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) pfi().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) blocks().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(), "cs")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cs().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mac_hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mac__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(), "tlli")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tlli().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pfi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "blocks")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          blocks().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 @RLCMAC_Types.RlcmacUlDataBlock: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    RlcmacUlDataBlock_template* precondition = new RlcmacUlDataBlock_template;
    precondition->set_param(*param.get_elem(0));
    RlcmacUlDataBlock_template* implied_template = new RlcmacUlDataBlock_template;
    implied_template->set_param(*param.get_elem(1));
    *this = RlcmacUlDataBlock_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.RlcmacUlDataBlock");
  }
  is_ifpresent = param.get_ifpresent();
}

void RlcmacUlDataBlock_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_cs.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacUlDataBlock");
single_value->field_mac__hdr.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacUlDataBlock");
single_value->field_tlli.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacUlDataBlock");
single_value->field_pfi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacUlDataBlock");
single_value->field_blocks.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacUlDataBlock");
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 : "@RLCMAC_Types.RlcmacUlDataBlock");
}

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

boolean RlcmacUlDataBlock_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 RlcmacUlBlock::copy_value(const RlcmacUlBlock& other_value)
{
switch (other_value.union_selection) {
case ALT_data:
field_data = new RlcmacUlDataBlock(*other_value.field_data);
break;
case ALT_data__egprs:
field_data__egprs = new RlcmacUlEgprsDataBlock(*other_value.field_data__egprs);
break;
case ALT_ctrl:
field_ctrl = new RlcmacUlCtrlBlock(*other_value.field_ctrl);
break;
default:
TTCN_error("Assignment of an unbound union value of type @RLCMAC_Types.RlcmacUlBlock.");
}
union_selection = other_value.union_selection;
}

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

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

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

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

boolean RlcmacUlBlock::operator==(const RlcmacUlBlock& other_value) const
{
if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @RLCMAC_Types.RlcmacUlBlock.");
if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @RLCMAC_Types.RlcmacUlBlock.");
if (union_selection != other_value.union_selection) return FALSE;
switch (union_selection) {
case ALT_data:
return *field_data == *other_value.field_data;
case ALT_data__egprs:
return *field_data__egprs == *other_value.field_data__egprs;
case ALT_ctrl:
return *field_ctrl == *other_value.field_ctrl;
default:
return FALSE;
}
}

RlcmacUlDataBlock& RlcmacUlBlock::data()
{
if (union_selection != ALT_data) {
clean_up();
field_data = new RlcmacUlDataBlock;
union_selection = ALT_data;
}
return *field_data;
}

const RlcmacUlDataBlock& RlcmacUlBlock::data() const
{
if (union_selection != ALT_data) TTCN_error("Using non-selected field data in a value of union type @RLCMAC_Types.RlcmacUlBlock.");
return *field_data;
}

RlcmacUlEgprsDataBlock& RlcmacUlBlock::data__egprs()
{
if (union_selection != ALT_data__egprs) {
clean_up();
field_data__egprs = new RlcmacUlEgprsDataBlock;
union_selection = ALT_data__egprs;
}
return *field_data__egprs;
}

const RlcmacUlEgprsDataBlock& RlcmacUlBlock::data__egprs() const
{
if (union_selection != ALT_data__egprs) TTCN_error("Using non-selected field data_egprs in a value of union type @RLCMAC_Types.RlcmacUlBlock.");
return *field_data__egprs;
}

RlcmacUlCtrlBlock& RlcmacUlBlock::ctrl()
{
if (union_selection != ALT_ctrl) {
clean_up();
field_ctrl = new RlcmacUlCtrlBlock;
union_selection = ALT_ctrl;
}
return *field_ctrl;
}

const RlcmacUlCtrlBlock& RlcmacUlBlock::ctrl() const
{
if (union_selection != ALT_ctrl) TTCN_error("Using non-selected field ctrl in a value of union type @RLCMAC_Types.RlcmacUlBlock.");
return *field_ctrl;
}

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

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

boolean RlcmacUlBlock::is_value() const
{
switch (union_selection) {
case UNBOUND_VALUE: return FALSE;
case ALT_data: return field_data->is_value();
case ALT_data__egprs: return field_data__egprs->is_value();
case ALT_ctrl: return field_ctrl->is_value();
default: TTCN_error("Invalid selection in union is_bound");}
}

void RlcmacUlBlock::clean_up()
{
switch (union_selection) {
case ALT_data:
  delete field_data;
  break;
case ALT_data__egprs:
  delete field_data__egprs;
  break;
case ALT_ctrl:
  delete field_ctrl;
  break;
default:
  break;
}
union_selection = UNBOUND_VALUE;
}

void RlcmacUlBlock::log() const
{
switch (union_selection) {
case ALT_data:
TTCN_Logger::log_event_str("{ data := ");
field_data->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_data__egprs:
TTCN_Logger::log_event_str("{ data_egprs := ");
field_data__egprs->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_ctrl:
TTCN_Logger::log_event_str("{ ctrl := ");
field_ctrl->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_unbound();
}
}

void RlcmacUlBlock::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, "data")) {
    data().set_param(*mp_last);
    if (!data().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "data_egprs")) {
    data__egprs().set_param(*mp_last);
    if (!data__egprs().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "ctrl")) {
    ctrl().set_param(*mp_last);
    if (!ctrl().is_bound()) clean_up();
    return;
  }
  mp_last->error("Field %s does not exist in type @RLCMAC_Types.RlcmacUlBlock.", last_name);
}

void RlcmacUlBlock::set_implicit_omit()
{
switch (union_selection) {
case ALT_data:
field_data->set_implicit_omit(); break;
case ALT_data__egprs:
field_data__egprs->set_implicit_omit(); break;
case ALT_ctrl:
field_ctrl->set_implicit_omit(); break;
default: break;
}
}

void RlcmacUlBlock::encode_text(Text_Buf& text_buf) const
{
text_buf.push_int(union_selection);
switch (union_selection) {
case ALT_data:
field_data->encode_text(text_buf);
break;
case ALT_data__egprs:
field_data__egprs->encode_text(text_buf);
break;
case ALT_ctrl:
field_ctrl->encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an unbound value of union type @RLCMAC_Types.RlcmacUlBlock.");
}
}

void RlcmacUlBlock::decode_text(Text_Buf& text_buf)
{
switch ((union_selection_type)text_buf.pull_int().get_val()) {
case ALT_data:
data().decode_text(text_buf);
break;
case ALT_data__egprs:
data__egprs().decode_text(text_buf);
break;
case ALT_ctrl:
ctrl().decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for type @RLCMAC_Types.RlcmacUlBlock.");
}
}

void RlcmacUlBlock::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 RlcmacUlBlock::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 RlcmacUlBlock::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, RlcmacUlBlock_data_descr_.raw->forceomit);
      decoded_length = data().RAW_decode(RlcmacUlBlock_data_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, RlcmacUlBlock_data__egprs_descr_.raw->forceomit);
      decoded_length = data__egprs().RAW_decode(RlcmacUlBlock_data__egprs_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 2: {
      RAW_Force_Omit field_force_omit(2, force_omit, RlcmacUlBlock_ctrl_descr_.raw->forceomit);
      decoded_length = ctrl().RAW_decode(RlcmacUlBlock_ctrl_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;
    EgprsHeaderType temporal_1;
    int decoded_1_length;
    MacPayloadType temporal_2;
    int decoded_2_length;
    already_failed = FALSE;
    if (!already_failed) {
      MacPayloadType temporal_0;
      int decoded_0_length;
      p_buf.set_pos_bit(starting_pos + 4);
      decoded_0_length = temporal_0.RAW_decode(UlMacDataHeader_payload__type_descr_, p_buf, limit, top_bit_ord, TRUE);
      if (decoded_0_length > 0) {
        if (temporal_0 == MacPayloadType::MAC__PT__RLC__DATA) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(0, force_omit, RlcmacUlBlock_data_descr_.raw->forceomit);
          decoded_length = data().RAW_decode(RlcmacUlBlock_data_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_data).mac__hdr().payload__type() == MacPayloadType::MAC__PT__RLC__DATA) {
               return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
             }else already_failed = TRUE;
          }
        }
      }
    }
    already_failed = FALSE;
    if (!already_failed) {
      p_buf.set_pos_bit(starting_pos + 4);
      decoded_1_length = temporal_1.RAW_decode(EgprsUlMacDataHeader_header__type_descr_, p_buf, limit, top_bit_ord, TRUE);
      if (decoded_1_length > 0) {
        if (temporal_1 == EgprsHeaderType::RLCMAC__HDR__TYPE__1 || temporal_1 == EgprsHeaderType::RLCMAC__HDR__TYPE__2 || temporal_1 == EgprsHeaderType::RLCMAC__HDR__TYPE__3) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(1, force_omit, RlcmacUlBlock_data__egprs_descr_.raw->forceomit);
          decoded_length = data__egprs().RAW_decode(RlcmacUlBlock_data__egprs_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_data__egprs).mac__hdr().header__type() == EgprsHeaderType::RLCMAC__HDR__TYPE__1 || (*field_data__egprs).mac__hdr().header__type() == EgprsHeaderType::RLCMAC__HDR__TYPE__2 || (*field_data__egprs).mac__hdr().header__type() == EgprsHeaderType::RLCMAC__HDR__TYPE__3) {
               return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
             }else already_failed = TRUE;
          }
        }
      }
    }
    already_failed = FALSE;
    if (!already_failed) {
      p_buf.set_pos_bit(starting_pos + 0);
      decoded_2_length = temporal_2.RAW_decode(UlMacCtrlHeader_payload__type_descr_, p_buf, limit, top_bit_ord, TRUE);
      if (decoded_2_length > 0) {
        if (temporal_2 == MacPayloadType::MAC__PT__RLCMAC__NO__OPT || temporal_2 == MacPayloadType::MAC__PT__RLCMAC__OPT) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(2, force_omit, RlcmacUlBlock_ctrl_descr_.raw->forceomit);
          decoded_length = ctrl().RAW_decode(RlcmacUlBlock_ctrl_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_ctrl).mac__hdr().payload__type() == MacPayloadType::MAC__PT__RLCMAC__NO__OPT || (*field_ctrl).mac__hdr().payload__type() == MacPayloadType::MAC__PT__RLCMAC__OPT) {
               return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
             }else already_failed = TRUE;
          }
        }
      }
    }
 }
 clean_up();
 return -1;
}

int RlcmacUlBlock::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const
{
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 3;  myleaf.body.node.nodes = init_nodes_of_enc_tree(3);
  memset(myleaf.body.node.nodes, 0, 3 * sizeof(RAW_enc_tree *));
  switch (union_selection) {
  case ALT_data:
    myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, RlcmacUlBlock_data_descr_.raw);
    encoded_length = field_data->RAW_encode(RlcmacUlBlock_data_descr_, *myleaf.body.node.nodes[0]);
    myleaf.body.node.nodes[0]->coding_descr = &RlcmacUlBlock_data_descr_;
    if ((*field_data).mac__hdr().payload__type() != MacPayloadType::MAC__PT__RLC__DATA) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+3;
  int new_pos0[]={0,1,0};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,3,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
  MacPayloadType new_val = MacPayloadType::MAC__PT__RLC__DATA;
  new_val.RAW_encode(UlMacDataHeader_payload__type_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_data__egprs:
    myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, RlcmacUlBlock_data__egprs_descr_.raw);
    encoded_length = field_data__egprs->RAW_encode(RlcmacUlBlock_data__egprs_descr_, *myleaf.body.node.nodes[1]);
    myleaf.body.node.nodes[1]->coding_descr = &RlcmacUlBlock_data__egprs_descr_;
    if ((*field_data__egprs).mac__hdr().header__type() != EgprsHeaderType::RLCMAC__HDR__TYPE__1 && (*field_data__egprs).mac__hdr().header__type() != EgprsHeaderType::RLCMAC__HDR__TYPE__2 && (*field_data__egprs).mac__hdr().header__type() != EgprsHeaderType::RLCMAC__HDR__TYPE__3) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+3;
  int new_pos0[]={1,1,0};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,3,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
  EgprsHeaderType new_val = EgprsHeaderType::RLCMAC__HDR__TYPE__1;
  new_val.RAW_encode(EgprsUlMacDataHeader_header__type_descr_,*temp_leaf);
  } else  {
  RAW_enc_tr_pos pr_pos1;
  pr_pos1.level=myleaf.curr_pos.level+3;
  int new_pos1[]={1,1,0};
  pr_pos1.pos=init_new_tree_pos(myleaf.curr_pos,3,new_pos1);
  temp_leaf = myleaf.get_node(pr_pos1);
  if(temp_leaf != NULL){
  EgprsHeaderType new_val = EgprsHeaderType::RLCMAC__HDR__TYPE__2;
  new_val.RAW_encode(EgprsUlMacDataHeader_header__type_descr_,*temp_leaf);
  } else  {
  RAW_enc_tr_pos pr_pos2;
  pr_pos2.level=myleaf.curr_pos.level+3;
  int new_pos2[]={1,1,0};
  pr_pos2.pos=init_new_tree_pos(myleaf.curr_pos,3,new_pos2);
  temp_leaf = myleaf.get_node(pr_pos2);
  if(temp_leaf != NULL){
  EgprsHeaderType new_val = EgprsHeaderType::RLCMAC__HDR__TYPE__3;
  new_val.RAW_encode(EgprsUlMacDataHeader_header__type_descr_,*temp_leaf);
  } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  }
  free_tree_pos(pr_pos2.pos);
  }
  free_tree_pos(pr_pos1.pos);
  }
  free_tree_pos(pr_pos0.pos);
  }
    }
    break;
  case ALT_ctrl:
    myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 2, RlcmacUlBlock_ctrl_descr_.raw);
    encoded_length = field_ctrl->RAW_encode(RlcmacUlBlock_ctrl_descr_, *myleaf.body.node.nodes[2]);
    myleaf.body.node.nodes[2]->coding_descr = &RlcmacUlBlock_ctrl_descr_;
    if ((*field_ctrl).mac__hdr().payload__type() != MacPayloadType::MAC__PT__RLCMAC__NO__OPT && (*field_ctrl).mac__hdr().payload__type() != MacPayloadType::MAC__PT__RLCMAC__OPT) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+3;
  int new_pos0[]={2,0,0};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,3,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
  MacPayloadType new_val = MacPayloadType::MAC__PT__RLCMAC__NO__OPT;
  new_val.RAW_encode(UlMacCtrlHeader_payload__type_descr_,*temp_leaf);
  } else  {
  RAW_enc_tr_pos pr_pos1;
  pr_pos1.level=myleaf.curr_pos.level+3;
  int new_pos1[]={2,0,0};
  pr_pos1.pos=init_new_tree_pos(myleaf.curr_pos,3,new_pos1);
  temp_leaf = myleaf.get_node(pr_pos1);
  if(temp_leaf != NULL){
  MacPayloadType new_val = MacPayloadType::MAC__PT__RLCMAC__OPT;
  new_val.RAW_encode(UlMacCtrlHeader_payload__type_descr_,*temp_leaf);
  } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  }
  free_tree_pos(pr_pos1.pos);
  }
  free_tree_pos(pr_pos0.pos);
  }
    }
    break;
  default:
    TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  }
  return encoded_length;
}

void RlcmacUlBlock_template::copy_value(const RlcmacUlBlock& other_value)
{
single_value.union_selection = other_value.get_selection();
switch (single_value.union_selection) {
case RlcmacUlBlock::ALT_data:
single_value.field_data = new RlcmacUlDataBlock_template(other_value.data());
break;
case RlcmacUlBlock::ALT_data__egprs:
single_value.field_data__egprs = new RlcmacUlEgprsDataBlock_template(other_value.data__egprs());
break;
case RlcmacUlBlock::ALT_ctrl:
single_value.field_ctrl = new RlcmacUlCtrlBlock_template(other_value.ctrl());
break;
default:
TTCN_error("Initializing a template with an unbound value of type @RLCMAC_Types.RlcmacUlBlock.");
}
set_selection(SPECIFIC_VALUE);
}

void RlcmacUlBlock_template::copy_template(const RlcmacUlBlock_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 RlcmacUlBlock::ALT_data:
single_value.field_data = new RlcmacUlDataBlock_template(*other_value.single_value.field_data);
break;
case RlcmacUlBlock::ALT_data__egprs:
single_value.field_data__egprs = new RlcmacUlEgprsDataBlock_template(*other_value.single_value.field_data__egprs);
break;
case RlcmacUlBlock::ALT_ctrl:
single_value.field_ctrl = new RlcmacUlCtrlBlock_template(*other_value.single_value.field_ctrl);
break;
default:
TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @RLCMAC_Types.RlcmacUlBlock.");
}
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 RlcmacUlBlock_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 RlcmacUlBlock_template(*other_value.implication_.precondition);
implication_.implied_template = new RlcmacUlBlock_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 @RLCMAC_Types.RlcmacUlBlock.");
}
set_selection(other_value);
}

RlcmacUlBlock_template::RlcmacUlBlock_template()
{
}

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

RlcmacUlBlock_template::RlcmacUlBlock_template(const RlcmacUlBlock& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

void RlcmacUlBlock_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case RlcmacUlBlock::ALT_data:
delete single_value.field_data;
break;
case RlcmacUlBlock::ALT_data__egprs:
delete single_value.field_data__egprs;
break;
case RlcmacUlBlock::ALT_ctrl:
delete single_value.field_ctrl;
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;
}

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

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

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

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

boolean RlcmacUlBlock_template::match(const RlcmacUlBlock& 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:
{
RlcmacUlBlock::union_selection_type value_selection = other_value.get_selection();
if (value_selection == RlcmacUlBlock::UNBOUND_VALUE) return FALSE;
if (value_selection != single_value.union_selection) return FALSE;
switch (value_selection) {
case RlcmacUlBlock::ALT_data:
return single_value.field_data->match(other_value.data(), legacy);
case RlcmacUlBlock::ALT_data__egprs:
return single_value.field_data__egprs->match(other_value.data__egprs(), legacy);
case RlcmacUlBlock::ALT_ctrl:
return single_value.field_ctrl->match(other_value.ctrl(), legacy);
default:
TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @RLCMAC_Types.RlcmacUlBlock.");
}
}
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 @RLCMAC_Types.RlcmacUlBlock.");
}
return FALSE;
}

boolean RlcmacUlBlock_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
switch (single_value.union_selection) {
case RlcmacUlBlock::ALT_data:
return single_value.field_data->is_value();
case RlcmacUlBlock::ALT_data__egprs:
return single_value.field_data__egprs->is_value();
case RlcmacUlBlock::ALT_ctrl:
return single_value.field_ctrl->is_value();
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @RLCMAC_Types.RlcmacUlBlock.");
}
}

RlcmacUlBlock RlcmacUlBlock_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 @RLCMAC_Types.RlcmacUlBlock.");
RlcmacUlBlock ret_val;
switch (single_value.union_selection) {
case RlcmacUlBlock::ALT_data:
ret_val.data() = single_value.field_data->valueof();
break;
case RlcmacUlBlock::ALT_data__egprs:
ret_val.data__egprs() = single_value.field_data__egprs->valueof();
break;
case RlcmacUlBlock::ALT_ctrl:
ret_val.ctrl() = single_value.field_ctrl->valueof();
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @RLCMAC_Types.RlcmacUlBlock.");
}
return ret_val;
}

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

RlcmacUlDataBlock_template& RlcmacUlBlock_template::data()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RlcmacUlBlock::ALT_data) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_data = new RlcmacUlDataBlock_template(ANY_VALUE);
else single_value.field_data = new RlcmacUlDataBlock_template;
single_value.union_selection = RlcmacUlBlock::ALT_data;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_data;
}

const RlcmacUlDataBlock_template& RlcmacUlBlock_template::data() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field data in a non-specific template of union type @RLCMAC_Types.RlcmacUlBlock.");
if (single_value.union_selection != RlcmacUlBlock::ALT_data) TTCN_error("Accessing non-selected field data in a template of union type @RLCMAC_Types.RlcmacUlBlock.");
return *single_value.field_data;
}

RlcmacUlEgprsDataBlock_template& RlcmacUlBlock_template::data__egprs()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RlcmacUlBlock::ALT_data__egprs) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_data__egprs = new RlcmacUlEgprsDataBlock_template(ANY_VALUE);
else single_value.field_data__egprs = new RlcmacUlEgprsDataBlock_template;
single_value.union_selection = RlcmacUlBlock::ALT_data__egprs;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_data__egprs;
}

const RlcmacUlEgprsDataBlock_template& RlcmacUlBlock_template::data__egprs() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field data_egprs in a non-specific template of union type @RLCMAC_Types.RlcmacUlBlock.");
if (single_value.union_selection != RlcmacUlBlock::ALT_data__egprs) TTCN_error("Accessing non-selected field data_egprs in a template of union type @RLCMAC_Types.RlcmacUlBlock.");
return *single_value.field_data__egprs;
}

RlcmacUlCtrlBlock_template& RlcmacUlBlock_template::ctrl()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RlcmacUlBlock::ALT_ctrl) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_ctrl = new RlcmacUlCtrlBlock_template(ANY_VALUE);
else single_value.field_ctrl = new RlcmacUlCtrlBlock_template;
single_value.union_selection = RlcmacUlBlock::ALT_ctrl;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_ctrl;
}

const RlcmacUlCtrlBlock_template& RlcmacUlBlock_template::ctrl() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ctrl in a non-specific template of union type @RLCMAC_Types.RlcmacUlBlock.");
if (single_value.union_selection != RlcmacUlBlock::ALT_ctrl) TTCN_error("Accessing non-selected field ctrl in a template of union type @RLCMAC_Types.RlcmacUlBlock.");
return *single_value.field_ctrl;
}

boolean RlcmacUlBlock_template::ischosen(RlcmacUlBlock::union_selection_type checked_selection) const
{
if (checked_selection == RlcmacUlBlock::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @RLCMAC_Types.RlcmacUlBlock.");
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.union_selection == RlcmacUlBlock::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @RLCMAC_Types.RlcmacUlBlock.");
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 @RLCMAC_Types.RlcmacUlBlock 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 RlcmacUlBlock_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case RlcmacUlBlock::ALT_data:
TTCN_Logger::log_event_str("{ data := ");
single_value.field_data->log();
TTCN_Logger::log_event_str(" }");
break;
case RlcmacUlBlock::ALT_data__egprs:
TTCN_Logger::log_event_str("{ data_egprs := ");
single_value.field_data__egprs->log();
TTCN_Logger::log_event_str(" }");
break;
case RlcmacUlBlock::ALT_ctrl:
TTCN_Logger::log_event_str("{ ctrl := ");
single_value.field_ctrl->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 RlcmacUlBlock_template::log_match(const RlcmacUlBlock& 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 RlcmacUlBlock::ALT_data:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
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::log_event_str("{ data := ");
single_value.field_data->log_match(match_value.data(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case RlcmacUlBlock::ALT_data__egprs:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".data_egprs");
single_value.field_data__egprs->log_match(match_value.data__egprs(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ data_egprs := ");
single_value.field_data__egprs->log_match(match_value.data__egprs(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case RlcmacUlBlock::ALT_ctrl:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".ctrl");
single_value.field_ctrl->log_match(match_value.ctrl(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ ctrl := ");
single_value.field_ctrl->log_match(match_value.ctrl(), 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 RlcmacUlBlock_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
switch (single_value.union_selection) {
case RlcmacUlBlock::ALT_data:
single_value.field_data->set_implicit_omit(); break;
case RlcmacUlBlock::ALT_data__egprs:
single_value.field_data__egprs->set_implicit_omit(); break;
case RlcmacUlBlock::ALT_ctrl:
single_value.field_ctrl->set_implicit_omit(); break;
default: break;
}
}

void RlcmacUlBlock_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 RlcmacUlBlock::ALT_data:
single_value.field_data->encode_text(text_buf);
break;
case RlcmacUlBlock::ALT_data__egprs:
single_value.field_data__egprs->encode_text(text_buf);
break;
case RlcmacUlBlock::ALT_ctrl:
single_value.field_ctrl->encode_text(text_buf);
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @RLCMAC_Types.RlcmacUlBlock.");
}
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 @RLCMAC_Types.RlcmacUlBlock.");
}
}

void RlcmacUlBlock_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
{
single_value.union_selection = RlcmacUlBlock::UNBOUND_VALUE;
RlcmacUlBlock::union_selection_type new_selection = (RlcmacUlBlock::union_selection_type)text_buf.pull_int().get_val();
switch (new_selection) {
case RlcmacUlBlock::ALT_data:
single_value.field_data = new RlcmacUlDataBlock_template;
single_value.field_data->decode_text(text_buf);
break;
case RlcmacUlBlock::ALT_data__egprs:
single_value.field_data__egprs = new RlcmacUlEgprsDataBlock_template;
single_value.field_data__egprs->decode_text(text_buf);
break;
case RlcmacUlBlock::ALT_ctrl:
single_value.field_ctrl = new RlcmacUlCtrlBlock_template;
single_value.field_ctrl->decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @RLCMAC_Types.RlcmacUlBlock.");
}
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 RlcmacUlBlock_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 @RLCMAC_Types.RlcmacUlBlock.");
}
}

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

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

void RlcmacUlBlock_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 RlcmacUlBlock::ALT_data:
single_value.field_data->check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacUlBlock");
return;
case RlcmacUlBlock::ALT_data__egprs:
single_value.field_data__egprs->check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacUlBlock");
return;
case RlcmacUlBlock::ALT_ctrl:
single_value.field_ctrl->check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacUlBlock");
return;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @RLCMAC_Types.RlcmacUlBlock.");
}
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 : "@RLCMAC_Types.RlcmacUlBlock");
}

void RlcmacDlBlock::copy_value(const RlcmacDlBlock& other_value)
{
switch (other_value.union_selection) {
case ALT_data:
field_data = new RlcmacDlDataBlock(*other_value.field_data);
break;
case ALT_data__egprs:
field_data__egprs = new RlcmacDlEgprsDataBlock(*other_value.field_data__egprs);
break;
case ALT_ctrl:
field_ctrl = new RlcmacDlCtrlBlock(*other_value.field_ctrl);
break;
default:
TTCN_error("Assignment of an unbound union value of type @RLCMAC_Types.RlcmacDlBlock.");
}
union_selection = other_value.union_selection;
}

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

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

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

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

boolean RlcmacDlBlock::operator==(const RlcmacDlBlock& other_value) const
{
if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @RLCMAC_Types.RlcmacDlBlock.");
if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @RLCMAC_Types.RlcmacDlBlock.");
if (union_selection != other_value.union_selection) return FALSE;
switch (union_selection) {
case ALT_data:
return *field_data == *other_value.field_data;
case ALT_data__egprs:
return *field_data__egprs == *other_value.field_data__egprs;
case ALT_ctrl:
return *field_ctrl == *other_value.field_ctrl;
default:
return FALSE;
}
}

RlcmacDlDataBlock& RlcmacDlBlock::data()
{
if (union_selection != ALT_data) {
clean_up();
field_data = new RlcmacDlDataBlock;
union_selection = ALT_data;
}
return *field_data;
}

const RlcmacDlDataBlock& RlcmacDlBlock::data() const
{
if (union_selection != ALT_data) TTCN_error("Using non-selected field data in a value of union type @RLCMAC_Types.RlcmacDlBlock.");
return *field_data;
}

RlcmacDlEgprsDataBlock& RlcmacDlBlock::data__egprs()
{
if (union_selection != ALT_data__egprs) {
clean_up();
field_data__egprs = new RlcmacDlEgprsDataBlock;
union_selection = ALT_data__egprs;
}
return *field_data__egprs;
}

const RlcmacDlEgprsDataBlock& RlcmacDlBlock::data__egprs() const
{
if (union_selection != ALT_data__egprs) TTCN_error("Using non-selected field data_egprs in a value of union type @RLCMAC_Types.RlcmacDlBlock.");
return *field_data__egprs;
}

RlcmacDlCtrlBlock& RlcmacDlBlock::ctrl()
{
if (union_selection != ALT_ctrl) {
clean_up();
field_ctrl = new RlcmacDlCtrlBlock;
union_selection = ALT_ctrl;
}
return *field_ctrl;
}

const RlcmacDlCtrlBlock& RlcmacDlBlock::ctrl() const
{
if (union_selection != ALT_ctrl) TTCN_error("Using non-selected field ctrl in a value of union type @RLCMAC_Types.RlcmacDlBlock.");
return *field_ctrl;
}

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

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

boolean RlcmacDlBlock::is_value() const
{
switch (union_selection) {
case UNBOUND_VALUE: return FALSE;
case ALT_data: return field_data->is_value();
case ALT_data__egprs: return field_data__egprs->is_value();
case ALT_ctrl: return field_ctrl->is_value();
default: TTCN_error("Invalid selection in union is_bound");}
}

void RlcmacDlBlock::clean_up()
{
switch (union_selection) {
case ALT_data:
  delete field_data;
  break;
case ALT_data__egprs:
  delete field_data__egprs;
  break;
case ALT_ctrl:
  delete field_ctrl;
  break;
default:
  break;
}
union_selection = UNBOUND_VALUE;
}

void RlcmacDlBlock::log() const
{
switch (union_selection) {
case ALT_data:
TTCN_Logger::log_event_str("{ data := ");
field_data->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_data__egprs:
TTCN_Logger::log_event_str("{ data_egprs := ");
field_data__egprs->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_ctrl:
TTCN_Logger::log_event_str("{ ctrl := ");
field_ctrl->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_unbound();
}
}

void RlcmacDlBlock::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, "data")) {
    data().set_param(*mp_last);
    if (!data().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "data_egprs")) {
    data__egprs().set_param(*mp_last);
    if (!data__egprs().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "ctrl")) {
    ctrl().set_param(*mp_last);
    if (!ctrl().is_bound()) clean_up();
    return;
  }
  mp_last->error("Field %s does not exist in type @RLCMAC_Types.RlcmacDlBlock.", last_name);
}

void RlcmacDlBlock::set_implicit_omit()
{
switch (union_selection) {
case ALT_data:
field_data->set_implicit_omit(); break;
case ALT_data__egprs:
field_data__egprs->set_implicit_omit(); break;
case ALT_ctrl:
field_ctrl->set_implicit_omit(); break;
default: break;
}
}

void RlcmacDlBlock::encode_text(Text_Buf& text_buf) const
{
text_buf.push_int(union_selection);
switch (union_selection) {
case ALT_data:
field_data->encode_text(text_buf);
break;
case ALT_data__egprs:
field_data__egprs->encode_text(text_buf);
break;
case ALT_ctrl:
field_ctrl->encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an unbound value of union type @RLCMAC_Types.RlcmacDlBlock.");
}
}

void RlcmacDlBlock::decode_text(Text_Buf& text_buf)
{
switch ((union_selection_type)text_buf.pull_int().get_val()) {
case ALT_data:
data().decode_text(text_buf);
break;
case ALT_data__egprs:
data__egprs().decode_text(text_buf);
break;
case ALT_ctrl:
ctrl().decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for type @RLCMAC_Types.RlcmacDlBlock.");
}
}

void RlcmacDlBlock::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 RlcmacDlBlock::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 RlcmacDlBlock::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, RlcmacDlBlock_data_descr_.raw->forceomit);
      decoded_length = data().RAW_decode(RlcmacDlBlock_data_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, RlcmacDlBlock_data__egprs_descr_.raw->forceomit);
      decoded_length = data__egprs().RAW_decode(RlcmacDlBlock_data__egprs_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 2: {
      RAW_Force_Omit field_force_omit(2, force_omit, RlcmacDlBlock_ctrl_descr_.raw->forceomit);
      decoded_length = ctrl().RAW_decode(RlcmacDlBlock_ctrl_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;
    EgprsHeaderType temporal_1;
    int decoded_1_length;
    MacPayloadType temporal_2;
    int decoded_2_length;
    already_failed = FALSE;
    if (!already_failed) {
      MacPayloadType temporal_0;
      int decoded_0_length;
      p_buf.set_pos_bit(starting_pos + 4);
      decoded_0_length = temporal_0.RAW_decode(DlMacHeader_payload__type_descr_, p_buf, limit, top_bit_ord, TRUE);
      if (decoded_0_length > 0) {
        if (temporal_0 == MacPayloadType::MAC__PT__RLC__DATA) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(0, force_omit, RlcmacDlBlock_data_descr_.raw->forceomit);
          decoded_length = data().RAW_decode(RlcmacDlBlock_data_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_data).mac__hdr().mac__hdr().payload__type() == MacPayloadType::MAC__PT__RLC__DATA) {
               return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
             }else already_failed = TRUE;
          }
        }
      }
    }
    already_failed = FALSE;
    if (!already_failed) {
      p_buf.set_pos_bit(starting_pos + 4);
      decoded_1_length = temporal_1.RAW_decode(EgprsDlMacDataHeader_header__type_descr_, p_buf, limit, top_bit_ord, TRUE);
      if (decoded_1_length > 0) {
        if (temporal_1 == EgprsHeaderType::RLCMAC__HDR__TYPE__1 || temporal_1 == EgprsHeaderType::RLCMAC__HDR__TYPE__2 || temporal_1 == EgprsHeaderType::RLCMAC__HDR__TYPE__3) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(1, force_omit, RlcmacDlBlock_data__egprs_descr_.raw->forceomit);
          decoded_length = data__egprs().RAW_decode(RlcmacDlBlock_data__egprs_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_data__egprs).mac__hdr().header__type() == EgprsHeaderType::RLCMAC__HDR__TYPE__1 || (*field_data__egprs).mac__hdr().header__type() == EgprsHeaderType::RLCMAC__HDR__TYPE__2 || (*field_data__egprs).mac__hdr().header__type() == EgprsHeaderType::RLCMAC__HDR__TYPE__3) {
               return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
             }else already_failed = TRUE;
          }
        }
      }
    }
    already_failed = FALSE;
    if (!already_failed) {
      p_buf.set_pos_bit(starting_pos + 0);
      decoded_2_length = temporal_2.RAW_decode(DlMacHeader_payload__type_descr_, p_buf, limit, top_bit_ord, TRUE);
      if (decoded_2_length > 0) {
        if (temporal_2 == MacPayloadType::MAC__PT__RLCMAC__NO__OPT || temporal_2 == MacPayloadType::MAC__PT__RLCMAC__OPT) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(2, force_omit, RlcmacDlBlock_ctrl_descr_.raw->forceomit);
          decoded_length = ctrl().RAW_decode(RlcmacDlBlock_ctrl_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_ctrl).mac__hdr().payload__type() == MacPayloadType::MAC__PT__RLCMAC__NO__OPT || (*field_ctrl).mac__hdr().payload__type() == MacPayloadType::MAC__PT__RLCMAC__OPT) {
               return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
             }else already_failed = TRUE;
          }
        }
      }
    }
 }
 clean_up();
 return -1;
}

int RlcmacDlBlock::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const
{
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 3;  myleaf.body.node.nodes = init_nodes_of_enc_tree(3);
  memset(myleaf.body.node.nodes, 0, 3 * sizeof(RAW_enc_tree *));
  switch (union_selection) {
  case ALT_data:
    myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, RlcmacDlBlock_data_descr_.raw);
    encoded_length = field_data->RAW_encode(RlcmacDlBlock_data_descr_, *myleaf.body.node.nodes[0]);
    myleaf.body.node.nodes[0]->coding_descr = &RlcmacDlBlock_data_descr_;
    if ((*field_data).mac__hdr().mac__hdr().payload__type() != MacPayloadType::MAC__PT__RLC__DATA) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+4;
  int new_pos0[]={0,1,0,0};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,4,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
  MacPayloadType new_val = MacPayloadType::MAC__PT__RLC__DATA;
  new_val.RAW_encode(DlMacHeader_payload__type_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_data__egprs:
    myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, RlcmacDlBlock_data__egprs_descr_.raw);
    encoded_length = field_data__egprs->RAW_encode(RlcmacDlBlock_data__egprs_descr_, *myleaf.body.node.nodes[1]);
    myleaf.body.node.nodes[1]->coding_descr = &RlcmacDlBlock_data__egprs_descr_;
    if ((*field_data__egprs).mac__hdr().header__type() != EgprsHeaderType::RLCMAC__HDR__TYPE__1 && (*field_data__egprs).mac__hdr().header__type() != EgprsHeaderType::RLCMAC__HDR__TYPE__2 && (*field_data__egprs).mac__hdr().header__type() != EgprsHeaderType::RLCMAC__HDR__TYPE__3) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+3;
  int new_pos0[]={1,1,0};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,3,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
  EgprsHeaderType new_val = EgprsHeaderType::RLCMAC__HDR__TYPE__1;
  new_val.RAW_encode(EgprsDlMacDataHeader_header__type_descr_,*temp_leaf);
  } else  {
  RAW_enc_tr_pos pr_pos1;
  pr_pos1.level=myleaf.curr_pos.level+3;
  int new_pos1[]={1,1,0};
  pr_pos1.pos=init_new_tree_pos(myleaf.curr_pos,3,new_pos1);
  temp_leaf = myleaf.get_node(pr_pos1);
  if(temp_leaf != NULL){
  EgprsHeaderType new_val = EgprsHeaderType::RLCMAC__HDR__TYPE__2;
  new_val.RAW_encode(EgprsDlMacDataHeader_header__type_descr_,*temp_leaf);
  } else  {
  RAW_enc_tr_pos pr_pos2;
  pr_pos2.level=myleaf.curr_pos.level+3;
  int new_pos2[]={1,1,0};
  pr_pos2.pos=init_new_tree_pos(myleaf.curr_pos,3,new_pos2);
  temp_leaf = myleaf.get_node(pr_pos2);
  if(temp_leaf != NULL){
  EgprsHeaderType new_val = EgprsHeaderType::RLCMAC__HDR__TYPE__3;
  new_val.RAW_encode(EgprsDlMacDataHeader_header__type_descr_,*temp_leaf);
  } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  }
  free_tree_pos(pr_pos2.pos);
  }
  free_tree_pos(pr_pos1.pos);
  }
  free_tree_pos(pr_pos0.pos);
  }
    }
    break;
  case ALT_ctrl:
    myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 2, RlcmacDlBlock_ctrl_descr_.raw);
    encoded_length = field_ctrl->RAW_encode(RlcmacDlBlock_ctrl_descr_, *myleaf.body.node.nodes[2]);
    myleaf.body.node.nodes[2]->coding_descr = &RlcmacDlBlock_ctrl_descr_;
    if ((*field_ctrl).mac__hdr().payload__type() != MacPayloadType::MAC__PT__RLCMAC__NO__OPT && (*field_ctrl).mac__hdr().payload__type() != MacPayloadType::MAC__PT__RLCMAC__OPT) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+3;
  int new_pos0[]={2,0,0};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,3,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
  MacPayloadType new_val = MacPayloadType::MAC__PT__RLCMAC__NO__OPT;
  new_val.RAW_encode(DlMacHeader_payload__type_descr_,*temp_leaf);
  } else  {
  RAW_enc_tr_pos pr_pos1;
  pr_pos1.level=myleaf.curr_pos.level+3;
  int new_pos1[]={2,0,0};
  pr_pos1.pos=init_new_tree_pos(myleaf.curr_pos,3,new_pos1);
  temp_leaf = myleaf.get_node(pr_pos1);
  if(temp_leaf != NULL){
  MacPayloadType new_val = MacPayloadType::MAC__PT__RLCMAC__OPT;
  new_val.RAW_encode(DlMacHeader_payload__type_descr_,*temp_leaf);
  } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  }
  free_tree_pos(pr_pos1.pos);
  }
  free_tree_pos(pr_pos0.pos);
  }
    }
    break;
  default:
    TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  }
  return encoded_length;
}

void RlcmacDlBlock_template::copy_value(const RlcmacDlBlock& other_value)
{
single_value.union_selection = other_value.get_selection();
switch (single_value.union_selection) {
case RlcmacDlBlock::ALT_data:
single_value.field_data = new RlcmacDlDataBlock_template(other_value.data());
break;
case RlcmacDlBlock::ALT_data__egprs:
single_value.field_data__egprs = new RlcmacDlEgprsDataBlock_template(other_value.data__egprs());
break;
case RlcmacDlBlock::ALT_ctrl:
single_value.field_ctrl = new RlcmacDlCtrlBlock_template(other_value.ctrl());
break;
default:
TTCN_error("Initializing a template with an unbound value of type @RLCMAC_Types.RlcmacDlBlock.");
}
set_selection(SPECIFIC_VALUE);
}

void RlcmacDlBlock_template::copy_template(const RlcmacDlBlock_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 RlcmacDlBlock::ALT_data:
single_value.field_data = new RlcmacDlDataBlock_template(*other_value.single_value.field_data);
break;
case RlcmacDlBlock::ALT_data__egprs:
single_value.field_data__egprs = new RlcmacDlEgprsDataBlock_template(*other_value.single_value.field_data__egprs);
break;
case RlcmacDlBlock::ALT_ctrl:
single_value.field_ctrl = new RlcmacDlCtrlBlock_template(*other_value.single_value.field_ctrl);
break;
default:
TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @RLCMAC_Types.RlcmacDlBlock.");
}
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 RlcmacDlBlock_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 RlcmacDlBlock_template(*other_value.implication_.precondition);
implication_.implied_template = new RlcmacDlBlock_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 @RLCMAC_Types.RlcmacDlBlock.");
}
set_selection(other_value);
}

RlcmacDlBlock_template::RlcmacDlBlock_template()
{
}

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

RlcmacDlBlock_template::RlcmacDlBlock_template(const RlcmacDlBlock& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

void RlcmacDlBlock_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case RlcmacDlBlock::ALT_data:
delete single_value.field_data;
break;
case RlcmacDlBlock::ALT_data__egprs:
delete single_value.field_data__egprs;
break;
case RlcmacDlBlock::ALT_ctrl:
delete single_value.field_ctrl;
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;
}

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

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

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

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

boolean RlcmacDlBlock_template::match(const RlcmacDlBlock& 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:
{
RlcmacDlBlock::union_selection_type value_selection = other_value.get_selection();
if (value_selection == RlcmacDlBlock::UNBOUND_VALUE) return FALSE;
if (value_selection != single_value.union_selection) return FALSE;
switch (value_selection) {
case RlcmacDlBlock::ALT_data:
return single_value.field_data->match(other_value.data(), legacy);
case RlcmacDlBlock::ALT_data__egprs:
return single_value.field_data__egprs->match(other_value.data__egprs(), legacy);
case RlcmacDlBlock::ALT_ctrl:
return single_value.field_ctrl->match(other_value.ctrl(), legacy);
default:
TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @RLCMAC_Types.RlcmacDlBlock.");
}
}
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 @RLCMAC_Types.RlcmacDlBlock.");
}
return FALSE;
}

boolean RlcmacDlBlock_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
switch (single_value.union_selection) {
case RlcmacDlBlock::ALT_data:
return single_value.field_data->is_value();
case RlcmacDlBlock::ALT_data__egprs:
return single_value.field_data__egprs->is_value();
case RlcmacDlBlock::ALT_ctrl:
return single_value.field_ctrl->is_value();
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @RLCMAC_Types.RlcmacDlBlock.");
}
}

RlcmacDlBlock RlcmacDlBlock_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 @RLCMAC_Types.RlcmacDlBlock.");
RlcmacDlBlock ret_val;
switch (single_value.union_selection) {
case RlcmacDlBlock::ALT_data:
ret_val.data() = single_value.field_data->valueof();
break;
case RlcmacDlBlock::ALT_data__egprs:
ret_val.data__egprs() = single_value.field_data__egprs->valueof();
break;
case RlcmacDlBlock::ALT_ctrl:
ret_val.ctrl() = single_value.field_ctrl->valueof();
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @RLCMAC_Types.RlcmacDlBlock.");
}
return ret_val;
}

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

RlcmacDlDataBlock_template& RlcmacDlBlock_template::data()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RlcmacDlBlock::ALT_data) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_data = new RlcmacDlDataBlock_template(ANY_VALUE);
else single_value.field_data = new RlcmacDlDataBlock_template;
single_value.union_selection = RlcmacDlBlock::ALT_data;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_data;
}

const RlcmacDlDataBlock_template& RlcmacDlBlock_template::data() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field data in a non-specific template of union type @RLCMAC_Types.RlcmacDlBlock.");
if (single_value.union_selection != RlcmacDlBlock::ALT_data) TTCN_error("Accessing non-selected field data in a template of union type @RLCMAC_Types.RlcmacDlBlock.");
return *single_value.field_data;
}

RlcmacDlEgprsDataBlock_template& RlcmacDlBlock_template::data__egprs()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RlcmacDlBlock::ALT_data__egprs) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_data__egprs = new RlcmacDlEgprsDataBlock_template(ANY_VALUE);
else single_value.field_data__egprs = new RlcmacDlEgprsDataBlock_template;
single_value.union_selection = RlcmacDlBlock::ALT_data__egprs;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_data__egprs;
}

const RlcmacDlEgprsDataBlock_template& RlcmacDlBlock_template::data__egprs() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field data_egprs in a non-specific template of union type @RLCMAC_Types.RlcmacDlBlock.");
if (single_value.union_selection != RlcmacDlBlock::ALT_data__egprs) TTCN_error("Accessing non-selected field data_egprs in a template of union type @RLCMAC_Types.RlcmacDlBlock.");
return *single_value.field_data__egprs;
}

RlcmacDlCtrlBlock_template& RlcmacDlBlock_template::ctrl()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RlcmacDlBlock::ALT_ctrl) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_ctrl = new RlcmacDlCtrlBlock_template(ANY_VALUE);
else single_value.field_ctrl = new RlcmacDlCtrlBlock_template;
single_value.union_selection = RlcmacDlBlock::ALT_ctrl;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_ctrl;
}

const RlcmacDlCtrlBlock_template& RlcmacDlBlock_template::ctrl() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ctrl in a non-specific template of union type @RLCMAC_Types.RlcmacDlBlock.");
if (single_value.union_selection != RlcmacDlBlock::ALT_ctrl) TTCN_error("Accessing non-selected field ctrl in a template of union type @RLCMAC_Types.RlcmacDlBlock.");
return *single_value.field_ctrl;
}

boolean RlcmacDlBlock_template::ischosen(RlcmacDlBlock::union_selection_type checked_selection) const
{
if (checked_selection == RlcmacDlBlock::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @RLCMAC_Types.RlcmacDlBlock.");
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.union_selection == RlcmacDlBlock::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @RLCMAC_Types.RlcmacDlBlock.");
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 @RLCMAC_Types.RlcmacDlBlock 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 RlcmacDlBlock_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case RlcmacDlBlock::ALT_data:
TTCN_Logger::log_event_str("{ data := ");
single_value.field_data->log();
TTCN_Logger::log_event_str(" }");
break;
case RlcmacDlBlock::ALT_data__egprs:
TTCN_Logger::log_event_str("{ data_egprs := ");
single_value.field_data__egprs->log();
TTCN_Logger::log_event_str(" }");
break;
case RlcmacDlBlock::ALT_ctrl:
TTCN_Logger::log_event_str("{ ctrl := ");
single_value.field_ctrl->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 RlcmacDlBlock_template::log_match(const RlcmacDlBlock& 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 RlcmacDlBlock::ALT_data:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
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::log_event_str("{ data := ");
single_value.field_data->log_match(match_value.data(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case RlcmacDlBlock::ALT_data__egprs:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".data_egprs");
single_value.field_data__egprs->log_match(match_value.data__egprs(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ data_egprs := ");
single_value.field_data__egprs->log_match(match_value.data__egprs(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case RlcmacDlBlock::ALT_ctrl:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".ctrl");
single_value.field_ctrl->log_match(match_value.ctrl(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ ctrl := ");
single_value.field_ctrl->log_match(match_value.ctrl(), 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 RlcmacDlBlock_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
switch (single_value.union_selection) {
case RlcmacDlBlock::ALT_data:
single_value.field_data->set_implicit_omit(); break;
case RlcmacDlBlock::ALT_data__egprs:
single_value.field_data__egprs->set_implicit_omit(); break;
case RlcmacDlBlock::ALT_ctrl:
single_value.field_ctrl->set_implicit_omit(); break;
default: break;
}
}

void RlcmacDlBlock_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 RlcmacDlBlock::ALT_data:
single_value.field_data->encode_text(text_buf);
break;
case RlcmacDlBlock::ALT_data__egprs:
single_value.field_data__egprs->encode_text(text_buf);
break;
case RlcmacDlBlock::ALT_ctrl:
single_value.field_ctrl->encode_text(text_buf);
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @RLCMAC_Types.RlcmacDlBlock.");
}
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 @RLCMAC_Types.RlcmacDlBlock.");
}
}

void RlcmacDlBlock_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
{
single_value.union_selection = RlcmacDlBlock::UNBOUND_VALUE;
RlcmacDlBlock::union_selection_type new_selection = (RlcmacDlBlock::union_selection_type)text_buf.pull_int().get_val();
switch (new_selection) {
case RlcmacDlBlock::ALT_data:
single_value.field_data = new RlcmacDlDataBlock_template;
single_value.field_data->decode_text(text_buf);
break;
case RlcmacDlBlock::ALT_data__egprs:
single_value.field_data__egprs = new RlcmacDlEgprsDataBlock_template;
single_value.field_data__egprs->decode_text(text_buf);
break;
case RlcmacDlBlock::ALT_ctrl:
single_value.field_ctrl = new RlcmacDlCtrlBlock_template;
single_value.field_ctrl->decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @RLCMAC_Types.RlcmacDlBlock.");
}
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 RlcmacDlBlock_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 @RLCMAC_Types.RlcmacDlBlock.");
}
}

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

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

void RlcmacDlBlock_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 RlcmacDlBlock::ALT_data:
single_value.field_data->check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacDlBlock");
return;
case RlcmacDlBlock::ALT_data__egprs:
single_value.field_data__egprs->check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacDlBlock");
return;
case RlcmacDlBlock::ALT_ctrl:
single_value.field_ctrl->check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.RlcmacDlBlock");
return;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @RLCMAC_Types.RlcmacDlBlock.");
}
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 : "@RLCMAC_Types.RlcmacDlBlock");
}

PTCCHTimingAdvanceIE::PTCCHTimingAdvanceIE()
{
}

PTCCHTimingAdvanceIE::PTCCHTimingAdvanceIE(const BITSTRING& par_spare,
    const INTEGER& par_ta__val)
  :   field_spare(par_spare),
  field_ta__val(par_ta__val)
{
}

PTCCHTimingAdvanceIE::PTCCHTimingAdvanceIE(const PTCCHTimingAdvanceIE& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.PTCCHTimingAdvanceIE.");
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.ta__val().is_bound()) field_ta__val = other_value.ta__val();
else field_ta__val.clean_up();
}

void PTCCHTimingAdvanceIE::clean_up()
{
field_spare.clean_up();
field_ta__val.clean_up();
}

const TTCN_Typedescriptor_t* PTCCHTimingAdvanceIE::get_descriptor() const { return &PTCCHTimingAdvanceIE_descr_; }
PTCCHTimingAdvanceIE& PTCCHTimingAdvanceIE::operator=(const PTCCHTimingAdvanceIE& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.PTCCHTimingAdvanceIE.");
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.ta__val().is_bound()) field_ta__val = other_value.ta__val();
  else field_ta__val.clean_up();
}
return *this;
}

boolean PTCCHTimingAdvanceIE::operator==(const PTCCHTimingAdvanceIE& other_value) const
{
return field_spare==other_value.field_spare
  && field_ta__val==other_value.field_ta__val;
}

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

void PTCCHTimingAdvanceIE::set_implicit_omit()
{
if (spare().is_bound()) spare().set_implicit_omit();
if (ta__val().is_bound()) ta__val().set_implicit_omit();
}

void PTCCHTimingAdvanceIE::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 @RLCMAC_Types.PTCCHTimingAdvanceIE has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ta__val().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ta_val")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ta__val().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 @RLCMAC_Types.PTCCHTimingAdvanceIE: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.PTCCHTimingAdvanceIE");
  }
}

void PTCCHTimingAdvanceIE::encode_text(Text_Buf& text_buf) const
{
field_spare.encode_text(text_buf);
field_ta__val.encode_text(text_buf);
}

void PTCCHTimingAdvanceIE::decode_text(Text_Buf& text_buf)
{
field_spare.decode_text(text_buf);
field_ta__val.decode_text(text_buf);
}

void PTCCHTimingAdvanceIE::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 PTCCHTimingAdvanceIE::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 PTCCHTimingAdvanceIE::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, PTCCHTimingAdvanceIE_spare_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(PTCCHTimingAdvanceIE_spare_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, PTCCHTimingAdvanceIE_ta__val_descr_.raw->forceomit);
  decoded_field_length = field_ta__val.RAW_decode(PTCCHTimingAdvanceIE_ta__val_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 PTCCHTimingAdvanceIE::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, PTCCHTimingAdvanceIE_spare_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PTCCHTimingAdvanceIE_ta__val_descr_.raw);
  encoded_length += field_spare.RAW_encode(PTCCHTimingAdvanceIE_spare_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ta__val.RAW_encode(PTCCHTimingAdvanceIE_ta__val_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct PTCCHTimingAdvanceIE_template::single_value_struct {
BITSTRING_template field_spare;
INTEGER_template field_ta__val;
};

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

void PTCCHTimingAdvanceIE_template::copy_value(const PTCCHTimingAdvanceIE& other_value)
{
single_value = new single_value_struct;
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
if (other_value.ta__val().is_bound()) {
  single_value->field_ta__val = other_value.ta__val();
} else {
  single_value->field_ta__val.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PTCCHTimingAdvanceIE_template::copy_template(const PTCCHTimingAdvanceIE_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ta__val().get_selection()) {
single_value->field_ta__val = other_value.ta__val();
} else {
single_value->field_ta__val.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 PTCCHTimingAdvanceIE_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 PTCCHTimingAdvanceIE_template(*other_value.implication_.precondition);
implication_.implied_template = new PTCCHTimingAdvanceIE_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 @RLCMAC_Types.PTCCHTimingAdvanceIE.");
break;
}
set_selection(other_value);
}

PTCCHTimingAdvanceIE_template::PTCCHTimingAdvanceIE_template()
{
}

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

PTCCHTimingAdvanceIE_template::PTCCHTimingAdvanceIE_template(const PTCCHTimingAdvanceIE& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PTCCHTimingAdvanceIE_template::match(const PTCCHTimingAdvanceIE& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
if(!other_value.ta__val().is_bound()) return FALSE;
if(!single_value->field_ta__val.match(other_value.ta__val(), 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 @RLCMAC_Types.PTCCHTimingAdvanceIE.");
}
return FALSE;
}

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

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

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

PTCCHTimingAdvanceIE PTCCHTimingAdvanceIE_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 @RLCMAC_Types.PTCCHTimingAdvanceIE.");
PTCCHTimingAdvanceIE ret_val;
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_ta__val.is_bound()) {
ret_val.ta__val() = single_value->field_ta__val.valueof();
}
return ret_val;
}

void PTCCHTimingAdvanceIE_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 @RLCMAC_Types.PTCCHTimingAdvanceIE.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PTCCHTimingAdvanceIE_template[list_length];
}

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

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

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

INTEGER_template& PTCCHTimingAdvanceIE_template::ta__val()
{
set_specific();
return single_value->field_ta__val;
}

const INTEGER_template& PTCCHTimingAdvanceIE_template::ta__val() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ta_val of a non-specific template of type @RLCMAC_Types.PTCCHTimingAdvanceIE.");
return single_value->field_ta__val;
}

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

void PTCCHTimingAdvanceIE_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(", ta_val := ");
single_value->field_ta__val.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 PTCCHTimingAdvanceIE_template::log_match(const PTCCHTimingAdvanceIE& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ta__val.match(match_value.ta__val(), legacy)){
TTCN_Logger::log_logmatch_info(".ta_val");
single_value->field_ta__val.log_match(match_value.ta__val(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(", ta_val := ");
single_value->field_ta__val.log_match(match_value.ta__val(), 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 PTCCHTimingAdvanceIE_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (spare().is_bound()) spare().set_implicit_omit();
if (ta__val().is_bound()) ta__val().set_implicit_omit();
}

void PTCCHTimingAdvanceIE_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_spare.encode_text(text_buf);
single_value->field_ta__val.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 @RLCMAC_Types.PTCCHTimingAdvanceIE.");
}
}

void PTCCHTimingAdvanceIE_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_spare.decode_text(text_buf);
single_value->field_ta__val.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 PTCCHTimingAdvanceIE_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 @RLCMAC_Types.PTCCHTimingAdvanceIE.");
}
}

void PTCCHTimingAdvanceIE_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: {
    PTCCHTimingAdvanceIE_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 @RLCMAC_Types.PTCCHTimingAdvanceIE has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ta__val().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ta_val")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ta__val().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 @RLCMAC_Types.PTCCHTimingAdvanceIE: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PTCCHTimingAdvanceIE_template* precondition = new PTCCHTimingAdvanceIE_template;
    precondition->set_param(*param.get_elem(0));
    PTCCHTimingAdvanceIE_template* implied_template = new PTCCHTimingAdvanceIE_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PTCCHTimingAdvanceIE_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.PTCCHTimingAdvanceIE");
  }
  is_ifpresent = param.get_ifpresent();
}

void PTCCHTimingAdvanceIE_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.PTCCHTimingAdvanceIE");
single_value->field_ta__val.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.PTCCHTimingAdvanceIE");
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 : "@RLCMAC_Types.PTCCHTimingAdvanceIE");
}

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

boolean PTCCHTimingAdvanceIE_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 PTCCHTimingAdvanceIE PTCCHTimingAdvanceIEs::UNBOUND_ELEM;
PTCCHTimingAdvanceIEs::PTCCHTimingAdvanceIEs()
{
val_ptr = NULL;
}

PTCCHTimingAdvanceIEs::PTCCHTimingAdvanceIEs(null_type)
{
val_ptr = new recordof_setof_struct;
val_ptr->ref_count = 1;
val_ptr->n_elements = 0;
val_ptr->value_elements = NULL;
}

PTCCHTimingAdvanceIEs::PTCCHTimingAdvanceIEs(const PTCCHTimingAdvanceIEs& other_value)
{
if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}

PTCCHTimingAdvanceIEs::~PTCCHTimingAdvanceIEs()
{
clean_up();
if (val_ptr != NULL) val_ptr = NULL;
}

void PTCCHTimingAdvanceIEs::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.");
}
}

PTCCHTimingAdvanceIEs& PTCCHTimingAdvanceIEs::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;
}

PTCCHTimingAdvanceIEs& PTCCHTimingAdvanceIEs::operator=(const PTCCHTimingAdvanceIEs& other_value)
{
if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
if (this != &other_value) {
clean_up();
val_ptr = other_value.val_ptr;
val_ptr->ref_count++;
}
return *this;
}

boolean PTCCHTimingAdvanceIEs::operator==(null_type) const
{
if (val_ptr == NULL)
TTCN_error("The left operand of comparison is an unbound value of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
return val_ptr->n_elements == 0 ;
}

boolean PTCCHTimingAdvanceIEs::operator==(const PTCCHTimingAdvanceIEs& other_value) const
{
if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
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;
}

PTCCHTimingAdvanceIE& PTCCHTimingAdvanceIEs::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of type @RLCMAC_Types.PTCCHTimingAdvanceIEs 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 = (PTCCHTimingAdvanceIE**)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 PTCCHTimingAdvanceIE(*(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 PTCCHTimingAdvanceIE;
}
return *val_ptr->value_elements[index_value];
}

PTCCHTimingAdvanceIE& PTCCHTimingAdvanceIEs::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
return (*this)[(int)index_value];
}

const PTCCHTimingAdvanceIE& PTCCHTimingAdvanceIEs::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
if (index_value < 0) TTCN_error("Accessing an element of type @RLCMAC_Types.PTCCHTimingAdvanceIEs using a negative index: %d.", index_value);
if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @RLCMAC_Types.PTCCHTimingAdvanceIEs: 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 PTCCHTimingAdvanceIE& PTCCHTimingAdvanceIEs::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
return (*this)[(int)index_value];
}

PTCCHTimingAdvanceIEs PTCCHTimingAdvanceIEs::operator<<=(int rotate_count) const
{
return *this >>= (-rotate_count);
}

PTCCHTimingAdvanceIEs PTCCHTimingAdvanceIEs::operator<<=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate left operator.");
return *this >>= (int)(-rotate_count);
}

PTCCHTimingAdvanceIEs PTCCHTimingAdvanceIEs::operator>>=(const INTEGER& rotate_count) const
{
rotate_count.must_bound("Unbound integer operand of rotate right operator.");
return *this >>= (int)rotate_count;
}

PTCCHTimingAdvanceIEs PTCCHTimingAdvanceIEs::operator>>=(int rotate_count) const
{
if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
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;
PTCCHTimingAdvanceIEs 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 PTCCHTimingAdvanceIE(*val_ptr->value_elements[i]);
}
}
return ret_val;
}

PTCCHTimingAdvanceIEs PTCCHTimingAdvanceIEs::operator+(const PTCCHTimingAdvanceIEs& other_value) const
{
if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @RLCMAC_Types.PTCCHTimingAdvanceIEs concatenation.");
if (val_ptr->n_elements == 0) return other_value;
if (other_value.val_ptr->n_elements == 0) return *this;
PTCCHTimingAdvanceIEs 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 PTCCHTimingAdvanceIE(*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 PTCCHTimingAdvanceIE(*other_value.val_ptr->value_elements[i]);
}
}
return ret_val;
}

PTCCHTimingAdvanceIEs PTCCHTimingAdvanceIEs::substr(int index, int returncount) const
{
if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
check_substr_arguments(val_ptr->n_elements, index, returncount, "@RLCMAC_Types.PTCCHTimingAdvanceIEs","element");
PTCCHTimingAdvanceIEs 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 PTCCHTimingAdvanceIE(*val_ptr->value_elements[i+index]);
}
}
return ret_val;
}

PTCCHTimingAdvanceIEs PTCCHTimingAdvanceIEs::replace(int index, int len, const PTCCHTimingAdvanceIEs& repl) const
{
if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
check_replace_arguments(val_ptr->n_elements, index, len, "@RLCMAC_Types.PTCCHTimingAdvanceIEs","element");
PTCCHTimingAdvanceIEs 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 PTCCHTimingAdvanceIE(*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 PTCCHTimingAdvanceIE(*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 PTCCHTimingAdvanceIE(*val_ptr->value_elements[index+i+len]);
}
}
return ret_val;
}

PTCCHTimingAdvanceIEs PTCCHTimingAdvanceIEs::replace(int index, int len, const PTCCHTimingAdvanceIEs_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 PTCCHTimingAdvanceIEs::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
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 = (PTCCHTimingAdvanceIE**)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 PTCCHTimingAdvanceIE(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (PTCCHTimingAdvanceIE**)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 @RLCMAC_Types.PTCCHTimingAdvanceIEs: %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 = (PTCCHTimingAdvanceIE**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}

boolean PTCCHTimingAdvanceIEs::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 PTCCHTimingAdvanceIEs::size_of() const
{
if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
return val_ptr->n_elements;
}

int PTCCHTimingAdvanceIEs::lengthof() const
{
if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
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 PTCCHTimingAdvanceIEs::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 PTCCHTimingAdvanceIEs::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 PTCCHTimingAdvanceIEs::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", "@RLCMAC_Types.PTCCHTimingAdvanceIEs");
    }
    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", "@RLCMAC_Types.PTCCHTimingAdvanceIEs");
    }
    break;
  default:
    TTCN_error("Internal error: Unknown operation type.");
  }
}

void PTCCHTimingAdvanceIEs::encode_text(Text_Buf& text_buf) const
{
if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
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 PTCCHTimingAdvanceIEs::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 @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
val_ptr->value_elements = (PTCCHTimingAdvanceIE**)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 PTCCHTimingAdvanceIE;
val_ptr->value_elements[elem_count]->decode_text(text_buf);
}
}

void PTCCHTimingAdvanceIEs::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 PTCCHTimingAdvanceIEs::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 PTCCHTimingAdvanceIEs::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 PTCCHTimingAdvanceIEs::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 PTCCHTimingAdvanceIEs_template::copy_value(const PTCCHTimingAdvanceIEs& other_value)
{
if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @RLCMAC_Types.PTCCHTimingAdvanceIEs with an unbound value.");
single_value.n_elements = other_value.size_of();
single_value.value_elements = (PTCCHTimingAdvanceIE_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 PTCCHTimingAdvanceIE_template(other_value[elem_count]);
} else {
single_value.value_elements[elem_count] = new PTCCHTimingAdvanceIE_template;
}
}
set_selection(SPECIFIC_VALUE);
}

void PTCCHTimingAdvanceIEs_template::copy_template(const PTCCHTimingAdvanceIEs_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 = (PTCCHTimingAdvanceIE_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 PTCCHTimingAdvanceIE_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new PTCCHTimingAdvanceIE_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 PTCCHTimingAdvanceIEs_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 PTCCHTimingAdvanceIEs_template(*other_value.implication_.precondition);
implication_.implied_template = new PTCCHTimingAdvanceIEs_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 @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
break;
}
set_selection(other_value);
}

boolean PTCCHTimingAdvanceIEs_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 PTCCHTimingAdvanceIEs_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const PTCCHTimingAdvanceIEs*)value_ptr)[value_index], legacy);
else return ((const PTCCHTimingAdvanceIEs_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit();
}

PTCCHTimingAdvanceIEs_template::PTCCHTimingAdvanceIEs_template()
{
}

PTCCHTimingAdvanceIEs_template::PTCCHTimingAdvanceIEs_template(template_sel other_value)
 : Base_Record_Of_Template(other_value)
{
check_single_selection(other_value);
}

PTCCHTimingAdvanceIEs_template::PTCCHTimingAdvanceIEs_template(null_type)
 : Base_Record_Of_Template(SPECIFIC_VALUE)
{
single_value.n_elements = 0;
single_value.value_elements = NULL;
}

PTCCHTimingAdvanceIEs_template::PTCCHTimingAdvanceIEs_template(const PTCCHTimingAdvanceIEs& other_value)
{
copy_value(other_value);
}

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

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

PTCCHTimingAdvanceIEs_template::PTCCHTimingAdvanceIEs_template(Dynamic_Match_Interface<PTCCHTimingAdvanceIEs>* p_dyn_match)
 : Base_Record_Of_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<PTCCHTimingAdvanceIEs>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

PTCCHTimingAdvanceIEs_template::PTCCHTimingAdvanceIEs_template(const PTCCHTimingAdvanceIEs_template& other_value)
 : Base_Record_Of_Template()
{
copy_template(other_value);
}

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

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

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

PTCCHTimingAdvanceIEs_template& PTCCHTimingAdvanceIEs_template::operator=(null_type)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value.n_elements = 0;
single_value.value_elements = NULL;
return *this;
}

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

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

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

PTCCHTimingAdvanceIE_template& PTCCHTimingAdvanceIEs_template::operator[](int index_value)
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @RLCMAC_Types.PTCCHTimingAdvanceIEs 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 @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
    break;
}
return *single_value.value_elements[index_value];
}

PTCCHTimingAdvanceIE_template& PTCCHTimingAdvanceIEs_template::operator[](const INTEGER& index_value)
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
return (*this)[(int)index_value];
}

const PTCCHTimingAdvanceIE_template& PTCCHTimingAdvanceIEs_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @RLCMAC_Types.PTCCHTimingAdvanceIEs using a negative index: %d.", index_value);
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @RLCMAC_Types.PTCCHTimingAdvanceIEs: 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 PTCCHTimingAdvanceIE_template& PTCCHTimingAdvanceIEs_template::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
return (*this)[(int)index_value];
}

void PTCCHTimingAdvanceIEs_template::set_size(int new_size)
{
if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
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 = (PTCCHTimingAdvanceIE_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 PTCCHTimingAdvanceIE_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 PTCCHTimingAdvanceIE_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 = (PTCCHTimingAdvanceIE_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}

int PTCCHTimingAdvanceIEs_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 PTCCHTimingAdvanceIEs_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 @RLCMAC_Types.PTCCHTimingAdvanceIEs 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 @RLCMAC_Types.PTCCHTimingAdvanceIEs 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 @RLCMAC_Types.PTCCHTimingAdvanceIEs 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 @RLCMAC_Types.PTCCHTimingAdvanceIEs 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 @RLCMAC_Types.PTCCHTimingAdvanceIEs 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 @RLCMAC_Types.PTCCHTimingAdvanceIEs containing complemented list.", op_name);
default:
  TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.", op_name);
}
return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @RLCMAC_Types.PTCCHTimingAdvanceIEs");
}

boolean PTCCHTimingAdvanceIEs_template::match(const PTCCHTimingAdvanceIEs& 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 @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
}
return FALSE;
}

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

PTCCHTimingAdvanceIEs PTCCHTimingAdvanceIEs_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 @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
PTCCHTimingAdvanceIEs 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;
}

PTCCHTimingAdvanceIEs PTCCHTimingAdvanceIEs_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);
}

PTCCHTimingAdvanceIEs PTCCHTimingAdvanceIEs_template::replace(int index, int len, const PTCCHTimingAdvanceIEs_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());
}

PTCCHTimingAdvanceIEs PTCCHTimingAdvanceIEs_template::replace(int index, int len, const PTCCHTimingAdvanceIEs& 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 PTCCHTimingAdvanceIEs_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 PTCCHTimingAdvanceIEs_template[list_length];
break;
default:
TTCN_error("Internal error: Setting an invalid type for a template of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
}
set_selection(template_type);
}

PTCCHTimingAdvanceIEs_template& PTCCHTimingAdvanceIEs_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 @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
return value_list.list_value[list_index];
}

void PTCCHTimingAdvanceIEs_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 PTCCHTimingAdvanceIEs_template::log_match(const PTCCHTimingAdvanceIEs& 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 PTCCHTimingAdvanceIEs_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 @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
}
}

void PTCCHTimingAdvanceIEs_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 @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
single_value.value_elements = (PTCCHTimingAdvanceIE_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 PTCCHTimingAdvanceIE_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 PTCCHTimingAdvanceIEs_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 @RLCMAC_Types.PTCCHTimingAdvanceIEs.");
}
}

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

boolean PTCCHTimingAdvanceIEs_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 PTCCHTimingAdvanceIEs_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 PTCCHTimingAdvanceIEs_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: {
    PTCCHTimingAdvanceIEs_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: {
    PTCCHTimingAdvanceIEs_template* precondition = new PTCCHTimingAdvanceIEs_template;
    precondition->set_param(*param.get_elem(0));
    PTCCHTimingAdvanceIEs_template* implied_template = new PTCCHTimingAdvanceIEs_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PTCCHTimingAdvanceIEs_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record of template", "@RLCMAC_Types.PTCCHTimingAdvanceIEs");
  }
  is_ifpresent = param.get_ifpresent();
  set_length_range(param);
}

void PTCCHTimingAdvanceIEs_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 : "@RLCMAC_Types.PTCCHTimingAdvanceIEs");
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 : "@RLCMAC_Types.PTCCHTimingAdvanceIEs");
}

boolean PTCCHTimingAdvanceIEs_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);
}
}
PTCCHDownlinkMsg::PTCCHDownlinkMsg()
{
}

PTCCHDownlinkMsg::PTCCHDownlinkMsg(const PTCCHTimingAdvanceIEs& par_ta__idx,
    const OCTETSTRING& par_padding)
  :   field_ta__idx(par_ta__idx),
  field_padding(par_padding)
{
}

PTCCHDownlinkMsg::PTCCHDownlinkMsg(const PTCCHDownlinkMsg& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_Types.PTCCHDownlinkMsg.");
if (other_value.ta__idx().is_bound()) field_ta__idx = other_value.ta__idx();
else field_ta__idx.clean_up();
if (other_value.padding().is_bound()) field_padding = other_value.padding();
else field_padding.clean_up();
}

void PTCCHDownlinkMsg::clean_up()
{
field_ta__idx.clean_up();
field_padding.clean_up();
}

const TTCN_Typedescriptor_t* PTCCHDownlinkMsg::get_descriptor() const { return &PTCCHDownlinkMsg_descr_; }
PTCCHDownlinkMsg& PTCCHDownlinkMsg::operator=(const PTCCHDownlinkMsg& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_Types.PTCCHDownlinkMsg.");
  if (other_value.ta__idx().is_bound()) field_ta__idx = other_value.ta__idx();
  else field_ta__idx.clean_up();
  if (other_value.padding().is_bound()) field_padding = other_value.padding();
  else field_padding.clean_up();
}
return *this;
}

boolean PTCCHDownlinkMsg::operator==(const PTCCHDownlinkMsg& other_value) const
{
return field_ta__idx==other_value.field_ta__idx
  && field_padding==other_value.field_padding;
}

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

void PTCCHDownlinkMsg::set_implicit_omit()
{
if (ta__idx().is_bound()) ta__idx().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

void PTCCHDownlinkMsg::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 @RLCMAC_Types.PTCCHDownlinkMsg 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) ta__idx().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(), "ta_idx")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ta__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(), "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 @RLCMAC_Types.PTCCHDownlinkMsg: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_Types.PTCCHDownlinkMsg");
  }
}

void PTCCHDownlinkMsg::encode_text(Text_Buf& text_buf) const
{
field_ta__idx.encode_text(text_buf);
field_padding.encode_text(text_buf);
}

void PTCCHDownlinkMsg::decode_text(Text_Buf& text_buf)
{
field_ta__idx.decode_text(text_buf);
field_padding.decode_text(text_buf);
}

void PTCCHDownlinkMsg::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 PTCCHDownlinkMsg::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 PTCCHDownlinkMsg::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, PTCCHDownlinkMsg_ta__idx_descr_.raw->forceomit);
  decoded_field_length = field_ta__idx.RAW_decode(PTCCHDownlinkMsg_ta__idx_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, PTCCHDownlinkMsg_padding_descr_.raw->forceomit);
  decoded_field_length = field_padding.RAW_decode(PTCCHDownlinkMsg_padding_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 PTCCHDownlinkMsg::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, PTCCHDownlinkMsg_ta__idx_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PTCCHDownlinkMsg_padding_descr_.raw);
  encoded_length += field_ta__idx.RAW_encode(PTCCHDownlinkMsg_ta__idx_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_padding.RAW_encode(PTCCHDownlinkMsg_padding_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct PTCCHDownlinkMsg_template::single_value_struct {
PTCCHTimingAdvanceIEs_template field_ta__idx;
OCTETSTRING_template field_padding;
};

void PTCCHDownlinkMsg_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__idx = ANY_VALUE;
single_value->field_padding = ANY_VALUE;
}
}
}

void PTCCHDownlinkMsg_template::copy_value(const PTCCHDownlinkMsg& other_value)
{
single_value = new single_value_struct;
if (other_value.ta__idx().is_bound()) {
  single_value->field_ta__idx = other_value.ta__idx();
} else {
  single_value->field_ta__idx.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 PTCCHDownlinkMsg_template::copy_template(const PTCCHDownlinkMsg_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.ta__idx().get_selection()) {
single_value->field_ta__idx = other_value.ta__idx();
} else {
single_value->field_ta__idx.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 PTCCHDownlinkMsg_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 PTCCHDownlinkMsg_template(*other_value.implication_.precondition);
implication_.implied_template = new PTCCHDownlinkMsg_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 @RLCMAC_Types.PTCCHDownlinkMsg.");
break;
}
set_selection(other_value);
}

PTCCHDownlinkMsg_template::PTCCHDownlinkMsg_template()
{
}

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

PTCCHDownlinkMsg_template::PTCCHDownlinkMsg_template(const PTCCHDownlinkMsg& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PTCCHDownlinkMsg_template::match(const PTCCHDownlinkMsg& 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__idx().is_bound()) return FALSE;
if(!single_value->field_ta__idx.match(other_value.ta__idx(), 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 @RLCMAC_Types.PTCCHDownlinkMsg.");
}
return FALSE;
}

boolean PTCCHDownlinkMsg_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__idx.is_bound()
 || single_value->field_padding.is_bound();
}

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

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

PTCCHDownlinkMsg PTCCHDownlinkMsg_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 @RLCMAC_Types.PTCCHDownlinkMsg.");
PTCCHDownlinkMsg ret_val;
if (single_value->field_ta__idx.is_bound()) {
ret_val.ta__idx() = single_value->field_ta__idx.valueof();
}
if (single_value->field_padding.is_bound()) {
ret_val.padding() = single_value->field_padding.valueof();
}
return ret_val;
}

void PTCCHDownlinkMsg_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 @RLCMAC_Types.PTCCHDownlinkMsg.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PTCCHDownlinkMsg_template[list_length];
}

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

PTCCHTimingAdvanceIEs_template& PTCCHDownlinkMsg_template::ta__idx()
{
set_specific();
return single_value->field_ta__idx;
}

const PTCCHTimingAdvanceIEs_template& PTCCHDownlinkMsg_template::ta__idx() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ta_idx of a non-specific template of type @RLCMAC_Types.PTCCHDownlinkMsg.");
return single_value->field_ta__idx;
}

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

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

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

void PTCCHDownlinkMsg_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ ta_idx := ");
single_value->field_ta__idx.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 PTCCHDownlinkMsg_template::log_match(const PTCCHDownlinkMsg& 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__idx.match(match_value.ta__idx(), legacy)){
TTCN_Logger::log_logmatch_info(".ta_idx");
single_value->field_ta__idx.log_match(match_value.ta__idx(), 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_idx := ");
single_value->field_ta__idx.log_match(match_value.ta__idx(), 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 PTCCHDownlinkMsg_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (ta__idx().is_bound()) ta__idx().set_implicit_omit();
if (padding().is_bound()) padding().set_implicit_omit();
}

void PTCCHDownlinkMsg_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_ta__idx.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 @RLCMAC_Types.PTCCHDownlinkMsg.");
}
}

void PTCCHDownlinkMsg_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__idx.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 PTCCHDownlinkMsg_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 @RLCMAC_Types.PTCCHDownlinkMsg.");
}
}

void PTCCHDownlinkMsg_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: {
    PTCCHDownlinkMsg_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 @RLCMAC_Types.PTCCHDownlinkMsg 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) ta__idx().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(), "ta_idx")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ta__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(), "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 @RLCMAC_Types.PTCCHDownlinkMsg: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PTCCHDownlinkMsg_template* precondition = new PTCCHDownlinkMsg_template;
    precondition->set_param(*param.get_elem(0));
    PTCCHDownlinkMsg_template* implied_template = new PTCCHDownlinkMsg_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PTCCHDownlinkMsg_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_Types.PTCCHDownlinkMsg");
  }
  is_ifpresent = param.get_ifpresent();
}

void PTCCHDownlinkMsg_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__idx.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.PTCCHDownlinkMsg");
single_value->field_padding.check_restriction(t_res, t_name ? t_name : "@RLCMAC_Types.PTCCHDownlinkMsg");
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 : "@RLCMAC_Types.PTCCHDownlinkMsg");
}

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

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


/* Bodies of functions, altsteps and testcases */

void MacPayloadType_encoder(const MacPayloadType& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.MacPayloadType' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(MacPayloadType_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER MacPayloadType_decoder(OCTETSTRING& input_stream, MacPayloadType& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.MacPayloadType' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(MacPayloadType_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void MacRrbp_encoder(const MacRrbp& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.MacRrbp' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(MacRrbp_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER MacRrbp_decoder(OCTETSTRING& input_stream, MacRrbp& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.MacRrbp' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(MacRrbp_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void EgprsHeaderType_encoder(const EgprsHeaderType& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.EgprsHeaderType' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(EgprsHeaderType_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER EgprsHeaderType_decoder(OCTETSTRING& input_stream, EgprsHeaderType& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.EgprsHeaderType' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(EgprsHeaderType_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void CodingScheme_encoder(const CodingScheme& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.CodingScheme' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(CodingScheme_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER CodingScheme_decoder(OCTETSTRING& input_stream, CodingScheme& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.CodingScheme' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(CodingScheme_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

boolean operator==(null_type, const CodingSchemeArray& other_value)
{
if (other_value.val_ptr == NULL)
TTCN_error("The right operand of comparison is an unbound value of type @RLCMAC_Types.CodingSchemeArray.");
return other_value.val_ptr->n_elements == 0;
}

void CodingSchemeArray_0_encoder(const CodingScheme& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.CodingScheme' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(CodingSchemeArray_0_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER CodingSchemeArray_0_decoder(OCTETSTRING& input_stream, CodingScheme& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.CodingScheme' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(CodingSchemeArray_0_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void CodingSchemeArray_encoder(const CodingSchemeArray& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.CodingSchemeArray' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(CodingSchemeArray_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER CodingSchemeArray_decoder(OCTETSTRING& input_stream, CodingSchemeArray& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.CodingSchemeArray' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(CodingSchemeArray_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void DlMacHeader_payload__type_encoder(const MacPayloadType& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.MacPayloadType' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(DlMacHeader_payload__type_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER DlMacHeader_payload__type_decoder(OCTETSTRING& input_stream, MacPayloadType& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.MacPayloadType' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(DlMacHeader_payload__type_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void DlMacHeader_rrbp_encoder(const MacRrbp& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.MacRrbp' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(DlMacHeader_rrbp_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER DlMacHeader_rrbp_decoder(OCTETSTRING& input_stream, MacRrbp& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.MacRrbp' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(DlMacHeader_rrbp_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void DlMacHeader_rrbp__valid_encoder(const BOOLEAN& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(DlMacHeader_rrbp__valid_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER DlMacHeader_rrbp__valid_decoder(OCTETSTRING& input_stream, BOOLEAN& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(DlMacHeader_rrbp__valid_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void DlMacHeader_usf_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(DlMacHeader_usf_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER DlMacHeader_usf_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(DlMacHeader_usf_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void DlMacHeader_encoder(const DlMacHeader& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.DlMacHeader' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(DlMacHeader_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER DlMacHeader_decoder(OCTETSTRING& input_stream, DlMacHeader& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.DlMacHeader' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(DlMacHeader_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void PowerReduction_encoder(const PowerReduction& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.PowerReduction' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(PowerReduction_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER PowerReduction_decoder(OCTETSTRING& input_stream, PowerReduction& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.PowerReduction' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(PowerReduction_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void DirectionBit_encoder(const DirectionBit& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.DirectionBit' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(DirectionBit_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER DirectionBit_decoder(OCTETSTRING& input_stream, DirectionBit& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.DirectionBit' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(DirectionBit_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void TfiOctet_pr_encoder(const PowerReduction& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.PowerReduction' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(TfiOctet_pr_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER TfiOctet_pr_decoder(OCTETSTRING& input_stream, PowerReduction& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.PowerReduction' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(TfiOctet_pr_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void TfiOctet_tfi_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(TfiOctet_tfi_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER TfiOctet_tfi_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(TfiOctet_tfi_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void TfiOctet_d_encoder(const DirectionBit& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.DirectionBit' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(TfiOctet_d_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER TfiOctet_d_decoder(OCTETSTRING& input_stream, DirectionBit& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.DirectionBit' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(TfiOctet_d_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void TfiOctet_encoder(const TfiOctet& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.TfiOctet' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(TfiOctet_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER TfiOctet_decoder(OCTETSTRING& input_stream, TfiOctet& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.TfiOctet' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(TfiOctet_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void RbsnExtOctet_rbsn__e_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(RbsnExtOctet_rbsn__e_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER RbsnExtOctet_rbsn__e_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(RbsnExtOctet_rbsn__e_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void RbsnExtOctet_fs__e_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(RbsnExtOctet_fs__e_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER RbsnExtOctet_fs__e_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(RbsnExtOctet_fs__e_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void RbsnExtOctet_spare_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(RbsnExtOctet_spare_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER RbsnExtOctet_spare_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(RbsnExtOctet_spare_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void RbsnExtOctet_encoder(const RbsnExtOctet& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.RbsnExtOctet' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(RbsnExtOctet_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER RbsnExtOctet_decoder(OCTETSTRING& input_stream, RbsnExtOctet& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.RbsnExtOctet' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(RbsnExtOctet_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void DlCtrlOptOctets_rbsn_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(DlCtrlOptOctets_rbsn_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER DlCtrlOptOctets_rbsn_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(DlCtrlOptOctets_rbsn_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void DlCtrlOptOctets_rti_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(DlCtrlOptOctets_rti_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER DlCtrlOptOctets_rti_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(DlCtrlOptOctets_rti_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void DlCtrlOptOctets_fs_encoder(const BOOLEAN& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(DlCtrlOptOctets_fs_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER DlCtrlOptOctets_fs_decoder(OCTETSTRING& input_stream, BOOLEAN& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(DlCtrlOptOctets_fs_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void DlCtrlOptOctets_tfi__octet__present_encoder(const BOOLEAN& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(DlCtrlOptOctets_tfi__octet__present_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER DlCtrlOptOctets_tfi__octet__present_decoder(OCTETSTRING& input_stream, BOOLEAN& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(DlCtrlOptOctets_tfi__octet__present_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void DlCtrlOptOctets_tfi_encoder(const TfiOctet& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.TfiOctet' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(DlCtrlOptOctets_tfi_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER DlCtrlOptOctets_tfi_decoder(OCTETSTRING& input_stream, TfiOctet& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.TfiOctet' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(DlCtrlOptOctets_tfi_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void DlCtrlOptOctets_rbsn__ext_encoder(const RbsnExtOctet& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.RbsnExtOctet' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(DlCtrlOptOctets_rbsn__ext_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER DlCtrlOptOctets_rbsn__ext_decoder(OCTETSTRING& input_stream, RbsnExtOctet& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.RbsnExtOctet' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(DlCtrlOptOctets_rbsn__ext_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void DlCtrlOptOctets_encoder(const DlCtrlOptOctets& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.DlCtrlOptOctets' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(DlCtrlOptOctets_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER DlCtrlOptOctets_decoder(OCTETSTRING& input_stream, DlCtrlOptOctets& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.DlCtrlOptOctets' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(DlCtrlOptOctets_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void RlcmacDlCtrlBlock_mac__hdr_encoder(const DlMacHeader& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.DlMacHeader' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(RlcmacDlCtrlBlock_mac__hdr_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER RlcmacDlCtrlBlock_mac__hdr_decoder(OCTETSTRING& input_stream, DlMacHeader& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.DlMacHeader' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(RlcmacDlCtrlBlock_mac__hdr_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void RlcmacDlCtrlBlock_payload_encoder(const RLCMAC__CSN1__Types::RlcmacDlCtrlMsg& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_CSN1_Types.RlcmacDlCtrlMsg' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(RlcmacDlCtrlBlock_payload_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER RlcmacDlCtrlBlock_payload_decoder(OCTETSTRING& input_stream, RLCMAC__CSN1__Types::RlcmacDlCtrlMsg& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_CSN1_Types.RlcmacDlCtrlMsg' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(RlcmacDlCtrlBlock_payload_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void RlcmacDlCtrlBlock_opt_encoder(const DlCtrlOptOctets& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.DlCtrlOptOctets' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(RlcmacDlCtrlBlock_opt_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER RlcmacDlCtrlBlock_opt_decoder(OCTETSTRING& input_stream, DlCtrlOptOctets& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.DlCtrlOptOctets' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(RlcmacDlCtrlBlock_opt_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void RlcmacDlCtrlBlock_encoder(const RlcmacDlCtrlBlock& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.RlcmacDlCtrlBlock' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(RlcmacDlCtrlBlock_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER RlcmacDlCtrlBlock_decoder(OCTETSTRING& input_stream, RlcmacDlCtrlBlock& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.RlcmacDlCtrlBlock' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(RlcmacDlCtrlBlock_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

OCTETSTRING enc__RlcmacDlCtrlBlock(const RlcmacDlCtrlBlock& si)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("enc_RlcmacDlCtrlBlock(): Encoding @RLCMAC_Types.RlcmacDlCtrlBlock: ");
si.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_Buffer ttcn_buffer;
si.encode(RlcmacDlCtrlBlock_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW, 0);
OCTETSTRING ret_val;
ttcn_buffer.get_string(ret_val);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("enc_RlcmacDlCtrlBlock(): Stream after encoding: ");
ret_val.log();
TTCN_Logger::end_event();
}
return ret_val;
}

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

void UlMacCtrlHeader_payload__type_encoder(const MacPayloadType& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.MacPayloadType' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(UlMacCtrlHeader_payload__type_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER UlMacCtrlHeader_payload__type_decoder(OCTETSTRING& input_stream, MacPayloadType& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.MacPayloadType' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(UlMacCtrlHeader_payload__type_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void UlMacCtrlHeader_spare_encoder(const BITSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(UlMacCtrlHeader_spare_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER UlMacCtrlHeader_spare_decoder(OCTETSTRING& input_stream, BITSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(UlMacCtrlHeader_spare_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void UlMacCtrlHeader_retry_encoder(const BOOLEAN& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(UlMacCtrlHeader_retry_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER UlMacCtrlHeader_retry_decoder(OCTETSTRING& input_stream, BOOLEAN& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `boolean' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(UlMacCtrlHeader_retry_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void UlMacCtrlHeader_encoder(const UlMacCtrlHeader& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.UlMacCtrlHeader' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(UlMacCtrlHeader_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER UlMacCtrlHeader_decoder(OCTETSTRING& input_stream, UlMacCtrlHeader& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.UlMacCtrlHeader' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(UlMacCtrlHeader_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void RlcmacUlCtrlBlock_mac__hdr_encoder(const UlMacCtrlHeader& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.UlMacCtrlHeader' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(RlcmacUlCtrlBlock_mac__hdr_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER RlcmacUlCtrlBlock_mac__hdr_decoder(OCTETSTRING& input_stream, UlMacCtrlHeader& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_Types.UlMacCtrlHeader' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(RlcmacUlCtrlBlock_mac__hdr_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void RlcmacUlCtrlBlock_payload_encoder(const RLCMAC__CSN1__Types::RlcmacUlCtrlMsg& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_CSN1_Types.RlcmacUlCtrlMsg' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(RlcmacUlCtrlBlock_payload_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER RlcmacUlCtrlBlock_payload_decoder(OCTETSTRING& input_stream, RLCMAC__CSN1__Types::RlcmacUlCtrlMsg& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_RAW) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@RLCMAC_CSN1_Types.RlcmacUlCtrlMsg' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(RlcmacUlCtrlBlock_payload_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}


} /* end of namespace */
