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

namespace RLCMAC__CSN1__Types {

/* Member functions of C++ classes */

COMPACTreducedMA::COMPACTreducedMA()
{
}

COMPACTreducedMA::COMPACTreducedMA(const INTEGER& par_ma__bitmap__length,
    const BITSTRING& par_ma__bitmap,
    const BITSTRING& par_maio__2__present,
    const OPTIONAL< BITSTRING >& par_maio__2)
  :   field_ma__bitmap__length(par_ma__bitmap__length),
  field_ma__bitmap(par_ma__bitmap),
  field_maio__2__present(par_maio__2__present),
  field_maio__2(par_maio__2)
{
}

COMPACTreducedMA::COMPACTreducedMA(const COMPACTreducedMA& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.COMPACTreducedMA.");
if (other_value.ma__bitmap__length().is_bound()) field_ma__bitmap__length = other_value.ma__bitmap__length();
else field_ma__bitmap__length.clean_up();
if (other_value.ma__bitmap().is_bound()) field_ma__bitmap = other_value.ma__bitmap();
else field_ma__bitmap.clean_up();
if (other_value.maio__2__present().is_bound()) field_maio__2__present = other_value.maio__2__present();
else field_maio__2__present.clean_up();
if (other_value.maio__2().is_bound()) field_maio__2 = other_value.maio__2();
else field_maio__2.clean_up();
}

void COMPACTreducedMA::clean_up()
{
field_ma__bitmap__length.clean_up();
field_ma__bitmap.clean_up();
field_maio__2__present.clean_up();
field_maio__2.clean_up();
}

const TTCN_Typedescriptor_t* COMPACTreducedMA::get_descriptor() const { return &COMPACTreducedMA_descr_; }
COMPACTreducedMA& COMPACTreducedMA::operator=(const COMPACTreducedMA& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.COMPACTreducedMA.");
  if (other_value.ma__bitmap__length().is_bound()) field_ma__bitmap__length = other_value.ma__bitmap__length();
  else field_ma__bitmap__length.clean_up();
  if (other_value.ma__bitmap().is_bound()) field_ma__bitmap = other_value.ma__bitmap();
  else field_ma__bitmap.clean_up();
  if (other_value.maio__2__present().is_bound()) field_maio__2__present = other_value.maio__2__present();
  else field_maio__2__present.clean_up();
  if (other_value.maio__2().is_bound()) field_maio__2 = other_value.maio__2();
  else field_maio__2.clean_up();
}
return *this;
}

boolean COMPACTreducedMA::operator==(const COMPACTreducedMA& other_value) const
{
return field_ma__bitmap__length==other_value.field_ma__bitmap__length
  && field_ma__bitmap==other_value.field_ma__bitmap
  && field_maio__2__present==other_value.field_maio__2__present
  && field_maio__2==other_value.field_maio__2;
}

boolean COMPACTreducedMA::is_bound() const
{
return (field_ma__bitmap__length.is_bound())
  || (field_ma__bitmap.is_bound())
  || (field_maio__2__present.is_bound())
  || (OPTIONAL_OMIT == field_maio__2.get_selection() || field_maio__2.is_bound());
}
boolean COMPACTreducedMA::is_value() const
{
return field_ma__bitmap__length.is_value()
  && field_ma__bitmap.is_value()
  && field_maio__2__present.is_value()
  && (OPTIONAL_OMIT == field_maio__2.get_selection() || field_maio__2.is_value());
}
int COMPACTreducedMA::size_of() const
{
  int ret_val = 3;
  if (field_maio__2.ispresent()) ret_val++;
  return ret_val;
}

void COMPACTreducedMA::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ ma_bitmap_length := ");
field_ma__bitmap__length.log();
TTCN_Logger::log_event_str(", ma_bitmap := ");
field_ma__bitmap.log();
TTCN_Logger::log_event_str(", maio_2_present := ");
field_maio__2__present.log();
TTCN_Logger::log_event_str(", maio_2 := ");
field_maio__2.log();
TTCN_Logger::log_event_str(" }");
}

void COMPACTreducedMA::set_implicit_omit()
{
if (ma__bitmap__length().is_bound()) ma__bitmap__length().set_implicit_omit();
if (ma__bitmap().is_bound()) ma__bitmap().set_implicit_omit();
if (maio__2__present().is_bound()) maio__2__present().set_implicit_omit();
if (!maio__2().is_bound()) maio__2() = OMIT_VALUE;
else maio__2().set_implicit_omit();
}

void COMPACTreducedMA::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_CSN1_Types.COMPACTreducedMA 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) ma__bitmap__length().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ma__bitmap().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) maio__2__present().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) maio__2().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(), "ma_bitmap_length")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ma__bitmap__length().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ma_bitmap")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ma__bitmap().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "maio_2_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          maio__2__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(), "maio_2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          maio__2().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_CSN1_Types.COMPACTreducedMA: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.COMPACTreducedMA");
  }
}

void COMPACTreducedMA::encode_text(Text_Buf& text_buf) const
{
field_ma__bitmap__length.encode_text(text_buf);
field_ma__bitmap.encode_text(text_buf);
field_maio__2__present.encode_text(text_buf);
field_maio__2.encode_text(text_buf);
}

void COMPACTreducedMA::decode_text(Text_Buf& text_buf)
{
field_ma__bitmap__length.decode_text(text_buf);
field_ma__bitmap.decode_text(text_buf);
field_maio__2__present.decode_text(text_buf);
field_maio__2.decode_text(text_buf);
}

void COMPACTreducedMA::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 COMPACTreducedMA::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 COMPACTreducedMA::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  int value_of_length_field0 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, COMPACTreducedMA_ma__bitmap__length_descr_.raw->forceomit);
  decoded_field_length = field_ma__bitmap__length.RAW_decode(COMPACTreducedMA_ma__bitmap__length_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());
  INTEGER tmp0 = field_ma__bitmap__length.convert_to_Integer(COMPACTreducedMA_ma__bitmap__length_descr_);
  field_ma__bitmap__length = tmp0;
  value_of_length_field0 += tmp0.get_long_long_val() * 1;
  RAW_Force_Omit field_1_force_omit(1, force_omit, COMPACTreducedMA_ma__bitmap_descr_.raw->forceomit);
  decoded_field_length = field_ma__bitmap.RAW_decode(COMPACTreducedMA_ma__bitmap_descr_, p_buf, min_of_ints(2, limit, value_of_length_field0), 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());
  value_of_length_field0 -= decoded_field_length;
  RAW_Force_Omit field_2_force_omit(2, force_omit, COMPACTreducedMA_maio__2__present_descr_.raw->forceomit);
  decoded_field_length = field_maio__2__present.RAW_decode(COMPACTreducedMA_maio__2__present_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (limit > 0 && field_maio__2__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(3)) {
    field_maio__2 = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_3_force_omit(3, force_omit, COMPACTreducedMA_maio__2_descr_.raw->forceomit);
  decoded_field_length = field_maio__2().RAW_decode(COMPACTreducedMA_maio__2_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 1) {
  field_maio__2 = 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_maio__2=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int COMPACTreducedMA::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, COMPACTreducedMA_ma__bitmap__length_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, COMPACTreducedMA_ma__bitmap_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, COMPACTreducedMA_maio__2__present_descr_.raw);
  if (field_maio__2.ispresent()) {
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, COMPACTreducedMA_maio__2_descr_.raw);
  }
  else myleaf.body.node.nodes[3] = NULL;
  encoded_length += 7;
  myleaf.body.node.nodes[0]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[0]->coding_descr = &COMPACTreducedMA_ma__bitmap__length_descr_;
  myleaf.body.node.nodes[0]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[0]->calcof.lengthto.unit = 1;
  myleaf.body.node.nodes[0]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[0]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[0]->length = 7;
  myleaf.body.node.nodes[0]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[1]->curr_pos.level;
  myleaf.body.node.nodes[0]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[1]->curr_pos.pos;
  encoded_length += field_ma__bitmap.RAW_encode(COMPACTreducedMA_ma__bitmap_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_maio__2__present.RAW_encode(COMPACTreducedMA_maio__2__present_descr_, *myleaf.body.node.nodes[2]);
  if (field_maio__2.ispresent()) {
  encoded_length += field_maio__2().RAW_encode(COMPACTreducedMA_maio__2_descr_, *myleaf.body.node.nodes[3]);
  }
  if (field_maio__2.ispresent() && (field_maio__2__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={2};
  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(COMPACTreducedMA_maio__2__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);
  }
  }
  return myleaf.length = encoded_length;
}

struct COMPACTreducedMA_template::single_value_struct {
INTEGER_template field_ma__bitmap__length;
BITSTRING_template field_ma__bitmap;
BITSTRING_template field_maio__2__present;
BITSTRING_template field_maio__2;
};

void COMPACTreducedMA_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_ma__bitmap__length = ANY_VALUE;
single_value->field_ma__bitmap = ANY_VALUE;
single_value->field_maio__2__present = ANY_VALUE;
single_value->field_maio__2 = ANY_OR_OMIT;
}
}
}

void COMPACTreducedMA_template::copy_value(const COMPACTreducedMA& other_value)
{
single_value = new single_value_struct;
if (other_value.ma__bitmap__length().is_bound()) {
  single_value->field_ma__bitmap__length = other_value.ma__bitmap__length();
} else {
  single_value->field_ma__bitmap__length.clean_up();
}
if (other_value.ma__bitmap().is_bound()) {
  single_value->field_ma__bitmap = other_value.ma__bitmap();
} else {
  single_value->field_ma__bitmap.clean_up();
}
if (other_value.maio__2__present().is_bound()) {
  single_value->field_maio__2__present = other_value.maio__2__present();
} else {
  single_value->field_maio__2__present.clean_up();
}
if (other_value.maio__2().is_bound()) {
  if (other_value.maio__2().ispresent()) single_value->field_maio__2 = other_value.maio__2()();
  else single_value->field_maio__2 = OMIT_VALUE;
} else {
  single_value->field_maio__2.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void COMPACTreducedMA_template::copy_template(const COMPACTreducedMA_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.ma__bitmap__length().get_selection()) {
single_value->field_ma__bitmap__length = other_value.ma__bitmap__length();
} else {
single_value->field_ma__bitmap__length.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ma__bitmap().get_selection()) {
single_value->field_ma__bitmap = other_value.ma__bitmap();
} else {
single_value->field_ma__bitmap.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.maio__2__present().get_selection()) {
single_value->field_maio__2__present = other_value.maio__2__present();
} else {
single_value->field_maio__2__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.maio__2().get_selection()) {
single_value->field_maio__2 = other_value.maio__2();
} else {
single_value->field_maio__2.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 COMPACTreducedMA_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 COMPACTreducedMA_template(*other_value.implication_.precondition);
implication_.implied_template = new COMPACTreducedMA_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_CSN1_Types.COMPACTreducedMA.");
break;
}
set_selection(other_value);
}

COMPACTreducedMA_template::COMPACTreducedMA_template()
{
}

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

COMPACTreducedMA_template::COMPACTreducedMA_template(const COMPACTreducedMA& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean COMPACTreducedMA_template::match(const COMPACTreducedMA& 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.ma__bitmap__length().is_bound()) return FALSE;
if(!single_value->field_ma__bitmap__length.match(other_value.ma__bitmap__length(), legacy))return FALSE;
if(!other_value.ma__bitmap().is_bound()) return FALSE;
if(!single_value->field_ma__bitmap.match(other_value.ma__bitmap(), legacy))return FALSE;
if(!other_value.maio__2__present().is_bound()) return FALSE;
if(!single_value->field_maio__2__present.match(other_value.maio__2__present(), legacy))return FALSE;
if(!other_value.maio__2().is_bound()) return FALSE;
if((other_value.maio__2().ispresent() ? !single_value->field_maio__2.match((const BITSTRING&)other_value.maio__2(), legacy) : !single_value->field_maio__2.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_CSN1_Types.COMPACTreducedMA.");
}
return FALSE;
}

boolean COMPACTreducedMA_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_ma__bitmap__length.is_bound()
 || single_value->field_ma__bitmap.is_bound()
 || single_value->field_maio__2__present.is_bound()
 || (single_value->field_maio__2.is_omit() || single_value->field_maio__2.is_bound());
}

boolean COMPACTreducedMA_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_ma__bitmap__length.is_value()
 && single_value->field_ma__bitmap.is_value()
 && single_value->field_maio__2__present.is_value()
 && (single_value->field_maio__2.is_omit() || single_value->field_maio__2.is_value());
}

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

COMPACTreducedMA COMPACTreducedMA_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_CSN1_Types.COMPACTreducedMA.");
COMPACTreducedMA ret_val;
if (single_value->field_ma__bitmap__length.is_bound()) {
ret_val.ma__bitmap__length() = single_value->field_ma__bitmap__length.valueof();
}
if (single_value->field_ma__bitmap.is_bound()) {
ret_val.ma__bitmap() = single_value->field_ma__bitmap.valueof();
}
if (single_value->field_maio__2__present.is_bound()) {
ret_val.maio__2__present() = single_value->field_maio__2__present.valueof();
}
if (single_value->field_maio__2.is_omit()) ret_val.maio__2() = OMIT_VALUE;
else if (single_value->field_maio__2.is_bound()) {
ret_val.maio__2() = single_value->field_maio__2.valueof();
}
return ret_val;
}

void COMPACTreducedMA_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_CSN1_Types.COMPACTreducedMA.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new COMPACTreducedMA_template[list_length];
}

COMPACTreducedMA_template& COMPACTreducedMA_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_CSN1_Types.COMPACTreducedMA.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.COMPACTreducedMA.");
return value_list.list_value[list_index];
}

INTEGER_template& COMPACTreducedMA_template::ma__bitmap__length()
{
set_specific();
return single_value->field_ma__bitmap__length;
}

const INTEGER_template& COMPACTreducedMA_template::ma__bitmap__length() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ma_bitmap_length of a non-specific template of type @RLCMAC_CSN1_Types.COMPACTreducedMA.");
return single_value->field_ma__bitmap__length;
}

BITSTRING_template& COMPACTreducedMA_template::ma__bitmap()
{
set_specific();
return single_value->field_ma__bitmap;
}

const BITSTRING_template& COMPACTreducedMA_template::ma__bitmap() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ma_bitmap of a non-specific template of type @RLCMAC_CSN1_Types.COMPACTreducedMA.");
return single_value->field_ma__bitmap;
}

BITSTRING_template& COMPACTreducedMA_template::maio__2__present()
{
set_specific();
return single_value->field_maio__2__present;
}

const BITSTRING_template& COMPACTreducedMA_template::maio__2__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field maio_2_present of a non-specific template of type @RLCMAC_CSN1_Types.COMPACTreducedMA.");
return single_value->field_maio__2__present;
}

BITSTRING_template& COMPACTreducedMA_template::maio__2()
{
set_specific();
return single_value->field_maio__2;
}

const BITSTRING_template& COMPACTreducedMA_template::maio__2() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field maio_2 of a non-specific template of type @RLCMAC_CSN1_Types.COMPACTreducedMA.");
return single_value->field_maio__2;
}

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

void COMPACTreducedMA_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ ma_bitmap_length := ");
single_value->field_ma__bitmap__length.log();
TTCN_Logger::log_event_str(", ma_bitmap := ");
single_value->field_ma__bitmap.log();
TTCN_Logger::log_event_str(", maio_2_present := ");
single_value->field_maio__2__present.log();
TTCN_Logger::log_event_str(", maio_2 := ");
single_value->field_maio__2.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 COMPACTreducedMA_template::log_match(const COMPACTreducedMA& 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_ma__bitmap__length.match(match_value.ma__bitmap__length(), legacy)){
TTCN_Logger::log_logmatch_info(".ma_bitmap_length");
single_value->field_ma__bitmap__length.log_match(match_value.ma__bitmap__length(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ma__bitmap.match(match_value.ma__bitmap(), legacy)){
TTCN_Logger::log_logmatch_info(".ma_bitmap");
single_value->field_ma__bitmap.log_match(match_value.ma__bitmap(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_maio__2__present.match(match_value.maio__2__present(), legacy)){
TTCN_Logger::log_logmatch_info(".maio_2_present");
single_value->field_maio__2__present.log_match(match_value.maio__2__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.maio__2().ispresent()){
if(!single_value->field_maio__2.match(match_value.maio__2(), legacy)){
TTCN_Logger::log_logmatch_info(".maio_2");
single_value->field_maio__2.log_match(match_value.maio__2(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_maio__2.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".maio_2 := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_maio__2.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("{ ma_bitmap_length := ");
single_value->field_ma__bitmap__length.log_match(match_value.ma__bitmap__length(), legacy);
TTCN_Logger::log_event_str(", ma_bitmap := ");
single_value->field_ma__bitmap.log_match(match_value.ma__bitmap(), legacy);
TTCN_Logger::log_event_str(", maio_2_present := ");
single_value->field_maio__2__present.log_match(match_value.maio__2__present(), legacy);
TTCN_Logger::log_event_str(", maio_2 := ");
if (match_value.maio__2().ispresent()) {
single_value->field_maio__2.log_match(match_value.maio__2(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_maio__2.log();
if (single_value->field_maio__2.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 COMPACTreducedMA_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (ma__bitmap__length().is_bound()) ma__bitmap__length().set_implicit_omit();
if (ma__bitmap().is_bound()) ma__bitmap().set_implicit_omit();
if (maio__2__present().is_bound()) maio__2__present().set_implicit_omit();
if (!maio__2().is_bound()) maio__2() = OMIT_VALUE;
else maio__2().set_implicit_omit();
}

void COMPACTreducedMA_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_ma__bitmap__length.encode_text(text_buf);
single_value->field_ma__bitmap.encode_text(text_buf);
single_value->field_maio__2__present.encode_text(text_buf);
single_value->field_maio__2.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_CSN1_Types.COMPACTreducedMA.");
}
}

void COMPACTreducedMA_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_ma__bitmap__length.decode_text(text_buf);
single_value->field_ma__bitmap.decode_text(text_buf);
single_value->field_maio__2__present.decode_text(text_buf);
single_value->field_maio__2.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 COMPACTreducedMA_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_CSN1_Types.COMPACTreducedMA.");
}
}

void COMPACTreducedMA_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: {
    COMPACTreducedMA_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_CSN1_Types.COMPACTreducedMA 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) ma__bitmap__length().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ma__bitmap().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) maio__2__present().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) maio__2().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(), "ma_bitmap_length")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ma__bitmap__length().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ma_bitmap")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ma__bitmap().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "maio_2_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          maio__2__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(), "maio_2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          maio__2().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_CSN1_Types.COMPACTreducedMA: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    COMPACTreducedMA_template* precondition = new COMPACTreducedMA_template;
    precondition->set_param(*param.get_elem(0));
    COMPACTreducedMA_template* implied_template = new COMPACTreducedMA_template;
    implied_template->set_param(*param.get_elem(1));
    *this = COMPACTreducedMA_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.COMPACTreducedMA");
  }
  is_ifpresent = param.get_ifpresent();
}

void COMPACTreducedMA_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_ma__bitmap__length.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.COMPACTreducedMA");
single_value->field_ma__bitmap.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.COMPACTreducedMA");
single_value->field_maio__2__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.COMPACTreducedMA");
single_value->field_maio__2.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.COMPACTreducedMA");
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_CSN1_Types.COMPACTreducedMA");
}

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

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

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

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

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

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

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

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

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

boolean NetworkControlOrder::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_CSN1_Types.NetworkControlOrder.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @RLCMAC_CSN1_Types.NetworkControlOrder comparison is an unknown numeric value %d", other_value);
return enum_value == other_value;
}

boolean NetworkControlOrder::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_CSN1_Types.NetworkControlOrder.");
return enum_value == other_value;
}

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

boolean NetworkControlOrder::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_CSN1_Types.NetworkControlOrder.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @RLCMAC_CSN1_Types.NetworkControlOrder comparison is an unknown numeric value %d", other_value);
return enum_value < other_value;
}

boolean NetworkControlOrder::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_CSN1_Types.NetworkControlOrder.");
return enum_value < other_value;
}

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

boolean NetworkControlOrder::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_CSN1_Types.NetworkControlOrder.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @RLCMAC_CSN1_Types.NetworkControlOrder comparison is an unknown numeric value %d", other_value);
return enum_value > other_value;
}

boolean NetworkControlOrder::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_CSN1_Types.NetworkControlOrder.");
return enum_value > other_value;
}

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

const char *NetworkControlOrder::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case NC__0: return "NC_0";
case NC__1: return "NC_1";
case NC__2: return "NC_2";
case NC__RESET: return "NC_RESET";
default:
return "<unknown>";
}
}

NetworkControlOrder::enum_type NetworkControlOrder::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, "NC_0")) return NC__0;
if (!strcmp(str_par, "NC_1")) return NC__1;
if (!strcmp(str_par, "NC_2")) return NC__2;
if (!strcmp(str_par, "NC_RESET")) return NC__RESET;
}
return UNKNOWN_VALUE;
}

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

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

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

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

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

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

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

void NetworkControlOrder::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_CSN1_Types.NetworkControlOrder.", enum_value);
}

void NetworkControlOrder::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 NetworkControlOrder::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 NetworkControlOrder::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 NetworkControlOrder::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 NetworkControlOrder_template::copy_template(const NetworkControlOrder_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 NetworkControlOrder_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 NetworkControlOrder_template(*other_value.implication_.precondition);
implication_.implied_template = new NetworkControlOrder_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_CSN1_Types.NetworkControlOrder.");
}
}

NetworkControlOrder_template::NetworkControlOrder_template()
{
}

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

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

NetworkControlOrder_template::NetworkControlOrder_template(NetworkControlOrder::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

boolean NetworkControlOrder_template::match(NetworkControlOrder::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_CSN1_Types.NetworkControlOrder.");
}
return FALSE;
}

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

NetworkControlOrder::enum_type NetworkControlOrder_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_CSN1_Types.NetworkControlOrder.");
return single_value;
}

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

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

void NetworkControlOrder_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(NetworkControlOrder::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 NetworkControlOrder_template::log_match(const NetworkControlOrder& 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 NetworkControlOrder_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_CSN1_Types.NetworkControlOrder.");
}
}

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

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

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

void NetworkControlOrder_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_CSN1_Types.NetworkControlOrder");
}

CellSelection::CellSelection()
{
}

CellSelection::CellSelection(const BITSTRING& par_cell__barr__access__2,
    const BITSTRING& par_exc__acc,
    const BITSTRING& par_same__ra__as__serving__cell,
    const BITSTRING& par_gprs__rxlev__access__min__present,
    const BITSTRING& par_gprs__temporary__offset__present,
    const BITSTRING& par_gprs__reselct__offset__present,
    const BITSTRING& par_hcs__params__present,
    const BITSTRING& par_si13__pbcch__location__present)
  :   field_cell__barr__access__2(par_cell__barr__access__2),
  field_exc__acc(par_exc__acc),
  field_same__ra__as__serving__cell(par_same__ra__as__serving__cell),
  field_gprs__rxlev__access__min__present(par_gprs__rxlev__access__min__present),
  field_gprs__temporary__offset__present(par_gprs__temporary__offset__present),
  field_gprs__reselct__offset__present(par_gprs__reselct__offset__present),
  field_hcs__params__present(par_hcs__params__present),
  field_si13__pbcch__location__present(par_si13__pbcch__location__present)
{
}

CellSelection::CellSelection(const CellSelection& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.CellSelection.");
if (other_value.cell__barr__access__2().is_bound()) field_cell__barr__access__2 = other_value.cell__barr__access__2();
else field_cell__barr__access__2.clean_up();
if (other_value.exc__acc().is_bound()) field_exc__acc = other_value.exc__acc();
else field_exc__acc.clean_up();
if (other_value.same__ra__as__serving__cell().is_bound()) field_same__ra__as__serving__cell = other_value.same__ra__as__serving__cell();
else field_same__ra__as__serving__cell.clean_up();
if (other_value.gprs__rxlev__access__min__present().is_bound()) field_gprs__rxlev__access__min__present = other_value.gprs__rxlev__access__min__present();
else field_gprs__rxlev__access__min__present.clean_up();
if (other_value.gprs__temporary__offset__present().is_bound()) field_gprs__temporary__offset__present = other_value.gprs__temporary__offset__present();
else field_gprs__temporary__offset__present.clean_up();
if (other_value.gprs__reselct__offset__present().is_bound()) field_gprs__reselct__offset__present = other_value.gprs__reselct__offset__present();
else field_gprs__reselct__offset__present.clean_up();
if (other_value.hcs__params__present().is_bound()) field_hcs__params__present = other_value.hcs__params__present();
else field_hcs__params__present.clean_up();
if (other_value.si13__pbcch__location__present().is_bound()) field_si13__pbcch__location__present = other_value.si13__pbcch__location__present();
else field_si13__pbcch__location__present.clean_up();
}

void CellSelection::clean_up()
{
field_cell__barr__access__2.clean_up();
field_exc__acc.clean_up();
field_same__ra__as__serving__cell.clean_up();
field_gprs__rxlev__access__min__present.clean_up();
field_gprs__temporary__offset__present.clean_up();
field_gprs__reselct__offset__present.clean_up();
field_hcs__params__present.clean_up();
field_si13__pbcch__location__present.clean_up();
}

const TTCN_Typedescriptor_t* CellSelection::get_descriptor() const { return &CellSelection_descr_; }
CellSelection& CellSelection::operator=(const CellSelection& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.CellSelection.");
  if (other_value.cell__barr__access__2().is_bound()) field_cell__barr__access__2 = other_value.cell__barr__access__2();
  else field_cell__barr__access__2.clean_up();
  if (other_value.exc__acc().is_bound()) field_exc__acc = other_value.exc__acc();
  else field_exc__acc.clean_up();
  if (other_value.same__ra__as__serving__cell().is_bound()) field_same__ra__as__serving__cell = other_value.same__ra__as__serving__cell();
  else field_same__ra__as__serving__cell.clean_up();
  if (other_value.gprs__rxlev__access__min__present().is_bound()) field_gprs__rxlev__access__min__present = other_value.gprs__rxlev__access__min__present();
  else field_gprs__rxlev__access__min__present.clean_up();
  if (other_value.gprs__temporary__offset__present().is_bound()) field_gprs__temporary__offset__present = other_value.gprs__temporary__offset__present();
  else field_gprs__temporary__offset__present.clean_up();
  if (other_value.gprs__reselct__offset__present().is_bound()) field_gprs__reselct__offset__present = other_value.gprs__reselct__offset__present();
  else field_gprs__reselct__offset__present.clean_up();
  if (other_value.hcs__params__present().is_bound()) field_hcs__params__present = other_value.hcs__params__present();
  else field_hcs__params__present.clean_up();
  if (other_value.si13__pbcch__location__present().is_bound()) field_si13__pbcch__location__present = other_value.si13__pbcch__location__present();
  else field_si13__pbcch__location__present.clean_up();
}
return *this;
}

boolean CellSelection::operator==(const CellSelection& other_value) const
{
return field_cell__barr__access__2==other_value.field_cell__barr__access__2
  && field_exc__acc==other_value.field_exc__acc
  && field_same__ra__as__serving__cell==other_value.field_same__ra__as__serving__cell
  && field_gprs__rxlev__access__min__present==other_value.field_gprs__rxlev__access__min__present
  && field_gprs__temporary__offset__present==other_value.field_gprs__temporary__offset__present
  && field_gprs__reselct__offset__present==other_value.field_gprs__reselct__offset__present
  && field_hcs__params__present==other_value.field_hcs__params__present
  && field_si13__pbcch__location__present==other_value.field_si13__pbcch__location__present;
}

boolean CellSelection::is_bound() const
{
return (field_cell__barr__access__2.is_bound())
  || (field_exc__acc.is_bound())
  || (field_same__ra__as__serving__cell.is_bound())
  || (field_gprs__rxlev__access__min__present.is_bound())
  || (field_gprs__temporary__offset__present.is_bound())
  || (field_gprs__reselct__offset__present.is_bound())
  || (field_hcs__params__present.is_bound())
  || (field_si13__pbcch__location__present.is_bound());
}
boolean CellSelection::is_value() const
{
return field_cell__barr__access__2.is_value()
  && field_exc__acc.is_value()
  && field_same__ra__as__serving__cell.is_value()
  && field_gprs__rxlev__access__min__present.is_value()
  && field_gprs__temporary__offset__present.is_value()
  && field_gprs__reselct__offset__present.is_value()
  && field_hcs__params__present.is_value()
  && field_si13__pbcch__location__present.is_value();
}
void CellSelection::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ cell_barr_access_2 := ");
field_cell__barr__access__2.log();
TTCN_Logger::log_event_str(", exc_acc := ");
field_exc__acc.log();
TTCN_Logger::log_event_str(", same_ra_as_serving_cell := ");
field_same__ra__as__serving__cell.log();
TTCN_Logger::log_event_str(", gprs_rxlev_access_min_present := ");
field_gprs__rxlev__access__min__present.log();
TTCN_Logger::log_event_str(", gprs_temporary_offset_present := ");
field_gprs__temporary__offset__present.log();
TTCN_Logger::log_event_str(", gprs_reselct_offset_present := ");
field_gprs__reselct__offset__present.log();
TTCN_Logger::log_event_str(", hcs_params_present := ");
field_hcs__params__present.log();
TTCN_Logger::log_event_str(", si13_pbcch_location_present := ");
field_si13__pbcch__location__present.log();
TTCN_Logger::log_event_str(" }");
}

void CellSelection::set_implicit_omit()
{
if (cell__barr__access__2().is_bound()) cell__barr__access__2().set_implicit_omit();
if (exc__acc().is_bound()) exc__acc().set_implicit_omit();
if (same__ra__as__serving__cell().is_bound()) same__ra__as__serving__cell().set_implicit_omit();
if (gprs__rxlev__access__min__present().is_bound()) gprs__rxlev__access__min__present().set_implicit_omit();
if (gprs__temporary__offset__present().is_bound()) gprs__temporary__offset__present().set_implicit_omit();
if (gprs__reselct__offset__present().is_bound()) gprs__reselct__offset__present().set_implicit_omit();
if (hcs__params__present().is_bound()) hcs__params__present().set_implicit_omit();
if (si13__pbcch__location__present().is_bound()) si13__pbcch__location__present().set_implicit_omit();
}

void CellSelection::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (8<param.get_size()) {
      param.error("record value of type @RLCMAC_CSN1_Types.CellSelection has 8 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) cell__barr__access__2().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) exc__acc().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) same__ra__as__serving__cell().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) gprs__rxlev__access__min__present().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) gprs__temporary__offset__present().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) gprs__reselct__offset__present().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) hcs__params__present().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) si13__pbcch__location__present().set_param(*param.get_elem(7));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cell_barr_access_2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cell__barr__access__2().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "exc_acc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          exc__acc().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "same_ra_as_serving_cell")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          same__ra__as__serving__cell().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gprs_rxlev_access_min_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gprs__rxlev__access__min__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(), "gprs_temporary_offset_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gprs__temporary__offset__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(), "gprs_reselct_offset_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gprs__reselct__offset__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(), "hcs_params_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          hcs__params__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(), "si13_pbcch_location_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          si13__pbcch__location__present().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_CSN1_Types.CellSelection: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.CellSelection");
  }
}

void CellSelection::encode_text(Text_Buf& text_buf) const
{
field_cell__barr__access__2.encode_text(text_buf);
field_exc__acc.encode_text(text_buf);
field_same__ra__as__serving__cell.encode_text(text_buf);
field_gprs__rxlev__access__min__present.encode_text(text_buf);
field_gprs__temporary__offset__present.encode_text(text_buf);
field_gprs__reselct__offset__present.encode_text(text_buf);
field_hcs__params__present.encode_text(text_buf);
field_si13__pbcch__location__present.encode_text(text_buf);
}

void CellSelection::decode_text(Text_Buf& text_buf)
{
field_cell__barr__access__2.decode_text(text_buf);
field_exc__acc.decode_text(text_buf);
field_same__ra__as__serving__cell.decode_text(text_buf);
field_gprs__rxlev__access__min__present.decode_text(text_buf);
field_gprs__temporary__offset__present.decode_text(text_buf);
field_gprs__reselct__offset__present.decode_text(text_buf);
field_hcs__params__present.decode_text(text_buf);
field_si13__pbcch__location__present.decode_text(text_buf);
}

void CellSelection::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 CellSelection::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 CellSelection::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, CellSelection_cell__barr__access__2_descr_.raw->forceomit);
  decoded_field_length = field_cell__barr__access__2.RAW_decode(CellSelection_cell__barr__access__2_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, CellSelection_exc__acc_descr_.raw->forceomit);
  decoded_field_length = field_exc__acc.RAW_decode(CellSelection_exc__acc_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, CellSelection_same__ra__as__serving__cell_descr_.raw->forceomit);
  decoded_field_length = field_same__ra__as__serving__cell.RAW_decode(CellSelection_same__ra__as__serving__cell_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, CellSelection_gprs__rxlev__access__min__present_descr_.raw->forceomit);
  decoded_field_length = field_gprs__rxlev__access__min__present.RAW_decode(CellSelection_gprs__rxlev__access__min__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());
  RAW_Force_Omit field_4_force_omit(4, force_omit, CellSelection_gprs__temporary__offset__present_descr_.raw->forceomit);
  decoded_field_length = field_gprs__temporary__offset__present.RAW_decode(CellSelection_gprs__temporary__offset__present_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, CellSelection_gprs__reselct__offset__present_descr_.raw->forceomit);
  decoded_field_length = field_gprs__reselct__offset__present.RAW_decode(CellSelection_gprs__reselct__offset__present_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, CellSelection_hcs__params__present_descr_.raw->forceomit);
  decoded_field_length = field_hcs__params__present.RAW_decode(CellSelection_hcs__params__present_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, CellSelection_si13__pbcch__location__present_descr_.raw->forceomit);
  decoded_field_length = field_si13__pbcch__location__present.RAW_decode(CellSelection_si13__pbcch__location__present_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_7_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int CellSelection::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 8;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(8);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, CellSelection_cell__barr__access__2_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, CellSelection_exc__acc_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, CellSelection_same__ra__as__serving__cell_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, CellSelection_gprs__rxlev__access__min__present_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, CellSelection_gprs__temporary__offset__present_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, CellSelection_gprs__reselct__offset__present_descr_.raw);
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, CellSelection_hcs__params__present_descr_.raw);
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, CellSelection_si13__pbcch__location__present_descr_.raw);
  encoded_length += field_cell__barr__access__2.RAW_encode(CellSelection_cell__barr__access__2_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_exc__acc.RAW_encode(CellSelection_exc__acc_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_same__ra__as__serving__cell.RAW_encode(CellSelection_same__ra__as__serving__cell_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_gprs__rxlev__access__min__present.RAW_encode(CellSelection_gprs__rxlev__access__min__present_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_gprs__temporary__offset__present.RAW_encode(CellSelection_gprs__temporary__offset__present_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_gprs__reselct__offset__present.RAW_encode(CellSelection_gprs__reselct__offset__present_descr_, *myleaf.body.node.nodes[5]);
  encoded_length += field_hcs__params__present.RAW_encode(CellSelection_hcs__params__present_descr_, *myleaf.body.node.nodes[6]);
  encoded_length += field_si13__pbcch__location__present.RAW_encode(CellSelection_si13__pbcch__location__present_descr_, *myleaf.body.node.nodes[7]);
  return myleaf.length = encoded_length;
}

struct CellSelection_template::single_value_struct {
BITSTRING_template field_cell__barr__access__2;
BITSTRING_template field_exc__acc;
BITSTRING_template field_same__ra__as__serving__cell;
BITSTRING_template field_gprs__rxlev__access__min__present;
BITSTRING_template field_gprs__temporary__offset__present;
BITSTRING_template field_gprs__reselct__offset__present;
BITSTRING_template field_hcs__params__present;
BITSTRING_template field_si13__pbcch__location__present;
};

void CellSelection_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_cell__barr__access__2 = ANY_VALUE;
single_value->field_exc__acc = ANY_VALUE;
single_value->field_same__ra__as__serving__cell = ANY_VALUE;
single_value->field_gprs__rxlev__access__min__present = ANY_VALUE;
single_value->field_gprs__temporary__offset__present = ANY_VALUE;
single_value->field_gprs__reselct__offset__present = ANY_VALUE;
single_value->field_hcs__params__present = ANY_VALUE;
single_value->field_si13__pbcch__location__present = ANY_VALUE;
}
}
}

void CellSelection_template::copy_value(const CellSelection& other_value)
{
single_value = new single_value_struct;
if (other_value.cell__barr__access__2().is_bound()) {
  single_value->field_cell__barr__access__2 = other_value.cell__barr__access__2();
} else {
  single_value->field_cell__barr__access__2.clean_up();
}
if (other_value.exc__acc().is_bound()) {
  single_value->field_exc__acc = other_value.exc__acc();
} else {
  single_value->field_exc__acc.clean_up();
}
if (other_value.same__ra__as__serving__cell().is_bound()) {
  single_value->field_same__ra__as__serving__cell = other_value.same__ra__as__serving__cell();
} else {
  single_value->field_same__ra__as__serving__cell.clean_up();
}
if (other_value.gprs__rxlev__access__min__present().is_bound()) {
  single_value->field_gprs__rxlev__access__min__present = other_value.gprs__rxlev__access__min__present();
} else {
  single_value->field_gprs__rxlev__access__min__present.clean_up();
}
if (other_value.gprs__temporary__offset__present().is_bound()) {
  single_value->field_gprs__temporary__offset__present = other_value.gprs__temporary__offset__present();
} else {
  single_value->field_gprs__temporary__offset__present.clean_up();
}
if (other_value.gprs__reselct__offset__present().is_bound()) {
  single_value->field_gprs__reselct__offset__present = other_value.gprs__reselct__offset__present();
} else {
  single_value->field_gprs__reselct__offset__present.clean_up();
}
if (other_value.hcs__params__present().is_bound()) {
  single_value->field_hcs__params__present = other_value.hcs__params__present();
} else {
  single_value->field_hcs__params__present.clean_up();
}
if (other_value.si13__pbcch__location__present().is_bound()) {
  single_value->field_si13__pbcch__location__present = other_value.si13__pbcch__location__present();
} else {
  single_value->field_si13__pbcch__location__present.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void CellSelection_template::copy_template(const CellSelection_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.cell__barr__access__2().get_selection()) {
single_value->field_cell__barr__access__2 = other_value.cell__barr__access__2();
} else {
single_value->field_cell__barr__access__2.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.exc__acc().get_selection()) {
single_value->field_exc__acc = other_value.exc__acc();
} else {
single_value->field_exc__acc.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.same__ra__as__serving__cell().get_selection()) {
single_value->field_same__ra__as__serving__cell = other_value.same__ra__as__serving__cell();
} else {
single_value->field_same__ra__as__serving__cell.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.gprs__rxlev__access__min__present().get_selection()) {
single_value->field_gprs__rxlev__access__min__present = other_value.gprs__rxlev__access__min__present();
} else {
single_value->field_gprs__rxlev__access__min__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.gprs__temporary__offset__present().get_selection()) {
single_value->field_gprs__temporary__offset__present = other_value.gprs__temporary__offset__present();
} else {
single_value->field_gprs__temporary__offset__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.gprs__reselct__offset__present().get_selection()) {
single_value->field_gprs__reselct__offset__present = other_value.gprs__reselct__offset__present();
} else {
single_value->field_gprs__reselct__offset__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.hcs__params__present().get_selection()) {
single_value->field_hcs__params__present = other_value.hcs__params__present();
} else {
single_value->field_hcs__params__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.si13__pbcch__location__present().get_selection()) {
single_value->field_si13__pbcch__location__present = other_value.si13__pbcch__location__present();
} else {
single_value->field_si13__pbcch__location__present.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 CellSelection_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 CellSelection_template(*other_value.implication_.precondition);
implication_.implied_template = new CellSelection_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_CSN1_Types.CellSelection.");
break;
}
set_selection(other_value);
}

CellSelection_template::CellSelection_template()
{
}

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

CellSelection_template::CellSelection_template(const CellSelection& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean CellSelection_template::match(const CellSelection& 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.cell__barr__access__2().is_bound()) return FALSE;
if(!single_value->field_cell__barr__access__2.match(other_value.cell__barr__access__2(), legacy))return FALSE;
if(!other_value.exc__acc().is_bound()) return FALSE;
if(!single_value->field_exc__acc.match(other_value.exc__acc(), legacy))return FALSE;
if(!other_value.same__ra__as__serving__cell().is_bound()) return FALSE;
if(!single_value->field_same__ra__as__serving__cell.match(other_value.same__ra__as__serving__cell(), legacy))return FALSE;
if(!other_value.gprs__rxlev__access__min__present().is_bound()) return FALSE;
if(!single_value->field_gprs__rxlev__access__min__present.match(other_value.gprs__rxlev__access__min__present(), legacy))return FALSE;
if(!other_value.gprs__temporary__offset__present().is_bound()) return FALSE;
if(!single_value->field_gprs__temporary__offset__present.match(other_value.gprs__temporary__offset__present(), legacy))return FALSE;
if(!other_value.gprs__reselct__offset__present().is_bound()) return FALSE;
if(!single_value->field_gprs__reselct__offset__present.match(other_value.gprs__reselct__offset__present(), legacy))return FALSE;
if(!other_value.hcs__params__present().is_bound()) return FALSE;
if(!single_value->field_hcs__params__present.match(other_value.hcs__params__present(), legacy))return FALSE;
if(!other_value.si13__pbcch__location__present().is_bound()) return FALSE;
if(!single_value->field_si13__pbcch__location__present.match(other_value.si13__pbcch__location__present(), 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_CSN1_Types.CellSelection.");
}
return FALSE;
}

boolean CellSelection_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_cell__barr__access__2.is_bound()
 || single_value->field_exc__acc.is_bound()
 || single_value->field_same__ra__as__serving__cell.is_bound()
 || single_value->field_gprs__rxlev__access__min__present.is_bound()
 || single_value->field_gprs__temporary__offset__present.is_bound()
 || single_value->field_gprs__reselct__offset__present.is_bound()
 || single_value->field_hcs__params__present.is_bound()
 || single_value->field_si13__pbcch__location__present.is_bound();
}

boolean CellSelection_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_cell__barr__access__2.is_value()
 && single_value->field_exc__acc.is_value()
 && single_value->field_same__ra__as__serving__cell.is_value()
 && single_value->field_gprs__rxlev__access__min__present.is_value()
 && single_value->field_gprs__temporary__offset__present.is_value()
 && single_value->field_gprs__reselct__offset__present.is_value()
 && single_value->field_hcs__params__present.is_value()
 && single_value->field_si13__pbcch__location__present.is_value();
}

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

CellSelection CellSelection_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_CSN1_Types.CellSelection.");
CellSelection ret_val;
if (single_value->field_cell__barr__access__2.is_bound()) {
ret_val.cell__barr__access__2() = single_value->field_cell__barr__access__2.valueof();
}
if (single_value->field_exc__acc.is_bound()) {
ret_val.exc__acc() = single_value->field_exc__acc.valueof();
}
if (single_value->field_same__ra__as__serving__cell.is_bound()) {
ret_val.same__ra__as__serving__cell() = single_value->field_same__ra__as__serving__cell.valueof();
}
if (single_value->field_gprs__rxlev__access__min__present.is_bound()) {
ret_val.gprs__rxlev__access__min__present() = single_value->field_gprs__rxlev__access__min__present.valueof();
}
if (single_value->field_gprs__temporary__offset__present.is_bound()) {
ret_val.gprs__temporary__offset__present() = single_value->field_gprs__temporary__offset__present.valueof();
}
if (single_value->field_gprs__reselct__offset__present.is_bound()) {
ret_val.gprs__reselct__offset__present() = single_value->field_gprs__reselct__offset__present.valueof();
}
if (single_value->field_hcs__params__present.is_bound()) {
ret_val.hcs__params__present() = single_value->field_hcs__params__present.valueof();
}
if (single_value->field_si13__pbcch__location__present.is_bound()) {
ret_val.si13__pbcch__location__present() = single_value->field_si13__pbcch__location__present.valueof();
}
return ret_val;
}

void CellSelection_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_CSN1_Types.CellSelection.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new CellSelection_template[list_length];
}

CellSelection_template& CellSelection_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_CSN1_Types.CellSelection.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.CellSelection.");
return value_list.list_value[list_index];
}

BITSTRING_template& CellSelection_template::cell__barr__access__2()
{
set_specific();
return single_value->field_cell__barr__access__2;
}

const BITSTRING_template& CellSelection_template::cell__barr__access__2() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field cell_barr_access_2 of a non-specific template of type @RLCMAC_CSN1_Types.CellSelection.");
return single_value->field_cell__barr__access__2;
}

BITSTRING_template& CellSelection_template::exc__acc()
{
set_specific();
return single_value->field_exc__acc;
}

const BITSTRING_template& CellSelection_template::exc__acc() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field exc_acc of a non-specific template of type @RLCMAC_CSN1_Types.CellSelection.");
return single_value->field_exc__acc;
}

BITSTRING_template& CellSelection_template::same__ra__as__serving__cell()
{
set_specific();
return single_value->field_same__ra__as__serving__cell;
}

const BITSTRING_template& CellSelection_template::same__ra__as__serving__cell() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field same_ra_as_serving_cell of a non-specific template of type @RLCMAC_CSN1_Types.CellSelection.");
return single_value->field_same__ra__as__serving__cell;
}

BITSTRING_template& CellSelection_template::gprs__rxlev__access__min__present()
{
set_specific();
return single_value->field_gprs__rxlev__access__min__present;
}

const BITSTRING_template& CellSelection_template::gprs__rxlev__access__min__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field gprs_rxlev_access_min_present of a non-specific template of type @RLCMAC_CSN1_Types.CellSelection.");
return single_value->field_gprs__rxlev__access__min__present;
}

BITSTRING_template& CellSelection_template::gprs__temporary__offset__present()
{
set_specific();
return single_value->field_gprs__temporary__offset__present;
}

const BITSTRING_template& CellSelection_template::gprs__temporary__offset__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field gprs_temporary_offset_present of a non-specific template of type @RLCMAC_CSN1_Types.CellSelection.");
return single_value->field_gprs__temporary__offset__present;
}

BITSTRING_template& CellSelection_template::gprs__reselct__offset__present()
{
set_specific();
return single_value->field_gprs__reselct__offset__present;
}

const BITSTRING_template& CellSelection_template::gprs__reselct__offset__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field gprs_reselct_offset_present of a non-specific template of type @RLCMAC_CSN1_Types.CellSelection.");
return single_value->field_gprs__reselct__offset__present;
}

BITSTRING_template& CellSelection_template::hcs__params__present()
{
set_specific();
return single_value->field_hcs__params__present;
}

const BITSTRING_template& CellSelection_template::hcs__params__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field hcs_params_present of a non-specific template of type @RLCMAC_CSN1_Types.CellSelection.");
return single_value->field_hcs__params__present;
}

BITSTRING_template& CellSelection_template::si13__pbcch__location__present()
{
set_specific();
return single_value->field_si13__pbcch__location__present;
}

const BITSTRING_template& CellSelection_template::si13__pbcch__location__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field si13_pbcch_location_present of a non-specific template of type @RLCMAC_CSN1_Types.CellSelection.");
return single_value->field_si13__pbcch__location__present;
}

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

void CellSelection_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ cell_barr_access_2 := ");
single_value->field_cell__barr__access__2.log();
TTCN_Logger::log_event_str(", exc_acc := ");
single_value->field_exc__acc.log();
TTCN_Logger::log_event_str(", same_ra_as_serving_cell := ");
single_value->field_same__ra__as__serving__cell.log();
TTCN_Logger::log_event_str(", gprs_rxlev_access_min_present := ");
single_value->field_gprs__rxlev__access__min__present.log();
TTCN_Logger::log_event_str(", gprs_temporary_offset_present := ");
single_value->field_gprs__temporary__offset__present.log();
TTCN_Logger::log_event_str(", gprs_reselct_offset_present := ");
single_value->field_gprs__reselct__offset__present.log();
TTCN_Logger::log_event_str(", hcs_params_present := ");
single_value->field_hcs__params__present.log();
TTCN_Logger::log_event_str(", si13_pbcch_location_present := ");
single_value->field_si13__pbcch__location__present.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 CellSelection_template::log_match(const CellSelection& 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_cell__barr__access__2.match(match_value.cell__barr__access__2(), legacy)){
TTCN_Logger::log_logmatch_info(".cell_barr_access_2");
single_value->field_cell__barr__access__2.log_match(match_value.cell__barr__access__2(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_exc__acc.match(match_value.exc__acc(), legacy)){
TTCN_Logger::log_logmatch_info(".exc_acc");
single_value->field_exc__acc.log_match(match_value.exc__acc(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_same__ra__as__serving__cell.match(match_value.same__ra__as__serving__cell(), legacy)){
TTCN_Logger::log_logmatch_info(".same_ra_as_serving_cell");
single_value->field_same__ra__as__serving__cell.log_match(match_value.same__ra__as__serving__cell(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_gprs__rxlev__access__min__present.match(match_value.gprs__rxlev__access__min__present(), legacy)){
TTCN_Logger::log_logmatch_info(".gprs_rxlev_access_min_present");
single_value->field_gprs__rxlev__access__min__present.log_match(match_value.gprs__rxlev__access__min__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_gprs__temporary__offset__present.match(match_value.gprs__temporary__offset__present(), legacy)){
TTCN_Logger::log_logmatch_info(".gprs_temporary_offset_present");
single_value->field_gprs__temporary__offset__present.log_match(match_value.gprs__temporary__offset__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_gprs__reselct__offset__present.match(match_value.gprs__reselct__offset__present(), legacy)){
TTCN_Logger::log_logmatch_info(".gprs_reselct_offset_present");
single_value->field_gprs__reselct__offset__present.log_match(match_value.gprs__reselct__offset__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_hcs__params__present.match(match_value.hcs__params__present(), legacy)){
TTCN_Logger::log_logmatch_info(".hcs_params_present");
single_value->field_hcs__params__present.log_match(match_value.hcs__params__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_si13__pbcch__location__present.match(match_value.si13__pbcch__location__present(), legacy)){
TTCN_Logger::log_logmatch_info(".si13_pbcch_location_present");
single_value->field_si13__pbcch__location__present.log_match(match_value.si13__pbcch__location__present(), 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("{ cell_barr_access_2 := ");
single_value->field_cell__barr__access__2.log_match(match_value.cell__barr__access__2(), legacy);
TTCN_Logger::log_event_str(", exc_acc := ");
single_value->field_exc__acc.log_match(match_value.exc__acc(), legacy);
TTCN_Logger::log_event_str(", same_ra_as_serving_cell := ");
single_value->field_same__ra__as__serving__cell.log_match(match_value.same__ra__as__serving__cell(), legacy);
TTCN_Logger::log_event_str(", gprs_rxlev_access_min_present := ");
single_value->field_gprs__rxlev__access__min__present.log_match(match_value.gprs__rxlev__access__min__present(), legacy);
TTCN_Logger::log_event_str(", gprs_temporary_offset_present := ");
single_value->field_gprs__temporary__offset__present.log_match(match_value.gprs__temporary__offset__present(), legacy);
TTCN_Logger::log_event_str(", gprs_reselct_offset_present := ");
single_value->field_gprs__reselct__offset__present.log_match(match_value.gprs__reselct__offset__present(), legacy);
TTCN_Logger::log_event_str(", hcs_params_present := ");
single_value->field_hcs__params__present.log_match(match_value.hcs__params__present(), legacy);
TTCN_Logger::log_event_str(", si13_pbcch_location_present := ");
single_value->field_si13__pbcch__location__present.log_match(match_value.si13__pbcch__location__present(), 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 CellSelection_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (cell__barr__access__2().is_bound()) cell__barr__access__2().set_implicit_omit();
if (exc__acc().is_bound()) exc__acc().set_implicit_omit();
if (same__ra__as__serving__cell().is_bound()) same__ra__as__serving__cell().set_implicit_omit();
if (gprs__rxlev__access__min__present().is_bound()) gprs__rxlev__access__min__present().set_implicit_omit();
if (gprs__temporary__offset__present().is_bound()) gprs__temporary__offset__present().set_implicit_omit();
if (gprs__reselct__offset__present().is_bound()) gprs__reselct__offset__present().set_implicit_omit();
if (hcs__params__present().is_bound()) hcs__params__present().set_implicit_omit();
if (si13__pbcch__location__present().is_bound()) si13__pbcch__location__present().set_implicit_omit();
}

void CellSelection_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_cell__barr__access__2.encode_text(text_buf);
single_value->field_exc__acc.encode_text(text_buf);
single_value->field_same__ra__as__serving__cell.encode_text(text_buf);
single_value->field_gprs__rxlev__access__min__present.encode_text(text_buf);
single_value->field_gprs__temporary__offset__present.encode_text(text_buf);
single_value->field_gprs__reselct__offset__present.encode_text(text_buf);
single_value->field_hcs__params__present.encode_text(text_buf);
single_value->field_si13__pbcch__location__present.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_CSN1_Types.CellSelection.");
}
}

void CellSelection_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_cell__barr__access__2.decode_text(text_buf);
single_value->field_exc__acc.decode_text(text_buf);
single_value->field_same__ra__as__serving__cell.decode_text(text_buf);
single_value->field_gprs__rxlev__access__min__present.decode_text(text_buf);
single_value->field_gprs__temporary__offset__present.decode_text(text_buf);
single_value->field_gprs__reselct__offset__present.decode_text(text_buf);
single_value->field_hcs__params__present.decode_text(text_buf);
single_value->field_si13__pbcch__location__present.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 CellSelection_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_CSN1_Types.CellSelection.");
}
}

void CellSelection_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: {
    CellSelection_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (8<param.get_size()) {
      param.error("record template of type @RLCMAC_CSN1_Types.CellSelection has 8 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) cell__barr__access__2().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) exc__acc().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) same__ra__as__serving__cell().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) gprs__rxlev__access__min__present().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) gprs__temporary__offset__present().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) gprs__reselct__offset__present().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) hcs__params__present().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) si13__pbcch__location__present().set_param(*param.get_elem(7));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cell_barr_access_2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cell__barr__access__2().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "exc_acc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          exc__acc().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "same_ra_as_serving_cell")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          same__ra__as__serving__cell().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gprs_rxlev_access_min_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gprs__rxlev__access__min__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(), "gprs_temporary_offset_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gprs__temporary__offset__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(), "gprs_reselct_offset_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gprs__reselct__offset__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(), "hcs_params_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          hcs__params__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(), "si13_pbcch_location_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          si13__pbcch__location__present().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_CSN1_Types.CellSelection: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    CellSelection_template* precondition = new CellSelection_template;
    precondition->set_param(*param.get_elem(0));
    CellSelection_template* implied_template = new CellSelection_template;
    implied_template->set_param(*param.get_elem(1));
    *this = CellSelection_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.CellSelection");
  }
  is_ifpresent = param.get_ifpresent();
}

void CellSelection_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_cell__barr__access__2.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.CellSelection");
single_value->field_exc__acc.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.CellSelection");
single_value->field_same__ra__as__serving__cell.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.CellSelection");
single_value->field_gprs__rxlev__access__min__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.CellSelection");
single_value->field_gprs__temporary__offset__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.CellSelection");
single_value->field_gprs__reselct__offset__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.CellSelection");
single_value->field_hcs__params__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.CellSelection");
single_value->field_si13__pbcch__location__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.CellSelection");
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_CSN1_Types.CellSelection");
}

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

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

AddFrequency::AddFrequency()
{
}

AddFrequency::AddFrequency(const INTEGER& par_start__frequency,
    const INTEGER& par_bsic,
    const BITSTRING& par_cell__sel__par__present,
    const OPTIONAL< CellSelection >& par_cell__sel__par,
    const INTEGER& par_nr__of__frequencies,
    const INTEGER& par_freq__diff__length)
  :   field_start__frequency(par_start__frequency),
  field_bsic(par_bsic),
  field_cell__sel__par__present(par_cell__sel__par__present),
  field_cell__sel__par(par_cell__sel__par),
  field_nr__of__frequencies(par_nr__of__frequencies),
  field_freq__diff__length(par_freq__diff__length)
{
}

AddFrequency::AddFrequency(const AddFrequency& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.AddFrequency.");
if (other_value.start__frequency().is_bound()) field_start__frequency = other_value.start__frequency();
else field_start__frequency.clean_up();
if (other_value.bsic().is_bound()) field_bsic = other_value.bsic();
else field_bsic.clean_up();
if (other_value.cell__sel__par__present().is_bound()) field_cell__sel__par__present = other_value.cell__sel__par__present();
else field_cell__sel__par__present.clean_up();
if (other_value.cell__sel__par().is_bound()) field_cell__sel__par = other_value.cell__sel__par();
else field_cell__sel__par.clean_up();
if (other_value.nr__of__frequencies().is_bound()) field_nr__of__frequencies = other_value.nr__of__frequencies();
else field_nr__of__frequencies.clean_up();
if (other_value.freq__diff__length().is_bound()) field_freq__diff__length = other_value.freq__diff__length();
else field_freq__diff__length.clean_up();
}

void AddFrequency::clean_up()
{
field_start__frequency.clean_up();
field_bsic.clean_up();
field_cell__sel__par__present.clean_up();
field_cell__sel__par.clean_up();
field_nr__of__frequencies.clean_up();
field_freq__diff__length.clean_up();
}

const TTCN_Typedescriptor_t* AddFrequency::get_descriptor() const { return &AddFrequency_descr_; }
AddFrequency& AddFrequency::operator=(const AddFrequency& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.AddFrequency.");
  if (other_value.start__frequency().is_bound()) field_start__frequency = other_value.start__frequency();
  else field_start__frequency.clean_up();
  if (other_value.bsic().is_bound()) field_bsic = other_value.bsic();
  else field_bsic.clean_up();
  if (other_value.cell__sel__par__present().is_bound()) field_cell__sel__par__present = other_value.cell__sel__par__present();
  else field_cell__sel__par__present.clean_up();
  if (other_value.cell__sel__par().is_bound()) field_cell__sel__par = other_value.cell__sel__par();
  else field_cell__sel__par.clean_up();
  if (other_value.nr__of__frequencies().is_bound()) field_nr__of__frequencies = other_value.nr__of__frequencies();
  else field_nr__of__frequencies.clean_up();
  if (other_value.freq__diff__length().is_bound()) field_freq__diff__length = other_value.freq__diff__length();
  else field_freq__diff__length.clean_up();
}
return *this;
}

boolean AddFrequency::operator==(const AddFrequency& other_value) const
{
return field_start__frequency==other_value.field_start__frequency
  && field_bsic==other_value.field_bsic
  && field_cell__sel__par__present==other_value.field_cell__sel__par__present
  && field_cell__sel__par==other_value.field_cell__sel__par
  && field_nr__of__frequencies==other_value.field_nr__of__frequencies
  && field_freq__diff__length==other_value.field_freq__diff__length;
}

boolean AddFrequency::is_bound() const
{
return (field_start__frequency.is_bound())
  || (field_bsic.is_bound())
  || (field_cell__sel__par__present.is_bound())
  || (OPTIONAL_OMIT == field_cell__sel__par.get_selection() || field_cell__sel__par.is_bound())
  || (field_nr__of__frequencies.is_bound())
  || (field_freq__diff__length.is_bound());
}
boolean AddFrequency::is_value() const
{
return field_start__frequency.is_value()
  && field_bsic.is_value()
  && field_cell__sel__par__present.is_value()
  && (OPTIONAL_OMIT == field_cell__sel__par.get_selection() || field_cell__sel__par.is_value())
  && field_nr__of__frequencies.is_value()
  && field_freq__diff__length.is_value();
}
int AddFrequency::size_of() const
{
  int ret_val = 5;
  if (field_cell__sel__par.ispresent()) ret_val++;
  return ret_val;
}

void AddFrequency::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ start_frequency := ");
field_start__frequency.log();
TTCN_Logger::log_event_str(", bsic := ");
field_bsic.log();
TTCN_Logger::log_event_str(", cell_sel_par_present := ");
field_cell__sel__par__present.log();
TTCN_Logger::log_event_str(", cell_sel_par := ");
field_cell__sel__par.log();
TTCN_Logger::log_event_str(", nr_of_frequencies := ");
field_nr__of__frequencies.log();
TTCN_Logger::log_event_str(", freq_diff_length := ");
field_freq__diff__length.log();
TTCN_Logger::log_event_str(" }");
}

void AddFrequency::set_implicit_omit()
{
if (start__frequency().is_bound()) start__frequency().set_implicit_omit();
if (bsic().is_bound()) bsic().set_implicit_omit();
if (cell__sel__par__present().is_bound()) cell__sel__par__present().set_implicit_omit();
if (!cell__sel__par().is_bound()) cell__sel__par() = OMIT_VALUE;
else cell__sel__par().set_implicit_omit();
if (nr__of__frequencies().is_bound()) nr__of__frequencies().set_implicit_omit();
if (freq__diff__length().is_bound()) freq__diff__length().set_implicit_omit();
}

void AddFrequency::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_CSN1_Types.AddFrequency 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) start__frequency().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) bsic().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) cell__sel__par__present().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) cell__sel__par().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) nr__of__frequencies().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) freq__diff__length().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(), "start_frequency")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          start__frequency().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "bsic")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bsic().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cell_sel_par_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cell__sel__par__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(), "cell_sel_par")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cell__sel__par().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nr_of_frequencies")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nr__of__frequencies().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "freq_diff_length")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          freq__diff__length().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_CSN1_Types.AddFrequency: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.AddFrequency");
  }
}

void AddFrequency::encode_text(Text_Buf& text_buf) const
{
field_start__frequency.encode_text(text_buf);
field_bsic.encode_text(text_buf);
field_cell__sel__par__present.encode_text(text_buf);
field_cell__sel__par.encode_text(text_buf);
field_nr__of__frequencies.encode_text(text_buf);
field_freq__diff__length.encode_text(text_buf);
}

void AddFrequency::decode_text(Text_Buf& text_buf)
{
field_start__frequency.decode_text(text_buf);
field_bsic.decode_text(text_buf);
field_cell__sel__par__present.decode_text(text_buf);
field_cell__sel__par.decode_text(text_buf);
field_nr__of__frequencies.decode_text(text_buf);
field_freq__diff__length.decode_text(text_buf);
}

void AddFrequency::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 AddFrequency::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 AddFrequency::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, AddFrequency_start__frequency_descr_.raw->forceomit);
  decoded_field_length = field_start__frequency.RAW_decode(AddFrequency_start__frequency_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, AddFrequency_bsic_descr_.raw->forceomit);
  decoded_field_length = field_bsic.RAW_decode(AddFrequency_bsic_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, AddFrequency_cell__sel__par__present_descr_.raw->forceomit);
  decoded_field_length = field_cell__sel__par__present.RAW_decode(AddFrequency_cell__sel__par__present_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (limit > 0 && field_cell__sel__par__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(3)) {
    field_cell__sel__par = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_3_force_omit(3, force_omit, AddFrequency_cell__sel__par_descr_.raw->forceomit);
  decoded_field_length = field_cell__sel__par().RAW_decode(AddFrequency_cell__sel__par_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 1) {
  field_cell__sel__par = 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_cell__sel__par=OMIT_VALUE;
  RAW_Force_Omit field_4_force_omit(4, force_omit, AddFrequency_nr__of__frequencies_descr_.raw->forceomit);
  decoded_field_length = field_nr__of__frequencies.RAW_decode(AddFrequency_nr__of__frequencies_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, AddFrequency_freq__diff__length_descr_.raw->forceomit);
  decoded_field_length = field_freq__diff__length.RAW_decode(AddFrequency_freq__diff__length_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 AddFrequency::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, AddFrequency_start__frequency_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, AddFrequency_bsic_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, AddFrequency_cell__sel__par__present_descr_.raw);
  if (field_cell__sel__par.ispresent()) {
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, AddFrequency_cell__sel__par_descr_.raw);
  }
  else myleaf.body.node.nodes[3] = NULL;
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, AddFrequency_nr__of__frequencies_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, AddFrequency_freq__diff__length_descr_.raw);
  encoded_length += field_start__frequency.RAW_encode(AddFrequency_start__frequency_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_bsic.RAW_encode(AddFrequency_bsic_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_cell__sel__par__present.RAW_encode(AddFrequency_cell__sel__par__present_descr_, *myleaf.body.node.nodes[2]);
  if (field_cell__sel__par.ispresent()) {
  encoded_length += field_cell__sel__par().RAW_encode(AddFrequency_cell__sel__par_descr_, *myleaf.body.node.nodes[3]);
  }
  encoded_length += field_nr__of__frequencies.RAW_encode(AddFrequency_nr__of__frequencies_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_freq__diff__length.RAW_encode(AddFrequency_freq__diff__length_descr_, *myleaf.body.node.nodes[5]);
  if (field_cell__sel__par.ispresent() && (field_cell__sel__par__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={2};
  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(AddFrequency_cell__sel__par__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);
  }
  }
  return myleaf.length = encoded_length;
}

struct AddFrequency_template::single_value_struct {
INTEGER_template field_start__frequency;
INTEGER_template field_bsic;
BITSTRING_template field_cell__sel__par__present;
CellSelection_template field_cell__sel__par;
INTEGER_template field_nr__of__frequencies;
INTEGER_template field_freq__diff__length;
};

void AddFrequency_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_start__frequency = ANY_VALUE;
single_value->field_bsic = ANY_VALUE;
single_value->field_cell__sel__par__present = ANY_VALUE;
single_value->field_cell__sel__par = ANY_OR_OMIT;
single_value->field_nr__of__frequencies = ANY_VALUE;
single_value->field_freq__diff__length = ANY_VALUE;
}
}
}

void AddFrequency_template::copy_value(const AddFrequency& other_value)
{
single_value = new single_value_struct;
if (other_value.start__frequency().is_bound()) {
  single_value->field_start__frequency = other_value.start__frequency();
} else {
  single_value->field_start__frequency.clean_up();
}
if (other_value.bsic().is_bound()) {
  single_value->field_bsic = other_value.bsic();
} else {
  single_value->field_bsic.clean_up();
}
if (other_value.cell__sel__par__present().is_bound()) {
  single_value->field_cell__sel__par__present = other_value.cell__sel__par__present();
} else {
  single_value->field_cell__sel__par__present.clean_up();
}
if (other_value.cell__sel__par().is_bound()) {
  if (other_value.cell__sel__par().ispresent()) single_value->field_cell__sel__par = other_value.cell__sel__par()();
  else single_value->field_cell__sel__par = OMIT_VALUE;
} else {
  single_value->field_cell__sel__par.clean_up();
}
if (other_value.nr__of__frequencies().is_bound()) {
  single_value->field_nr__of__frequencies = other_value.nr__of__frequencies();
} else {
  single_value->field_nr__of__frequencies.clean_up();
}
if (other_value.freq__diff__length().is_bound()) {
  single_value->field_freq__diff__length = other_value.freq__diff__length();
} else {
  single_value->field_freq__diff__length.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void AddFrequency_template::copy_template(const AddFrequency_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.start__frequency().get_selection()) {
single_value->field_start__frequency = other_value.start__frequency();
} else {
single_value->field_start__frequency.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.bsic().get_selection()) {
single_value->field_bsic = other_value.bsic();
} else {
single_value->field_bsic.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.cell__sel__par__present().get_selection()) {
single_value->field_cell__sel__par__present = other_value.cell__sel__par__present();
} else {
single_value->field_cell__sel__par__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.cell__sel__par().get_selection()) {
single_value->field_cell__sel__par = other_value.cell__sel__par();
} else {
single_value->field_cell__sel__par.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nr__of__frequencies().get_selection()) {
single_value->field_nr__of__frequencies = other_value.nr__of__frequencies();
} else {
single_value->field_nr__of__frequencies.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.freq__diff__length().get_selection()) {
single_value->field_freq__diff__length = other_value.freq__diff__length();
} else {
single_value->field_freq__diff__length.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 AddFrequency_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 AddFrequency_template(*other_value.implication_.precondition);
implication_.implied_template = new AddFrequency_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_CSN1_Types.AddFrequency.");
break;
}
set_selection(other_value);
}

AddFrequency_template::AddFrequency_template()
{
}

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

AddFrequency_template::AddFrequency_template(const AddFrequency& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean AddFrequency_template::match(const AddFrequency& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.start__frequency().is_bound()) return FALSE;
if(!single_value->field_start__frequency.match(other_value.start__frequency(), legacy))return FALSE;
if(!other_value.bsic().is_bound()) return FALSE;
if(!single_value->field_bsic.match(other_value.bsic(), legacy))return FALSE;
if(!other_value.cell__sel__par__present().is_bound()) return FALSE;
if(!single_value->field_cell__sel__par__present.match(other_value.cell__sel__par__present(), legacy))return FALSE;
if(!other_value.cell__sel__par().is_bound()) return FALSE;
if((other_value.cell__sel__par().ispresent() ? !single_value->field_cell__sel__par.match((const CellSelection&)other_value.cell__sel__par(), legacy) : !single_value->field_cell__sel__par.match_omit(legacy)))return FALSE;
if(!other_value.nr__of__frequencies().is_bound()) return FALSE;
if(!single_value->field_nr__of__frequencies.match(other_value.nr__of__frequencies(), legacy))return FALSE;
if(!other_value.freq__diff__length().is_bound()) return FALSE;
if(!single_value->field_freq__diff__length.match(other_value.freq__diff__length(), 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_CSN1_Types.AddFrequency.");
}
return FALSE;
}

boolean AddFrequency_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_start__frequency.is_bound()
 || single_value->field_bsic.is_bound()
 || single_value->field_cell__sel__par__present.is_bound()
 || (single_value->field_cell__sel__par.is_omit() || single_value->field_cell__sel__par.is_bound())
 || single_value->field_nr__of__frequencies.is_bound()
 || single_value->field_freq__diff__length.is_bound();
}

boolean AddFrequency_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_start__frequency.is_value()
 && single_value->field_bsic.is_value()
 && single_value->field_cell__sel__par__present.is_value()
 && (single_value->field_cell__sel__par.is_omit() || single_value->field_cell__sel__par.is_value())
 && single_value->field_nr__of__frequencies.is_value()
 && single_value->field_freq__diff__length.is_value();
}

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

AddFrequency AddFrequency_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_CSN1_Types.AddFrequency.");
AddFrequency ret_val;
if (single_value->field_start__frequency.is_bound()) {
ret_val.start__frequency() = single_value->field_start__frequency.valueof();
}
if (single_value->field_bsic.is_bound()) {
ret_val.bsic() = single_value->field_bsic.valueof();
}
if (single_value->field_cell__sel__par__present.is_bound()) {
ret_val.cell__sel__par__present() = single_value->field_cell__sel__par__present.valueof();
}
if (single_value->field_cell__sel__par.is_omit()) ret_val.cell__sel__par() = OMIT_VALUE;
else if (single_value->field_cell__sel__par.is_bound()) {
ret_val.cell__sel__par() = single_value->field_cell__sel__par.valueof();
}
if (single_value->field_nr__of__frequencies.is_bound()) {
ret_val.nr__of__frequencies() = single_value->field_nr__of__frequencies.valueof();
}
if (single_value->field_freq__diff__length.is_bound()) {
ret_val.freq__diff__length() = single_value->field_freq__diff__length.valueof();
}
return ret_val;
}

void AddFrequency_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_CSN1_Types.AddFrequency.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new AddFrequency_template[list_length];
}

AddFrequency_template& AddFrequency_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_CSN1_Types.AddFrequency.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.AddFrequency.");
return value_list.list_value[list_index];
}

INTEGER_template& AddFrequency_template::start__frequency()
{
set_specific();
return single_value->field_start__frequency;
}

const INTEGER_template& AddFrequency_template::start__frequency() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field start_frequency of a non-specific template of type @RLCMAC_CSN1_Types.AddFrequency.");
return single_value->field_start__frequency;
}

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

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

BITSTRING_template& AddFrequency_template::cell__sel__par__present()
{
set_specific();
return single_value->field_cell__sel__par__present;
}

const BITSTRING_template& AddFrequency_template::cell__sel__par__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field cell_sel_par_present of a non-specific template of type @RLCMAC_CSN1_Types.AddFrequency.");
return single_value->field_cell__sel__par__present;
}

CellSelection_template& AddFrequency_template::cell__sel__par()
{
set_specific();
return single_value->field_cell__sel__par;
}

const CellSelection_template& AddFrequency_template::cell__sel__par() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field cell_sel_par of a non-specific template of type @RLCMAC_CSN1_Types.AddFrequency.");
return single_value->field_cell__sel__par;
}

INTEGER_template& AddFrequency_template::nr__of__frequencies()
{
set_specific();
return single_value->field_nr__of__frequencies;
}

const INTEGER_template& AddFrequency_template::nr__of__frequencies() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nr_of_frequencies of a non-specific template of type @RLCMAC_CSN1_Types.AddFrequency.");
return single_value->field_nr__of__frequencies;
}

INTEGER_template& AddFrequency_template::freq__diff__length()
{
set_specific();
return single_value->field_freq__diff__length;
}

const INTEGER_template& AddFrequency_template::freq__diff__length() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field freq_diff_length of a non-specific template of type @RLCMAC_CSN1_Types.AddFrequency.");
return single_value->field_freq__diff__length;
}

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

void AddFrequency_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ start_frequency := ");
single_value->field_start__frequency.log();
TTCN_Logger::log_event_str(", bsic := ");
single_value->field_bsic.log();
TTCN_Logger::log_event_str(", cell_sel_par_present := ");
single_value->field_cell__sel__par__present.log();
TTCN_Logger::log_event_str(", cell_sel_par := ");
single_value->field_cell__sel__par.log();
TTCN_Logger::log_event_str(", nr_of_frequencies := ");
single_value->field_nr__of__frequencies.log();
TTCN_Logger::log_event_str(", freq_diff_length := ");
single_value->field_freq__diff__length.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 AddFrequency_template::log_match(const AddFrequency& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_start__frequency.match(match_value.start__frequency(), legacy)){
TTCN_Logger::log_logmatch_info(".start_frequency");
single_value->field_start__frequency.log_match(match_value.start__frequency(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_bsic.match(match_value.bsic(), legacy)){
TTCN_Logger::log_logmatch_info(".bsic");
single_value->field_bsic.log_match(match_value.bsic(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_cell__sel__par__present.match(match_value.cell__sel__par__present(), legacy)){
TTCN_Logger::log_logmatch_info(".cell_sel_par_present");
single_value->field_cell__sel__par__present.log_match(match_value.cell__sel__par__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.cell__sel__par().ispresent()){
if(!single_value->field_cell__sel__par.match(match_value.cell__sel__par(), legacy)){
TTCN_Logger::log_logmatch_info(".cell_sel_par");
single_value->field_cell__sel__par.log_match(match_value.cell__sel__par(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_cell__sel__par.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".cell_sel_par := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_cell__sel__par.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_nr__of__frequencies.match(match_value.nr__of__frequencies(), legacy)){
TTCN_Logger::log_logmatch_info(".nr_of_frequencies");
single_value->field_nr__of__frequencies.log_match(match_value.nr__of__frequencies(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_freq__diff__length.match(match_value.freq__diff__length(), legacy)){
TTCN_Logger::log_logmatch_info(".freq_diff_length");
single_value->field_freq__diff__length.log_match(match_value.freq__diff__length(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ start_frequency := ");
single_value->field_start__frequency.log_match(match_value.start__frequency(), legacy);
TTCN_Logger::log_event_str(", bsic := ");
single_value->field_bsic.log_match(match_value.bsic(), legacy);
TTCN_Logger::log_event_str(", cell_sel_par_present := ");
single_value->field_cell__sel__par__present.log_match(match_value.cell__sel__par__present(), legacy);
TTCN_Logger::log_event_str(", cell_sel_par := ");
if (match_value.cell__sel__par().ispresent()) {
single_value->field_cell__sel__par.log_match(match_value.cell__sel__par(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_cell__sel__par.log();
if (single_value->field_cell__sel__par.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", nr_of_frequencies := ");
single_value->field_nr__of__frequencies.log_match(match_value.nr__of__frequencies(), legacy);
TTCN_Logger::log_event_str(", freq_diff_length := ");
single_value->field_freq__diff__length.log_match(match_value.freq__diff__length(), 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 AddFrequency_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (start__frequency().is_bound()) start__frequency().set_implicit_omit();
if (bsic().is_bound()) bsic().set_implicit_omit();
if (cell__sel__par__present().is_bound()) cell__sel__par__present().set_implicit_omit();
if (!cell__sel__par().is_bound()) cell__sel__par() = OMIT_VALUE;
else cell__sel__par().set_implicit_omit();
if (nr__of__frequencies().is_bound()) nr__of__frequencies().set_implicit_omit();
if (freq__diff__length().is_bound()) freq__diff__length().set_implicit_omit();
}

void AddFrequency_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_start__frequency.encode_text(text_buf);
single_value->field_bsic.encode_text(text_buf);
single_value->field_cell__sel__par__present.encode_text(text_buf);
single_value->field_cell__sel__par.encode_text(text_buf);
single_value->field_nr__of__frequencies.encode_text(text_buf);
single_value->field_freq__diff__length.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_CSN1_Types.AddFrequency.");
}
}

void AddFrequency_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_start__frequency.decode_text(text_buf);
single_value->field_bsic.decode_text(text_buf);
single_value->field_cell__sel__par__present.decode_text(text_buf);
single_value->field_cell__sel__par.decode_text(text_buf);
single_value->field_nr__of__frequencies.decode_text(text_buf);
single_value->field_freq__diff__length.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 AddFrequency_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_CSN1_Types.AddFrequency.");
}
}

void AddFrequency_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: {
    AddFrequency_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_CSN1_Types.AddFrequency 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) start__frequency().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) bsic().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) cell__sel__par__present().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) cell__sel__par().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) nr__of__frequencies().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) freq__diff__length().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(), "start_frequency")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          start__frequency().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "bsic")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bsic().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cell_sel_par_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cell__sel__par__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(), "cell_sel_par")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cell__sel__par().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nr_of_frequencies")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nr__of__frequencies().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "freq_diff_length")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          freq__diff__length().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_CSN1_Types.AddFrequency: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    AddFrequency_template* precondition = new AddFrequency_template;
    precondition->set_param(*param.get_elem(0));
    AddFrequency_template* implied_template = new AddFrequency_template;
    implied_template->set_param(*param.get_elem(1));
    *this = AddFrequency_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.AddFrequency");
  }
  is_ifpresent = param.get_ifpresent();
}

void AddFrequency_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_start__frequency.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.AddFrequency");
single_value->field_bsic.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.AddFrequency");
single_value->field_cell__sel__par__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.AddFrequency");
single_value->field_cell__sel__par.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.AddFrequency");
single_value->field_nr__of__frequencies.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.AddFrequency");
single_value->field_freq__diff__length.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.AddFrequency");
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_CSN1_Types.AddFrequency");
}

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

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

RepeatedAddFrequencyItem::RepeatedAddFrequencyItem()
{
}

RepeatedAddFrequencyItem::RepeatedAddFrequencyItem(const BITSTRING& par_presence,
    const AddFrequency& par_item)
  :   field_presence(par_presence),
  field_item(par_item)
{
}

RepeatedAddFrequencyItem::RepeatedAddFrequencyItem(const RepeatedAddFrequencyItem& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.RepeatedAddFrequencyItem.");
if (other_value.presence().is_bound()) field_presence = other_value.presence();
else field_presence.clean_up();
if (other_value.item().is_bound()) field_item = other_value.item();
else field_item.clean_up();
}

void RepeatedAddFrequencyItem::clean_up()
{
field_presence.clean_up();
field_item.clean_up();
}

const TTCN_Typedescriptor_t* RepeatedAddFrequencyItem::get_descriptor() const { return &RepeatedAddFrequencyItem_descr_; }
RepeatedAddFrequencyItem& RepeatedAddFrequencyItem::operator=(const RepeatedAddFrequencyItem& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.RepeatedAddFrequencyItem.");
  if (other_value.presence().is_bound()) field_presence = other_value.presence();
  else field_presence.clean_up();
  if (other_value.item().is_bound()) field_item = other_value.item();
  else field_item.clean_up();
}
return *this;
}

boolean RepeatedAddFrequencyItem::operator==(const RepeatedAddFrequencyItem& other_value) const
{
return field_presence==other_value.field_presence
  && field_item==other_value.field_item;
}

boolean RepeatedAddFrequencyItem::is_bound() const
{
return (field_presence.is_bound())
  || (field_item.is_bound());
}
boolean RepeatedAddFrequencyItem::is_value() const
{
return field_presence.is_value()
  && field_item.is_value();
}
void RepeatedAddFrequencyItem::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ presence := ");
field_presence.log();
TTCN_Logger::log_event_str(", item := ");
field_item.log();
TTCN_Logger::log_event_str(" }");
}

void RepeatedAddFrequencyItem::set_implicit_omit()
{
if (presence().is_bound()) presence().set_implicit_omit();
if (item().is_bound()) item().set_implicit_omit();
}

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

void RepeatedAddFrequencyItem::encode_text(Text_Buf& text_buf) const
{
field_presence.encode_text(text_buf);
field_item.encode_text(text_buf);
}

void RepeatedAddFrequencyItem::decode_text(Text_Buf& text_buf)
{
field_presence.decode_text(text_buf);
field_item.decode_text(text_buf);
}

void RepeatedAddFrequencyItem::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 RepeatedAddFrequencyItem::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 RepeatedAddFrequencyItem::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, RepeatedAddFrequencyItem_presence_descr_.raw->forceomit);
  decoded_field_length = field_presence.RAW_decode(RepeatedAddFrequencyItem_presence_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, RepeatedAddFrequencyItem_item_descr_.raw->forceomit);
  decoded_field_length = field_item.RAW_decode(RepeatedAddFrequencyItem_item_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_presence !=  bs_0) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int RepeatedAddFrequencyItem::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, RepeatedAddFrequencyItem_presence_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RepeatedAddFrequencyItem_item_descr_.raw);
  encoded_length += field_presence.RAW_encode(RepeatedAddFrequencyItem_presence_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_item.RAW_encode(RepeatedAddFrequencyItem_item_descr_, *myleaf.body.node.nodes[1]);
  if (field_presence !=  bs_0) {
  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(RepeatedAddFrequencyItem_presence_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 RepeatedAddFrequencyItem_template::single_value_struct {
BITSTRING_template field_presence;
AddFrequency_template field_item;
};

void RepeatedAddFrequencyItem_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_presence = ANY_VALUE;
single_value->field_item = ANY_VALUE;
}
}
}

void RepeatedAddFrequencyItem_template::copy_value(const RepeatedAddFrequencyItem& other_value)
{
single_value = new single_value_struct;
if (other_value.presence().is_bound()) {
  single_value->field_presence = other_value.presence();
} else {
  single_value->field_presence.clean_up();
}
if (other_value.item().is_bound()) {
  single_value->field_item = other_value.item();
} else {
  single_value->field_item.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RepeatedAddFrequencyItem_template::copy_template(const RepeatedAddFrequencyItem_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) {
single_value->field_presence = other_value.presence();
} else {
single_value->field_presence.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.item().get_selection()) {
single_value->field_item = other_value.item();
} else {
single_value->field_item.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 RepeatedAddFrequencyItem_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 RepeatedAddFrequencyItem_template(*other_value.implication_.precondition);
implication_.implied_template = new RepeatedAddFrequencyItem_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_CSN1_Types.RepeatedAddFrequencyItem.");
break;
}
set_selection(other_value);
}

RepeatedAddFrequencyItem_template::RepeatedAddFrequencyItem_template()
{
}

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

RepeatedAddFrequencyItem_template::RepeatedAddFrequencyItem_template(const RepeatedAddFrequencyItem& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean RepeatedAddFrequencyItem_template::match(const RepeatedAddFrequencyItem& 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.presence().is_bound()) return FALSE;
if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE;
if(!other_value.item().is_bound()) return FALSE;
if(!single_value->field_item.match(other_value.item(), 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_CSN1_Types.RepeatedAddFrequencyItem.");
}
return FALSE;
}

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

boolean RepeatedAddFrequencyItem_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_presence.is_value()
 && single_value->field_item.is_value();
}

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

RepeatedAddFrequencyItem RepeatedAddFrequencyItem_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_CSN1_Types.RepeatedAddFrequencyItem.");
RepeatedAddFrequencyItem ret_val;
if (single_value->field_presence.is_bound()) {
ret_val.presence() = single_value->field_presence.valueof();
}
if (single_value->field_item.is_bound()) {
ret_val.item() = single_value->field_item.valueof();
}
return ret_val;
}

void RepeatedAddFrequencyItem_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_CSN1_Types.RepeatedAddFrequencyItem.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RepeatedAddFrequencyItem_template[list_length];
}

RepeatedAddFrequencyItem_template& RepeatedAddFrequencyItem_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_CSN1_Types.RepeatedAddFrequencyItem.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.RepeatedAddFrequencyItem.");
return value_list.list_value[list_index];
}

BITSTRING_template& RepeatedAddFrequencyItem_template::presence()
{
set_specific();
return single_value->field_presence;
}

const BITSTRING_template& RepeatedAddFrequencyItem_template::presence() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field presence of a non-specific template of type @RLCMAC_CSN1_Types.RepeatedAddFrequencyItem.");
return single_value->field_presence;
}

AddFrequency_template& RepeatedAddFrequencyItem_template::item()
{
set_specific();
return single_value->field_item;
}

const AddFrequency_template& RepeatedAddFrequencyItem_template::item() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field item of a non-specific template of type @RLCMAC_CSN1_Types.RepeatedAddFrequencyItem.");
return single_value->field_item;
}

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

void RepeatedAddFrequencyItem_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ presence := ");
single_value->field_presence.log();
TTCN_Logger::log_event_str(", item := ");
single_value->field_item.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 RepeatedAddFrequencyItem_template::log_match(const RepeatedAddFrequencyItem& 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_presence.match(match_value.presence(), legacy)){
TTCN_Logger::log_logmatch_info(".presence");
single_value->field_presence.log_match(match_value.presence(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_item.match(match_value.item(), legacy)){
TTCN_Logger::log_logmatch_info(".item");
single_value->field_item.log_match(match_value.item(), 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("{ presence := ");
single_value->field_presence.log_match(match_value.presence(), legacy);
TTCN_Logger::log_event_str(", item := ");
single_value->field_item.log_match(match_value.item(), 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 RepeatedAddFrequencyItem_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (presence().is_bound()) presence().set_implicit_omit();
if (item().is_bound()) item().set_implicit_omit();
}

void RepeatedAddFrequencyItem_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_presence.encode_text(text_buf);
single_value->field_item.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_CSN1_Types.RepeatedAddFrequencyItem.");
}
}

void RepeatedAddFrequencyItem_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_presence.decode_text(text_buf);
single_value->field_item.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 RepeatedAddFrequencyItem_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_CSN1_Types.RepeatedAddFrequencyItem.");
}
}

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

void RepeatedAddFrequencyItem_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_presence.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.RepeatedAddFrequencyItem");
single_value->field_item.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.RepeatedAddFrequencyItem");
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_CSN1_Types.RepeatedAddFrequencyItem");
}

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

boolean RepeatedAddFrequencyItem_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 RepeatedAddFrequencyItem RepeatedAddFrequencyItemList::UNBOUND_ELEM;
RepeatedAddFrequencyItemList::RepeatedAddFrequencyItemList()
{
val_ptr = NULL;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

void RepeatedAddFrequencyItemList_template::copy_template(const RepeatedAddFrequencyItemList_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 = (RepeatedAddFrequencyItem_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 RepeatedAddFrequencyItem_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new RepeatedAddFrequencyItem_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 RepeatedAddFrequencyItemList_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 RepeatedAddFrequencyItemList_template(*other_value.implication_.precondition);
implication_.implied_template = new RepeatedAddFrequencyItemList_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_CSN1_Types.RepeatedAddFrequencyItemList.");
break;
}
set_selection(other_value);
}

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

RepeatedAddFrequencyItemList_template::RepeatedAddFrequencyItemList_template()
{
}

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

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

RepeatedAddFrequencyItemList_template::RepeatedAddFrequencyItemList_template(const RepeatedAddFrequencyItemList& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

const RepeatedAddFrequencyItem_template& RepeatedAddFrequencyItemList_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @RLCMAC_CSN1_Types.RepeatedAddFrequencyItemList 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_CSN1_Types.RepeatedAddFrequencyItemList.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @RLCMAC_CSN1_Types.RepeatedAddFrequencyItemList: 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 RepeatedAddFrequencyItem_template& RepeatedAddFrequencyItemList_template::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @RLCMAC_CSN1_Types.RepeatedAddFrequencyItemList.");
return (*this)[(int)index_value];
}

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

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

boolean RepeatedAddFrequencyItemList_template::match(const RepeatedAddFrequencyItemList& 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_CSN1_Types.RepeatedAddFrequencyItemList.");
}
return FALSE;
}

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

RepeatedAddFrequencyItemList RepeatedAddFrequencyItemList_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_CSN1_Types.RepeatedAddFrequencyItemList.");
RepeatedAddFrequencyItemList 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;
}

RepeatedAddFrequencyItemList RepeatedAddFrequencyItemList_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);
}

RepeatedAddFrequencyItemList RepeatedAddFrequencyItemList_template::replace(int index, int len, const RepeatedAddFrequencyItemList_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());
}

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

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

void RepeatedAddFrequencyItemList_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 RepeatedAddFrequencyItemList_template::log_match(const RepeatedAddFrequencyItemList& 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 RepeatedAddFrequencyItemList_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_CSN1_Types.RepeatedAddFrequencyItemList.");
}
}

void RepeatedAddFrequencyItemList_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_CSN1_Types.RepeatedAddFrequencyItemList.");
single_value.value_elements = (RepeatedAddFrequencyItem_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 RepeatedAddFrequencyItem_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 RepeatedAddFrequencyItemList_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_CSN1_Types.RepeatedAddFrequencyItemList.");
}
}

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

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

void RepeatedAddFrequencyItemList_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_CSN1_Types.RepeatedAddFrequencyItemList");
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_CSN1_Types.RepeatedAddFrequencyItemList");
}

boolean RepeatedAddFrequencyItemList_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);
}
}
NCFrequencyList::NCFrequencyList()
{
}

NCFrequencyList::NCFrequencyList(const BITSTRING& par_removed__freq__present,
    const OPTIONAL< INTEGER >& par_nr__of__removed__freq,
    const OPTIONAL< FreqIndexList >& par_removed__freq__index,
    const OPTIONAL< RepeatedAddFrequencyItemList >& par_repeated__add__frequency,
    const BITSTRING& par_repeated__add__frequency__term)
  :   field_removed__freq__present(par_removed__freq__present),
  field_nr__of__removed__freq(par_nr__of__removed__freq),
  field_removed__freq__index(par_removed__freq__index),
  field_repeated__add__frequency(par_repeated__add__frequency),
  field_repeated__add__frequency__term(par_repeated__add__frequency__term)
{
}

NCFrequencyList::NCFrequencyList(const NCFrequencyList& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.NCFrequencyList.");
if (other_value.removed__freq__present().is_bound()) field_removed__freq__present = other_value.removed__freq__present();
else field_removed__freq__present.clean_up();
if (other_value.nr__of__removed__freq().is_bound()) field_nr__of__removed__freq = other_value.nr__of__removed__freq();
else field_nr__of__removed__freq.clean_up();
if (other_value.removed__freq__index().is_bound()) field_removed__freq__index = other_value.removed__freq__index();
else field_removed__freq__index.clean_up();
if (other_value.repeated__add__frequency().is_bound()) field_repeated__add__frequency = other_value.repeated__add__frequency();
else field_repeated__add__frequency.clean_up();
if (other_value.repeated__add__frequency__term().is_bound()) field_repeated__add__frequency__term = other_value.repeated__add__frequency__term();
else field_repeated__add__frequency__term.clean_up();
}

void NCFrequencyList::clean_up()
{
field_removed__freq__present.clean_up();
field_nr__of__removed__freq.clean_up();
field_removed__freq__index.clean_up();
field_repeated__add__frequency.clean_up();
field_repeated__add__frequency__term.clean_up();
}

const TTCN_Typedescriptor_t* NCFrequencyList::get_descriptor() const { return &NCFrequencyList_descr_; }
NCFrequencyList& NCFrequencyList::operator=(const NCFrequencyList& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.NCFrequencyList.");
  if (other_value.removed__freq__present().is_bound()) field_removed__freq__present = other_value.removed__freq__present();
  else field_removed__freq__present.clean_up();
  if (other_value.nr__of__removed__freq().is_bound()) field_nr__of__removed__freq = other_value.nr__of__removed__freq();
  else field_nr__of__removed__freq.clean_up();
  if (other_value.removed__freq__index().is_bound()) field_removed__freq__index = other_value.removed__freq__index();
  else field_removed__freq__index.clean_up();
  if (other_value.repeated__add__frequency().is_bound()) field_repeated__add__frequency = other_value.repeated__add__frequency();
  else field_repeated__add__frequency.clean_up();
  if (other_value.repeated__add__frequency__term().is_bound()) field_repeated__add__frequency__term = other_value.repeated__add__frequency__term();
  else field_repeated__add__frequency__term.clean_up();
}
return *this;
}

boolean NCFrequencyList::operator==(const NCFrequencyList& other_value) const
{
return field_removed__freq__present==other_value.field_removed__freq__present
  && field_nr__of__removed__freq==other_value.field_nr__of__removed__freq
  && field_removed__freq__index==other_value.field_removed__freq__index
  && field_repeated__add__frequency==other_value.field_repeated__add__frequency
  && field_repeated__add__frequency__term==other_value.field_repeated__add__frequency__term;
}

boolean NCFrequencyList::is_bound() const
{
return (field_removed__freq__present.is_bound())
  || (OPTIONAL_OMIT == field_nr__of__removed__freq.get_selection() || field_nr__of__removed__freq.is_bound())
  || (OPTIONAL_OMIT == field_removed__freq__index.get_selection() || field_removed__freq__index.is_bound())
  || (OPTIONAL_OMIT == field_repeated__add__frequency.get_selection() || field_repeated__add__frequency.is_bound())
  || (field_repeated__add__frequency__term.is_bound());
}
boolean NCFrequencyList::is_value() const
{
return field_removed__freq__present.is_value()
  && (OPTIONAL_OMIT == field_nr__of__removed__freq.get_selection() || field_nr__of__removed__freq.is_value())
  && (OPTIONAL_OMIT == field_removed__freq__index.get_selection() || field_removed__freq__index.is_value())
  && (OPTIONAL_OMIT == field_repeated__add__frequency.get_selection() || field_repeated__add__frequency.is_value())
  && field_repeated__add__frequency__term.is_value();
}
int NCFrequencyList::size_of() const
{
  int ret_val = 2;
  if (field_nr__of__removed__freq.ispresent()) ret_val++;
  if (field_removed__freq__index.ispresent()) ret_val++;
  if (field_repeated__add__frequency.ispresent()) ret_val++;
  return ret_val;
}

void NCFrequencyList::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ removed_freq_present := ");
field_removed__freq__present.log();
TTCN_Logger::log_event_str(", nr_of_removed_freq := ");
field_nr__of__removed__freq.log();
TTCN_Logger::log_event_str(", removed_freq_index := ");
field_removed__freq__index.log();
TTCN_Logger::log_event_str(", repeated_add_frequency := ");
field_repeated__add__frequency.log();
TTCN_Logger::log_event_str(", repeated_add_frequency_term := ");
field_repeated__add__frequency__term.log();
TTCN_Logger::log_event_str(" }");
}

void NCFrequencyList::set_implicit_omit()
{
if (removed__freq__present().is_bound()) removed__freq__present().set_implicit_omit();
if (!nr__of__removed__freq().is_bound()) nr__of__removed__freq() = OMIT_VALUE;
else nr__of__removed__freq().set_implicit_omit();
if (!removed__freq__index().is_bound()) removed__freq__index() = OMIT_VALUE;
else removed__freq__index().set_implicit_omit();
if (!repeated__add__frequency().is_bound()) repeated__add__frequency() = OMIT_VALUE;
else repeated__add__frequency().set_implicit_omit();
if (repeated__add__frequency__term().is_bound()) repeated__add__frequency__term().set_implicit_omit();
}

void NCFrequencyList::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_CSN1_Types.NCFrequencyList 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) removed__freq__present().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nr__of__removed__freq().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) removed__freq__index().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) repeated__add__frequency().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) repeated__add__frequency__term().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(), "removed_freq_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          removed__freq__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(), "nr_of_removed_freq")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nr__of__removed__freq().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "removed_freq_index")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          removed__freq__index().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "repeated_add_frequency")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          repeated__add__frequency().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "repeated_add_frequency_term")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          repeated__add__frequency__term().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_CSN1_Types.NCFrequencyList: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.NCFrequencyList");
  }
}

void NCFrequencyList::encode_text(Text_Buf& text_buf) const
{
field_removed__freq__present.encode_text(text_buf);
field_nr__of__removed__freq.encode_text(text_buf);
field_removed__freq__index.encode_text(text_buf);
field_repeated__add__frequency.encode_text(text_buf);
field_repeated__add__frequency__term.encode_text(text_buf);
}

void NCFrequencyList::decode_text(Text_Buf& text_buf)
{
field_removed__freq__present.decode_text(text_buf);
field_nr__of__removed__freq.decode_text(text_buf);
field_removed__freq__index.decode_text(text_buf);
field_repeated__add__frequency.decode_text(text_buf);
field_repeated__add__frequency__term.decode_text(text_buf);
}

void NCFrequencyList::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 NCFrequencyList::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 NCFrequencyList::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  int value_of_length_field1 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, NCFrequencyList_removed__freq__present_descr_.raw->forceomit);
  decoded_field_length = field_removed__freq__present.RAW_decode(NCFrequencyList_removed__freq__present_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_removed__freq__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(1)) {
    field_nr__of__removed__freq = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_1_force_omit(1, force_omit, NCFrequencyList_nr__of__removed__freq_descr_.raw->forceomit);
  decoded_field_length = field_nr__of__removed__freq().RAW_decode(NCFrequencyList_nr__of__removed__freq_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 1) {
  field_nr__of__removed__freq = 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());
  INTEGER tmp1 = field_nr__of__removed__freq().convert_to_Integer(NCFrequencyList_nr__of__removed__freq_descr_);
  tmp1 = tmp1 - -1;
  field_nr__of__removed__freq() = tmp1;
  value_of_length_field1 += tmp1.get_long_long_val() * 1;
  }
  }
  }
  else field_nr__of__removed__freq=OMIT_VALUE;
  if (limit > 0 && value_of_length_field1 > 0 && field_removed__freq__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(2)) {
    field_removed__freq__index = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_2_force_omit(2, force_omit, NCFrequencyList_removed__freq__index_descr_.raw->forceomit);
  decoded_field_length = field_removed__freq__index().RAW_decode(NCFrequencyList_removed__freq__index_descr_, p_buf, limit, local_top_order, TRUE, value_of_length_field1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 1) {
  field_removed__freq__index = 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());
  value_of_length_field1 -= decoded_field_length;
  }
  }
  }
  else field_removed__freq__index=OMIT_VALUE;
  if (limit > 0){
  if (force_omit != NULL && (*force_omit)(3)) {
    field_repeated__add__frequency = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_3_force_omit(3, force_omit, NCFrequencyList_repeated__add__frequency_descr_.raw->forceomit);
  decoded_field_length = field_repeated__add__frequency().RAW_decode(NCFrequencyList_repeated__add__frequency_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 1) {
  field_repeated__add__frequency = 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_repeated__add__frequency=OMIT_VALUE;
  RAW_Force_Omit field_4_force_omit(4, force_omit, NCFrequencyList_repeated__add__frequency__term_descr_.raw->forceomit);
  decoded_field_length = field_repeated__add__frequency__term.RAW_decode(NCFrequencyList_repeated__add__frequency__term_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 NCFrequencyList::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, NCFrequencyList_removed__freq__present_descr_.raw);
  if (field_nr__of__removed__freq.ispresent()) {
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NCFrequencyList_nr__of__removed__freq_descr_.raw);
  }
  else myleaf.body.node.nodes[1] = NULL;
  if (field_removed__freq__index.ispresent()) {
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, NCFrequencyList_removed__freq__index_descr_.raw);
  }
  else myleaf.body.node.nodes[2] = NULL;
  if (field_repeated__add__frequency.ispresent()) {
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, NCFrequencyList_repeated__add__frequency_descr_.raw);
  }
  else myleaf.body.node.nodes[3] = NULL;
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, NCFrequencyList_repeated__add__frequency__term_descr_.raw);
  encoded_length += field_removed__freq__present.RAW_encode(NCFrequencyList_removed__freq__present_descr_, *myleaf.body.node.nodes[0]);
  if (field_nr__of__removed__freq.ispresent()) {
  encoded_length += 5;
  myleaf.body.node.nodes[1]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[1]->coding_descr = &NCFrequencyList_nr__of__removed__freq_descr_;
  myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[1]->calcof.lengthto.unit = -1;
  myleaf.body.node.nodes[1]->calcof.lengthto.offset = -1;
  myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[1]->length = 5;
  if (field_removed__freq__index.ispresent()) {
  myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level;
  myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos;
  } else {
  myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = 0;
  myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = 0;
  }
  }
  if (field_removed__freq__index.ispresent()) {
  encoded_length += field_removed__freq__index().RAW_encode(NCFrequencyList_removed__freq__index_descr_, *myleaf.body.node.nodes[2]);
  }
  if (field_repeated__add__frequency.ispresent()) {
  encoded_length += field_repeated__add__frequency().RAW_encode(NCFrequencyList_repeated__add__frequency_descr_, *myleaf.body.node.nodes[3]);
  }
  encoded_length += field_repeated__add__frequency__term.RAW_encode(NCFrequencyList_repeated__add__frequency__term_descr_, *myleaf.body.node.nodes[4]);
  if (field_nr__of__removed__freq.ispresent() && (field_removed__freq__present !=  bs_0)) {
  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(NCFrequencyList_removed__freq__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_removed__freq__index.ispresent() && (field_removed__freq__present !=  bs_0)) {
  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(NCFrequencyList_removed__freq__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);
  }
  }
  return myleaf.length = encoded_length;
}

struct NCFrequencyList_template::single_value_struct {
BITSTRING_template field_removed__freq__present;
INTEGER_template field_nr__of__removed__freq;
FreqIndexList_template field_removed__freq__index;
RepeatedAddFrequencyItemList_template field_repeated__add__frequency;
BITSTRING_template field_repeated__add__frequency__term;
};

void NCFrequencyList_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_removed__freq__present = ANY_VALUE;
single_value->field_nr__of__removed__freq = ANY_OR_OMIT;
single_value->field_removed__freq__index = ANY_OR_OMIT;
single_value->field_repeated__add__frequency = ANY_OR_OMIT;
single_value->field_repeated__add__frequency__term = ANY_VALUE;
}
}
}

void NCFrequencyList_template::copy_value(const NCFrequencyList& other_value)
{
single_value = new single_value_struct;
if (other_value.removed__freq__present().is_bound()) {
  single_value->field_removed__freq__present = other_value.removed__freq__present();
} else {
  single_value->field_removed__freq__present.clean_up();
}
if (other_value.nr__of__removed__freq().is_bound()) {
  if (other_value.nr__of__removed__freq().ispresent()) single_value->field_nr__of__removed__freq = other_value.nr__of__removed__freq()();
  else single_value->field_nr__of__removed__freq = OMIT_VALUE;
} else {
  single_value->field_nr__of__removed__freq.clean_up();
}
if (other_value.removed__freq__index().is_bound()) {
  if (other_value.removed__freq__index().ispresent()) single_value->field_removed__freq__index = other_value.removed__freq__index()();
  else single_value->field_removed__freq__index = OMIT_VALUE;
} else {
  single_value->field_removed__freq__index.clean_up();
}
if (other_value.repeated__add__frequency().is_bound()) {
  if (other_value.repeated__add__frequency().ispresent()) single_value->field_repeated__add__frequency = other_value.repeated__add__frequency()();
  else single_value->field_repeated__add__frequency = OMIT_VALUE;
} else {
  single_value->field_repeated__add__frequency.clean_up();
}
if (other_value.repeated__add__frequency__term().is_bound()) {
  single_value->field_repeated__add__frequency__term = other_value.repeated__add__frequency__term();
} else {
  single_value->field_repeated__add__frequency__term.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void NCFrequencyList_template::copy_template(const NCFrequencyList_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.removed__freq__present().get_selection()) {
single_value->field_removed__freq__present = other_value.removed__freq__present();
} else {
single_value->field_removed__freq__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nr__of__removed__freq().get_selection()) {
single_value->field_nr__of__removed__freq = other_value.nr__of__removed__freq();
} else {
single_value->field_nr__of__removed__freq.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.removed__freq__index().get_selection()) {
single_value->field_removed__freq__index = other_value.removed__freq__index();
} else {
single_value->field_removed__freq__index.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.repeated__add__frequency().get_selection()) {
single_value->field_repeated__add__frequency = other_value.repeated__add__frequency();
} else {
single_value->field_repeated__add__frequency.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.repeated__add__frequency__term().get_selection()) {
single_value->field_repeated__add__frequency__term = other_value.repeated__add__frequency__term();
} else {
single_value->field_repeated__add__frequency__term.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 NCFrequencyList_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 NCFrequencyList_template(*other_value.implication_.precondition);
implication_.implied_template = new NCFrequencyList_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_CSN1_Types.NCFrequencyList.");
break;
}
set_selection(other_value);
}

NCFrequencyList_template::NCFrequencyList_template()
{
}

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

NCFrequencyList_template::NCFrequencyList_template(const NCFrequencyList& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean NCFrequencyList_template::match(const NCFrequencyList& 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.removed__freq__present().is_bound()) return FALSE;
if(!single_value->field_removed__freq__present.match(other_value.removed__freq__present(), legacy))return FALSE;
if(!other_value.nr__of__removed__freq().is_bound()) return FALSE;
if((other_value.nr__of__removed__freq().ispresent() ? !single_value->field_nr__of__removed__freq.match((const INTEGER&)other_value.nr__of__removed__freq(), legacy) : !single_value->field_nr__of__removed__freq.match_omit(legacy)))return FALSE;
if(!other_value.removed__freq__index().is_bound()) return FALSE;
if((other_value.removed__freq__index().ispresent() ? !single_value->field_removed__freq__index.match((const FreqIndexList&)other_value.removed__freq__index(), legacy) : !single_value->field_removed__freq__index.match_omit(legacy)))return FALSE;
if(!other_value.repeated__add__frequency().is_bound()) return FALSE;
if((other_value.repeated__add__frequency().ispresent() ? !single_value->field_repeated__add__frequency.match((const RepeatedAddFrequencyItemList&)other_value.repeated__add__frequency(), legacy) : !single_value->field_repeated__add__frequency.match_omit(legacy)))return FALSE;
if(!other_value.repeated__add__frequency__term().is_bound()) return FALSE;
if(!single_value->field_repeated__add__frequency__term.match(other_value.repeated__add__frequency__term(), 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_CSN1_Types.NCFrequencyList.");
}
return FALSE;
}

boolean NCFrequencyList_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_removed__freq__present.is_bound()
 || (single_value->field_nr__of__removed__freq.is_omit() || single_value->field_nr__of__removed__freq.is_bound())
 || (single_value->field_removed__freq__index.is_omit() || single_value->field_removed__freq__index.is_bound())
 || (single_value->field_repeated__add__frequency.is_omit() || single_value->field_repeated__add__frequency.is_bound())
 || single_value->field_repeated__add__frequency__term.is_bound();
}

boolean NCFrequencyList_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_removed__freq__present.is_value()
 && (single_value->field_nr__of__removed__freq.is_omit() || single_value->field_nr__of__removed__freq.is_value())
 && (single_value->field_removed__freq__index.is_omit() || single_value->field_removed__freq__index.is_value())
 && (single_value->field_repeated__add__frequency.is_omit() || single_value->field_repeated__add__frequency.is_value())
 && single_value->field_repeated__add__frequency__term.is_value();
}

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

NCFrequencyList NCFrequencyList_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_CSN1_Types.NCFrequencyList.");
NCFrequencyList ret_val;
if (single_value->field_removed__freq__present.is_bound()) {
ret_val.removed__freq__present() = single_value->field_removed__freq__present.valueof();
}
if (single_value->field_nr__of__removed__freq.is_omit()) ret_val.nr__of__removed__freq() = OMIT_VALUE;
else if (single_value->field_nr__of__removed__freq.is_bound()) {
ret_val.nr__of__removed__freq() = single_value->field_nr__of__removed__freq.valueof();
}
if (single_value->field_removed__freq__index.is_omit()) ret_val.removed__freq__index() = OMIT_VALUE;
else if (single_value->field_removed__freq__index.is_bound()) {
ret_val.removed__freq__index() = single_value->field_removed__freq__index.valueof();
}
if (single_value->field_repeated__add__frequency.is_omit()) ret_val.repeated__add__frequency() = OMIT_VALUE;
else if (single_value->field_repeated__add__frequency.is_bound()) {
ret_val.repeated__add__frequency() = single_value->field_repeated__add__frequency.valueof();
}
if (single_value->field_repeated__add__frequency__term.is_bound()) {
ret_val.repeated__add__frequency__term() = single_value->field_repeated__add__frequency__term.valueof();
}
return ret_val;
}

void NCFrequencyList_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_CSN1_Types.NCFrequencyList.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new NCFrequencyList_template[list_length];
}

NCFrequencyList_template& NCFrequencyList_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_CSN1_Types.NCFrequencyList.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.NCFrequencyList.");
return value_list.list_value[list_index];
}

BITSTRING_template& NCFrequencyList_template::removed__freq__present()
{
set_specific();
return single_value->field_removed__freq__present;
}

const BITSTRING_template& NCFrequencyList_template::removed__freq__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field removed_freq_present of a non-specific template of type @RLCMAC_CSN1_Types.NCFrequencyList.");
return single_value->field_removed__freq__present;
}

INTEGER_template& NCFrequencyList_template::nr__of__removed__freq()
{
set_specific();
return single_value->field_nr__of__removed__freq;
}

const INTEGER_template& NCFrequencyList_template::nr__of__removed__freq() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nr_of_removed_freq of a non-specific template of type @RLCMAC_CSN1_Types.NCFrequencyList.");
return single_value->field_nr__of__removed__freq;
}

FreqIndexList_template& NCFrequencyList_template::removed__freq__index()
{
set_specific();
return single_value->field_removed__freq__index;
}

const FreqIndexList_template& NCFrequencyList_template::removed__freq__index() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field removed_freq_index of a non-specific template of type @RLCMAC_CSN1_Types.NCFrequencyList.");
return single_value->field_removed__freq__index;
}

RepeatedAddFrequencyItemList_template& NCFrequencyList_template::repeated__add__frequency()
{
set_specific();
return single_value->field_repeated__add__frequency;
}

const RepeatedAddFrequencyItemList_template& NCFrequencyList_template::repeated__add__frequency() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field repeated_add_frequency of a non-specific template of type @RLCMAC_CSN1_Types.NCFrequencyList.");
return single_value->field_repeated__add__frequency;
}

BITSTRING_template& NCFrequencyList_template::repeated__add__frequency__term()
{
set_specific();
return single_value->field_repeated__add__frequency__term;
}

const BITSTRING_template& NCFrequencyList_template::repeated__add__frequency__term() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field repeated_add_frequency_term of a non-specific template of type @RLCMAC_CSN1_Types.NCFrequencyList.");
return single_value->field_repeated__add__frequency__term;
}

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

void NCFrequencyList_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ removed_freq_present := ");
single_value->field_removed__freq__present.log();
TTCN_Logger::log_event_str(", nr_of_removed_freq := ");
single_value->field_nr__of__removed__freq.log();
TTCN_Logger::log_event_str(", removed_freq_index := ");
single_value->field_removed__freq__index.log();
TTCN_Logger::log_event_str(", repeated_add_frequency := ");
single_value->field_repeated__add__frequency.log();
TTCN_Logger::log_event_str(", repeated_add_frequency_term := ");
single_value->field_repeated__add__frequency__term.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 NCFrequencyList_template::log_match(const NCFrequencyList& 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_removed__freq__present.match(match_value.removed__freq__present(), legacy)){
TTCN_Logger::log_logmatch_info(".removed_freq_present");
single_value->field_removed__freq__present.log_match(match_value.removed__freq__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.nr__of__removed__freq().ispresent()){
if(!single_value->field_nr__of__removed__freq.match(match_value.nr__of__removed__freq(), legacy)){
TTCN_Logger::log_logmatch_info(".nr_of_removed_freq");
single_value->field_nr__of__removed__freq.log_match(match_value.nr__of__removed__freq(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_nr__of__removed__freq.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".nr_of_removed_freq := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_nr__of__removed__freq.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.removed__freq__index().ispresent()){
if(!single_value->field_removed__freq__index.match(match_value.removed__freq__index(), legacy)){
TTCN_Logger::log_logmatch_info(".removed_freq_index");
single_value->field_removed__freq__index.log_match(match_value.removed__freq__index(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_removed__freq__index.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".removed_freq_index := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_removed__freq__index.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.repeated__add__frequency().ispresent()){
if(!single_value->field_repeated__add__frequency.match(match_value.repeated__add__frequency(), legacy)){
TTCN_Logger::log_logmatch_info(".repeated_add_frequency");
single_value->field_repeated__add__frequency.log_match(match_value.repeated__add__frequency(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_repeated__add__frequency.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".repeated_add_frequency := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_repeated__add__frequency.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_repeated__add__frequency__term.match(match_value.repeated__add__frequency__term(), legacy)){
TTCN_Logger::log_logmatch_info(".repeated_add_frequency_term");
single_value->field_repeated__add__frequency__term.log_match(match_value.repeated__add__frequency__term(), 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("{ removed_freq_present := ");
single_value->field_removed__freq__present.log_match(match_value.removed__freq__present(), legacy);
TTCN_Logger::log_event_str(", nr_of_removed_freq := ");
if (match_value.nr__of__removed__freq().ispresent()) {
single_value->field_nr__of__removed__freq.log_match(match_value.nr__of__removed__freq(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_nr__of__removed__freq.log();
if (single_value->field_nr__of__removed__freq.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", removed_freq_index := ");
if (match_value.removed__freq__index().ispresent()) {
single_value->field_removed__freq__index.log_match(match_value.removed__freq__index(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_removed__freq__index.log();
if (single_value->field_removed__freq__index.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", repeated_add_frequency := ");
if (match_value.repeated__add__frequency().ispresent()) {
single_value->field_repeated__add__frequency.log_match(match_value.repeated__add__frequency(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_repeated__add__frequency.log();
if (single_value->field_repeated__add__frequency.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", repeated_add_frequency_term := ");
single_value->field_repeated__add__frequency__term.log_match(match_value.repeated__add__frequency__term(), 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 NCFrequencyList_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (removed__freq__present().is_bound()) removed__freq__present().set_implicit_omit();
if (!nr__of__removed__freq().is_bound()) nr__of__removed__freq() = OMIT_VALUE;
else nr__of__removed__freq().set_implicit_omit();
if (!removed__freq__index().is_bound()) removed__freq__index() = OMIT_VALUE;
else removed__freq__index().set_implicit_omit();
if (!repeated__add__frequency().is_bound()) repeated__add__frequency() = OMIT_VALUE;
else repeated__add__frequency().set_implicit_omit();
if (repeated__add__frequency__term().is_bound()) repeated__add__frequency__term().set_implicit_omit();
}

void NCFrequencyList_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_removed__freq__present.encode_text(text_buf);
single_value->field_nr__of__removed__freq.encode_text(text_buf);
single_value->field_removed__freq__index.encode_text(text_buf);
single_value->field_repeated__add__frequency.encode_text(text_buf);
single_value->field_repeated__add__frequency__term.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_CSN1_Types.NCFrequencyList.");
}
}

void NCFrequencyList_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_removed__freq__present.decode_text(text_buf);
single_value->field_nr__of__removed__freq.decode_text(text_buf);
single_value->field_removed__freq__index.decode_text(text_buf);
single_value->field_repeated__add__frequency.decode_text(text_buf);
single_value->field_repeated__add__frequency__term.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 NCFrequencyList_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_CSN1_Types.NCFrequencyList.");
}
}

void NCFrequencyList_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: {
    NCFrequencyList_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_CSN1_Types.NCFrequencyList 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) removed__freq__present().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nr__of__removed__freq().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) removed__freq__index().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) repeated__add__frequency().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) repeated__add__frequency__term().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(), "removed_freq_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          removed__freq__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(), "nr_of_removed_freq")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nr__of__removed__freq().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "removed_freq_index")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          removed__freq__index().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "repeated_add_frequency")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          repeated__add__frequency().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "repeated_add_frequency_term")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          repeated__add__frequency__term().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_CSN1_Types.NCFrequencyList: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    NCFrequencyList_template* precondition = new NCFrequencyList_template;
    precondition->set_param(*param.get_elem(0));
    NCFrequencyList_template* implied_template = new NCFrequencyList_template;
    implied_template->set_param(*param.get_elem(1));
    *this = NCFrequencyList_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.NCFrequencyList");
  }
  is_ifpresent = param.get_ifpresent();
}

void NCFrequencyList_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_removed__freq__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.NCFrequencyList");
single_value->field_nr__of__removed__freq.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.NCFrequencyList");
single_value->field_removed__freq__index.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.NCFrequencyList");
single_value->field_repeated__add__frequency.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.NCFrequencyList");
single_value->field_repeated__add__frequency__term.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.NCFrequencyList");
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_CSN1_Types.NCFrequencyList");
}

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

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

NCMeasurementParameters::NCMeasurementParameters()
{
}

NCMeasurementParameters::NCMeasurementParameters(const NetworkControlOrder& par_nco,
    const BITSTRING& par_nc__period__present,
    const OPTIONAL< INTEGER >& par_nc__non__drx__period,
    const OPTIONAL< INTEGER >& par_nc__reporting__period__i,
    const OPTIONAL< INTEGER >& par_nc__reporting__period__t,
    const BITSTRING& par_nc__freq__list__present,
    const OPTIONAL< NCFrequencyList >& par_nc__freq__list)
  :   field_nco(par_nco),
  field_nc__period__present(par_nc__period__present),
  field_nc__non__drx__period(par_nc__non__drx__period),
  field_nc__reporting__period__i(par_nc__reporting__period__i),
  field_nc__reporting__period__t(par_nc__reporting__period__t),
  field_nc__freq__list__present(par_nc__freq__list__present),
  field_nc__freq__list(par_nc__freq__list)
{
}

NCMeasurementParameters::NCMeasurementParameters(const NCMeasurementParameters& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.NCMeasurementParameters.");
if (other_value.nco().is_bound()) field_nco = other_value.nco();
else field_nco.clean_up();
if (other_value.nc__period__present().is_bound()) field_nc__period__present = other_value.nc__period__present();
else field_nc__period__present.clean_up();
if (other_value.nc__non__drx__period().is_bound()) field_nc__non__drx__period = other_value.nc__non__drx__period();
else field_nc__non__drx__period.clean_up();
if (other_value.nc__reporting__period__i().is_bound()) field_nc__reporting__period__i = other_value.nc__reporting__period__i();
else field_nc__reporting__period__i.clean_up();
if (other_value.nc__reporting__period__t().is_bound()) field_nc__reporting__period__t = other_value.nc__reporting__period__t();
else field_nc__reporting__period__t.clean_up();
if (other_value.nc__freq__list__present().is_bound()) field_nc__freq__list__present = other_value.nc__freq__list__present();
else field_nc__freq__list__present.clean_up();
if (other_value.nc__freq__list().is_bound()) field_nc__freq__list = other_value.nc__freq__list();
else field_nc__freq__list.clean_up();
}

void NCMeasurementParameters::clean_up()
{
field_nco.clean_up();
field_nc__period__present.clean_up();
field_nc__non__drx__period.clean_up();
field_nc__reporting__period__i.clean_up();
field_nc__reporting__period__t.clean_up();
field_nc__freq__list__present.clean_up();
field_nc__freq__list.clean_up();
}

const TTCN_Typedescriptor_t* NCMeasurementParameters::get_descriptor() const { return &NCMeasurementParameters_descr_; }
NCMeasurementParameters& NCMeasurementParameters::operator=(const NCMeasurementParameters& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.NCMeasurementParameters.");
  if (other_value.nco().is_bound()) field_nco = other_value.nco();
  else field_nco.clean_up();
  if (other_value.nc__period__present().is_bound()) field_nc__period__present = other_value.nc__period__present();
  else field_nc__period__present.clean_up();
  if (other_value.nc__non__drx__period().is_bound()) field_nc__non__drx__period = other_value.nc__non__drx__period();
  else field_nc__non__drx__period.clean_up();
  if (other_value.nc__reporting__period__i().is_bound()) field_nc__reporting__period__i = other_value.nc__reporting__period__i();
  else field_nc__reporting__period__i.clean_up();
  if (other_value.nc__reporting__period__t().is_bound()) field_nc__reporting__period__t = other_value.nc__reporting__period__t();
  else field_nc__reporting__period__t.clean_up();
  if (other_value.nc__freq__list__present().is_bound()) field_nc__freq__list__present = other_value.nc__freq__list__present();
  else field_nc__freq__list__present.clean_up();
  if (other_value.nc__freq__list().is_bound()) field_nc__freq__list = other_value.nc__freq__list();
  else field_nc__freq__list.clean_up();
}
return *this;
}

boolean NCMeasurementParameters::operator==(const NCMeasurementParameters& other_value) const
{
return field_nco==other_value.field_nco
  && field_nc__period__present==other_value.field_nc__period__present
  && field_nc__non__drx__period==other_value.field_nc__non__drx__period
  && field_nc__reporting__period__i==other_value.field_nc__reporting__period__i
  && field_nc__reporting__period__t==other_value.field_nc__reporting__period__t
  && field_nc__freq__list__present==other_value.field_nc__freq__list__present
  && field_nc__freq__list==other_value.field_nc__freq__list;
}

boolean NCMeasurementParameters::is_bound() const
{
return (field_nco.is_bound())
  || (field_nc__period__present.is_bound())
  || (OPTIONAL_OMIT == field_nc__non__drx__period.get_selection() || field_nc__non__drx__period.is_bound())
  || (OPTIONAL_OMIT == field_nc__reporting__period__i.get_selection() || field_nc__reporting__period__i.is_bound())
  || (OPTIONAL_OMIT == field_nc__reporting__period__t.get_selection() || field_nc__reporting__period__t.is_bound())
  || (field_nc__freq__list__present.is_bound())
  || (OPTIONAL_OMIT == field_nc__freq__list.get_selection() || field_nc__freq__list.is_bound());
}
boolean NCMeasurementParameters::is_value() const
{
return field_nco.is_value()
  && field_nc__period__present.is_value()
  && (OPTIONAL_OMIT == field_nc__non__drx__period.get_selection() || field_nc__non__drx__period.is_value())
  && (OPTIONAL_OMIT == field_nc__reporting__period__i.get_selection() || field_nc__reporting__period__i.is_value())
  && (OPTIONAL_OMIT == field_nc__reporting__period__t.get_selection() || field_nc__reporting__period__t.is_value())
  && field_nc__freq__list__present.is_value()
  && (OPTIONAL_OMIT == field_nc__freq__list.get_selection() || field_nc__freq__list.is_value());
}
int NCMeasurementParameters::size_of() const
{
  int ret_val = 3;
  if (field_nc__non__drx__period.ispresent()) ret_val++;
  if (field_nc__reporting__period__i.ispresent()) ret_val++;
  if (field_nc__reporting__period__t.ispresent()) ret_val++;
  if (field_nc__freq__list.ispresent()) ret_val++;
  return ret_val;
}

void NCMeasurementParameters::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ nco := ");
field_nco.log();
TTCN_Logger::log_event_str(", nc_period_present := ");
field_nc__period__present.log();
TTCN_Logger::log_event_str(", nc_non_drx_period := ");
field_nc__non__drx__period.log();
TTCN_Logger::log_event_str(", nc_reporting_period_i := ");
field_nc__reporting__period__i.log();
TTCN_Logger::log_event_str(", nc_reporting_period_t := ");
field_nc__reporting__period__t.log();
TTCN_Logger::log_event_str(", nc_freq_list_present := ");
field_nc__freq__list__present.log();
TTCN_Logger::log_event_str(", nc_freq_list := ");
field_nc__freq__list.log();
TTCN_Logger::log_event_str(" }");
}

void NCMeasurementParameters::set_implicit_omit()
{
if (nco().is_bound()) nco().set_implicit_omit();
if (nc__period__present().is_bound()) nc__period__present().set_implicit_omit();
if (!nc__non__drx__period().is_bound()) nc__non__drx__period() = OMIT_VALUE;
else nc__non__drx__period().set_implicit_omit();
if (!nc__reporting__period__i().is_bound()) nc__reporting__period__i() = OMIT_VALUE;
else nc__reporting__period__i().set_implicit_omit();
if (!nc__reporting__period__t().is_bound()) nc__reporting__period__t() = OMIT_VALUE;
else nc__reporting__period__t().set_implicit_omit();
if (nc__freq__list__present().is_bound()) nc__freq__list__present().set_implicit_omit();
if (!nc__freq__list().is_bound()) nc__freq__list() = OMIT_VALUE;
else nc__freq__list().set_implicit_omit();
}

void NCMeasurementParameters::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_CSN1_Types.NCMeasurementParameters 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) nco().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nc__period__present().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nc__non__drx__period().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) nc__reporting__period__i().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) nc__reporting__period__t().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) nc__freq__list__present().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) nc__freq__list().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(), "nco")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nco().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nc_period_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nc__period__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(), "nc_non_drx_period")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nc__non__drx__period().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nc_reporting_period_i")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nc__reporting__period__i().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nc_reporting_period_t")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nc__reporting__period__t().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nc_freq_list_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nc__freq__list__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(), "nc_freq_list")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nc__freq__list().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_CSN1_Types.NCMeasurementParameters: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.NCMeasurementParameters");
  }
}

void NCMeasurementParameters::encode_text(Text_Buf& text_buf) const
{
field_nco.encode_text(text_buf);
field_nc__period__present.encode_text(text_buf);
field_nc__non__drx__period.encode_text(text_buf);
field_nc__reporting__period__i.encode_text(text_buf);
field_nc__reporting__period__t.encode_text(text_buf);
field_nc__freq__list__present.encode_text(text_buf);
field_nc__freq__list.encode_text(text_buf);
}

void NCMeasurementParameters::decode_text(Text_Buf& text_buf)
{
field_nco.decode_text(text_buf);
field_nc__period__present.decode_text(text_buf);
field_nc__non__drx__period.decode_text(text_buf);
field_nc__reporting__period__i.decode_text(text_buf);
field_nc__reporting__period__t.decode_text(text_buf);
field_nc__freq__list__present.decode_text(text_buf);
field_nc__freq__list.decode_text(text_buf);
}

void NCMeasurementParameters::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 NCMeasurementParameters::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 NCMeasurementParameters::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, NCMeasurementParameters_nco_descr_.raw->forceomit);
  decoded_field_length = field_nco.RAW_decode(NCMeasurementParameters_nco_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, NCMeasurementParameters_nc__period__present_descr_.raw->forceomit);
  decoded_field_length = field_nc__period__present.RAW_decode(NCMeasurementParameters_nc__period__present_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_nc__period__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(2)) {
    field_nc__non__drx__period = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_2_force_omit(2, force_omit, NCMeasurementParameters_nc__non__drx__period_descr_.raw->forceomit);
  decoded_field_length = field_nc__non__drx__period().RAW_decode(NCMeasurementParameters_nc__non__drx__period_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 1) {
  field_nc__non__drx__period = 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_nc__non__drx__period=OMIT_VALUE;
  if (limit > 0 && field_nc__period__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(3)) {
    field_nc__reporting__period__i = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_3_force_omit(3, force_omit, NCMeasurementParameters_nc__reporting__period__i_descr_.raw->forceomit);
  decoded_field_length = field_nc__reporting__period__i().RAW_decode(NCMeasurementParameters_nc__reporting__period__i_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 1) {
  field_nc__reporting__period__i = 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_nc__reporting__period__i=OMIT_VALUE;
  if (limit > 0 && field_nc__period__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(4)) {
    field_nc__reporting__period__t = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_4_force_omit(4, force_omit, NCMeasurementParameters_nc__reporting__period__t_descr_.raw->forceomit);
  decoded_field_length = field_nc__reporting__period__t().RAW_decode(NCMeasurementParameters_nc__reporting__period__t_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit);
  if (decoded_field_length < 1) {
  field_nc__reporting__period__t = 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_nc__reporting__period__t=OMIT_VALUE;
  RAW_Force_Omit field_5_force_omit(5, force_omit, NCMeasurementParameters_nc__freq__list__present_descr_.raw->forceomit);
  decoded_field_length = field_nc__freq__list__present.RAW_decode(NCMeasurementParameters_nc__freq__list__present_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());
  if (limit > 0 && field_nc__freq__list__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(6)) {
    field_nc__freq__list = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_6_force_omit(6, force_omit, NCMeasurementParameters_nc__freq__list_descr_.raw->forceomit);
  decoded_field_length = field_nc__freq__list().RAW_decode(NCMeasurementParameters_nc__freq__list_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_6_force_omit);
  if (decoded_field_length < 1) {
  field_nc__freq__list = 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_nc__freq__list=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int NCMeasurementParameters::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, NCMeasurementParameters_nco_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NCMeasurementParameters_nc__period__present_descr_.raw);
  if (field_nc__non__drx__period.ispresent()) {
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, NCMeasurementParameters_nc__non__drx__period_descr_.raw);
  }
  else myleaf.body.node.nodes[2] = NULL;
  if (field_nc__reporting__period__i.ispresent()) {
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, NCMeasurementParameters_nc__reporting__period__i_descr_.raw);
  }
  else myleaf.body.node.nodes[3] = NULL;
  if (field_nc__reporting__period__t.ispresent()) {
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, NCMeasurementParameters_nc__reporting__period__t_descr_.raw);
  }
  else myleaf.body.node.nodes[4] = NULL;
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, NCMeasurementParameters_nc__freq__list__present_descr_.raw);
  if (field_nc__freq__list.ispresent()) {
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, NCMeasurementParameters_nc__freq__list_descr_.raw);
  }
  else myleaf.body.node.nodes[6] = NULL;
  encoded_length += field_nco.RAW_encode(NCMeasurementParameters_nco_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_nc__period__present.RAW_encode(NCMeasurementParameters_nc__period__present_descr_, *myleaf.body.node.nodes[1]);
  if (field_nc__non__drx__period.ispresent()) {
  encoded_length += field_nc__non__drx__period().RAW_encode(NCMeasurementParameters_nc__non__drx__period_descr_, *myleaf.body.node.nodes[2]);
  }
  if (field_nc__reporting__period__i.ispresent()) {
  encoded_length += field_nc__reporting__period__i().RAW_encode(NCMeasurementParameters_nc__reporting__period__i_descr_, *myleaf.body.node.nodes[3]);
  }
  if (field_nc__reporting__period__t.ispresent()) {
  encoded_length += field_nc__reporting__period__t().RAW_encode(NCMeasurementParameters_nc__reporting__period__t_descr_, *myleaf.body.node.nodes[4]);
  }
  encoded_length += field_nc__freq__list__present.RAW_encode(NCMeasurementParameters_nc__freq__list__present_descr_, *myleaf.body.node.nodes[5]);
  if (field_nc__freq__list.ispresent()) {
  encoded_length += field_nc__freq__list().RAW_encode(NCMeasurementParameters_nc__freq__list_descr_, *myleaf.body.node.nodes[6]);
  }
  if (field_nc__non__drx__period.ispresent() && (field_nc__period__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={1};
  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(NCMeasurementParameters_nc__period__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_nc__reporting__period__i.ispresent() && (field_nc__period__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={1};
  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(NCMeasurementParameters_nc__period__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_nc__reporting__period__t.ispresent() && (field_nc__period__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={1};
  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(NCMeasurementParameters_nc__period__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_nc__freq__list.ispresent() && (field_nc__freq__list__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={5};
  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(NCMeasurementParameters_nc__freq__list__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);
  }
  }
  return myleaf.length = encoded_length;
}

struct NCMeasurementParameters_template::single_value_struct {
NetworkControlOrder_template field_nco;
BITSTRING_template field_nc__period__present;
INTEGER_template field_nc__non__drx__period;
INTEGER_template field_nc__reporting__period__i;
INTEGER_template field_nc__reporting__period__t;
BITSTRING_template field_nc__freq__list__present;
NCFrequencyList_template field_nc__freq__list;
};

void NCMeasurementParameters_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_nco = ANY_VALUE;
single_value->field_nc__period__present = ANY_VALUE;
single_value->field_nc__non__drx__period = ANY_OR_OMIT;
single_value->field_nc__reporting__period__i = ANY_OR_OMIT;
single_value->field_nc__reporting__period__t = ANY_OR_OMIT;
single_value->field_nc__freq__list__present = ANY_VALUE;
single_value->field_nc__freq__list = ANY_OR_OMIT;
}
}
}

void NCMeasurementParameters_template::copy_value(const NCMeasurementParameters& other_value)
{
single_value = new single_value_struct;
if (other_value.nco().is_bound()) {
  single_value->field_nco = other_value.nco();
} else {
  single_value->field_nco.clean_up();
}
if (other_value.nc__period__present().is_bound()) {
  single_value->field_nc__period__present = other_value.nc__period__present();
} else {
  single_value->field_nc__period__present.clean_up();
}
if (other_value.nc__non__drx__period().is_bound()) {
  if (other_value.nc__non__drx__period().ispresent()) single_value->field_nc__non__drx__period = other_value.nc__non__drx__period()();
  else single_value->field_nc__non__drx__period = OMIT_VALUE;
} else {
  single_value->field_nc__non__drx__period.clean_up();
}
if (other_value.nc__reporting__period__i().is_bound()) {
  if (other_value.nc__reporting__period__i().ispresent()) single_value->field_nc__reporting__period__i = other_value.nc__reporting__period__i()();
  else single_value->field_nc__reporting__period__i = OMIT_VALUE;
} else {
  single_value->field_nc__reporting__period__i.clean_up();
}
if (other_value.nc__reporting__period__t().is_bound()) {
  if (other_value.nc__reporting__period__t().ispresent()) single_value->field_nc__reporting__period__t = other_value.nc__reporting__period__t()();
  else single_value->field_nc__reporting__period__t = OMIT_VALUE;
} else {
  single_value->field_nc__reporting__period__t.clean_up();
}
if (other_value.nc__freq__list__present().is_bound()) {
  single_value->field_nc__freq__list__present = other_value.nc__freq__list__present();
} else {
  single_value->field_nc__freq__list__present.clean_up();
}
if (other_value.nc__freq__list().is_bound()) {
  if (other_value.nc__freq__list().ispresent()) single_value->field_nc__freq__list = other_value.nc__freq__list()();
  else single_value->field_nc__freq__list = OMIT_VALUE;
} else {
  single_value->field_nc__freq__list.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void NCMeasurementParameters_template::copy_template(const NCMeasurementParameters_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.nco().get_selection()) {
single_value->field_nco = other_value.nco();
} else {
single_value->field_nco.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nc__period__present().get_selection()) {
single_value->field_nc__period__present = other_value.nc__period__present();
} else {
single_value->field_nc__period__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nc__non__drx__period().get_selection()) {
single_value->field_nc__non__drx__period = other_value.nc__non__drx__period();
} else {
single_value->field_nc__non__drx__period.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nc__reporting__period__i().get_selection()) {
single_value->field_nc__reporting__period__i = other_value.nc__reporting__period__i();
} else {
single_value->field_nc__reporting__period__i.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nc__reporting__period__t().get_selection()) {
single_value->field_nc__reporting__period__t = other_value.nc__reporting__period__t();
} else {
single_value->field_nc__reporting__period__t.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nc__freq__list__present().get_selection()) {
single_value->field_nc__freq__list__present = other_value.nc__freq__list__present();
} else {
single_value->field_nc__freq__list__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nc__freq__list().get_selection()) {
single_value->field_nc__freq__list = other_value.nc__freq__list();
} else {
single_value->field_nc__freq__list.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 NCMeasurementParameters_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 NCMeasurementParameters_template(*other_value.implication_.precondition);
implication_.implied_template = new NCMeasurementParameters_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_CSN1_Types.NCMeasurementParameters.");
break;
}
set_selection(other_value);
}

NCMeasurementParameters_template::NCMeasurementParameters_template()
{
}

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

NCMeasurementParameters_template::NCMeasurementParameters_template(const NCMeasurementParameters& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean NCMeasurementParameters_template::match(const NCMeasurementParameters& 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.nco().is_bound()) return FALSE;
if(!single_value->field_nco.match(other_value.nco(), legacy))return FALSE;
if(!other_value.nc__period__present().is_bound()) return FALSE;
if(!single_value->field_nc__period__present.match(other_value.nc__period__present(), legacy))return FALSE;
if(!other_value.nc__non__drx__period().is_bound()) return FALSE;
if((other_value.nc__non__drx__period().ispresent() ? !single_value->field_nc__non__drx__period.match((const INTEGER&)other_value.nc__non__drx__period(), legacy) : !single_value->field_nc__non__drx__period.match_omit(legacy)))return FALSE;
if(!other_value.nc__reporting__period__i().is_bound()) return FALSE;
if((other_value.nc__reporting__period__i().ispresent() ? !single_value->field_nc__reporting__period__i.match((const INTEGER&)other_value.nc__reporting__period__i(), legacy) : !single_value->field_nc__reporting__period__i.match_omit(legacy)))return FALSE;
if(!other_value.nc__reporting__period__t().is_bound()) return FALSE;
if((other_value.nc__reporting__period__t().ispresent() ? !single_value->field_nc__reporting__period__t.match((const INTEGER&)other_value.nc__reporting__period__t(), legacy) : !single_value->field_nc__reporting__period__t.match_omit(legacy)))return FALSE;
if(!other_value.nc__freq__list__present().is_bound()) return FALSE;
if(!single_value->field_nc__freq__list__present.match(other_value.nc__freq__list__present(), legacy))return FALSE;
if(!other_value.nc__freq__list().is_bound()) return FALSE;
if((other_value.nc__freq__list().ispresent() ? !single_value->field_nc__freq__list.match((const NCFrequencyList&)other_value.nc__freq__list(), legacy) : !single_value->field_nc__freq__list.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_CSN1_Types.NCMeasurementParameters.");
}
return FALSE;
}

boolean NCMeasurementParameters_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_nco.is_bound()
 || single_value->field_nc__period__present.is_bound()
 || (single_value->field_nc__non__drx__period.is_omit() || single_value->field_nc__non__drx__period.is_bound())
 || (single_value->field_nc__reporting__period__i.is_omit() || single_value->field_nc__reporting__period__i.is_bound())
 || (single_value->field_nc__reporting__period__t.is_omit() || single_value->field_nc__reporting__period__t.is_bound())
 || single_value->field_nc__freq__list__present.is_bound()
 || (single_value->field_nc__freq__list.is_omit() || single_value->field_nc__freq__list.is_bound());
}

boolean NCMeasurementParameters_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_nco.is_value()
 && single_value->field_nc__period__present.is_value()
 && (single_value->field_nc__non__drx__period.is_omit() || single_value->field_nc__non__drx__period.is_value())
 && (single_value->field_nc__reporting__period__i.is_omit() || single_value->field_nc__reporting__period__i.is_value())
 && (single_value->field_nc__reporting__period__t.is_omit() || single_value->field_nc__reporting__period__t.is_value())
 && single_value->field_nc__freq__list__present.is_value()
 && (single_value->field_nc__freq__list.is_omit() || single_value->field_nc__freq__list.is_value());
}

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

NCMeasurementParameters NCMeasurementParameters_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_CSN1_Types.NCMeasurementParameters.");
NCMeasurementParameters ret_val;
if (single_value->field_nco.is_bound()) {
ret_val.nco() = single_value->field_nco.valueof();
}
if (single_value->field_nc__period__present.is_bound()) {
ret_val.nc__period__present() = single_value->field_nc__period__present.valueof();
}
if (single_value->field_nc__non__drx__period.is_omit()) ret_val.nc__non__drx__period() = OMIT_VALUE;
else if (single_value->field_nc__non__drx__period.is_bound()) {
ret_val.nc__non__drx__period() = single_value->field_nc__non__drx__period.valueof();
}
if (single_value->field_nc__reporting__period__i.is_omit()) ret_val.nc__reporting__period__i() = OMIT_VALUE;
else if (single_value->field_nc__reporting__period__i.is_bound()) {
ret_val.nc__reporting__period__i() = single_value->field_nc__reporting__period__i.valueof();
}
if (single_value->field_nc__reporting__period__t.is_omit()) ret_val.nc__reporting__period__t() = OMIT_VALUE;
else if (single_value->field_nc__reporting__period__t.is_bound()) {
ret_val.nc__reporting__period__t() = single_value->field_nc__reporting__period__t.valueof();
}
if (single_value->field_nc__freq__list__present.is_bound()) {
ret_val.nc__freq__list__present() = single_value->field_nc__freq__list__present.valueof();
}
if (single_value->field_nc__freq__list.is_omit()) ret_val.nc__freq__list() = OMIT_VALUE;
else if (single_value->field_nc__freq__list.is_bound()) {
ret_val.nc__freq__list() = single_value->field_nc__freq__list.valueof();
}
return ret_val;
}

void NCMeasurementParameters_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_CSN1_Types.NCMeasurementParameters.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new NCMeasurementParameters_template[list_length];
}

NCMeasurementParameters_template& NCMeasurementParameters_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_CSN1_Types.NCMeasurementParameters.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.NCMeasurementParameters.");
return value_list.list_value[list_index];
}

NetworkControlOrder_template& NCMeasurementParameters_template::nco()
{
set_specific();
return single_value->field_nco;
}

const NetworkControlOrder_template& NCMeasurementParameters_template::nco() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nco of a non-specific template of type @RLCMAC_CSN1_Types.NCMeasurementParameters.");
return single_value->field_nco;
}

BITSTRING_template& NCMeasurementParameters_template::nc__period__present()
{
set_specific();
return single_value->field_nc__period__present;
}

const BITSTRING_template& NCMeasurementParameters_template::nc__period__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nc_period_present of a non-specific template of type @RLCMAC_CSN1_Types.NCMeasurementParameters.");
return single_value->field_nc__period__present;
}

INTEGER_template& NCMeasurementParameters_template::nc__non__drx__period()
{
set_specific();
return single_value->field_nc__non__drx__period;
}

const INTEGER_template& NCMeasurementParameters_template::nc__non__drx__period() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nc_non_drx_period of a non-specific template of type @RLCMAC_CSN1_Types.NCMeasurementParameters.");
return single_value->field_nc__non__drx__period;
}

INTEGER_template& NCMeasurementParameters_template::nc__reporting__period__i()
{
set_specific();
return single_value->field_nc__reporting__period__i;
}

const INTEGER_template& NCMeasurementParameters_template::nc__reporting__period__i() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nc_reporting_period_i of a non-specific template of type @RLCMAC_CSN1_Types.NCMeasurementParameters.");
return single_value->field_nc__reporting__period__i;
}

INTEGER_template& NCMeasurementParameters_template::nc__reporting__period__t()
{
set_specific();
return single_value->field_nc__reporting__period__t;
}

const INTEGER_template& NCMeasurementParameters_template::nc__reporting__period__t() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nc_reporting_period_t of a non-specific template of type @RLCMAC_CSN1_Types.NCMeasurementParameters.");
return single_value->field_nc__reporting__period__t;
}

BITSTRING_template& NCMeasurementParameters_template::nc__freq__list__present()
{
set_specific();
return single_value->field_nc__freq__list__present;
}

const BITSTRING_template& NCMeasurementParameters_template::nc__freq__list__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nc_freq_list_present of a non-specific template of type @RLCMAC_CSN1_Types.NCMeasurementParameters.");
return single_value->field_nc__freq__list__present;
}

NCFrequencyList_template& NCMeasurementParameters_template::nc__freq__list()
{
set_specific();
return single_value->field_nc__freq__list;
}

const NCFrequencyList_template& NCMeasurementParameters_template::nc__freq__list() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nc_freq_list of a non-specific template of type @RLCMAC_CSN1_Types.NCMeasurementParameters.");
return single_value->field_nc__freq__list;
}

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

void NCMeasurementParameters_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ nco := ");
single_value->field_nco.log();
TTCN_Logger::log_event_str(", nc_period_present := ");
single_value->field_nc__period__present.log();
TTCN_Logger::log_event_str(", nc_non_drx_period := ");
single_value->field_nc__non__drx__period.log();
TTCN_Logger::log_event_str(", nc_reporting_period_i := ");
single_value->field_nc__reporting__period__i.log();
TTCN_Logger::log_event_str(", nc_reporting_period_t := ");
single_value->field_nc__reporting__period__t.log();
TTCN_Logger::log_event_str(", nc_freq_list_present := ");
single_value->field_nc__freq__list__present.log();
TTCN_Logger::log_event_str(", nc_freq_list := ");
single_value->field_nc__freq__list.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 NCMeasurementParameters_template::log_match(const NCMeasurementParameters& 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_nco.match(match_value.nco(), legacy)){
TTCN_Logger::log_logmatch_info(".nco");
single_value->field_nco.log_match(match_value.nco(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_nc__period__present.match(match_value.nc__period__present(), legacy)){
TTCN_Logger::log_logmatch_info(".nc_period_present");
single_value->field_nc__period__present.log_match(match_value.nc__period__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.nc__non__drx__period().ispresent()){
if(!single_value->field_nc__non__drx__period.match(match_value.nc__non__drx__period(), legacy)){
TTCN_Logger::log_logmatch_info(".nc_non_drx_period");
single_value->field_nc__non__drx__period.log_match(match_value.nc__non__drx__period(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_nc__non__drx__period.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".nc_non_drx_period := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_nc__non__drx__period.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.nc__reporting__period__i().ispresent()){
if(!single_value->field_nc__reporting__period__i.match(match_value.nc__reporting__period__i(), legacy)){
TTCN_Logger::log_logmatch_info(".nc_reporting_period_i");
single_value->field_nc__reporting__period__i.log_match(match_value.nc__reporting__period__i(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_nc__reporting__period__i.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".nc_reporting_period_i := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_nc__reporting__period__i.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.nc__reporting__period__t().ispresent()){
if(!single_value->field_nc__reporting__period__t.match(match_value.nc__reporting__period__t(), legacy)){
TTCN_Logger::log_logmatch_info(".nc_reporting_period_t");
single_value->field_nc__reporting__period__t.log_match(match_value.nc__reporting__period__t(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_nc__reporting__period__t.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".nc_reporting_period_t := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_nc__reporting__period__t.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_nc__freq__list__present.match(match_value.nc__freq__list__present(), legacy)){
TTCN_Logger::log_logmatch_info(".nc_freq_list_present");
single_value->field_nc__freq__list__present.log_match(match_value.nc__freq__list__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.nc__freq__list().ispresent()){
if(!single_value->field_nc__freq__list.match(match_value.nc__freq__list(), legacy)){
TTCN_Logger::log_logmatch_info(".nc_freq_list");
single_value->field_nc__freq__list.log_match(match_value.nc__freq__list(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_nc__freq__list.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".nc_freq_list := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_nc__freq__list.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("{ nco := ");
single_value->field_nco.log_match(match_value.nco(), legacy);
TTCN_Logger::log_event_str(", nc_period_present := ");
single_value->field_nc__period__present.log_match(match_value.nc__period__present(), legacy);
TTCN_Logger::log_event_str(", nc_non_drx_period := ");
if (match_value.nc__non__drx__period().ispresent()) {
single_value->field_nc__non__drx__period.log_match(match_value.nc__non__drx__period(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_nc__non__drx__period.log();
if (single_value->field_nc__non__drx__period.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", nc_reporting_period_i := ");
if (match_value.nc__reporting__period__i().ispresent()) {
single_value->field_nc__reporting__period__i.log_match(match_value.nc__reporting__period__i(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_nc__reporting__period__i.log();
if (single_value->field_nc__reporting__period__i.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", nc_reporting_period_t := ");
if (match_value.nc__reporting__period__t().ispresent()) {
single_value->field_nc__reporting__period__t.log_match(match_value.nc__reporting__period__t(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_nc__reporting__period__t.log();
if (single_value->field_nc__reporting__period__t.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", nc_freq_list_present := ");
single_value->field_nc__freq__list__present.log_match(match_value.nc__freq__list__present(), legacy);
TTCN_Logger::log_event_str(", nc_freq_list := ");
if (match_value.nc__freq__list().ispresent()) {
single_value->field_nc__freq__list.log_match(match_value.nc__freq__list(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_nc__freq__list.log();
if (single_value->field_nc__freq__list.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 NCMeasurementParameters_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (nco().is_bound()) nco().set_implicit_omit();
if (nc__period__present().is_bound()) nc__period__present().set_implicit_omit();
if (!nc__non__drx__period().is_bound()) nc__non__drx__period() = OMIT_VALUE;
else nc__non__drx__period().set_implicit_omit();
if (!nc__reporting__period__i().is_bound()) nc__reporting__period__i() = OMIT_VALUE;
else nc__reporting__period__i().set_implicit_omit();
if (!nc__reporting__period__t().is_bound()) nc__reporting__period__t() = OMIT_VALUE;
else nc__reporting__period__t().set_implicit_omit();
if (nc__freq__list__present().is_bound()) nc__freq__list__present().set_implicit_omit();
if (!nc__freq__list().is_bound()) nc__freq__list() = OMIT_VALUE;
else nc__freq__list().set_implicit_omit();
}

void NCMeasurementParameters_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_nco.encode_text(text_buf);
single_value->field_nc__period__present.encode_text(text_buf);
single_value->field_nc__non__drx__period.encode_text(text_buf);
single_value->field_nc__reporting__period__i.encode_text(text_buf);
single_value->field_nc__reporting__period__t.encode_text(text_buf);
single_value->field_nc__freq__list__present.encode_text(text_buf);
single_value->field_nc__freq__list.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_CSN1_Types.NCMeasurementParameters.");
}
}

void NCMeasurementParameters_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_nco.decode_text(text_buf);
single_value->field_nc__period__present.decode_text(text_buf);
single_value->field_nc__non__drx__period.decode_text(text_buf);
single_value->field_nc__reporting__period__i.decode_text(text_buf);
single_value->field_nc__reporting__period__t.decode_text(text_buf);
single_value->field_nc__freq__list__present.decode_text(text_buf);
single_value->field_nc__freq__list.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 NCMeasurementParameters_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_CSN1_Types.NCMeasurementParameters.");
}
}

void NCMeasurementParameters_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: {
    NCMeasurementParameters_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_CSN1_Types.NCMeasurementParameters 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) nco().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nc__period__present().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nc__non__drx__period().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) nc__reporting__period__i().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) nc__reporting__period__t().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) nc__freq__list__present().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) nc__freq__list().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(), "nco")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nco().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nc_period_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nc__period__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(), "nc_non_drx_period")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nc__non__drx__period().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nc_reporting_period_i")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nc__reporting__period__i().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nc_reporting_period_t")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nc__reporting__period__t().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nc_freq_list_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nc__freq__list__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(), "nc_freq_list")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nc__freq__list().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_CSN1_Types.NCMeasurementParameters: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    NCMeasurementParameters_template* precondition = new NCMeasurementParameters_template;
    precondition->set_param(*param.get_elem(0));
    NCMeasurementParameters_template* implied_template = new NCMeasurementParameters_template;
    implied_template->set_param(*param.get_elem(1));
    *this = NCMeasurementParameters_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.NCMeasurementParameters");
  }
  is_ifpresent = param.get_ifpresent();
}

void NCMeasurementParameters_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_nco.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.NCMeasurementParameters");
single_value->field_nc__period__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.NCMeasurementParameters");
single_value->field_nc__non__drx__period.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.NCMeasurementParameters");
single_value->field_nc__reporting__period__i.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.NCMeasurementParameters");
single_value->field_nc__reporting__period__t.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.NCMeasurementParameters");
single_value->field_nc__freq__list__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.NCMeasurementParameters");
single_value->field_nc__freq__list.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.NCMeasurementParameters");
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_CSN1_Types.NCMeasurementParameters");
}

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

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

PacketMeasOrder::PacketMeasOrder()
{
}

PacketMeasOrder::PacketMeasOrder(const PageMode& par_page__mode,
    const GlobalTfiOrTlli& par_tfi__or__tlli,
    const INTEGER& par_pmo__index,
    const INTEGER& par_pmo__count,
    const BITSTRING& par_nc__meas__param__present,
    const OPTIONAL< NCMeasurementParameters >& par_nc__meas__param,
    const BITSTRING& par_zero)
  :   field_page__mode(par_page__mode),
  field_tfi__or__tlli(par_tfi__or__tlli),
  field_pmo__index(par_pmo__index),
  field_pmo__count(par_pmo__count),
  field_nc__meas__param__present(par_nc__meas__param__present),
  field_nc__meas__param(par_nc__meas__param),
  field_zero(par_zero)
{
}

PacketMeasOrder::PacketMeasOrder(const PacketMeasOrder& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PacketMeasOrder.");
if (other_value.page__mode().is_bound()) field_page__mode = other_value.page__mode();
else field_page__mode.clean_up();
if (other_value.tfi__or__tlli().is_bound()) field_tfi__or__tlli = other_value.tfi__or__tlli();
else field_tfi__or__tlli.clean_up();
if (other_value.pmo__index().is_bound()) field_pmo__index = other_value.pmo__index();
else field_pmo__index.clean_up();
if (other_value.pmo__count().is_bound()) field_pmo__count = other_value.pmo__count();
else field_pmo__count.clean_up();
if (other_value.nc__meas__param__present().is_bound()) field_nc__meas__param__present = other_value.nc__meas__param__present();
else field_nc__meas__param__present.clean_up();
if (other_value.nc__meas__param().is_bound()) field_nc__meas__param = other_value.nc__meas__param();
else field_nc__meas__param.clean_up();
if (other_value.zero().is_bound()) field_zero = other_value.zero();
else field_zero.clean_up();
}

void PacketMeasOrder::clean_up()
{
field_page__mode.clean_up();
field_tfi__or__tlli.clean_up();
field_pmo__index.clean_up();
field_pmo__count.clean_up();
field_nc__meas__param__present.clean_up();
field_nc__meas__param.clean_up();
field_zero.clean_up();
}

const TTCN_Typedescriptor_t* PacketMeasOrder::get_descriptor() const { return &PacketMeasOrder_descr_; }
PacketMeasOrder& PacketMeasOrder::operator=(const PacketMeasOrder& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PacketMeasOrder.");
  if (other_value.page__mode().is_bound()) field_page__mode = other_value.page__mode();
  else field_page__mode.clean_up();
  if (other_value.tfi__or__tlli().is_bound()) field_tfi__or__tlli = other_value.tfi__or__tlli();
  else field_tfi__or__tlli.clean_up();
  if (other_value.pmo__index().is_bound()) field_pmo__index = other_value.pmo__index();
  else field_pmo__index.clean_up();
  if (other_value.pmo__count().is_bound()) field_pmo__count = other_value.pmo__count();
  else field_pmo__count.clean_up();
  if (other_value.nc__meas__param__present().is_bound()) field_nc__meas__param__present = other_value.nc__meas__param__present();
  else field_nc__meas__param__present.clean_up();
  if (other_value.nc__meas__param().is_bound()) field_nc__meas__param = other_value.nc__meas__param();
  else field_nc__meas__param.clean_up();
  if (other_value.zero().is_bound()) field_zero = other_value.zero();
  else field_zero.clean_up();
}
return *this;
}

boolean PacketMeasOrder::operator==(const PacketMeasOrder& other_value) const
{
return field_page__mode==other_value.field_page__mode
  && field_tfi__or__tlli==other_value.field_tfi__or__tlli
  && field_pmo__index==other_value.field_pmo__index
  && field_pmo__count==other_value.field_pmo__count
  && field_nc__meas__param__present==other_value.field_nc__meas__param__present
  && field_nc__meas__param==other_value.field_nc__meas__param
  && field_zero==other_value.field_zero;
}

boolean PacketMeasOrder::is_bound() const
{
return (field_page__mode.is_bound())
  || (field_tfi__or__tlli.is_bound())
  || (field_pmo__index.is_bound())
  || (field_pmo__count.is_bound())
  || (field_nc__meas__param__present.is_bound())
  || (OPTIONAL_OMIT == field_nc__meas__param.get_selection() || field_nc__meas__param.is_bound())
  || (field_zero.is_bound());
}
boolean PacketMeasOrder::is_value() const
{
return field_page__mode.is_value()
  && field_tfi__or__tlli.is_value()
  && field_pmo__index.is_value()
  && field_pmo__count.is_value()
  && field_nc__meas__param__present.is_value()
  && (OPTIONAL_OMIT == field_nc__meas__param.get_selection() || field_nc__meas__param.is_value())
  && field_zero.is_value();
}
int PacketMeasOrder::size_of() const
{
  int ret_val = 6;
  if (field_nc__meas__param.ispresent()) ret_val++;
  return ret_val;
}

void PacketMeasOrder::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ page_mode := ");
field_page__mode.log();
TTCN_Logger::log_event_str(", tfi_or_tlli := ");
field_tfi__or__tlli.log();
TTCN_Logger::log_event_str(", pmo_index := ");
field_pmo__index.log();
TTCN_Logger::log_event_str(", pmo_count := ");
field_pmo__count.log();
TTCN_Logger::log_event_str(", nc_meas_param_present := ");
field_nc__meas__param__present.log();
TTCN_Logger::log_event_str(", nc_meas_param := ");
field_nc__meas__param.log();
TTCN_Logger::log_event_str(", zero := ");
field_zero.log();
TTCN_Logger::log_event_str(" }");
}

void PacketMeasOrder::set_implicit_omit()
{
if (page__mode().is_bound()) page__mode().set_implicit_omit();
if (tfi__or__tlli().is_bound()) tfi__or__tlli().set_implicit_omit();
if (pmo__index().is_bound()) pmo__index().set_implicit_omit();
if (pmo__count().is_bound()) pmo__count().set_implicit_omit();
if (nc__meas__param__present().is_bound()) nc__meas__param__present().set_implicit_omit();
if (!nc__meas__param().is_bound()) nc__meas__param() = OMIT_VALUE;
else nc__meas__param().set_implicit_omit();
if (zero().is_bound()) zero().set_implicit_omit();
}

void PacketMeasOrder::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_CSN1_Types.PacketMeasOrder 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) page__mode().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tfi__or__tlli().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) pmo__index().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) pmo__count().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) nc__meas__param__present().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) nc__meas__param().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) zero().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(), "page_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          page__mode().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tfi_or_tlli")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tfi__or__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(), "pmo_index")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pmo__index().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pmo_count")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pmo__count().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nc_meas_param_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nc__meas__param__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(), "nc_meas_param")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nc__meas__param().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "zero")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          zero().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_CSN1_Types.PacketMeasOrder: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.PacketMeasOrder");
  }
}

void PacketMeasOrder::encode_text(Text_Buf& text_buf) const
{
field_page__mode.encode_text(text_buf);
field_tfi__or__tlli.encode_text(text_buf);
field_pmo__index.encode_text(text_buf);
field_pmo__count.encode_text(text_buf);
field_nc__meas__param__present.encode_text(text_buf);
field_nc__meas__param.encode_text(text_buf);
field_zero.encode_text(text_buf);
}

void PacketMeasOrder::decode_text(Text_Buf& text_buf)
{
field_page__mode.decode_text(text_buf);
field_tfi__or__tlli.decode_text(text_buf);
field_pmo__index.decode_text(text_buf);
field_pmo__count.decode_text(text_buf);
field_nc__meas__param__present.decode_text(text_buf);
field_nc__meas__param.decode_text(text_buf);
field_zero.decode_text(text_buf);
}

void PacketMeasOrder::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 PacketMeasOrder::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 PacketMeasOrder::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, PacketMeasOrder_page__mode_descr_.raw->forceomit);
  decoded_field_length = field_page__mode.RAW_decode(PacketMeasOrder_page__mode_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, PacketMeasOrder_tfi__or__tlli_descr_.raw->forceomit);
  decoded_field_length = field_tfi__or__tlli.RAW_decode(PacketMeasOrder_tfi__or__tlli_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, PacketMeasOrder_pmo__index_descr_.raw->forceomit);
  decoded_field_length = field_pmo__index.RAW_decode(PacketMeasOrder_pmo__index_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, PacketMeasOrder_pmo__count_descr_.raw->forceomit);
  decoded_field_length = field_pmo__count.RAW_decode(PacketMeasOrder_pmo__count_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, PacketMeasOrder_nc__meas__param__present_descr_.raw->forceomit);
  decoded_field_length = field_nc__meas__param__present.RAW_decode(PacketMeasOrder_nc__meas__param__present_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());
  if (limit > 0 && field_nc__meas__param__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(5)) {
    field_nc__meas__param = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_5_force_omit(5, force_omit, PacketMeasOrder_nc__meas__param_descr_.raw->forceomit);
  decoded_field_length = field_nc__meas__param().RAW_decode(PacketMeasOrder_nc__meas__param_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 1) {
  field_nc__meas__param = 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_nc__meas__param=OMIT_VALUE;
  RAW_Force_Omit field_6_force_omit(6, force_omit, PacketMeasOrder_zero_descr_.raw->forceomit);
  decoded_field_length = field_zero.RAW_decode(PacketMeasOrder_zero_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 PacketMeasOrder::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, PacketMeasOrder_page__mode_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PacketMeasOrder_tfi__or__tlli_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PacketMeasOrder_pmo__index_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, PacketMeasOrder_pmo__count_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, PacketMeasOrder_nc__meas__param__present_descr_.raw);
  if (field_nc__meas__param.ispresent()) {
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, PacketMeasOrder_nc__meas__param_descr_.raw);
  }
  else myleaf.body.node.nodes[5] = NULL;
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, PacketMeasOrder_zero_descr_.raw);
  encoded_length += field_page__mode.RAW_encode(PacketMeasOrder_page__mode_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_tfi__or__tlli.RAW_encode(PacketMeasOrder_tfi__or__tlli_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_pmo__index.RAW_encode(PacketMeasOrder_pmo__index_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_pmo__count.RAW_encode(PacketMeasOrder_pmo__count_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_nc__meas__param__present.RAW_encode(PacketMeasOrder_nc__meas__param__present_descr_, *myleaf.body.node.nodes[4]);
  if (field_nc__meas__param.ispresent()) {
  encoded_length += field_nc__meas__param().RAW_encode(PacketMeasOrder_nc__meas__param_descr_, *myleaf.body.node.nodes[5]);
  }
  encoded_length += field_zero.RAW_encode(PacketMeasOrder_zero_descr_, *myleaf.body.node.nodes[6]);
  if (field_nc__meas__param.ispresent() && (field_nc__meas__param__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={4};
  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(PacketMeasOrder_nc__meas__param__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);
  }
  }
  return myleaf.length = encoded_length;
}

struct PacketMeasOrder_template::single_value_struct {
PageMode_template field_page__mode;
GlobalTfiOrTlli_template field_tfi__or__tlli;
INTEGER_template field_pmo__index;
INTEGER_template field_pmo__count;
BITSTRING_template field_nc__meas__param__present;
NCMeasurementParameters_template field_nc__meas__param;
BITSTRING_template field_zero;
};

void PacketMeasOrder_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_page__mode = ANY_VALUE;
single_value->field_tfi__or__tlli = ANY_VALUE;
single_value->field_pmo__index = ANY_VALUE;
single_value->field_pmo__count = ANY_VALUE;
single_value->field_nc__meas__param__present = ANY_VALUE;
single_value->field_nc__meas__param = ANY_OR_OMIT;
single_value->field_zero = ANY_VALUE;
}
}
}

void PacketMeasOrder_template::copy_value(const PacketMeasOrder& other_value)
{
single_value = new single_value_struct;
if (other_value.page__mode().is_bound()) {
  single_value->field_page__mode = other_value.page__mode();
} else {
  single_value->field_page__mode.clean_up();
}
if (other_value.tfi__or__tlli().is_bound()) {
  single_value->field_tfi__or__tlli = other_value.tfi__or__tlli();
} else {
  single_value->field_tfi__or__tlli.clean_up();
}
if (other_value.pmo__index().is_bound()) {
  single_value->field_pmo__index = other_value.pmo__index();
} else {
  single_value->field_pmo__index.clean_up();
}
if (other_value.pmo__count().is_bound()) {
  single_value->field_pmo__count = other_value.pmo__count();
} else {
  single_value->field_pmo__count.clean_up();
}
if (other_value.nc__meas__param__present().is_bound()) {
  single_value->field_nc__meas__param__present = other_value.nc__meas__param__present();
} else {
  single_value->field_nc__meas__param__present.clean_up();
}
if (other_value.nc__meas__param().is_bound()) {
  if (other_value.nc__meas__param().ispresent()) single_value->field_nc__meas__param = other_value.nc__meas__param()();
  else single_value->field_nc__meas__param = OMIT_VALUE;
} else {
  single_value->field_nc__meas__param.clean_up();
}
if (other_value.zero().is_bound()) {
  single_value->field_zero = other_value.zero();
} else {
  single_value->field_zero.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PacketMeasOrder_template::copy_template(const PacketMeasOrder_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.page__mode().get_selection()) {
single_value->field_page__mode = other_value.page__mode();
} else {
single_value->field_page__mode.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tfi__or__tlli().get_selection()) {
single_value->field_tfi__or__tlli = other_value.tfi__or__tlli();
} else {
single_value->field_tfi__or__tlli.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pmo__index().get_selection()) {
single_value->field_pmo__index = other_value.pmo__index();
} else {
single_value->field_pmo__index.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pmo__count().get_selection()) {
single_value->field_pmo__count = other_value.pmo__count();
} else {
single_value->field_pmo__count.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nc__meas__param__present().get_selection()) {
single_value->field_nc__meas__param__present = other_value.nc__meas__param__present();
} else {
single_value->field_nc__meas__param__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nc__meas__param().get_selection()) {
single_value->field_nc__meas__param = other_value.nc__meas__param();
} else {
single_value->field_nc__meas__param.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.zero().get_selection()) {
single_value->field_zero = other_value.zero();
} else {
single_value->field_zero.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 PacketMeasOrder_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 PacketMeasOrder_template(*other_value.implication_.precondition);
implication_.implied_template = new PacketMeasOrder_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_CSN1_Types.PacketMeasOrder.");
break;
}
set_selection(other_value);
}

PacketMeasOrder_template::PacketMeasOrder_template()
{
}

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

PacketMeasOrder_template::PacketMeasOrder_template(const PacketMeasOrder& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PacketMeasOrder_template::match(const PacketMeasOrder& 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.page__mode().is_bound()) return FALSE;
if(!single_value->field_page__mode.match(other_value.page__mode(), legacy))return FALSE;
if(!other_value.tfi__or__tlli().is_bound()) return FALSE;
if(!single_value->field_tfi__or__tlli.match(other_value.tfi__or__tlli(), legacy))return FALSE;
if(!other_value.pmo__index().is_bound()) return FALSE;
if(!single_value->field_pmo__index.match(other_value.pmo__index(), legacy))return FALSE;
if(!other_value.pmo__count().is_bound()) return FALSE;
if(!single_value->field_pmo__count.match(other_value.pmo__count(), legacy))return FALSE;
if(!other_value.nc__meas__param__present().is_bound()) return FALSE;
if(!single_value->field_nc__meas__param__present.match(other_value.nc__meas__param__present(), legacy))return FALSE;
if(!other_value.nc__meas__param().is_bound()) return FALSE;
if((other_value.nc__meas__param().ispresent() ? !single_value->field_nc__meas__param.match((const NCMeasurementParameters&)other_value.nc__meas__param(), legacy) : !single_value->field_nc__meas__param.match_omit(legacy)))return FALSE;
if(!other_value.zero().is_bound()) return FALSE;
if(!single_value->field_zero.match(other_value.zero(), 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_CSN1_Types.PacketMeasOrder.");
}
return FALSE;
}

boolean PacketMeasOrder_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_page__mode.is_bound()
 || single_value->field_tfi__or__tlli.is_bound()
 || single_value->field_pmo__index.is_bound()
 || single_value->field_pmo__count.is_bound()
 || single_value->field_nc__meas__param__present.is_bound()
 || (single_value->field_nc__meas__param.is_omit() || single_value->field_nc__meas__param.is_bound())
 || single_value->field_zero.is_bound();
}

boolean PacketMeasOrder_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_page__mode.is_value()
 && single_value->field_tfi__or__tlli.is_value()
 && single_value->field_pmo__index.is_value()
 && single_value->field_pmo__count.is_value()
 && single_value->field_nc__meas__param__present.is_value()
 && (single_value->field_nc__meas__param.is_omit() || single_value->field_nc__meas__param.is_value())
 && single_value->field_zero.is_value();
}

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

PacketMeasOrder PacketMeasOrder_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_CSN1_Types.PacketMeasOrder.");
PacketMeasOrder ret_val;
if (single_value->field_page__mode.is_bound()) {
ret_val.page__mode() = single_value->field_page__mode.valueof();
}
if (single_value->field_tfi__or__tlli.is_bound()) {
ret_val.tfi__or__tlli() = single_value->field_tfi__or__tlli.valueof();
}
if (single_value->field_pmo__index.is_bound()) {
ret_val.pmo__index() = single_value->field_pmo__index.valueof();
}
if (single_value->field_pmo__count.is_bound()) {
ret_val.pmo__count() = single_value->field_pmo__count.valueof();
}
if (single_value->field_nc__meas__param__present.is_bound()) {
ret_val.nc__meas__param__present() = single_value->field_nc__meas__param__present.valueof();
}
if (single_value->field_nc__meas__param.is_omit()) ret_val.nc__meas__param() = OMIT_VALUE;
else if (single_value->field_nc__meas__param.is_bound()) {
ret_val.nc__meas__param() = single_value->field_nc__meas__param.valueof();
}
if (single_value->field_zero.is_bound()) {
ret_val.zero() = single_value->field_zero.valueof();
}
return ret_val;
}

void PacketMeasOrder_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_CSN1_Types.PacketMeasOrder.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PacketMeasOrder_template[list_length];
}

PacketMeasOrder_template& PacketMeasOrder_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_CSN1_Types.PacketMeasOrder.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.PacketMeasOrder.");
return value_list.list_value[list_index];
}

PageMode_template& PacketMeasOrder_template::page__mode()
{
set_specific();
return single_value->field_page__mode;
}

const PageMode_template& PacketMeasOrder_template::page__mode() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field page_mode of a non-specific template of type @RLCMAC_CSN1_Types.PacketMeasOrder.");
return single_value->field_page__mode;
}

GlobalTfiOrTlli_template& PacketMeasOrder_template::tfi__or__tlli()
{
set_specific();
return single_value->field_tfi__or__tlli;
}

const GlobalTfiOrTlli_template& PacketMeasOrder_template::tfi__or__tlli() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tfi_or_tlli of a non-specific template of type @RLCMAC_CSN1_Types.PacketMeasOrder.");
return single_value->field_tfi__or__tlli;
}

INTEGER_template& PacketMeasOrder_template::pmo__index()
{
set_specific();
return single_value->field_pmo__index;
}

const INTEGER_template& PacketMeasOrder_template::pmo__index() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pmo_index of a non-specific template of type @RLCMAC_CSN1_Types.PacketMeasOrder.");
return single_value->field_pmo__index;
}

INTEGER_template& PacketMeasOrder_template::pmo__count()
{
set_specific();
return single_value->field_pmo__count;
}

const INTEGER_template& PacketMeasOrder_template::pmo__count() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pmo_count of a non-specific template of type @RLCMAC_CSN1_Types.PacketMeasOrder.");
return single_value->field_pmo__count;
}

BITSTRING_template& PacketMeasOrder_template::nc__meas__param__present()
{
set_specific();
return single_value->field_nc__meas__param__present;
}

const BITSTRING_template& PacketMeasOrder_template::nc__meas__param__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nc_meas_param_present of a non-specific template of type @RLCMAC_CSN1_Types.PacketMeasOrder.");
return single_value->field_nc__meas__param__present;
}

NCMeasurementParameters_template& PacketMeasOrder_template::nc__meas__param()
{
set_specific();
return single_value->field_nc__meas__param;
}

const NCMeasurementParameters_template& PacketMeasOrder_template::nc__meas__param() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nc_meas_param of a non-specific template of type @RLCMAC_CSN1_Types.PacketMeasOrder.");
return single_value->field_nc__meas__param;
}

BITSTRING_template& PacketMeasOrder_template::zero()
{
set_specific();
return single_value->field_zero;
}

const BITSTRING_template& PacketMeasOrder_template::zero() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field zero of a non-specific template of type @RLCMAC_CSN1_Types.PacketMeasOrder.");
return single_value->field_zero;
}

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

void PacketMeasOrder_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ page_mode := ");
single_value->field_page__mode.log();
TTCN_Logger::log_event_str(", tfi_or_tlli := ");
single_value->field_tfi__or__tlli.log();
TTCN_Logger::log_event_str(", pmo_index := ");
single_value->field_pmo__index.log();
TTCN_Logger::log_event_str(", pmo_count := ");
single_value->field_pmo__count.log();
TTCN_Logger::log_event_str(", nc_meas_param_present := ");
single_value->field_nc__meas__param__present.log();
TTCN_Logger::log_event_str(", nc_meas_param := ");
single_value->field_nc__meas__param.log();
TTCN_Logger::log_event_str(", zero := ");
single_value->field_zero.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 PacketMeasOrder_template::log_match(const PacketMeasOrder& 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_page__mode.match(match_value.page__mode(), legacy)){
TTCN_Logger::log_logmatch_info(".page_mode");
single_value->field_page__mode.log_match(match_value.page__mode(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tfi__or__tlli.match(match_value.tfi__or__tlli(), legacy)){
TTCN_Logger::log_logmatch_info(".tfi_or_tlli");
single_value->field_tfi__or__tlli.log_match(match_value.tfi__or__tlli(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pmo__index.match(match_value.pmo__index(), legacy)){
TTCN_Logger::log_logmatch_info(".pmo_index");
single_value->field_pmo__index.log_match(match_value.pmo__index(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pmo__count.match(match_value.pmo__count(), legacy)){
TTCN_Logger::log_logmatch_info(".pmo_count");
single_value->field_pmo__count.log_match(match_value.pmo__count(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_nc__meas__param__present.match(match_value.nc__meas__param__present(), legacy)){
TTCN_Logger::log_logmatch_info(".nc_meas_param_present");
single_value->field_nc__meas__param__present.log_match(match_value.nc__meas__param__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.nc__meas__param().ispresent()){
if(!single_value->field_nc__meas__param.match(match_value.nc__meas__param(), legacy)){
TTCN_Logger::log_logmatch_info(".nc_meas_param");
single_value->field_nc__meas__param.log_match(match_value.nc__meas__param(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_nc__meas__param.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".nc_meas_param := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_nc__meas__param.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_zero.match(match_value.zero(), legacy)){
TTCN_Logger::log_logmatch_info(".zero");
single_value->field_zero.log_match(match_value.zero(), 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("{ page_mode := ");
single_value->field_page__mode.log_match(match_value.page__mode(), legacy);
TTCN_Logger::log_event_str(", tfi_or_tlli := ");
single_value->field_tfi__or__tlli.log_match(match_value.tfi__or__tlli(), legacy);
TTCN_Logger::log_event_str(", pmo_index := ");
single_value->field_pmo__index.log_match(match_value.pmo__index(), legacy);
TTCN_Logger::log_event_str(", pmo_count := ");
single_value->field_pmo__count.log_match(match_value.pmo__count(), legacy);
TTCN_Logger::log_event_str(", nc_meas_param_present := ");
single_value->field_nc__meas__param__present.log_match(match_value.nc__meas__param__present(), legacy);
TTCN_Logger::log_event_str(", nc_meas_param := ");
if (match_value.nc__meas__param().ispresent()) {
single_value->field_nc__meas__param.log_match(match_value.nc__meas__param(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_nc__meas__param.log();
if (single_value->field_nc__meas__param.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", zero := ");
single_value->field_zero.log_match(match_value.zero(), 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 PacketMeasOrder_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (page__mode().is_bound()) page__mode().set_implicit_omit();
if (tfi__or__tlli().is_bound()) tfi__or__tlli().set_implicit_omit();
if (pmo__index().is_bound()) pmo__index().set_implicit_omit();
if (pmo__count().is_bound()) pmo__count().set_implicit_omit();
if (nc__meas__param__present().is_bound()) nc__meas__param__present().set_implicit_omit();
if (!nc__meas__param().is_bound()) nc__meas__param() = OMIT_VALUE;
else nc__meas__param().set_implicit_omit();
if (zero().is_bound()) zero().set_implicit_omit();
}

void PacketMeasOrder_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_page__mode.encode_text(text_buf);
single_value->field_tfi__or__tlli.encode_text(text_buf);
single_value->field_pmo__index.encode_text(text_buf);
single_value->field_pmo__count.encode_text(text_buf);
single_value->field_nc__meas__param__present.encode_text(text_buf);
single_value->field_nc__meas__param.encode_text(text_buf);
single_value->field_zero.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_CSN1_Types.PacketMeasOrder.");
}
}

void PacketMeasOrder_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_page__mode.decode_text(text_buf);
single_value->field_tfi__or__tlli.decode_text(text_buf);
single_value->field_pmo__index.decode_text(text_buf);
single_value->field_pmo__count.decode_text(text_buf);
single_value->field_nc__meas__param__present.decode_text(text_buf);
single_value->field_nc__meas__param.decode_text(text_buf);
single_value->field_zero.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 PacketMeasOrder_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_CSN1_Types.PacketMeasOrder.");
}
}

void PacketMeasOrder_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: {
    PacketMeasOrder_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_CSN1_Types.PacketMeasOrder 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) page__mode().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tfi__or__tlli().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) pmo__index().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) pmo__count().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) nc__meas__param__present().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) nc__meas__param().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) zero().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(), "page_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          page__mode().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tfi_or_tlli")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tfi__or__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(), "pmo_index")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pmo__index().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pmo_count")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pmo__count().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nc_meas_param_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nc__meas__param__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(), "nc_meas_param")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nc__meas__param().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "zero")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          zero().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_CSN1_Types.PacketMeasOrder: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PacketMeasOrder_template* precondition = new PacketMeasOrder_template;
    precondition->set_param(*param.get_elem(0));
    PacketMeasOrder_template* implied_template = new PacketMeasOrder_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PacketMeasOrder_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.PacketMeasOrder");
  }
  is_ifpresent = param.get_ifpresent();
}

void PacketMeasOrder_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_page__mode.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketMeasOrder");
single_value->field_tfi__or__tlli.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketMeasOrder");
single_value->field_pmo__index.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketMeasOrder");
single_value->field_pmo__count.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketMeasOrder");
single_value->field_nc__meas__param__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketMeasOrder");
single_value->field_nc__meas__param.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketMeasOrder");
single_value->field_zero.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketMeasOrder");
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_CSN1_Types.PacketMeasOrder");
}

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

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

O__Gtfi::O__Gtfi()
{
}

O__Gtfi::O__Gtfi(const BITSTRING& par_presence,
    const GlobalTfi& par_global__tfi)
  :   field_presence(par_presence),
  field_global__tfi(par_global__tfi)
{
}

O__Gtfi::O__Gtfi(const O__Gtfi& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.O_Gtfi.");
if (other_value.presence().is_bound()) field_presence = other_value.presence();
else field_presence.clean_up();
if (other_value.global__tfi().is_bound()) field_global__tfi = other_value.global__tfi();
else field_global__tfi.clean_up();
}

void O__Gtfi::clean_up()
{
field_presence.clean_up();
field_global__tfi.clean_up();
}

const TTCN_Typedescriptor_t* O__Gtfi::get_descriptor() const { return &O__Gtfi_descr_; }
O__Gtfi& O__Gtfi::operator=(const O__Gtfi& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.O_Gtfi.");
  if (other_value.presence().is_bound()) field_presence = other_value.presence();
  else field_presence.clean_up();
  if (other_value.global__tfi().is_bound()) field_global__tfi = other_value.global__tfi();
  else field_global__tfi.clean_up();
}
return *this;
}

boolean O__Gtfi::operator==(const O__Gtfi& other_value) const
{
return field_presence==other_value.field_presence
  && field_global__tfi==other_value.field_global__tfi;
}

boolean O__Gtfi::is_bound() const
{
return (field_presence.is_bound())
  || (field_global__tfi.is_bound());
}
boolean O__Gtfi::is_value() const
{
return field_presence.is_value()
  && field_global__tfi.is_value();
}
void O__Gtfi::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ presence := ");
field_presence.log();
TTCN_Logger::log_event_str(", global_tfi := ");
field_global__tfi.log();
TTCN_Logger::log_event_str(" }");
}

void O__Gtfi::set_implicit_omit()
{
if (presence().is_bound()) presence().set_implicit_omit();
if (global__tfi().is_bound()) global__tfi().set_implicit_omit();
}

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

void O__Gtfi::encode_text(Text_Buf& text_buf) const
{
field_presence.encode_text(text_buf);
field_global__tfi.encode_text(text_buf);
}

void O__Gtfi::decode_text(Text_Buf& text_buf)
{
field_presence.decode_text(text_buf);
field_global__tfi.decode_text(text_buf);
}

void O__Gtfi::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 O__Gtfi::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 O__Gtfi::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, O__Gtfi_presence_descr_.raw->forceomit);
  decoded_field_length = field_presence.RAW_decode(O__Gtfi_presence_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, O__Gtfi_global__tfi_descr_.raw->forceomit);
  decoded_field_length = field_global__tfi.RAW_decode(O__Gtfi_global__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());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

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

struct O__Gtfi_template::single_value_struct {
BITSTRING_template field_presence;
GlobalTfi_template field_global__tfi;
};

void O__Gtfi_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_presence = ANY_VALUE;
single_value->field_global__tfi = ANY_VALUE;
}
}
}

void O__Gtfi_template::copy_value(const O__Gtfi& other_value)
{
single_value = new single_value_struct;
if (other_value.presence().is_bound()) {
  single_value->field_presence = other_value.presence();
} else {
  single_value->field_presence.clean_up();
}
if (other_value.global__tfi().is_bound()) {
  single_value->field_global__tfi = other_value.global__tfi();
} else {
  single_value->field_global__tfi.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void O__Gtfi_template::copy_template(const O__Gtfi_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) {
single_value->field_presence = other_value.presence();
} else {
single_value->field_presence.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.global__tfi().get_selection()) {
single_value->field_global__tfi = other_value.global__tfi();
} else {
single_value->field_global__tfi.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 O__Gtfi_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 O__Gtfi_template(*other_value.implication_.precondition);
implication_.implied_template = new O__Gtfi_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_CSN1_Types.O_Gtfi.");
break;
}
set_selection(other_value);
}

O__Gtfi_template::O__Gtfi_template()
{
}

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

O__Gtfi_template::O__Gtfi_template(const O__Gtfi& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

O__Gtfi_template& O__Gtfi_template::operator=(const OPTIONAL<O__Gtfi>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const O__Gtfi&)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_CSN1_Types.O_Gtfi.");
}
return *this;
}

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

boolean O__Gtfi_template::match(const O__Gtfi& 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.presence().is_bound()) return FALSE;
if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE;
if(!other_value.global__tfi().is_bound()) return FALSE;
if(!single_value->field_global__tfi.match(other_value.global__tfi(), 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_CSN1_Types.O_Gtfi.");
}
return FALSE;
}

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

boolean O__Gtfi_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_presence.is_value()
 && single_value->field_global__tfi.is_value();
}

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

O__Gtfi O__Gtfi_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_CSN1_Types.O_Gtfi.");
O__Gtfi ret_val;
if (single_value->field_presence.is_bound()) {
ret_val.presence() = single_value->field_presence.valueof();
}
if (single_value->field_global__tfi.is_bound()) {
ret_val.global__tfi() = single_value->field_global__tfi.valueof();
}
return ret_val;
}

void O__Gtfi_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_CSN1_Types.O_Gtfi.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new O__Gtfi_template[list_length];
}

O__Gtfi_template& O__Gtfi_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_CSN1_Types.O_Gtfi.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.O_Gtfi.");
return value_list.list_value[list_index];
}

BITSTRING_template& O__Gtfi_template::presence()
{
set_specific();
return single_value->field_presence;
}

const BITSTRING_template& O__Gtfi_template::presence() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field presence of a non-specific template of type @RLCMAC_CSN1_Types.O_Gtfi.");
return single_value->field_presence;
}

GlobalTfi_template& O__Gtfi_template::global__tfi()
{
set_specific();
return single_value->field_global__tfi;
}

const GlobalTfi_template& O__Gtfi_template::global__tfi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field global_tfi of a non-specific template of type @RLCMAC_CSN1_Types.O_Gtfi.");
return single_value->field_global__tfi;
}

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

void O__Gtfi_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ presence := ");
single_value->field_presence.log();
TTCN_Logger::log_event_str(", global_tfi := ");
single_value->field_global__tfi.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 O__Gtfi_template::log_match(const O__Gtfi& 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_presence.match(match_value.presence(), legacy)){
TTCN_Logger::log_logmatch_info(".presence");
single_value->field_presence.log_match(match_value.presence(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_global__tfi.match(match_value.global__tfi(), legacy)){
TTCN_Logger::log_logmatch_info(".global_tfi");
single_value->field_global__tfi.log_match(match_value.global__tfi(), 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("{ presence := ");
single_value->field_presence.log_match(match_value.presence(), legacy);
TTCN_Logger::log_event_str(", global_tfi := ");
single_value->field_global__tfi.log_match(match_value.global__tfi(), 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 O__Gtfi_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (presence().is_bound()) presence().set_implicit_omit();
if (global__tfi().is_bound()) global__tfi().set_implicit_omit();
}

void O__Gtfi_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_presence.encode_text(text_buf);
single_value->field_global__tfi.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_CSN1_Types.O_Gtfi.");
}
}

void O__Gtfi_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_presence.decode_text(text_buf);
single_value->field_global__tfi.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 O__Gtfi_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_CSN1_Types.O_Gtfi.");
}
}

void O__Gtfi_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: {
    O__Gtfi_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_CSN1_Types.O_Gtfi 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) presence().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) global__tfi().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(), "presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          presence().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "global_tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          global__tfi().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_CSN1_Types.O_Gtfi: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    O__Gtfi_template* precondition = new O__Gtfi_template;
    precondition->set_param(*param.get_elem(0));
    O__Gtfi_template* implied_template = new O__Gtfi_template;
    implied_template->set_param(*param.get_elem(1));
    *this = O__Gtfi_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.O_Gtfi");
  }
  is_ifpresent = param.get_ifpresent();
}

void O__Gtfi_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_presence.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.O_Gtfi");
single_value->field_global__tfi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.O_Gtfi");
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_CSN1_Types.O_Gtfi");
}

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

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

IO__Tlli::IO__Tlli()
{
}

IO__Tlli::IO__Tlli(const BITSTRING& par_presence,
    const OCTETSTRING& par_tlli)
  :   field_presence(par_presence),
  field_tlli(par_tlli)
{
}

IO__Tlli::IO__Tlli(const IO__Tlli& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.IO_Tlli.");
if (other_value.presence().is_bound()) field_presence = other_value.presence();
else field_presence.clean_up();
if (other_value.tlli().is_bound()) field_tlli = other_value.tlli();
else field_tlli.clean_up();
}

void IO__Tlli::clean_up()
{
field_presence.clean_up();
field_tlli.clean_up();
}

const TTCN_Typedescriptor_t* IO__Tlli::get_descriptor() const { return &IO__Tlli_descr_; }
IO__Tlli& IO__Tlli::operator=(const IO__Tlli& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.IO_Tlli.");
  if (other_value.presence().is_bound()) field_presence = other_value.presence();
  else field_presence.clean_up();
  if (other_value.tlli().is_bound()) field_tlli = other_value.tlli();
  else field_tlli.clean_up();
}
return *this;
}

boolean IO__Tlli::operator==(const IO__Tlli& other_value) const
{
return field_presence==other_value.field_presence
  && field_tlli==other_value.field_tlli;
}

boolean IO__Tlli::is_bound() const
{
return (field_presence.is_bound())
  || (field_tlli.is_bound());
}
boolean IO__Tlli::is_value() const
{
return field_presence.is_value()
  && field_tlli.is_value();
}
void IO__Tlli::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ presence := ");
field_presence.log();
TTCN_Logger::log_event_str(", tlli := ");
field_tlli.log();
TTCN_Logger::log_event_str(" }");
}

void IO__Tlli::set_implicit_omit()
{
if (presence().is_bound()) presence().set_implicit_omit();
if (tlli().is_bound()) tlli().set_implicit_omit();
}

void IO__Tlli::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_CSN1_Types.IO_Tlli 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) presence().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tlli().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(), "presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          presence().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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++) 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_CSN1_Types.IO_Tlli: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.IO_Tlli");
  }
}

void IO__Tlli::encode_text(Text_Buf& text_buf) const
{
field_presence.encode_text(text_buf);
field_tlli.encode_text(text_buf);
}

void IO__Tlli::decode_text(Text_Buf& text_buf)
{
field_presence.decode_text(text_buf);
field_tlli.decode_text(text_buf);
}

void IO__Tlli::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 IO__Tlli::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 IO__Tlli::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, IO__Tlli_presence_descr_.raw->forceomit);
  decoded_field_length = field_presence.RAW_decode(IO__Tlli_presence_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, IO__Tlli_tlli_descr_.raw->forceomit);
  decoded_field_length = field_tlli.RAW_decode(IO__Tlli_tlli_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 IO__Tlli::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, IO__Tlli_presence_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, IO__Tlli_tlli_descr_.raw);
  encoded_length += field_presence.RAW_encode(IO__Tlli_presence_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_tlli.RAW_encode(IO__Tlli_tlli_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct IO__Tlli_template::single_value_struct {
BITSTRING_template field_presence;
OCTETSTRING_template field_tlli;
};

void IO__Tlli_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_presence = ANY_VALUE;
single_value->field_tlli = ANY_VALUE;
}
}
}

void IO__Tlli_template::copy_value(const IO__Tlli& other_value)
{
single_value = new single_value_struct;
if (other_value.presence().is_bound()) {
  single_value->field_presence = other_value.presence();
} else {
  single_value->field_presence.clean_up();
}
if (other_value.tlli().is_bound()) {
  single_value->field_tlli = other_value.tlli();
} else {
  single_value->field_tlli.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void IO__Tlli_template::copy_template(const IO__Tlli_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) {
single_value->field_presence = other_value.presence();
} else {
single_value->field_presence.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tlli().get_selection()) {
single_value->field_tlli = other_value.tlli();
} else {
single_value->field_tlli.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 IO__Tlli_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 IO__Tlli_template(*other_value.implication_.precondition);
implication_.implied_template = new IO__Tlli_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_CSN1_Types.IO_Tlli.");
break;
}
set_selection(other_value);
}

IO__Tlli_template::IO__Tlli_template()
{
}

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

IO__Tlli_template::IO__Tlli_template(const IO__Tlli& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

IO__Tlli_template& IO__Tlli_template::operator=(const OPTIONAL<IO__Tlli>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const IO__Tlli&)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_CSN1_Types.IO_Tlli.");
}
return *this;
}

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

boolean IO__Tlli_template::match(const IO__Tlli& 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.presence().is_bound()) return FALSE;
if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE;
if(!other_value.tlli().is_bound()) return FALSE;
if(!single_value->field_tlli.match(other_value.tlli(), 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_CSN1_Types.IO_Tlli.");
}
return FALSE;
}

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

boolean IO__Tlli_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_presence.is_value()
 && single_value->field_tlli.is_value();
}

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

IO__Tlli IO__Tlli_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_CSN1_Types.IO_Tlli.");
IO__Tlli ret_val;
if (single_value->field_presence.is_bound()) {
ret_val.presence() = single_value->field_presence.valueof();
}
if (single_value->field_tlli.is_bound()) {
ret_val.tlli() = single_value->field_tlli.valueof();
}
return ret_val;
}

void IO__Tlli_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_CSN1_Types.IO_Tlli.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new IO__Tlli_template[list_length];
}

IO__Tlli_template& IO__Tlli_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_CSN1_Types.IO_Tlli.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.IO_Tlli.");
return value_list.list_value[list_index];
}

BITSTRING_template& IO__Tlli_template::presence()
{
set_specific();
return single_value->field_presence;
}

const BITSTRING_template& IO__Tlli_template::presence() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field presence of a non-specific template of type @RLCMAC_CSN1_Types.IO_Tlli.");
return single_value->field_presence;
}

OCTETSTRING_template& IO__Tlli_template::tlli()
{
set_specific();
return single_value->field_tlli;
}

const OCTETSTRING_template& IO__Tlli_template::tlli() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tlli of a non-specific template of type @RLCMAC_CSN1_Types.IO_Tlli.");
return single_value->field_tlli;
}

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

void IO__Tlli_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ presence := ");
single_value->field_presence.log();
TTCN_Logger::log_event_str(", tlli := ");
single_value->field_tlli.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 IO__Tlli_template::log_match(const IO__Tlli& 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_presence.match(match_value.presence(), legacy)){
TTCN_Logger::log_logmatch_info(".presence");
single_value->field_presence.log_match(match_value.presence(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
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 {
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("{ presence := ");
single_value->field_presence.log_match(match_value.presence(), legacy);
TTCN_Logger::log_event_str(", tlli := ");
single_value->field_tlli.log_match(match_value.tlli(), 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 IO__Tlli_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (presence().is_bound()) presence().set_implicit_omit();
if (tlli().is_bound()) tlli().set_implicit_omit();
}

void IO__Tlli_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_presence.encode_text(text_buf);
single_value->field_tlli.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_CSN1_Types.IO_Tlli.");
}
}

void IO__Tlli_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_presence.decode_text(text_buf);
single_value->field_tlli.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 IO__Tlli_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_CSN1_Types.IO_Tlli.");
}
}

void IO__Tlli_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: {
    IO__Tlli_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_CSN1_Types.IO_Tlli 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) presence().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tlli().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(), "presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          presence().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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++) 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_CSN1_Types.IO_Tlli: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    IO__Tlli_template* precondition = new IO__Tlli_template;
    precondition->set_param(*param.get_elem(0));
    IO__Tlli_template* implied_template = new IO__Tlli_template;
    implied_template->set_param(*param.get_elem(1));
    *this = IO__Tlli_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.IO_Tlli");
  }
  is_ifpresent = param.get_ifpresent();
}

void IO__Tlli_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_presence.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.IO_Tlli");
single_value->field_tlli.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.IO_Tlli");
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_CSN1_Types.IO_Tlli");
}

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

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

PacketRequestReference::PacketRequestReference()
{
}

PacketRequestReference::PacketRequestReference(const INTEGER& par_ra__info,
    const INTEGER& par_frame__nr)
  :   field_ra__info(par_ra__info),
  field_frame__nr(par_frame__nr)
{
}

PacketRequestReference::PacketRequestReference(const PacketRequestReference& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PacketRequestReference.");
if (other_value.ra__info().is_bound()) field_ra__info = other_value.ra__info();
else field_ra__info.clean_up();
if (other_value.frame__nr().is_bound()) field_frame__nr = other_value.frame__nr();
else field_frame__nr.clean_up();
}

void PacketRequestReference::clean_up()
{
field_ra__info.clean_up();
field_frame__nr.clean_up();
}

const TTCN_Typedescriptor_t* PacketRequestReference::get_descriptor() const { return &PacketRequestReference_descr_; }
PacketRequestReference& PacketRequestReference::operator=(const PacketRequestReference& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PacketRequestReference.");
  if (other_value.ra__info().is_bound()) field_ra__info = other_value.ra__info();
  else field_ra__info.clean_up();
  if (other_value.frame__nr().is_bound()) field_frame__nr = other_value.frame__nr();
  else field_frame__nr.clean_up();
}
return *this;
}

boolean PacketRequestReference::operator==(const PacketRequestReference& other_value) const
{
return field_ra__info==other_value.field_ra__info
  && field_frame__nr==other_value.field_frame__nr;
}

boolean PacketRequestReference::is_bound() const
{
return (field_ra__info.is_bound())
  || (field_frame__nr.is_bound());
}
boolean PacketRequestReference::is_value() const
{
return field_ra__info.is_value()
  && field_frame__nr.is_value();
}
void PacketRequestReference::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ ra_info := ");
field_ra__info.log();
TTCN_Logger::log_event_str(", frame_nr := ");
field_frame__nr.log();
TTCN_Logger::log_event_str(" }");
}

void PacketRequestReference::set_implicit_omit()
{
if (ra__info().is_bound()) ra__info().set_implicit_omit();
if (frame__nr().is_bound()) frame__nr().set_implicit_omit();
}

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

void PacketRequestReference::encode_text(Text_Buf& text_buf) const
{
field_ra__info.encode_text(text_buf);
field_frame__nr.encode_text(text_buf);
}

void PacketRequestReference::decode_text(Text_Buf& text_buf)
{
field_ra__info.decode_text(text_buf);
field_frame__nr.decode_text(text_buf);
}

void PacketRequestReference::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 PacketRequestReference::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 PacketRequestReference::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, PacketRequestReference_ra__info_descr_.raw->forceomit);
  decoded_field_length = field_ra__info.RAW_decode(PacketRequestReference_ra__info_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, PacketRequestReference_frame__nr_descr_.raw->forceomit);
  decoded_field_length = field_frame__nr.RAW_decode(PacketRequestReference_frame__nr_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 PacketRequestReference::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, PacketRequestReference_ra__info_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PacketRequestReference_frame__nr_descr_.raw);
  encoded_length += field_ra__info.RAW_encode(PacketRequestReference_ra__info_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_frame__nr.RAW_encode(PacketRequestReference_frame__nr_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct PacketRequestReference_template::single_value_struct {
INTEGER_template field_ra__info;
INTEGER_template field_frame__nr;
};

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

void PacketRequestReference_template::copy_value(const PacketRequestReference& other_value)
{
single_value = new single_value_struct;
if (other_value.ra__info().is_bound()) {
  single_value->field_ra__info = other_value.ra__info();
} else {
  single_value->field_ra__info.clean_up();
}
if (other_value.frame__nr().is_bound()) {
  single_value->field_frame__nr = other_value.frame__nr();
} else {
  single_value->field_frame__nr.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PacketRequestReference_template::copy_template(const PacketRequestReference_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.ra__info().get_selection()) {
single_value->field_ra__info = other_value.ra__info();
} else {
single_value->field_ra__info.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.frame__nr().get_selection()) {
single_value->field_frame__nr = other_value.frame__nr();
} else {
single_value->field_frame__nr.clean_up();
}
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 PacketRequestReference_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 PacketRequestReference_template(*other_value.implication_.precondition);
implication_.implied_template = new PacketRequestReference_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_CSN1_Types.PacketRequestReference.");
break;
}
set_selection(other_value);
}

PacketRequestReference_template::PacketRequestReference_template()
{
}

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

PacketRequestReference_template::PacketRequestReference_template(const PacketRequestReference& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PacketRequestReference_template::match(const PacketRequestReference& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.ra__info().is_bound()) return FALSE;
if(!single_value->field_ra__info.match(other_value.ra__info(), legacy))return FALSE;
if(!other_value.frame__nr().is_bound()) return FALSE;
if(!single_value->field_frame__nr.match(other_value.frame__nr(), legacy))return FALSE;
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_CSN1_Types.PacketRequestReference.");
}
return FALSE;
}

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

boolean PacketRequestReference_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_ra__info.is_value()
 && single_value->field_frame__nr.is_value();
}

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

PacketRequestReference PacketRequestReference_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_CSN1_Types.PacketRequestReference.");
PacketRequestReference ret_val;
if (single_value->field_ra__info.is_bound()) {
ret_val.ra__info() = single_value->field_ra__info.valueof();
}
if (single_value->field_frame__nr.is_bound()) {
ret_val.frame__nr() = single_value->field_frame__nr.valueof();
}
return ret_val;
}

void PacketRequestReference_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_CSN1_Types.PacketRequestReference.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PacketRequestReference_template[list_length];
}

PacketRequestReference_template& PacketRequestReference_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_CSN1_Types.PacketRequestReference.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.PacketRequestReference.");
return value_list.list_value[list_index];
}

INTEGER_template& PacketRequestReference_template::ra__info()
{
set_specific();
return single_value->field_ra__info;
}

const INTEGER_template& PacketRequestReference_template::ra__info() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ra_info of a non-specific template of type @RLCMAC_CSN1_Types.PacketRequestReference.");
return single_value->field_ra__info;
}

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

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

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

void PacketRequestReference_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ ra_info := ");
single_value->field_ra__info.log();
TTCN_Logger::log_event_str(", frame_nr := ");
single_value->field_frame__nr.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 PacketRequestReference_template::log_match(const PacketRequestReference& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_ra__info.match(match_value.ra__info(), legacy)){
TTCN_Logger::log_logmatch_info(".ra_info");
single_value->field_ra__info.log_match(match_value.ra__info(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_frame__nr.match(match_value.frame__nr(), legacy)){
TTCN_Logger::log_logmatch_info(".frame_nr");
single_value->field_frame__nr.log_match(match_value.frame__nr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ ra_info := ");
single_value->field_ra__info.log_match(match_value.ra__info(), legacy);
TTCN_Logger::log_event_str(", frame_nr := ");
single_value->field_frame__nr.log_match(match_value.frame__nr(), legacy);
TTCN_Logger::log_event_str(" }");
} 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 PacketRequestReference_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (ra__info().is_bound()) ra__info().set_implicit_omit();
if (frame__nr().is_bound()) frame__nr().set_implicit_omit();
}

void PacketRequestReference_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_ra__info.encode_text(text_buf);
single_value->field_frame__nr.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_CSN1_Types.PacketRequestReference.");
}
}

void PacketRequestReference_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_ra__info.decode_text(text_buf);
single_value->field_frame__nr.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 PacketRequestReference_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_CSN1_Types.PacketRequestReference.");
}
}

void PacketRequestReference_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: {
    PacketRequestReference_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_CSN1_Types.PacketRequestReference 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) ra__info().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) frame__nr().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(), "ra_info")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ra__info().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "frame_nr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          frame__nr().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) 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_CSN1_Types.PacketRequestReference: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PacketRequestReference_template* precondition = new PacketRequestReference_template;
    precondition->set_param(*param.get_elem(0));
    PacketRequestReference_template* implied_template = new PacketRequestReference_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PacketRequestReference_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.PacketRequestReference");
  }
  is_ifpresent = param.get_ifpresent();
}

void PacketRequestReference_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_ra__info.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketRequestReference");
single_value->field_frame__nr.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketRequestReference");
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_CSN1_Types.PacketRequestReference");
}

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

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

IIO__Tqi::IIO__Tqi()
{
}

IIO__Tqi::IIO__Tqi(const BITSTRING& par_presence,
    const PacketRequestReference& par_pkt__req__ref)
  :   field_presence(par_presence),
  field_pkt__req__ref(par_pkt__req__ref)
{
}

IIO__Tqi::IIO__Tqi(const IIO__Tqi& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.IIO_Tqi.");
if (other_value.presence().is_bound()) field_presence = other_value.presence();
else field_presence.clean_up();
if (other_value.pkt__req__ref().is_bound()) field_pkt__req__ref = other_value.pkt__req__ref();
else field_pkt__req__ref.clean_up();
}

void IIO__Tqi::clean_up()
{
field_presence.clean_up();
field_pkt__req__ref.clean_up();
}

const TTCN_Typedescriptor_t* IIO__Tqi::get_descriptor() const { return &IIO__Tqi_descr_; }
IIO__Tqi& IIO__Tqi::operator=(const IIO__Tqi& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.IIO_Tqi.");
  if (other_value.presence().is_bound()) field_presence = other_value.presence();
  else field_presence.clean_up();
  if (other_value.pkt__req__ref().is_bound()) field_pkt__req__ref = other_value.pkt__req__ref();
  else field_pkt__req__ref.clean_up();
}
return *this;
}

boolean IIO__Tqi::operator==(const IIO__Tqi& other_value) const
{
return field_presence==other_value.field_presence
  && field_pkt__req__ref==other_value.field_pkt__req__ref;
}

boolean IIO__Tqi::is_bound() const
{
return (field_presence.is_bound())
  || (field_pkt__req__ref.is_bound());
}
boolean IIO__Tqi::is_value() const
{
return field_presence.is_value()
  && field_pkt__req__ref.is_value();
}
void IIO__Tqi::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ presence := ");
field_presence.log();
TTCN_Logger::log_event_str(", pkt_req_ref := ");
field_pkt__req__ref.log();
TTCN_Logger::log_event_str(" }");
}

void IIO__Tqi::set_implicit_omit()
{
if (presence().is_bound()) presence().set_implicit_omit();
if (pkt__req__ref().is_bound()) pkt__req__ref().set_implicit_omit();
}

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

void IIO__Tqi::encode_text(Text_Buf& text_buf) const
{
field_presence.encode_text(text_buf);
field_pkt__req__ref.encode_text(text_buf);
}

void IIO__Tqi::decode_text(Text_Buf& text_buf)
{
field_presence.decode_text(text_buf);
field_pkt__req__ref.decode_text(text_buf);
}

void IIO__Tqi::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 IIO__Tqi::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 IIO__Tqi::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, IIO__Tqi_presence_descr_.raw->forceomit);
  decoded_field_length = field_presence.RAW_decode(IIO__Tqi_presence_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, IIO__Tqi_pkt__req__ref_descr_.raw->forceomit);
  decoded_field_length = field_pkt__req__ref.RAW_decode(IIO__Tqi_pkt__req__ref_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 IIO__Tqi::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, IIO__Tqi_presence_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, IIO__Tqi_pkt__req__ref_descr_.raw);
  encoded_length += field_presence.RAW_encode(IIO__Tqi_presence_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_pkt__req__ref.RAW_encode(IIO__Tqi_pkt__req__ref_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct IIO__Tqi_template::single_value_struct {
BITSTRING_template field_presence;
PacketRequestReference_template field_pkt__req__ref;
};

void IIO__Tqi_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_presence = ANY_VALUE;
single_value->field_pkt__req__ref = ANY_VALUE;
}
}
}

void IIO__Tqi_template::copy_value(const IIO__Tqi& other_value)
{
single_value = new single_value_struct;
if (other_value.presence().is_bound()) {
  single_value->field_presence = other_value.presence();
} else {
  single_value->field_presence.clean_up();
}
if (other_value.pkt__req__ref().is_bound()) {
  single_value->field_pkt__req__ref = other_value.pkt__req__ref();
} else {
  single_value->field_pkt__req__ref.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void IIO__Tqi_template::copy_template(const IIO__Tqi_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) {
single_value->field_presence = other_value.presence();
} else {
single_value->field_presence.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pkt__req__ref().get_selection()) {
single_value->field_pkt__req__ref = other_value.pkt__req__ref();
} else {
single_value->field_pkt__req__ref.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 IIO__Tqi_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 IIO__Tqi_template(*other_value.implication_.precondition);
implication_.implied_template = new IIO__Tqi_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_CSN1_Types.IIO_Tqi.");
break;
}
set_selection(other_value);
}

IIO__Tqi_template::IIO__Tqi_template()
{
}

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

IIO__Tqi_template::IIO__Tqi_template(const IIO__Tqi& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

IIO__Tqi_template& IIO__Tqi_template::operator=(const OPTIONAL<IIO__Tqi>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const IIO__Tqi&)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_CSN1_Types.IIO_Tqi.");
}
return *this;
}

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

boolean IIO__Tqi_template::match(const IIO__Tqi& 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.presence().is_bound()) return FALSE;
if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE;
if(!other_value.pkt__req__ref().is_bound()) return FALSE;
if(!single_value->field_pkt__req__ref.match(other_value.pkt__req__ref(), 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_CSN1_Types.IIO_Tqi.");
}
return FALSE;
}

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

boolean IIO__Tqi_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_presence.is_value()
 && single_value->field_pkt__req__ref.is_value();
}

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

IIO__Tqi IIO__Tqi_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_CSN1_Types.IIO_Tqi.");
IIO__Tqi ret_val;
if (single_value->field_presence.is_bound()) {
ret_val.presence() = single_value->field_presence.valueof();
}
if (single_value->field_pkt__req__ref.is_bound()) {
ret_val.pkt__req__ref() = single_value->field_pkt__req__ref.valueof();
}
return ret_val;
}

void IIO__Tqi_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_CSN1_Types.IIO_Tqi.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new IIO__Tqi_template[list_length];
}

IIO__Tqi_template& IIO__Tqi_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_CSN1_Types.IIO_Tqi.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.IIO_Tqi.");
return value_list.list_value[list_index];
}

BITSTRING_template& IIO__Tqi_template::presence()
{
set_specific();
return single_value->field_presence;
}

const BITSTRING_template& IIO__Tqi_template::presence() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field presence of a non-specific template of type @RLCMAC_CSN1_Types.IIO_Tqi.");
return single_value->field_presence;
}

PacketRequestReference_template& IIO__Tqi_template::pkt__req__ref()
{
set_specific();
return single_value->field_pkt__req__ref;
}

const PacketRequestReference_template& IIO__Tqi_template::pkt__req__ref() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pkt_req_ref of a non-specific template of type @RLCMAC_CSN1_Types.IIO_Tqi.");
return single_value->field_pkt__req__ref;
}

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

void IIO__Tqi_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ presence := ");
single_value->field_presence.log();
TTCN_Logger::log_event_str(", pkt_req_ref := ");
single_value->field_pkt__req__ref.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 IIO__Tqi_template::log_match(const IIO__Tqi& 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_presence.match(match_value.presence(), legacy)){
TTCN_Logger::log_logmatch_info(".presence");
single_value->field_presence.log_match(match_value.presence(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pkt__req__ref.match(match_value.pkt__req__ref(), legacy)){
TTCN_Logger::log_logmatch_info(".pkt_req_ref");
single_value->field_pkt__req__ref.log_match(match_value.pkt__req__ref(), 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("{ presence := ");
single_value->field_presence.log_match(match_value.presence(), legacy);
TTCN_Logger::log_event_str(", pkt_req_ref := ");
single_value->field_pkt__req__ref.log_match(match_value.pkt__req__ref(), 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 IIO__Tqi_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (presence().is_bound()) presence().set_implicit_omit();
if (pkt__req__ref().is_bound()) pkt__req__ref().set_implicit_omit();
}

void IIO__Tqi_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_presence.encode_text(text_buf);
single_value->field_pkt__req__ref.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_CSN1_Types.IIO_Tqi.");
}
}

void IIO__Tqi_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_presence.decode_text(text_buf);
single_value->field_pkt__req__ref.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 IIO__Tqi_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_CSN1_Types.IIO_Tqi.");
}
}

void IIO__Tqi_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: {
    IIO__Tqi_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_CSN1_Types.IIO_Tqi 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) presence().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) pkt__req__ref().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(), "presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          presence().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pkt_req_ref")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pkt__req__ref().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_CSN1_Types.IIO_Tqi: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    IIO__Tqi_template* precondition = new IIO__Tqi_template;
    precondition->set_param(*param.get_elem(0));
    IIO__Tqi_template* implied_template = new IIO__Tqi_template;
    implied_template->set_param(*param.get_elem(1));
    *this = IIO__Tqi_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.IIO_Tqi");
  }
  is_ifpresent = param.get_ifpresent();
}

void IIO__Tqi_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_presence.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.IIO_Tqi");
single_value->field_pkt__req__ref.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.IIO_Tqi");
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_CSN1_Types.IIO_Tqi");
}

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

boolean IIO__Tqi_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 PktUlAssUnion::copy_value(const PktUlAssUnion& other_value)
{
switch (other_value.union_selection) {
case ALT_global__tfi:
field_global__tfi = new O__Gtfi(*other_value.field_global__tfi);
break;
case ALT_tlli:
field_tlli = new IO__Tlli(*other_value.field_tlli);
break;
case ALT_tqi:
field_tqi = new IIO__Tqi(*other_value.field_tqi);
break;
default:
TTCN_error("Assignment of an unbound union value of type @RLCMAC_CSN1_Types.PktUlAssUnion.");
}
union_selection = other_value.union_selection;
}

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

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

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

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

boolean PktUlAssUnion::operator==(const PktUlAssUnion& other_value) const
{
if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @RLCMAC_CSN1_Types.PktUlAssUnion.");
if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @RLCMAC_CSN1_Types.PktUlAssUnion.");
if (union_selection != other_value.union_selection) return FALSE;
switch (union_selection) {
case ALT_global__tfi:
return *field_global__tfi == *other_value.field_global__tfi;
case ALT_tlli:
return *field_tlli == *other_value.field_tlli;
case ALT_tqi:
return *field_tqi == *other_value.field_tqi;
default:
return FALSE;
}
}

O__Gtfi& PktUlAssUnion::global__tfi()
{
if (union_selection != ALT_global__tfi) {
clean_up();
field_global__tfi = new O__Gtfi;
union_selection = ALT_global__tfi;
}
return *field_global__tfi;
}

const O__Gtfi& PktUlAssUnion::global__tfi() const
{
if (union_selection != ALT_global__tfi) TTCN_error("Using non-selected field global_tfi in a value of union type @RLCMAC_CSN1_Types.PktUlAssUnion.");
return *field_global__tfi;
}

IO__Tlli& PktUlAssUnion::tlli()
{
if (union_selection != ALT_tlli) {
clean_up();
field_tlli = new IO__Tlli;
union_selection = ALT_tlli;
}
return *field_tlli;
}

const IO__Tlli& PktUlAssUnion::tlli() const
{
if (union_selection != ALT_tlli) TTCN_error("Using non-selected field tlli in a value of union type @RLCMAC_CSN1_Types.PktUlAssUnion.");
return *field_tlli;
}

IIO__Tqi& PktUlAssUnion::tqi()
{
if (union_selection != ALT_tqi) {
clean_up();
field_tqi = new IIO__Tqi;
union_selection = ALT_tqi;
}
return *field_tqi;
}

const IIO__Tqi& PktUlAssUnion::tqi() const
{
if (union_selection != ALT_tqi) TTCN_error("Using non-selected field tqi in a value of union type @RLCMAC_CSN1_Types.PktUlAssUnion.");
return *field_tqi;
}

boolean PktUlAssUnion::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_CSN1_Types.PktUlAssUnion.");
return union_selection == checked_selection;
}

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

boolean PktUlAssUnion::is_value() const
{
switch (union_selection) {
case UNBOUND_VALUE: return FALSE;
case ALT_global__tfi: return field_global__tfi->is_value();
case ALT_tlli: return field_tlli->is_value();
case ALT_tqi: return field_tqi->is_value();
default: TTCN_error("Invalid selection in union is_bound");}
}

void PktUlAssUnion::clean_up()
{
switch (union_selection) {
case ALT_global__tfi:
  delete field_global__tfi;
  break;
case ALT_tlli:
  delete field_tlli;
  break;
case ALT_tqi:
  delete field_tqi;
  break;
default:
  break;
}
union_selection = UNBOUND_VALUE;
}

void PktUlAssUnion::log() const
{
switch (union_selection) {
case ALT_global__tfi:
TTCN_Logger::log_event_str("{ global_tfi := ");
field_global__tfi->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_tlli:
TTCN_Logger::log_event_str("{ tlli := ");
field_tlli->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_tqi:
TTCN_Logger::log_event_str("{ tqi := ");
field_tqi->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_unbound();
}
}

void PktUlAssUnion::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, "global_tfi")) {
    global__tfi().set_param(*mp_last);
    if (!global__tfi().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "tlli")) {
    tlli().set_param(*mp_last);
    if (!tlli().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "tqi")) {
    tqi().set_param(*mp_last);
    if (!tqi().is_bound()) clean_up();
    return;
  }
  mp_last->error("Field %s does not exist in type @RLCMAC_CSN1_Types.PktUlAssUnion.", last_name);
}

void PktUlAssUnion::set_implicit_omit()
{
switch (union_selection) {
case ALT_global__tfi:
field_global__tfi->set_implicit_omit(); break;
case ALT_tlli:
field_tlli->set_implicit_omit(); break;
case ALT_tqi:
field_tqi->set_implicit_omit(); break;
default: break;
}
}

void PktUlAssUnion::encode_text(Text_Buf& text_buf) const
{
text_buf.push_int(union_selection);
switch (union_selection) {
case ALT_global__tfi:
field_global__tfi->encode_text(text_buf);
break;
case ALT_tlli:
field_tlli->encode_text(text_buf);
break;
case ALT_tqi:
field_tqi->encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an unbound value of union type @RLCMAC_CSN1_Types.PktUlAssUnion.");
}
}

void PktUlAssUnion::decode_text(Text_Buf& text_buf)
{
switch ((union_selection_type)text_buf.pull_int().get_val()) {
case ALT_global__tfi:
global__tfi().decode_text(text_buf);
break;
case ALT_tlli:
tlli().decode_text(text_buf);
break;
case ALT_tqi:
tqi().decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for type @RLCMAC_CSN1_Types.PktUlAssUnion.");
}
}

void PktUlAssUnion::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 PktUlAssUnion::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 PktUlAssUnion::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, PktUlAssUnion_global__tfi_descr_.raw->forceomit);
      decoded_length = global__tfi().RAW_decode(PktUlAssUnion_global__tfi_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, PktUlAssUnion_tlli_descr_.raw->forceomit);
      decoded_length = tlli().RAW_decode(PktUlAssUnion_tlli_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, PktUlAssUnion_tqi_descr_.raw->forceomit);
      decoded_length = tqi().RAW_decode(PktUlAssUnion_tqi_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    default: break;
    }
    return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
  } else {
    boolean already_failed = FALSE;
    already_failed = FALSE;
    if (!already_failed) {
      BITSTRING temporal_0;
      int decoded_0_length;
      p_buf.set_pos_bit(starting_pos + 0);
      decoded_0_length = temporal_0.RAW_decode(O__Gtfi_presence_descr_, p_buf, limit, top_bit_ord, TRUE);
      if (decoded_0_length > 0) {
        if (temporal_0 ==  bs_1) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(0, force_omit, PktUlAssUnion_global__tfi_descr_.raw->forceomit);
          decoded_length = global__tfi().RAW_decode(PktUlAssUnion_global__tfi_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_global__tfi).presence() ==  bs_1) {
               return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
             }else already_failed = TRUE;
          }
        }
      }
    }
    already_failed = FALSE;
    if (!already_failed) {
      BITSTRING temporal_1;
      int decoded_1_length;
      p_buf.set_pos_bit(starting_pos + 0);
      decoded_1_length = temporal_1.RAW_decode(IO__Tlli_presence_descr_, p_buf, limit, top_bit_ord, TRUE);
      if (decoded_1_length > 0) {
        if (temporal_1 ==  bs_4) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(1, force_omit, PktUlAssUnion_tlli_descr_.raw->forceomit);
          decoded_length = tlli().RAW_decode(PktUlAssUnion_tlli_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_tlli).presence() ==  bs_4) {
               return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
             }else already_failed = TRUE;
          }
        }
      }
    }
    already_failed = FALSE;
    if (!already_failed) {
      BITSTRING temporal_2;
      int decoded_2_length;
      p_buf.set_pos_bit(starting_pos + 0);
      decoded_2_length = temporal_2.RAW_decode(IIO__Tqi_presence_descr_, p_buf, limit, top_bit_ord, TRUE);
      if (decoded_2_length > 0) {
        if (temporal_2 ==  bs_6) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(2, force_omit, PktUlAssUnion_tqi_descr_.raw->forceomit);
          decoded_length = tqi().RAW_decode(PktUlAssUnion_tqi_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_tqi).presence() ==  bs_6) {
               return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
             }else already_failed = TRUE;
          }
        }
      }
    }
 }
 clean_up();
 return -1;
}

int PktUlAssUnion::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_global__tfi:
    myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, PktUlAssUnion_global__tfi_descr_.raw);
    encoded_length = field_global__tfi->RAW_encode(PktUlAssUnion_global__tfi_descr_, *myleaf.body.node.nodes[0]);
    myleaf.body.node.nodes[0]->coding_descr = &PktUlAssUnion_global__tfi_descr_;
    if ((*field_global__tfi).presence() !=  bs_1) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+2;
  int new_pos0[]={0,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){
   bs_1.RAW_encode(O__Gtfi_presence_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_tlli:
    myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, PktUlAssUnion_tlli_descr_.raw);
    encoded_length = field_tlli->RAW_encode(PktUlAssUnion_tlli_descr_, *myleaf.body.node.nodes[1]);
    myleaf.body.node.nodes[1]->coding_descr = &PktUlAssUnion_tlli_descr_;
    if ((*field_tlli).presence() !=  bs_4) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+2;
  int new_pos0[]={1,0};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,2,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
   bs_4.RAW_encode(IO__Tlli_presence_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_tqi:
    myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 2, PktUlAssUnion_tqi_descr_.raw);
    encoded_length = field_tqi->RAW_encode(PktUlAssUnion_tqi_descr_, *myleaf.body.node.nodes[2]);
    myleaf.body.node.nodes[2]->coding_descr = &PktUlAssUnion_tqi_descr_;
    if ((*field_tqi).presence() !=  bs_6) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+2;
  int new_pos0[]={2,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){
   bs_6.RAW_encode(IIO__Tqi_presence_descr_,*temp_leaf);
  } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  }
  free_tree_pos(pr_pos0.pos);
  }
    }
    break;
  default:
    TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  }
  return encoded_length;
}

void PktUlAssUnion_template::copy_value(const PktUlAssUnion& other_value)
{
single_value.union_selection = other_value.get_selection();
switch (single_value.union_selection) {
case PktUlAssUnion::ALT_global__tfi:
single_value.field_global__tfi = new O__Gtfi_template(other_value.global__tfi());
break;
case PktUlAssUnion::ALT_tlli:
single_value.field_tlli = new IO__Tlli_template(other_value.tlli());
break;
case PktUlAssUnion::ALT_tqi:
single_value.field_tqi = new IIO__Tqi_template(other_value.tqi());
break;
default:
TTCN_error("Initializing a template with an unbound value of type @RLCMAC_CSN1_Types.PktUlAssUnion.");
}
set_selection(SPECIFIC_VALUE);
}

void PktUlAssUnion_template::copy_template(const PktUlAssUnion_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 PktUlAssUnion::ALT_global__tfi:
single_value.field_global__tfi = new O__Gtfi_template(*other_value.single_value.field_global__tfi);
break;
case PktUlAssUnion::ALT_tlli:
single_value.field_tlli = new IO__Tlli_template(*other_value.single_value.field_tlli);
break;
case PktUlAssUnion::ALT_tqi:
single_value.field_tqi = new IIO__Tqi_template(*other_value.single_value.field_tqi);
break;
default:
TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @RLCMAC_CSN1_Types.PktUlAssUnion.");
}
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 PktUlAssUnion_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 PktUlAssUnion_template(*other_value.implication_.precondition);
implication_.implied_template = new PktUlAssUnion_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_CSN1_Types.PktUlAssUnion.");
}
set_selection(other_value);
}

PktUlAssUnion_template::PktUlAssUnion_template()
{
}

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

PktUlAssUnion_template::PktUlAssUnion_template(const PktUlAssUnion& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

void PktUlAssUnion_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case PktUlAssUnion::ALT_global__tfi:
delete single_value.field_global__tfi;
break;
case PktUlAssUnion::ALT_tlli:
delete single_value.field_tlli;
break;
case PktUlAssUnion::ALT_tqi:
delete single_value.field_tqi;
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;
}

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

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

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

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

boolean PktUlAssUnion_template::match(const PktUlAssUnion& 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:
{
PktUlAssUnion::union_selection_type value_selection = other_value.get_selection();
if (value_selection == PktUlAssUnion::UNBOUND_VALUE) return FALSE;
if (value_selection != single_value.union_selection) return FALSE;
switch (value_selection) {
case PktUlAssUnion::ALT_global__tfi:
return single_value.field_global__tfi->match(other_value.global__tfi(), legacy);
case PktUlAssUnion::ALT_tlli:
return single_value.field_tlli->match(other_value.tlli(), legacy);
case PktUlAssUnion::ALT_tqi:
return single_value.field_tqi->match(other_value.tqi(), legacy);
default:
TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @RLCMAC_CSN1_Types.PktUlAssUnion.");
}
}
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_CSN1_Types.PktUlAssUnion.");
}
return FALSE;
}

boolean PktUlAssUnion_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
switch (single_value.union_selection) {
case PktUlAssUnion::ALT_global__tfi:
return single_value.field_global__tfi->is_value();
case PktUlAssUnion::ALT_tlli:
return single_value.field_tlli->is_value();
case PktUlAssUnion::ALT_tqi:
return single_value.field_tqi->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_CSN1_Types.PktUlAssUnion.");
}
}

PktUlAssUnion PktUlAssUnion_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_CSN1_Types.PktUlAssUnion.");
PktUlAssUnion ret_val;
switch (single_value.union_selection) {
case PktUlAssUnion::ALT_global__tfi:
ret_val.global__tfi() = single_value.field_global__tfi->valueof();
break;
case PktUlAssUnion::ALT_tlli:
ret_val.tlli() = single_value.field_tlli->valueof();
break;
case PktUlAssUnion::ALT_tqi:
ret_val.tqi() = single_value.field_tqi->valueof();
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @RLCMAC_CSN1_Types.PktUlAssUnion.");
}
return ret_val;
}

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

O__Gtfi_template& PktUlAssUnion_template::global__tfi()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PktUlAssUnion::ALT_global__tfi) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_global__tfi = new O__Gtfi_template(ANY_VALUE);
else single_value.field_global__tfi = new O__Gtfi_template;
single_value.union_selection = PktUlAssUnion::ALT_global__tfi;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_global__tfi;
}

const O__Gtfi_template& PktUlAssUnion_template::global__tfi() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field global_tfi in a non-specific template of union type @RLCMAC_CSN1_Types.PktUlAssUnion.");
if (single_value.union_selection != PktUlAssUnion::ALT_global__tfi) TTCN_error("Accessing non-selected field global_tfi in a template of union type @RLCMAC_CSN1_Types.PktUlAssUnion.");
return *single_value.field_global__tfi;
}

IO__Tlli_template& PktUlAssUnion_template::tlli()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PktUlAssUnion::ALT_tlli) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_tlli = new IO__Tlli_template(ANY_VALUE);
else single_value.field_tlli = new IO__Tlli_template;
single_value.union_selection = PktUlAssUnion::ALT_tlli;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_tlli;
}

const IO__Tlli_template& PktUlAssUnion_template::tlli() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field tlli in a non-specific template of union type @RLCMAC_CSN1_Types.PktUlAssUnion.");
if (single_value.union_selection != PktUlAssUnion::ALT_tlli) TTCN_error("Accessing non-selected field tlli in a template of union type @RLCMAC_CSN1_Types.PktUlAssUnion.");
return *single_value.field_tlli;
}

IIO__Tqi_template& PktUlAssUnion_template::tqi()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PktUlAssUnion::ALT_tqi) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_tqi = new IIO__Tqi_template(ANY_VALUE);
else single_value.field_tqi = new IIO__Tqi_template;
single_value.union_selection = PktUlAssUnion::ALT_tqi;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_tqi;
}

const IIO__Tqi_template& PktUlAssUnion_template::tqi() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field tqi in a non-specific template of union type @RLCMAC_CSN1_Types.PktUlAssUnion.");
if (single_value.union_selection != PktUlAssUnion::ALT_tqi) TTCN_error("Accessing non-selected field tqi in a template of union type @RLCMAC_CSN1_Types.PktUlAssUnion.");
return *single_value.field_tqi;
}

boolean PktUlAssUnion_template::ischosen(PktUlAssUnion::union_selection_type checked_selection) const
{
if (checked_selection == PktUlAssUnion::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @RLCMAC_CSN1_Types.PktUlAssUnion.");
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.union_selection == PktUlAssUnion::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @RLCMAC_CSN1_Types.PktUlAssUnion.");
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_CSN1_Types.PktUlAssUnion 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 PktUlAssUnion_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case PktUlAssUnion::ALT_global__tfi:
TTCN_Logger::log_event_str("{ global_tfi := ");
single_value.field_global__tfi->log();
TTCN_Logger::log_event_str(" }");
break;
case PktUlAssUnion::ALT_tlli:
TTCN_Logger::log_event_str("{ tlli := ");
single_value.field_tlli->log();
TTCN_Logger::log_event_str(" }");
break;
case PktUlAssUnion::ALT_tqi:
TTCN_Logger::log_event_str("{ tqi := ");
single_value.field_tqi->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 PktUlAssUnion_template::log_match(const PktUlAssUnion& 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 PktUlAssUnion::ALT_global__tfi:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".global_tfi");
single_value.field_global__tfi->log_match(match_value.global__tfi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ global_tfi := ");
single_value.field_global__tfi->log_match(match_value.global__tfi(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case PktUlAssUnion::ALT_tlli:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
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 {
TTCN_Logger::log_event_str("{ tlli := ");
single_value.field_tlli->log_match(match_value.tlli(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case PktUlAssUnion::ALT_tqi:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".tqi");
single_value.field_tqi->log_match(match_value.tqi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ tqi := ");
single_value.field_tqi->log_match(match_value.tqi(), 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 PktUlAssUnion_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
switch (single_value.union_selection) {
case PktUlAssUnion::ALT_global__tfi:
single_value.field_global__tfi->set_implicit_omit(); break;
case PktUlAssUnion::ALT_tlli:
single_value.field_tlli->set_implicit_omit(); break;
case PktUlAssUnion::ALT_tqi:
single_value.field_tqi->set_implicit_omit(); break;
default: break;
}
}

void PktUlAssUnion_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 PktUlAssUnion::ALT_global__tfi:
single_value.field_global__tfi->encode_text(text_buf);
break;
case PktUlAssUnion::ALT_tlli:
single_value.field_tlli->encode_text(text_buf);
break;
case PktUlAssUnion::ALT_tqi:
single_value.field_tqi->encode_text(text_buf);
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @RLCMAC_CSN1_Types.PktUlAssUnion.");
}
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_CSN1_Types.PktUlAssUnion.");
}
}

void PktUlAssUnion_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
{
single_value.union_selection = PktUlAssUnion::UNBOUND_VALUE;
PktUlAssUnion::union_selection_type new_selection = (PktUlAssUnion::union_selection_type)text_buf.pull_int().get_val();
switch (new_selection) {
case PktUlAssUnion::ALT_global__tfi:
single_value.field_global__tfi = new O__Gtfi_template;
single_value.field_global__tfi->decode_text(text_buf);
break;
case PktUlAssUnion::ALT_tlli:
single_value.field_tlli = new IO__Tlli_template;
single_value.field_tlli->decode_text(text_buf);
break;
case PktUlAssUnion::ALT_tqi:
single_value.field_tqi = new IIO__Tqi_template;
single_value.field_tqi->decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @RLCMAC_CSN1_Types.PktUlAssUnion.");
}
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 PktUlAssUnion_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_CSN1_Types.PktUlAssUnion.");
}
}

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

boolean PktUlAssUnion_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 PktUlAssUnion_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_CSN1_Types.PktUlAssUnion'");
    }
    if (strcmp("global_tfi", param_field) == 0) {
      global__tfi().set_param(param);
      return;
    } else if (strcmp("tlli", param_field) == 0) {
      tlli().set_param(param);
      return;
    } else if (strcmp("tqi", param_field) == 0) {
      tqi().set_param(param);
      return;
    } else param.error("Field `%s' not found in union template type `@RLCMAC_CSN1_Types.PktUlAssUnion'", 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: {
    PktUlAssUnion_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_CSN1_Types.PktUlAssUnion");
    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, "global_tfi")) {
      global__tfi().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "tlli")) {
      tlli().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "tqi")) {
      tqi().set_param(*mp_last);
      break;
    }
    mp_last->error("Field %s does not exist in type @RLCMAC_CSN1_Types.PktUlAssUnion.", last_name);
  } break;
  case Module_Param::MP_Implication_Template: {
    PktUlAssUnion_template* precondition = new PktUlAssUnion_template;
    precondition->set_param(*m_p->get_elem(0));
    PktUlAssUnion_template* implied_template = new PktUlAssUnion_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = PktUlAssUnion_template(precondition, implied_template);
  } break;
  default:
    param.type_error("union template", "@RLCMAC_CSN1_Types.PktUlAssUnion");
  }
  is_ifpresent = param.get_ifpresent();
}

void PktUlAssUnion_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 PktUlAssUnion::ALT_global__tfi:
single_value.field_global__tfi->check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssUnion");
return;
case PktUlAssUnion::ALT_tlli:
single_value.field_tlli->check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssUnion");
return;
case PktUlAssUnion::ALT_tqi:
single_value.field_tqi->check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssUnion");
return;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @RLCMAC_CSN1_Types.PktUlAssUnion.");
}
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_CSN1_Types.PktUlAssUnion");
}

TsAllocationUnion::TsAllocationUnion()
{
}

TsAllocationUnion::TsAllocationUnion(const BITSTRING& par_presence,
    const OPTIONAL< TsAllocationTsArr >& par_ts,
    const OPTIONAL< TsAllocationPwr >& par_ts__with__pwr)
  :   field_presence(par_presence),
  field_ts(par_ts),
  field_ts__with__pwr(par_ts__with__pwr)
{
}

TsAllocationUnion::TsAllocationUnion(const TsAllocationUnion& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.TsAllocationUnion.");
if (other_value.presence().is_bound()) field_presence = other_value.presence();
else field_presence.clean_up();
if (other_value.ts().is_bound()) field_ts = other_value.ts();
else field_ts.clean_up();
if (other_value.ts__with__pwr().is_bound()) field_ts__with__pwr = other_value.ts__with__pwr();
else field_ts__with__pwr.clean_up();
}

void TsAllocationUnion::clean_up()
{
field_presence.clean_up();
field_ts.clean_up();
field_ts__with__pwr.clean_up();
}

const TTCN_Typedescriptor_t* TsAllocationUnion::get_descriptor() const { return &TsAllocationUnion_descr_; }
TsAllocationUnion& TsAllocationUnion::operator=(const TsAllocationUnion& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.TsAllocationUnion.");
  if (other_value.presence().is_bound()) field_presence = other_value.presence();
  else field_presence.clean_up();
  if (other_value.ts().is_bound()) field_ts = other_value.ts();
  else field_ts.clean_up();
  if (other_value.ts__with__pwr().is_bound()) field_ts__with__pwr = other_value.ts__with__pwr();
  else field_ts__with__pwr.clean_up();
}
return *this;
}

boolean TsAllocationUnion::operator==(const TsAllocationUnion& other_value) const
{
return field_presence==other_value.field_presence
  && field_ts==other_value.field_ts
  && field_ts__with__pwr==other_value.field_ts__with__pwr;
}

boolean TsAllocationUnion::is_bound() const
{
return (field_presence.is_bound())
  || (OPTIONAL_OMIT == field_ts.get_selection() || field_ts.is_bound())
  || (OPTIONAL_OMIT == field_ts__with__pwr.get_selection() || field_ts__with__pwr.is_bound());
}
boolean TsAllocationUnion::is_value() const
{
return field_presence.is_value()
  && (OPTIONAL_OMIT == field_ts.get_selection() || field_ts.is_value())
  && (OPTIONAL_OMIT == field_ts__with__pwr.get_selection() || field_ts__with__pwr.is_value());
}
int TsAllocationUnion::size_of() const
{
  int ret_val = 1;
  if (field_ts.ispresent()) ret_val++;
  if (field_ts__with__pwr.ispresent()) ret_val++;
  return ret_val;
}

void TsAllocationUnion::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ presence := ");
field_presence.log();
TTCN_Logger::log_event_str(", ts := ");
field_ts.log();
TTCN_Logger::log_event_str(", ts_with_pwr := ");
field_ts__with__pwr.log();
TTCN_Logger::log_event_str(" }");
}

void TsAllocationUnion::set_implicit_omit()
{
if (presence().is_bound()) presence().set_implicit_omit();
if (!ts().is_bound()) ts() = OMIT_VALUE;
else ts().set_implicit_omit();
if (!ts__with__pwr().is_bound()) ts__with__pwr() = OMIT_VALUE;
else ts__with__pwr().set_implicit_omit();
}

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

void TsAllocationUnion::encode_text(Text_Buf& text_buf) const
{
field_presence.encode_text(text_buf);
field_ts.encode_text(text_buf);
field_ts__with__pwr.encode_text(text_buf);
}

void TsAllocationUnion::decode_text(Text_Buf& text_buf)
{
field_presence.decode_text(text_buf);
field_ts.decode_text(text_buf);
field_ts__with__pwr.decode_text(text_buf);
}

void TsAllocationUnion::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 TsAllocationUnion::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 TsAllocationUnion::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, TsAllocationUnion_presence_descr_.raw->forceomit);
  decoded_field_length = field_presence.RAW_decode(TsAllocationUnion_presence_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_presence ==  bs_1){
  if (force_omit != NULL && (*force_omit)(1)) {
    field_ts = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_1_force_omit(1, force_omit, TsAllocationUnion_ts_descr_.raw->forceomit);
  decoded_field_length = field_ts().RAW_decode(TsAllocationUnion_ts_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 1) {
  field_ts = 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_ts=OMIT_VALUE;
  if (limit > 0 && field_presence ==  bs_0){
  if (force_omit != NULL && (*force_omit)(2)) {
    field_ts__with__pwr = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_2_force_omit(2, force_omit, TsAllocationUnion_ts__with__pwr_descr_.raw->forceomit);
  decoded_field_length = field_ts__with__pwr().RAW_decode(TsAllocationUnion_ts__with__pwr_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 1) {
  field_ts__with__pwr = 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_ts__with__pwr=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int TsAllocationUnion::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, TsAllocationUnion_presence_descr_.raw);
  if (field_ts.ispresent()) {
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, TsAllocationUnion_ts_descr_.raw);
  }
  else myleaf.body.node.nodes[1] = NULL;
  if (field_ts__with__pwr.ispresent()) {
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, TsAllocationUnion_ts__with__pwr_descr_.raw);
  }
  else myleaf.body.node.nodes[2] = NULL;
  encoded_length += field_presence.RAW_encode(TsAllocationUnion_presence_descr_, *myleaf.body.node.nodes[0]);
  if (field_ts.ispresent()) {
  encoded_length += field_ts().RAW_encode(TsAllocationUnion_ts_descr_, *myleaf.body.node.nodes[1]);
  }
  if (field_ts__with__pwr.ispresent()) {
  encoded_length += field_ts__with__pwr().RAW_encode(TsAllocationUnion_ts__with__pwr_descr_, *myleaf.body.node.nodes[2]);
  }
  if (field_ts.ispresent() && (field_presence !=  bs_1)) {
  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_1.RAW_encode(TsAllocationUnion_presence_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_ts__with__pwr.ispresent() && (field_presence !=  bs_0)) {
  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(TsAllocationUnion_presence_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 TsAllocationUnion_template::single_value_struct {
BITSTRING_template field_presence;
TsAllocationTsArr_template field_ts;
TsAllocationPwr_template field_ts__with__pwr;
};

void TsAllocationUnion_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_presence = ANY_VALUE;
single_value->field_ts = ANY_OR_OMIT;
single_value->field_ts__with__pwr = ANY_OR_OMIT;
}
}
}

void TsAllocationUnion_template::copy_value(const TsAllocationUnion& other_value)
{
single_value = new single_value_struct;
if (other_value.presence().is_bound()) {
  single_value->field_presence = other_value.presence();
} else {
  single_value->field_presence.clean_up();
}
if (other_value.ts().is_bound()) {
  if (other_value.ts().ispresent()) single_value->field_ts = other_value.ts()();
  else single_value->field_ts = OMIT_VALUE;
} else {
  single_value->field_ts.clean_up();
}
if (other_value.ts__with__pwr().is_bound()) {
  if (other_value.ts__with__pwr().ispresent()) single_value->field_ts__with__pwr = other_value.ts__with__pwr()();
  else single_value->field_ts__with__pwr = OMIT_VALUE;
} else {
  single_value->field_ts__with__pwr.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void TsAllocationUnion_template::copy_template(const TsAllocationUnion_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) {
single_value->field_presence = other_value.presence();
} else {
single_value->field_presence.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ts().get_selection()) {
single_value->field_ts = other_value.ts();
} else {
single_value->field_ts.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ts__with__pwr().get_selection()) {
single_value->field_ts__with__pwr = other_value.ts__with__pwr();
} else {
single_value->field_ts__with__pwr.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 TsAllocationUnion_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 TsAllocationUnion_template(*other_value.implication_.precondition);
implication_.implied_template = new TsAllocationUnion_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_CSN1_Types.TsAllocationUnion.");
break;
}
set_selection(other_value);
}

TsAllocationUnion_template::TsAllocationUnion_template()
{
}

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

TsAllocationUnion_template::TsAllocationUnion_template(const TsAllocationUnion& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean TsAllocationUnion_template::match(const TsAllocationUnion& 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.presence().is_bound()) return FALSE;
if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE;
if(!other_value.ts().is_bound()) return FALSE;
if((other_value.ts().ispresent() ? !single_value->field_ts.match((const TsAllocationTsArr&)other_value.ts(), legacy) : !single_value->field_ts.match_omit(legacy)))return FALSE;
if(!other_value.ts__with__pwr().is_bound()) return FALSE;
if((other_value.ts__with__pwr().ispresent() ? !single_value->field_ts__with__pwr.match((const TsAllocationPwr&)other_value.ts__with__pwr(), legacy) : !single_value->field_ts__with__pwr.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_CSN1_Types.TsAllocationUnion.");
}
return FALSE;
}

boolean TsAllocationUnion_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_presence.is_bound()
 || (single_value->field_ts.is_omit() || single_value->field_ts.is_bound())
 || (single_value->field_ts__with__pwr.is_omit() || single_value->field_ts__with__pwr.is_bound());
}

boolean TsAllocationUnion_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_presence.is_value()
 && (single_value->field_ts.is_omit() || single_value->field_ts.is_value())
 && (single_value->field_ts__with__pwr.is_omit() || single_value->field_ts__with__pwr.is_value());
}

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

TsAllocationUnion TsAllocationUnion_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_CSN1_Types.TsAllocationUnion.");
TsAllocationUnion ret_val;
if (single_value->field_presence.is_bound()) {
ret_val.presence() = single_value->field_presence.valueof();
}
if (single_value->field_ts.is_omit()) ret_val.ts() = OMIT_VALUE;
else if (single_value->field_ts.is_bound()) {
ret_val.ts() = single_value->field_ts.valueof();
}
if (single_value->field_ts__with__pwr.is_omit()) ret_val.ts__with__pwr() = OMIT_VALUE;
else if (single_value->field_ts__with__pwr.is_bound()) {
ret_val.ts__with__pwr() = single_value->field_ts__with__pwr.valueof();
}
return ret_val;
}

void TsAllocationUnion_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_CSN1_Types.TsAllocationUnion.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new TsAllocationUnion_template[list_length];
}

TsAllocationUnion_template& TsAllocationUnion_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_CSN1_Types.TsAllocationUnion.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.TsAllocationUnion.");
return value_list.list_value[list_index];
}

BITSTRING_template& TsAllocationUnion_template::presence()
{
set_specific();
return single_value->field_presence;
}

const BITSTRING_template& TsAllocationUnion_template::presence() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field presence of a non-specific template of type @RLCMAC_CSN1_Types.TsAllocationUnion.");
return single_value->field_presence;
}

TsAllocationTsArr_template& TsAllocationUnion_template::ts()
{
set_specific();
return single_value->field_ts;
}

const TsAllocationTsArr_template& TsAllocationUnion_template::ts() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ts of a non-specific template of type @RLCMAC_CSN1_Types.TsAllocationUnion.");
return single_value->field_ts;
}

TsAllocationPwr_template& TsAllocationUnion_template::ts__with__pwr()
{
set_specific();
return single_value->field_ts__with__pwr;
}

const TsAllocationPwr_template& TsAllocationUnion_template::ts__with__pwr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ts_with_pwr of a non-specific template of type @RLCMAC_CSN1_Types.TsAllocationUnion.");
return single_value->field_ts__with__pwr;
}

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

void TsAllocationUnion_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ presence := ");
single_value->field_presence.log();
TTCN_Logger::log_event_str(", ts := ");
single_value->field_ts.log();
TTCN_Logger::log_event_str(", ts_with_pwr := ");
single_value->field_ts__with__pwr.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 TsAllocationUnion_template::log_match(const TsAllocationUnion& 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_presence.match(match_value.presence(), legacy)){
TTCN_Logger::log_logmatch_info(".presence");
single_value->field_presence.log_match(match_value.presence(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.ts().ispresent()){
if(!single_value->field_ts.match(match_value.ts(), legacy)){
TTCN_Logger::log_logmatch_info(".ts");
single_value->field_ts.log_match(match_value.ts(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_ts.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".ts := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_ts.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.ts__with__pwr().ispresent()){
if(!single_value->field_ts__with__pwr.match(match_value.ts__with__pwr(), legacy)){
TTCN_Logger::log_logmatch_info(".ts_with_pwr");
single_value->field_ts__with__pwr.log_match(match_value.ts__with__pwr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_ts__with__pwr.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".ts_with_pwr := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_ts__with__pwr.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("{ presence := ");
single_value->field_presence.log_match(match_value.presence(), legacy);
TTCN_Logger::log_event_str(", ts := ");
if (match_value.ts().ispresent()) {
single_value->field_ts.log_match(match_value.ts(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_ts.log();
if (single_value->field_ts.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", ts_with_pwr := ");
if (match_value.ts__with__pwr().ispresent()) {
single_value->field_ts__with__pwr.log_match(match_value.ts__with__pwr(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_ts__with__pwr.log();
if (single_value->field_ts__with__pwr.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 TsAllocationUnion_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (presence().is_bound()) presence().set_implicit_omit();
if (!ts().is_bound()) ts() = OMIT_VALUE;
else ts().set_implicit_omit();
if (!ts__with__pwr().is_bound()) ts__with__pwr() = OMIT_VALUE;
else ts__with__pwr().set_implicit_omit();
}

void TsAllocationUnion_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_presence.encode_text(text_buf);
single_value->field_ts.encode_text(text_buf);
single_value->field_ts__with__pwr.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_CSN1_Types.TsAllocationUnion.");
}
}

void TsAllocationUnion_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_presence.decode_text(text_buf);
single_value->field_ts.decode_text(text_buf);
single_value->field_ts__with__pwr.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 TsAllocationUnion_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_CSN1_Types.TsAllocationUnion.");
}
}

void TsAllocationUnion_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: {
    TsAllocationUnion_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_CSN1_Types.TsAllocationUnion 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) presence().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ts().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ts__with__pwr().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(), "presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          presence().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ts")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ts().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ts_with_pwr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ts__with__pwr().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_CSN1_Types.TsAllocationUnion: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    TsAllocationUnion_template* precondition = new TsAllocationUnion_template;
    precondition->set_param(*param.get_elem(0));
    TsAllocationUnion_template* implied_template = new TsAllocationUnion_template;
    implied_template->set_param(*param.get_elem(1));
    *this = TsAllocationUnion_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.TsAllocationUnion");
  }
  is_ifpresent = param.get_ifpresent();
}

void TsAllocationUnion_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_presence.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.TsAllocationUnion");
single_value->field_ts.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.TsAllocationUnion");
single_value->field_ts__with__pwr.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.TsAllocationUnion");
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_CSN1_Types.TsAllocationUnion");
}

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

boolean TsAllocationUnion_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 TsAllocationTs TsAllocationTsArr::UNBOUND_ELEM;
TsAllocationTsArr::TsAllocationTsArr()
{
val_ptr = NULL;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

void TsAllocationTsArr_template::copy_template(const TsAllocationTsArr_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 = (TsAllocationTs_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 TsAllocationTs_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new TsAllocationTs_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 TsAllocationTsArr_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 TsAllocationTsArr_template(*other_value.implication_.precondition);
implication_.implied_template = new TsAllocationTsArr_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_CSN1_Types.TsAllocationTsArr.");
break;
}
set_selection(other_value);
}

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

TsAllocationTsArr_template::TsAllocationTsArr_template()
{
}

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

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

TsAllocationTsArr_template::TsAllocationTsArr_template(const TsAllocationTsArr& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

const TsAllocationTs_template& TsAllocationTsArr_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @RLCMAC_CSN1_Types.TsAllocationTsArr 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_CSN1_Types.TsAllocationTsArr.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @RLCMAC_CSN1_Types.TsAllocationTsArr: 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 TsAllocationTs_template& TsAllocationTsArr_template::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @RLCMAC_CSN1_Types.TsAllocationTsArr.");
return (*this)[(int)index_value];
}

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

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

boolean TsAllocationTsArr_template::match(const TsAllocationTsArr& 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_CSN1_Types.TsAllocationTsArr.");
}
return FALSE;
}

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

TsAllocationTsArr TsAllocationTsArr_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_CSN1_Types.TsAllocationTsArr.");
TsAllocationTsArr 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;
}

TsAllocationTsArr TsAllocationTsArr_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);
}

TsAllocationTsArr TsAllocationTsArr_template::replace(int index, int len, const TsAllocationTsArr_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());
}

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

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

void TsAllocationTsArr_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 TsAllocationTsArr_template::log_match(const TsAllocationTsArr& 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 TsAllocationTsArr_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_CSN1_Types.TsAllocationTsArr.");
}
}

void TsAllocationTsArr_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_CSN1_Types.TsAllocationTsArr.");
single_value.value_elements = (TsAllocationTs_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 TsAllocationTs_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 TsAllocationTsArr_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_CSN1_Types.TsAllocationTsArr.");
}
}

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

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

void TsAllocationTsArr_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_CSN1_Types.TsAllocationTsArr");
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_CSN1_Types.TsAllocationTsArr");
}

boolean TsAllocationTsArr_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);
}
}
TsAllocationTs::TsAllocationTs()
{
}

TsAllocationTs::TsAllocationTs(const BITSTRING& par_presence,
    const OPTIONAL< INTEGER >& par_usf__tn)
  :   field_presence(par_presence),
  field_usf__tn(par_usf__tn)
{
}

TsAllocationTs::TsAllocationTs(const TsAllocationTs& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.TsAllocationTs.");
if (other_value.presence().is_bound()) field_presence = other_value.presence();
else field_presence.clean_up();
if (other_value.usf__tn().is_bound()) field_usf__tn = other_value.usf__tn();
else field_usf__tn.clean_up();
}

void TsAllocationTs::clean_up()
{
field_presence.clean_up();
field_usf__tn.clean_up();
}

const TTCN_Typedescriptor_t* TsAllocationTs::get_descriptor() const { return &TsAllocationTs_descr_; }
TsAllocationTs& TsAllocationTs::operator=(const TsAllocationTs& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.TsAllocationTs.");
  if (other_value.presence().is_bound()) field_presence = other_value.presence();
  else field_presence.clean_up();
  if (other_value.usf__tn().is_bound()) field_usf__tn = other_value.usf__tn();
  else field_usf__tn.clean_up();
}
return *this;
}

boolean TsAllocationTs::operator==(const TsAllocationTs& other_value) const
{
return field_presence==other_value.field_presence
  && field_usf__tn==other_value.field_usf__tn;
}

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

void TsAllocationTs::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ presence := ");
field_presence.log();
TTCN_Logger::log_event_str(", usf_tn := ");
field_usf__tn.log();
TTCN_Logger::log_event_str(" }");
}

void TsAllocationTs::set_implicit_omit()
{
if (presence().is_bound()) presence().set_implicit_omit();
if (!usf__tn().is_bound()) usf__tn() = OMIT_VALUE;
else usf__tn().set_implicit_omit();
}

void TsAllocationTs::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_CSN1_Types.TsAllocationTs 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) presence().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) usf__tn().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(), "presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          presence().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_tn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          usf__tn().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_CSN1_Types.TsAllocationTs: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.TsAllocationTs");
  }
}

void TsAllocationTs::encode_text(Text_Buf& text_buf) const
{
field_presence.encode_text(text_buf);
field_usf__tn.encode_text(text_buf);
}

void TsAllocationTs::decode_text(Text_Buf& text_buf)
{
field_presence.decode_text(text_buf);
field_usf__tn.decode_text(text_buf);
}

void TsAllocationTs::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 TsAllocationTs::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 TsAllocationTs::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, TsAllocationTs_presence_descr_.raw->forceomit);
  decoded_field_length = field_presence.RAW_decode(TsAllocationTs_presence_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_presence ==  bs_0){
  if (force_omit != NULL && (*force_omit)(1)) {
    field_usf__tn = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_1_force_omit(1, force_omit, TsAllocationTs_usf__tn_descr_.raw->forceomit);
  decoded_field_length = field_usf__tn().RAW_decode(TsAllocationTs_usf__tn_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 1) {
  field_usf__tn = 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_usf__tn=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int TsAllocationTs::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, TsAllocationTs_presence_descr_.raw);
  if (field_usf__tn.ispresent()) {
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, TsAllocationTs_usf__tn_descr_.raw);
  }
  else myleaf.body.node.nodes[1] = NULL;
  encoded_length += field_presence.RAW_encode(TsAllocationTs_presence_descr_, *myleaf.body.node.nodes[0]);
  if (field_usf__tn.ispresent()) {
  encoded_length += field_usf__tn().RAW_encode(TsAllocationTs_usf__tn_descr_, *myleaf.body.node.nodes[1]);
  }
  if (field_usf__tn.ispresent() && (field_presence !=  bs_0)) {
  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(TsAllocationTs_presence_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 TsAllocationTs_template::single_value_struct {
BITSTRING_template field_presence;
INTEGER_template field_usf__tn;
};

void TsAllocationTs_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_presence = ANY_VALUE;
single_value->field_usf__tn = ANY_OR_OMIT;
}
}
}

void TsAllocationTs_template::copy_value(const TsAllocationTs& other_value)
{
single_value = new single_value_struct;
if (other_value.presence().is_bound()) {
  single_value->field_presence = other_value.presence();
} else {
  single_value->field_presence.clean_up();
}
if (other_value.usf__tn().is_bound()) {
  if (other_value.usf__tn().ispresent()) single_value->field_usf__tn = other_value.usf__tn()();
  else single_value->field_usf__tn = OMIT_VALUE;
} else {
  single_value->field_usf__tn.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void TsAllocationTs_template::copy_template(const TsAllocationTs_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) {
single_value->field_presence = other_value.presence();
} else {
single_value->field_presence.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.usf__tn().get_selection()) {
single_value->field_usf__tn = other_value.usf__tn();
} else {
single_value->field_usf__tn.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 TsAllocationTs_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 TsAllocationTs_template(*other_value.implication_.precondition);
implication_.implied_template = new TsAllocationTs_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_CSN1_Types.TsAllocationTs.");
break;
}
set_selection(other_value);
}

TsAllocationTs_template::TsAllocationTs_template()
{
}

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

TsAllocationTs_template::TsAllocationTs_template(const TsAllocationTs& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean TsAllocationTs_template::match(const TsAllocationTs& 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.presence().is_bound()) return FALSE;
if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE;
if(!other_value.usf__tn().is_bound()) return FALSE;
if((other_value.usf__tn().ispresent() ? !single_value->field_usf__tn.match((const INTEGER&)other_value.usf__tn(), legacy) : !single_value->field_usf__tn.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_CSN1_Types.TsAllocationTs.");
}
return FALSE;
}

boolean TsAllocationTs_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_presence.is_bound()
 || (single_value->field_usf__tn.is_omit() || single_value->field_usf__tn.is_bound());
}

boolean TsAllocationTs_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_presence.is_value()
 && (single_value->field_usf__tn.is_omit() || single_value->field_usf__tn.is_value());
}

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

TsAllocationTs TsAllocationTs_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_CSN1_Types.TsAllocationTs.");
TsAllocationTs ret_val;
if (single_value->field_presence.is_bound()) {
ret_val.presence() = single_value->field_presence.valueof();
}
if (single_value->field_usf__tn.is_omit()) ret_val.usf__tn() = OMIT_VALUE;
else if (single_value->field_usf__tn.is_bound()) {
ret_val.usf__tn() = single_value->field_usf__tn.valueof();
}
return ret_val;
}

void TsAllocationTs_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_CSN1_Types.TsAllocationTs.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new TsAllocationTs_template[list_length];
}

TsAllocationTs_template& TsAllocationTs_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_CSN1_Types.TsAllocationTs.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.TsAllocationTs.");
return value_list.list_value[list_index];
}

BITSTRING_template& TsAllocationTs_template::presence()
{
set_specific();
return single_value->field_presence;
}

const BITSTRING_template& TsAllocationTs_template::presence() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field presence of a non-specific template of type @RLCMAC_CSN1_Types.TsAllocationTs.");
return single_value->field_presence;
}

INTEGER_template& TsAllocationTs_template::usf__tn()
{
set_specific();
return single_value->field_usf__tn;
}

const INTEGER_template& TsAllocationTs_template::usf__tn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field usf_tn of a non-specific template of type @RLCMAC_CSN1_Types.TsAllocationTs.");
return single_value->field_usf__tn;
}

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

void TsAllocationTs_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ presence := ");
single_value->field_presence.log();
TTCN_Logger::log_event_str(", usf_tn := ");
single_value->field_usf__tn.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 TsAllocationTs_template::log_match(const TsAllocationTs& 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_presence.match(match_value.presence(), legacy)){
TTCN_Logger::log_logmatch_info(".presence");
single_value->field_presence.log_match(match_value.presence(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.usf__tn().ispresent()){
if(!single_value->field_usf__tn.match(match_value.usf__tn(), legacy)){
TTCN_Logger::log_logmatch_info(".usf_tn");
single_value->field_usf__tn.log_match(match_value.usf__tn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_usf__tn.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".usf_tn := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_usf__tn.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("{ presence := ");
single_value->field_presence.log_match(match_value.presence(), legacy);
TTCN_Logger::log_event_str(", usf_tn := ");
if (match_value.usf__tn().ispresent()) {
single_value->field_usf__tn.log_match(match_value.usf__tn(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_usf__tn.log();
if (single_value->field_usf__tn.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 TsAllocationTs_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (presence().is_bound()) presence().set_implicit_omit();
if (!usf__tn().is_bound()) usf__tn() = OMIT_VALUE;
else usf__tn().set_implicit_omit();
}

void TsAllocationTs_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_presence.encode_text(text_buf);
single_value->field_usf__tn.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_CSN1_Types.TsAllocationTs.");
}
}

void TsAllocationTs_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_presence.decode_text(text_buf);
single_value->field_usf__tn.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 TsAllocationTs_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_CSN1_Types.TsAllocationTs.");
}
}

void TsAllocationTs_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: {
    TsAllocationTs_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_CSN1_Types.TsAllocationTs 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) presence().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) usf__tn().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(), "presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          presence().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_tn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          usf__tn().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_CSN1_Types.TsAllocationTs: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    TsAllocationTs_template* precondition = new TsAllocationTs_template;
    precondition->set_param(*param.get_elem(0));
    TsAllocationTs_template* implied_template = new TsAllocationTs_template;
    implied_template->set_param(*param.get_elem(1));
    *this = TsAllocationTs_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.TsAllocationTs");
  }
  is_ifpresent = param.get_ifpresent();
}

void TsAllocationTs_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_presence.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.TsAllocationTs");
single_value->field_usf__tn.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.TsAllocationTs");
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_CSN1_Types.TsAllocationTs");
}

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

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

TnGamma::TnGamma()
{
}

TnGamma::TnGamma(const BITSTRING& par_presence,
    const OPTIONAL< INTEGER >& par_usf__tn,
    const OPTIONAL< INTEGER >& par_gamma__tn)
  :   field_presence(par_presence),
  field_usf__tn(par_usf__tn),
  field_gamma__tn(par_gamma__tn)
{
}

TnGamma::TnGamma(const TnGamma& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.TnGamma.");
if (other_value.presence().is_bound()) field_presence = other_value.presence();
else field_presence.clean_up();
if (other_value.usf__tn().is_bound()) field_usf__tn = other_value.usf__tn();
else field_usf__tn.clean_up();
if (other_value.gamma__tn().is_bound()) field_gamma__tn = other_value.gamma__tn();
else field_gamma__tn.clean_up();
}

void TnGamma::clean_up()
{
field_presence.clean_up();
field_usf__tn.clean_up();
field_gamma__tn.clean_up();
}

const TTCN_Typedescriptor_t* TnGamma::get_descriptor() const { return &TnGamma_descr_; }
TnGamma& TnGamma::operator=(const TnGamma& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.TnGamma.");
  if (other_value.presence().is_bound()) field_presence = other_value.presence();
  else field_presence.clean_up();
  if (other_value.usf__tn().is_bound()) field_usf__tn = other_value.usf__tn();
  else field_usf__tn.clean_up();
  if (other_value.gamma__tn().is_bound()) field_gamma__tn = other_value.gamma__tn();
  else field_gamma__tn.clean_up();
}
return *this;
}

boolean TnGamma::operator==(const TnGamma& other_value) const
{
return field_presence==other_value.field_presence
  && field_usf__tn==other_value.field_usf__tn
  && field_gamma__tn==other_value.field_gamma__tn;
}

boolean TnGamma::is_bound() const
{
return (field_presence.is_bound())
  || (OPTIONAL_OMIT == field_usf__tn.get_selection() || field_usf__tn.is_bound())
  || (OPTIONAL_OMIT == field_gamma__tn.get_selection() || field_gamma__tn.is_bound());
}
boolean TnGamma::is_value() const
{
return field_presence.is_value()
  && (OPTIONAL_OMIT == field_usf__tn.get_selection() || field_usf__tn.is_value())
  && (OPTIONAL_OMIT == field_gamma__tn.get_selection() || field_gamma__tn.is_value());
}
int TnGamma::size_of() const
{
  int ret_val = 1;
  if (field_usf__tn.ispresent()) ret_val++;
  if (field_gamma__tn.ispresent()) ret_val++;
  return ret_val;
}

void TnGamma::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ presence := ");
field_presence.log();
TTCN_Logger::log_event_str(", usf_tn := ");
field_usf__tn.log();
TTCN_Logger::log_event_str(", gamma_tn := ");
field_gamma__tn.log();
TTCN_Logger::log_event_str(" }");
}

void TnGamma::set_implicit_omit()
{
if (presence().is_bound()) presence().set_implicit_omit();
if (!usf__tn().is_bound()) usf__tn() = OMIT_VALUE;
else usf__tn().set_implicit_omit();
if (!gamma__tn().is_bound()) gamma__tn() = OMIT_VALUE;
else gamma__tn().set_implicit_omit();
}

void TnGamma::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_CSN1_Types.TnGamma 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) presence().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) usf__tn().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) gamma__tn().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(), "presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          presence().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_tn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          usf__tn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gamma_tn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gamma__tn().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_CSN1_Types.TnGamma: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.TnGamma");
  }
}

void TnGamma::encode_text(Text_Buf& text_buf) const
{
field_presence.encode_text(text_buf);
field_usf__tn.encode_text(text_buf);
field_gamma__tn.encode_text(text_buf);
}

void TnGamma::decode_text(Text_Buf& text_buf)
{
field_presence.decode_text(text_buf);
field_usf__tn.decode_text(text_buf);
field_gamma__tn.decode_text(text_buf);
}

void TnGamma::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 TnGamma::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 TnGamma::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, TnGamma_presence_descr_.raw->forceomit);
  decoded_field_length = field_presence.RAW_decode(TnGamma_presence_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_presence ==  bs_0){
  if (force_omit != NULL && (*force_omit)(1)) {
    field_usf__tn = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_1_force_omit(1, force_omit, TnGamma_usf__tn_descr_.raw->forceomit);
  decoded_field_length = field_usf__tn().RAW_decode(TnGamma_usf__tn_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 1) {
  field_usf__tn = 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_usf__tn=OMIT_VALUE;
  if (limit > 0 && field_presence ==  bs_0){
  if (force_omit != NULL && (*force_omit)(2)) {
    field_gamma__tn = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_2_force_omit(2, force_omit, TnGamma_gamma__tn_descr_.raw->forceomit);
  decoded_field_length = field_gamma__tn().RAW_decode(TnGamma_gamma__tn_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 1) {
  field_gamma__tn = 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_gamma__tn=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int TnGamma::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, TnGamma_presence_descr_.raw);
  if (field_usf__tn.ispresent()) {
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, TnGamma_usf__tn_descr_.raw);
  }
  else myleaf.body.node.nodes[1] = NULL;
  if (field_gamma__tn.ispresent()) {
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, TnGamma_gamma__tn_descr_.raw);
  }
  else myleaf.body.node.nodes[2] = NULL;
  encoded_length += field_presence.RAW_encode(TnGamma_presence_descr_, *myleaf.body.node.nodes[0]);
  if (field_usf__tn.ispresent()) {
  encoded_length += field_usf__tn().RAW_encode(TnGamma_usf__tn_descr_, *myleaf.body.node.nodes[1]);
  }
  if (field_gamma__tn.ispresent()) {
  encoded_length += field_gamma__tn().RAW_encode(TnGamma_gamma__tn_descr_, *myleaf.body.node.nodes[2]);
  }
  if (field_usf__tn.ispresent() && (field_presence !=  bs_0)) {
  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(TnGamma_presence_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_gamma__tn.ispresent() && (field_presence !=  bs_0)) {
  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(TnGamma_presence_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 TnGamma_template::single_value_struct {
BITSTRING_template field_presence;
INTEGER_template field_usf__tn;
INTEGER_template field_gamma__tn;
};

void TnGamma_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_presence = ANY_VALUE;
single_value->field_usf__tn = ANY_OR_OMIT;
single_value->field_gamma__tn = ANY_OR_OMIT;
}
}
}

void TnGamma_template::copy_value(const TnGamma& other_value)
{
single_value = new single_value_struct;
if (other_value.presence().is_bound()) {
  single_value->field_presence = other_value.presence();
} else {
  single_value->field_presence.clean_up();
}
if (other_value.usf__tn().is_bound()) {
  if (other_value.usf__tn().ispresent()) single_value->field_usf__tn = other_value.usf__tn()();
  else single_value->field_usf__tn = OMIT_VALUE;
} else {
  single_value->field_usf__tn.clean_up();
}
if (other_value.gamma__tn().is_bound()) {
  if (other_value.gamma__tn().ispresent()) single_value->field_gamma__tn = other_value.gamma__tn()();
  else single_value->field_gamma__tn = OMIT_VALUE;
} else {
  single_value->field_gamma__tn.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void TnGamma_template::copy_template(const TnGamma_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) {
single_value->field_presence = other_value.presence();
} else {
single_value->field_presence.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.usf__tn().get_selection()) {
single_value->field_usf__tn = other_value.usf__tn();
} else {
single_value->field_usf__tn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.gamma__tn().get_selection()) {
single_value->field_gamma__tn = other_value.gamma__tn();
} else {
single_value->field_gamma__tn.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 TnGamma_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 TnGamma_template(*other_value.implication_.precondition);
implication_.implied_template = new TnGamma_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_CSN1_Types.TnGamma.");
break;
}
set_selection(other_value);
}

TnGamma_template::TnGamma_template()
{
}

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

TnGamma_template::TnGamma_template(const TnGamma& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean TnGamma_template::match(const TnGamma& 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.presence().is_bound()) return FALSE;
if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE;
if(!other_value.usf__tn().is_bound()) return FALSE;
if((other_value.usf__tn().ispresent() ? !single_value->field_usf__tn.match((const INTEGER&)other_value.usf__tn(), legacy) : !single_value->field_usf__tn.match_omit(legacy)))return FALSE;
if(!other_value.gamma__tn().is_bound()) return FALSE;
if((other_value.gamma__tn().ispresent() ? !single_value->field_gamma__tn.match((const INTEGER&)other_value.gamma__tn(), legacy) : !single_value->field_gamma__tn.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_CSN1_Types.TnGamma.");
}
return FALSE;
}

boolean TnGamma_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_presence.is_bound()
 || (single_value->field_usf__tn.is_omit() || single_value->field_usf__tn.is_bound())
 || (single_value->field_gamma__tn.is_omit() || single_value->field_gamma__tn.is_bound());
}

boolean TnGamma_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_presence.is_value()
 && (single_value->field_usf__tn.is_omit() || single_value->field_usf__tn.is_value())
 && (single_value->field_gamma__tn.is_omit() || single_value->field_gamma__tn.is_value());
}

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

TnGamma TnGamma_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_CSN1_Types.TnGamma.");
TnGamma ret_val;
if (single_value->field_presence.is_bound()) {
ret_val.presence() = single_value->field_presence.valueof();
}
if (single_value->field_usf__tn.is_omit()) ret_val.usf__tn() = OMIT_VALUE;
else if (single_value->field_usf__tn.is_bound()) {
ret_val.usf__tn() = single_value->field_usf__tn.valueof();
}
if (single_value->field_gamma__tn.is_omit()) ret_val.gamma__tn() = OMIT_VALUE;
else if (single_value->field_gamma__tn.is_bound()) {
ret_val.gamma__tn() = single_value->field_gamma__tn.valueof();
}
return ret_val;
}

void TnGamma_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_CSN1_Types.TnGamma.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new TnGamma_template[list_length];
}

TnGamma_template& TnGamma_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_CSN1_Types.TnGamma.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.TnGamma.");
return value_list.list_value[list_index];
}

BITSTRING_template& TnGamma_template::presence()
{
set_specific();
return single_value->field_presence;
}

const BITSTRING_template& TnGamma_template::presence() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field presence of a non-specific template of type @RLCMAC_CSN1_Types.TnGamma.");
return single_value->field_presence;
}

INTEGER_template& TnGamma_template::usf__tn()
{
set_specific();
return single_value->field_usf__tn;
}

const INTEGER_template& TnGamma_template::usf__tn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field usf_tn of a non-specific template of type @RLCMAC_CSN1_Types.TnGamma.");
return single_value->field_usf__tn;
}

INTEGER_template& TnGamma_template::gamma__tn()
{
set_specific();
return single_value->field_gamma__tn;
}

const INTEGER_template& TnGamma_template::gamma__tn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field gamma_tn of a non-specific template of type @RLCMAC_CSN1_Types.TnGamma.");
return single_value->field_gamma__tn;
}

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

void TnGamma_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ presence := ");
single_value->field_presence.log();
TTCN_Logger::log_event_str(", usf_tn := ");
single_value->field_usf__tn.log();
TTCN_Logger::log_event_str(", gamma_tn := ");
single_value->field_gamma__tn.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 TnGamma_template::log_match(const TnGamma& 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_presence.match(match_value.presence(), legacy)){
TTCN_Logger::log_logmatch_info(".presence");
single_value->field_presence.log_match(match_value.presence(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.usf__tn().ispresent()){
if(!single_value->field_usf__tn.match(match_value.usf__tn(), legacy)){
TTCN_Logger::log_logmatch_info(".usf_tn");
single_value->field_usf__tn.log_match(match_value.usf__tn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_usf__tn.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".usf_tn := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_usf__tn.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.gamma__tn().ispresent()){
if(!single_value->field_gamma__tn.match(match_value.gamma__tn(), legacy)){
TTCN_Logger::log_logmatch_info(".gamma_tn");
single_value->field_gamma__tn.log_match(match_value.gamma__tn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_gamma__tn.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".gamma_tn := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_gamma__tn.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("{ presence := ");
single_value->field_presence.log_match(match_value.presence(), legacy);
TTCN_Logger::log_event_str(", usf_tn := ");
if (match_value.usf__tn().ispresent()) {
single_value->field_usf__tn.log_match(match_value.usf__tn(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_usf__tn.log();
if (single_value->field_usf__tn.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", gamma_tn := ");
if (match_value.gamma__tn().ispresent()) {
single_value->field_gamma__tn.log_match(match_value.gamma__tn(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_gamma__tn.log();
if (single_value->field_gamma__tn.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 TnGamma_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (presence().is_bound()) presence().set_implicit_omit();
if (!usf__tn().is_bound()) usf__tn() = OMIT_VALUE;
else usf__tn().set_implicit_omit();
if (!gamma__tn().is_bound()) gamma__tn() = OMIT_VALUE;
else gamma__tn().set_implicit_omit();
}

void TnGamma_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_presence.encode_text(text_buf);
single_value->field_usf__tn.encode_text(text_buf);
single_value->field_gamma__tn.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_CSN1_Types.TnGamma.");
}
}

void TnGamma_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_presence.decode_text(text_buf);
single_value->field_usf__tn.decode_text(text_buf);
single_value->field_gamma__tn.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 TnGamma_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_CSN1_Types.TnGamma.");
}
}

void TnGamma_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: {
    TnGamma_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_CSN1_Types.TnGamma 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) presence().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) usf__tn().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) gamma__tn().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(), "presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          presence().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_tn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          usf__tn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gamma_tn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gamma__tn().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_CSN1_Types.TnGamma: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    TnGamma_template* precondition = new TnGamma_template;
    precondition->set_param(*param.get_elem(0));
    TnGamma_template* implied_template = new TnGamma_template;
    implied_template->set_param(*param.get_elem(1));
    *this = TnGamma_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.TnGamma");
  }
  is_ifpresent = param.get_ifpresent();
}

void TnGamma_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_presence.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.TnGamma");
single_value->field_usf__tn.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.TnGamma");
single_value->field_gamma__tn.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.TnGamma");
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_CSN1_Types.TnGamma");
}

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

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

TsAllocationPwr::TsAllocationPwr()
{
}

TsAllocationPwr::TsAllocationPwr(const INTEGER& par_alpha,
    const TnGamma& par_tn__gamma)
  :   field_alpha(par_alpha),
  field_tn__gamma(par_tn__gamma)
{
}

TsAllocationPwr::TsAllocationPwr(const TsAllocationPwr& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.TsAllocationPwr.");
if (other_value.alpha().is_bound()) field_alpha = other_value.alpha();
else field_alpha.clean_up();
if (other_value.tn__gamma().is_bound()) field_tn__gamma = other_value.tn__gamma();
else field_tn__gamma.clean_up();
}

void TsAllocationPwr::clean_up()
{
field_alpha.clean_up();
field_tn__gamma.clean_up();
}

const TTCN_Typedescriptor_t* TsAllocationPwr::get_descriptor() const { return &TsAllocationPwr_descr_; }
TsAllocationPwr& TsAllocationPwr::operator=(const TsAllocationPwr& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.TsAllocationPwr.");
  if (other_value.alpha().is_bound()) field_alpha = other_value.alpha();
  else field_alpha.clean_up();
  if (other_value.tn__gamma().is_bound()) field_tn__gamma = other_value.tn__gamma();
  else field_tn__gamma.clean_up();
}
return *this;
}

boolean TsAllocationPwr::operator==(const TsAllocationPwr& other_value) const
{
return field_alpha==other_value.field_alpha
  && field_tn__gamma==other_value.field_tn__gamma;
}

boolean TsAllocationPwr::is_bound() const
{
return (field_alpha.is_bound())
  || (field_tn__gamma.is_bound());
}
boolean TsAllocationPwr::is_value() const
{
return field_alpha.is_value()
  && field_tn__gamma.is_value();
}
void TsAllocationPwr::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ alpha := ");
field_alpha.log();
TTCN_Logger::log_event_str(", tn_gamma := ");
field_tn__gamma.log();
TTCN_Logger::log_event_str(" }");
}

void TsAllocationPwr::set_implicit_omit()
{
if (alpha().is_bound()) alpha().set_implicit_omit();
if (tn__gamma().is_bound()) tn__gamma().set_implicit_omit();
}

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

void TsAllocationPwr::encode_text(Text_Buf& text_buf) const
{
field_alpha.encode_text(text_buf);
field_tn__gamma.encode_text(text_buf);
}

void TsAllocationPwr::decode_text(Text_Buf& text_buf)
{
field_alpha.decode_text(text_buf);
field_tn__gamma.decode_text(text_buf);
}

void TsAllocationPwr::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 TsAllocationPwr::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 TsAllocationPwr::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, TsAllocationPwr_alpha_descr_.raw->forceomit);
  decoded_field_length = field_alpha.RAW_decode(TsAllocationPwr_alpha_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, TsAllocationPwr_tn__gamma_descr_.raw->forceomit);
  decoded_field_length = field_tn__gamma.RAW_decode(TsAllocationPwr_tn__gamma_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 TsAllocationPwr::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, TsAllocationPwr_alpha_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, TsAllocationPwr_tn__gamma_descr_.raw);
  encoded_length += field_alpha.RAW_encode(TsAllocationPwr_alpha_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_tn__gamma.RAW_encode(TsAllocationPwr_tn__gamma_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct TsAllocationPwr_template::single_value_struct {
INTEGER_template field_alpha;
TnGamma_template field_tn__gamma;
};

void TsAllocationPwr_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_alpha = ANY_VALUE;
single_value->field_tn__gamma = ANY_VALUE;
}
}
}

void TsAllocationPwr_template::copy_value(const TsAllocationPwr& other_value)
{
single_value = new single_value_struct;
if (other_value.alpha().is_bound()) {
  single_value->field_alpha = other_value.alpha();
} else {
  single_value->field_alpha.clean_up();
}
if (other_value.tn__gamma().is_bound()) {
  single_value->field_tn__gamma = other_value.tn__gamma();
} else {
  single_value->field_tn__gamma.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void TsAllocationPwr_template::copy_template(const TsAllocationPwr_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.alpha().get_selection()) {
single_value->field_alpha = other_value.alpha();
} else {
single_value->field_alpha.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tn__gamma().get_selection()) {
single_value->field_tn__gamma = other_value.tn__gamma();
} else {
single_value->field_tn__gamma.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 TsAllocationPwr_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 TsAllocationPwr_template(*other_value.implication_.precondition);
implication_.implied_template = new TsAllocationPwr_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_CSN1_Types.TsAllocationPwr.");
break;
}
set_selection(other_value);
}

TsAllocationPwr_template::TsAllocationPwr_template()
{
}

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

TsAllocationPwr_template::TsAllocationPwr_template(const TsAllocationPwr& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean TsAllocationPwr_template::match(const TsAllocationPwr& 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.alpha().is_bound()) return FALSE;
if(!single_value->field_alpha.match(other_value.alpha(), legacy))return FALSE;
if(!other_value.tn__gamma().is_bound()) return FALSE;
if(!single_value->field_tn__gamma.match(other_value.tn__gamma(), 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_CSN1_Types.TsAllocationPwr.");
}
return FALSE;
}

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

boolean TsAllocationPwr_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_alpha.is_value()
 && single_value->field_tn__gamma.is_value();
}

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

TsAllocationPwr TsAllocationPwr_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_CSN1_Types.TsAllocationPwr.");
TsAllocationPwr ret_val;
if (single_value->field_alpha.is_bound()) {
ret_val.alpha() = single_value->field_alpha.valueof();
}
if (single_value->field_tn__gamma.is_bound()) {
ret_val.tn__gamma() = single_value->field_tn__gamma.valueof();
}
return ret_val;
}

void TsAllocationPwr_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_CSN1_Types.TsAllocationPwr.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new TsAllocationPwr_template[list_length];
}

TsAllocationPwr_template& TsAllocationPwr_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_CSN1_Types.TsAllocationPwr.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.TsAllocationPwr.");
return value_list.list_value[list_index];
}

INTEGER_template& TsAllocationPwr_template::alpha()
{
set_specific();
return single_value->field_alpha;
}

const INTEGER_template& TsAllocationPwr_template::alpha() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field alpha of a non-specific template of type @RLCMAC_CSN1_Types.TsAllocationPwr.");
return single_value->field_alpha;
}

TnGamma_template& TsAllocationPwr_template::tn__gamma()
{
set_specific();
return single_value->field_tn__gamma;
}

const TnGamma_template& TsAllocationPwr_template::tn__gamma() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tn_gamma of a non-specific template of type @RLCMAC_CSN1_Types.TsAllocationPwr.");
return single_value->field_tn__gamma;
}

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

void TsAllocationPwr_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ alpha := ");
single_value->field_alpha.log();
TTCN_Logger::log_event_str(", tn_gamma := ");
single_value->field_tn__gamma.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 TsAllocationPwr_template::log_match(const TsAllocationPwr& 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_alpha.match(match_value.alpha(), legacy)){
TTCN_Logger::log_logmatch_info(".alpha");
single_value->field_alpha.log_match(match_value.alpha(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tn__gamma.match(match_value.tn__gamma(), legacy)){
TTCN_Logger::log_logmatch_info(".tn_gamma");
single_value->field_tn__gamma.log_match(match_value.tn__gamma(), 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("{ alpha := ");
single_value->field_alpha.log_match(match_value.alpha(), legacy);
TTCN_Logger::log_event_str(", tn_gamma := ");
single_value->field_tn__gamma.log_match(match_value.tn__gamma(), 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 TsAllocationPwr_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (alpha().is_bound()) alpha().set_implicit_omit();
if (tn__gamma().is_bound()) tn__gamma().set_implicit_omit();
}

void TsAllocationPwr_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_alpha.encode_text(text_buf);
single_value->field_tn__gamma.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_CSN1_Types.TsAllocationPwr.");
}
}

void TsAllocationPwr_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_alpha.decode_text(text_buf);
single_value->field_tn__gamma.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 TsAllocationPwr_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_CSN1_Types.TsAllocationPwr.");
}
}

void TsAllocationPwr_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: {
    TsAllocationPwr_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_CSN1_Types.TsAllocationPwr 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) alpha().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tn__gamma().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(), "alpha")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          alpha().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tn_gamma")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tn__gamma().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_CSN1_Types.TsAllocationPwr: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    TsAllocationPwr_template* precondition = new TsAllocationPwr_template;
    precondition->set_param(*param.get_elem(0));
    TsAllocationPwr_template* implied_template = new TsAllocationPwr_template;
    implied_template->set_param(*param.get_elem(1));
    *this = TsAllocationPwr_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.TsAllocationPwr");
  }
  is_ifpresent = param.get_ifpresent();
}

void TsAllocationPwr_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_alpha.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.TsAllocationPwr");
single_value->field_tn__gamma.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.TsAllocationPwr");
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_CSN1_Types.TsAllocationPwr");
}

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

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

DynamicAllocation::DynamicAllocation()
{
}

DynamicAllocation::DynamicAllocation(const BITSTRING& par_extd__dyn__alloc,
    const BITSTRING& par_p0__present,
    const OPTIONAL< INTEGER >& par_p0,
    const OPTIONAL< BITSTRING >& par_pr__mode,
    const BITSTRING& par_usf__granularity,
    const BITSTRING& par_ul__tfi__ass__present,
    const OPTIONAL< INTEGER >& par_ul__tfi__assignment,
    const BITSTRING& par_reserved,
    const BITSTRING& par_tbf__starting__time__present,
    const OPTIONAL< StartingFnDesc >& par_tbf__starting__time,
    const TsAllocationUnion& par_ts__allocation)
  :   field_extd__dyn__alloc(par_extd__dyn__alloc),
  field_p0__present(par_p0__present),
  field_p0(par_p0),
  field_pr__mode(par_pr__mode),
  field_usf__granularity(par_usf__granularity),
  field_ul__tfi__ass__present(par_ul__tfi__ass__present),
  field_ul__tfi__assignment(par_ul__tfi__assignment),
  field_reserved(par_reserved),
  field_tbf__starting__time__present(par_tbf__starting__time__present),
  field_tbf__starting__time(par_tbf__starting__time),
  field_ts__allocation(par_ts__allocation)
{
}

DynamicAllocation::DynamicAllocation(const DynamicAllocation& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.DynamicAllocation.");
if (other_value.extd__dyn__alloc().is_bound()) field_extd__dyn__alloc = other_value.extd__dyn__alloc();
else field_extd__dyn__alloc.clean_up();
if (other_value.p0__present().is_bound()) field_p0__present = other_value.p0__present();
else field_p0__present.clean_up();
if (other_value.p0().is_bound()) field_p0 = other_value.p0();
else field_p0.clean_up();
if (other_value.pr__mode().is_bound()) field_pr__mode = other_value.pr__mode();
else field_pr__mode.clean_up();
if (other_value.usf__granularity().is_bound()) field_usf__granularity = other_value.usf__granularity();
else field_usf__granularity.clean_up();
if (other_value.ul__tfi__ass__present().is_bound()) field_ul__tfi__ass__present = other_value.ul__tfi__ass__present();
else field_ul__tfi__ass__present.clean_up();
if (other_value.ul__tfi__assignment().is_bound()) field_ul__tfi__assignment = other_value.ul__tfi__assignment();
else field_ul__tfi__assignment.clean_up();
if (other_value.reserved().is_bound()) field_reserved = other_value.reserved();
else field_reserved.clean_up();
if (other_value.tbf__starting__time__present().is_bound()) field_tbf__starting__time__present = other_value.tbf__starting__time__present();
else field_tbf__starting__time__present.clean_up();
if (other_value.tbf__starting__time().is_bound()) field_tbf__starting__time = other_value.tbf__starting__time();
else field_tbf__starting__time.clean_up();
if (other_value.ts__allocation().is_bound()) field_ts__allocation = other_value.ts__allocation();
else field_ts__allocation.clean_up();
}

void DynamicAllocation::clean_up()
{
field_extd__dyn__alloc.clean_up();
field_p0__present.clean_up();
field_p0.clean_up();
field_pr__mode.clean_up();
field_usf__granularity.clean_up();
field_ul__tfi__ass__present.clean_up();
field_ul__tfi__assignment.clean_up();
field_reserved.clean_up();
field_tbf__starting__time__present.clean_up();
field_tbf__starting__time.clean_up();
field_ts__allocation.clean_up();
}

const TTCN_Typedescriptor_t* DynamicAllocation::get_descriptor() const { return &DynamicAllocation_descr_; }
DynamicAllocation& DynamicAllocation::operator=(const DynamicAllocation& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.DynamicAllocation.");
  if (other_value.extd__dyn__alloc().is_bound()) field_extd__dyn__alloc = other_value.extd__dyn__alloc();
  else field_extd__dyn__alloc.clean_up();
  if (other_value.p0__present().is_bound()) field_p0__present = other_value.p0__present();
  else field_p0__present.clean_up();
  if (other_value.p0().is_bound()) field_p0 = other_value.p0();
  else field_p0.clean_up();
  if (other_value.pr__mode().is_bound()) field_pr__mode = other_value.pr__mode();
  else field_pr__mode.clean_up();
  if (other_value.usf__granularity().is_bound()) field_usf__granularity = other_value.usf__granularity();
  else field_usf__granularity.clean_up();
  if (other_value.ul__tfi__ass__present().is_bound()) field_ul__tfi__ass__present = other_value.ul__tfi__ass__present();
  else field_ul__tfi__ass__present.clean_up();
  if (other_value.ul__tfi__assignment().is_bound()) field_ul__tfi__assignment = other_value.ul__tfi__assignment();
  else field_ul__tfi__assignment.clean_up();
  if (other_value.reserved().is_bound()) field_reserved = other_value.reserved();
  else field_reserved.clean_up();
  if (other_value.tbf__starting__time__present().is_bound()) field_tbf__starting__time__present = other_value.tbf__starting__time__present();
  else field_tbf__starting__time__present.clean_up();
  if (other_value.tbf__starting__time().is_bound()) field_tbf__starting__time = other_value.tbf__starting__time();
  else field_tbf__starting__time.clean_up();
  if (other_value.ts__allocation().is_bound()) field_ts__allocation = other_value.ts__allocation();
  else field_ts__allocation.clean_up();
}
return *this;
}

boolean DynamicAllocation::operator==(const DynamicAllocation& other_value) const
{
return field_extd__dyn__alloc==other_value.field_extd__dyn__alloc
  && field_p0__present==other_value.field_p0__present
  && field_p0==other_value.field_p0
  && field_pr__mode==other_value.field_pr__mode
  && field_usf__granularity==other_value.field_usf__granularity
  && field_ul__tfi__ass__present==other_value.field_ul__tfi__ass__present
  && field_ul__tfi__assignment==other_value.field_ul__tfi__assignment
  && field_reserved==other_value.field_reserved
  && field_tbf__starting__time__present==other_value.field_tbf__starting__time__present
  && field_tbf__starting__time==other_value.field_tbf__starting__time
  && field_ts__allocation==other_value.field_ts__allocation;
}

boolean DynamicAllocation::is_bound() const
{
return (field_extd__dyn__alloc.is_bound())
  || (field_p0__present.is_bound())
  || (OPTIONAL_OMIT == field_p0.get_selection() || field_p0.is_bound())
  || (OPTIONAL_OMIT == field_pr__mode.get_selection() || field_pr__mode.is_bound())
  || (field_usf__granularity.is_bound())
  || (field_ul__tfi__ass__present.is_bound())
  || (OPTIONAL_OMIT == field_ul__tfi__assignment.get_selection() || field_ul__tfi__assignment.is_bound())
  || (field_reserved.is_bound())
  || (field_tbf__starting__time__present.is_bound())
  || (OPTIONAL_OMIT == field_tbf__starting__time.get_selection() || field_tbf__starting__time.is_bound())
  || (field_ts__allocation.is_bound());
}
boolean DynamicAllocation::is_value() const
{
return field_extd__dyn__alloc.is_value()
  && field_p0__present.is_value()
  && (OPTIONAL_OMIT == field_p0.get_selection() || field_p0.is_value())
  && (OPTIONAL_OMIT == field_pr__mode.get_selection() || field_pr__mode.is_value())
  && field_usf__granularity.is_value()
  && field_ul__tfi__ass__present.is_value()
  && (OPTIONAL_OMIT == field_ul__tfi__assignment.get_selection() || field_ul__tfi__assignment.is_value())
  && field_reserved.is_value()
  && field_tbf__starting__time__present.is_value()
  && (OPTIONAL_OMIT == field_tbf__starting__time.get_selection() || field_tbf__starting__time.is_value())
  && field_ts__allocation.is_value();
}
int DynamicAllocation::size_of() const
{
  int ret_val = 7;
  if (field_p0.ispresent()) ret_val++;
  if (field_pr__mode.ispresent()) ret_val++;
  if (field_ul__tfi__assignment.ispresent()) ret_val++;
  if (field_tbf__starting__time.ispresent()) ret_val++;
  return ret_val;
}

void DynamicAllocation::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ extd_dyn_alloc := ");
field_extd__dyn__alloc.log();
TTCN_Logger::log_event_str(", p0_present := ");
field_p0__present.log();
TTCN_Logger::log_event_str(", p0 := ");
field_p0.log();
TTCN_Logger::log_event_str(", pr_mode := ");
field_pr__mode.log();
TTCN_Logger::log_event_str(", usf_granularity := ");
field_usf__granularity.log();
TTCN_Logger::log_event_str(", ul_tfi_ass_present := ");
field_ul__tfi__ass__present.log();
TTCN_Logger::log_event_str(", ul_tfi_assignment := ");
field_ul__tfi__assignment.log();
TTCN_Logger::log_event_str(", reserved := ");
field_reserved.log();
TTCN_Logger::log_event_str(", tbf_starting_time_present := ");
field_tbf__starting__time__present.log();
TTCN_Logger::log_event_str(", tbf_starting_time := ");
field_tbf__starting__time.log();
TTCN_Logger::log_event_str(", ts_allocation := ");
field_ts__allocation.log();
TTCN_Logger::log_event_str(" }");
}

void DynamicAllocation::set_implicit_omit()
{
if (extd__dyn__alloc().is_bound()) extd__dyn__alloc().set_implicit_omit();
if (p0__present().is_bound()) p0__present().set_implicit_omit();
if (!p0().is_bound()) p0() = OMIT_VALUE;
else p0().set_implicit_omit();
if (!pr__mode().is_bound()) pr__mode() = OMIT_VALUE;
else pr__mode().set_implicit_omit();
if (usf__granularity().is_bound()) usf__granularity().set_implicit_omit();
if (ul__tfi__ass__present().is_bound()) ul__tfi__ass__present().set_implicit_omit();
if (!ul__tfi__assignment().is_bound()) ul__tfi__assignment() = OMIT_VALUE;
else ul__tfi__assignment().set_implicit_omit();
if (reserved().is_bound()) reserved().set_implicit_omit();
if (tbf__starting__time__present().is_bound()) tbf__starting__time__present().set_implicit_omit();
if (!tbf__starting__time().is_bound()) tbf__starting__time() = OMIT_VALUE;
else tbf__starting__time().set_implicit_omit();
if (ts__allocation().is_bound()) ts__allocation().set_implicit_omit();
}

void DynamicAllocation::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_CSN1_Types.DynamicAllocation 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) extd__dyn__alloc().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) p0__present().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) p0().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) pr__mode().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) usf__granularity().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) ul__tfi__ass__present().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) ul__tfi__assignment().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) reserved().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) tbf__starting__time__present().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) tbf__starting__time().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) ts__allocation().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(), "extd_dyn_alloc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          extd__dyn__alloc().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "p0_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          p0__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(), "p0")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          p0().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pr__mode().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "usf_granularity")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          usf__granularity().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ul_tfi_ass_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ul__tfi__ass__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(), "ul_tfi_assignment")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ul__tfi__assignment().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "reserved")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          reserved().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tbf_starting_time_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tbf__starting__time__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(), "tbf_starting_time")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tbf__starting__time().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ts_allocation")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ts__allocation().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_CSN1_Types.DynamicAllocation: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.DynamicAllocation");
  }
}

void DynamicAllocation::encode_text(Text_Buf& text_buf) const
{
field_extd__dyn__alloc.encode_text(text_buf);
field_p0__present.encode_text(text_buf);
field_p0.encode_text(text_buf);
field_pr__mode.encode_text(text_buf);
field_usf__granularity.encode_text(text_buf);
field_ul__tfi__ass__present.encode_text(text_buf);
field_ul__tfi__assignment.encode_text(text_buf);
field_reserved.encode_text(text_buf);
field_tbf__starting__time__present.encode_text(text_buf);
field_tbf__starting__time.encode_text(text_buf);
field_ts__allocation.encode_text(text_buf);
}

void DynamicAllocation::decode_text(Text_Buf& text_buf)
{
field_extd__dyn__alloc.decode_text(text_buf);
field_p0__present.decode_text(text_buf);
field_p0.decode_text(text_buf);
field_pr__mode.decode_text(text_buf);
field_usf__granularity.decode_text(text_buf);
field_ul__tfi__ass__present.decode_text(text_buf);
field_ul__tfi__assignment.decode_text(text_buf);
field_reserved.decode_text(text_buf);
field_tbf__starting__time__present.decode_text(text_buf);
field_tbf__starting__time.decode_text(text_buf);
field_ts__allocation.decode_text(text_buf);
}

void DynamicAllocation::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 DynamicAllocation::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 DynamicAllocation::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, DynamicAllocation_extd__dyn__alloc_descr_.raw->forceomit);
  decoded_field_length = field_extd__dyn__alloc.RAW_decode(DynamicAllocation_extd__dyn__alloc_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, DynamicAllocation_p0__present_descr_.raw->forceomit);
  decoded_field_length = field_p0__present.RAW_decode(DynamicAllocation_p0__present_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_p0__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(2)) {
    field_p0 = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_2_force_omit(2, force_omit, DynamicAllocation_p0_descr_.raw->forceomit);
  decoded_field_length = field_p0().RAW_decode(DynamicAllocation_p0_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 1) {
  field_p0 = 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_p0=OMIT_VALUE;
  if (limit > 0 && field_p0__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(3)) {
    field_pr__mode = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_3_force_omit(3, force_omit, DynamicAllocation_pr__mode_descr_.raw->forceomit);
  decoded_field_length = field_pr__mode().RAW_decode(DynamicAllocation_pr__mode_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 1) {
  field_pr__mode = 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_pr__mode=OMIT_VALUE;
  RAW_Force_Omit field_4_force_omit(4, force_omit, DynamicAllocation_usf__granularity_descr_.raw->forceomit);
  decoded_field_length = field_usf__granularity.RAW_decode(DynamicAllocation_usf__granularity_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, DynamicAllocation_ul__tfi__ass__present_descr_.raw->forceomit);
  decoded_field_length = field_ul__tfi__ass__present.RAW_decode(DynamicAllocation_ul__tfi__ass__present_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());
  if (limit > 0 && field_ul__tfi__ass__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(6)) {
    field_ul__tfi__assignment = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_6_force_omit(6, force_omit, DynamicAllocation_ul__tfi__assignment_descr_.raw->forceomit);
  decoded_field_length = field_ul__tfi__assignment().RAW_decode(DynamicAllocation_ul__tfi__assignment_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_6_force_omit);
  if (decoded_field_length < 1) {
  field_ul__tfi__assignment = 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_ul__tfi__assignment=OMIT_VALUE;
  RAW_Force_Omit field_7_force_omit(7, force_omit, DynamicAllocation_reserved_descr_.raw->forceomit);
  decoded_field_length = field_reserved.RAW_decode(DynamicAllocation_reserved_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, DynamicAllocation_tbf__starting__time__present_descr_.raw->forceomit);
  decoded_field_length = field_tbf__starting__time__present.RAW_decode(DynamicAllocation_tbf__starting__time__present_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());
  if (limit > 0 && field_tbf__starting__time__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(9)) {
    field_tbf__starting__time = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_9_force_omit(9, force_omit, DynamicAllocation_tbf__starting__time_descr_.raw->forceomit);
  decoded_field_length = field_tbf__starting__time().RAW_decode(DynamicAllocation_tbf__starting__time_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_9_force_omit);
  if (decoded_field_length < 1) {
  field_tbf__starting__time = 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_tbf__starting__time=OMIT_VALUE;
  RAW_Force_Omit field_10_force_omit(10, force_omit, DynamicAllocation_ts__allocation_descr_.raw->forceomit);
  decoded_field_length = field_ts__allocation.RAW_decode(DynamicAllocation_ts__allocation_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_10_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int DynamicAllocation::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, DynamicAllocation_extd__dyn__alloc_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, DynamicAllocation_p0__present_descr_.raw);
  if (field_p0.ispresent()) {
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, DynamicAllocation_p0_descr_.raw);
  }
  else myleaf.body.node.nodes[2] = NULL;
  if (field_pr__mode.ispresent()) {
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, DynamicAllocation_pr__mode_descr_.raw);
  }
  else myleaf.body.node.nodes[3] = NULL;
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, DynamicAllocation_usf__granularity_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, DynamicAllocation_ul__tfi__ass__present_descr_.raw);
  if (field_ul__tfi__assignment.ispresent()) {
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, DynamicAllocation_ul__tfi__assignment_descr_.raw);
  }
  else myleaf.body.node.nodes[6] = NULL;
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, DynamicAllocation_reserved_descr_.raw);
  myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, DynamicAllocation_tbf__starting__time__present_descr_.raw);
  if (field_tbf__starting__time.ispresent()) {
  myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, DynamicAllocation_tbf__starting__time_descr_.raw);
  }
  else myleaf.body.node.nodes[9] = NULL;
  myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 10, DynamicAllocation_ts__allocation_descr_.raw);
  encoded_length += field_extd__dyn__alloc.RAW_encode(DynamicAllocation_extd__dyn__alloc_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_p0__present.RAW_encode(DynamicAllocation_p0__present_descr_, *myleaf.body.node.nodes[1]);
  if (field_p0.ispresent()) {
  encoded_length += field_p0().RAW_encode(DynamicAllocation_p0_descr_, *myleaf.body.node.nodes[2]);
  }
  if (field_pr__mode.ispresent()) {
  encoded_length += field_pr__mode().RAW_encode(DynamicAllocation_pr__mode_descr_, *myleaf.body.node.nodes[3]);
  }
  encoded_length += field_usf__granularity.RAW_encode(DynamicAllocation_usf__granularity_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_ul__tfi__ass__present.RAW_encode(DynamicAllocation_ul__tfi__ass__present_descr_, *myleaf.body.node.nodes[5]);
  if (field_ul__tfi__assignment.ispresent()) {
  encoded_length += field_ul__tfi__assignment().RAW_encode(DynamicAllocation_ul__tfi__assignment_descr_, *myleaf.body.node.nodes[6]);
  }
  encoded_length += field_reserved.RAW_encode(DynamicAllocation_reserved_descr_, *myleaf.body.node.nodes[7]);
  encoded_length += field_tbf__starting__time__present.RAW_encode(DynamicAllocation_tbf__starting__time__present_descr_, *myleaf.body.node.nodes[8]);
  if (field_tbf__starting__time.ispresent()) {
  encoded_length += field_tbf__starting__time().RAW_encode(DynamicAllocation_tbf__starting__time_descr_, *myleaf.body.node.nodes[9]);
  }
  encoded_length += field_ts__allocation.RAW_encode(DynamicAllocation_ts__allocation_descr_, *myleaf.body.node.nodes[10]);
  if (field_p0.ispresent() && (field_p0__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={1};
  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(DynamicAllocation_p0__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_pr__mode.ispresent() && (field_p0__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={1};
  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(DynamicAllocation_p0__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_ul__tfi__assignment.ispresent() && (field_ul__tfi__ass__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={5};
  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(DynamicAllocation_ul__tfi__ass__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_tbf__starting__time.ispresent() && (field_tbf__starting__time__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={8};
  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(DynamicAllocation_tbf__starting__time__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);
  }
  }
  return myleaf.length = encoded_length;
}

struct DynamicAllocation_template::single_value_struct {
BITSTRING_template field_extd__dyn__alloc;
BITSTRING_template field_p0__present;
INTEGER_template field_p0;
BITSTRING_template field_pr__mode;
BITSTRING_template field_usf__granularity;
BITSTRING_template field_ul__tfi__ass__present;
INTEGER_template field_ul__tfi__assignment;
BITSTRING_template field_reserved;
BITSTRING_template field_tbf__starting__time__present;
StartingFnDesc_template field_tbf__starting__time;
TsAllocationUnion_template field_ts__allocation;
};

void DynamicAllocation_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_extd__dyn__alloc = ANY_VALUE;
single_value->field_p0__present = ANY_VALUE;
single_value->field_p0 = ANY_OR_OMIT;
single_value->field_pr__mode = ANY_OR_OMIT;
single_value->field_usf__granularity = ANY_VALUE;
single_value->field_ul__tfi__ass__present = ANY_VALUE;
single_value->field_ul__tfi__assignment = ANY_OR_OMIT;
single_value->field_reserved = ANY_VALUE;
single_value->field_tbf__starting__time__present = ANY_VALUE;
single_value->field_tbf__starting__time = ANY_OR_OMIT;
single_value->field_ts__allocation = ANY_VALUE;
}
}
}

void DynamicAllocation_template::copy_value(const DynamicAllocation& other_value)
{
single_value = new single_value_struct;
if (other_value.extd__dyn__alloc().is_bound()) {
  single_value->field_extd__dyn__alloc = other_value.extd__dyn__alloc();
} else {
  single_value->field_extd__dyn__alloc.clean_up();
}
if (other_value.p0__present().is_bound()) {
  single_value->field_p0__present = other_value.p0__present();
} else {
  single_value->field_p0__present.clean_up();
}
if (other_value.p0().is_bound()) {
  if (other_value.p0().ispresent()) single_value->field_p0 = other_value.p0()();
  else single_value->field_p0 = OMIT_VALUE;
} else {
  single_value->field_p0.clean_up();
}
if (other_value.pr__mode().is_bound()) {
  if (other_value.pr__mode().ispresent()) single_value->field_pr__mode = other_value.pr__mode()();
  else single_value->field_pr__mode = OMIT_VALUE;
} else {
  single_value->field_pr__mode.clean_up();
}
if (other_value.usf__granularity().is_bound()) {
  single_value->field_usf__granularity = other_value.usf__granularity();
} else {
  single_value->field_usf__granularity.clean_up();
}
if (other_value.ul__tfi__ass__present().is_bound()) {
  single_value->field_ul__tfi__ass__present = other_value.ul__tfi__ass__present();
} else {
  single_value->field_ul__tfi__ass__present.clean_up();
}
if (other_value.ul__tfi__assignment().is_bound()) {
  if (other_value.ul__tfi__assignment().ispresent()) single_value->field_ul__tfi__assignment = other_value.ul__tfi__assignment()();
  else single_value->field_ul__tfi__assignment = OMIT_VALUE;
} else {
  single_value->field_ul__tfi__assignment.clean_up();
}
if (other_value.reserved().is_bound()) {
  single_value->field_reserved = other_value.reserved();
} else {
  single_value->field_reserved.clean_up();
}
if (other_value.tbf__starting__time__present().is_bound()) {
  single_value->field_tbf__starting__time__present = other_value.tbf__starting__time__present();
} else {
  single_value->field_tbf__starting__time__present.clean_up();
}
if (other_value.tbf__starting__time().is_bound()) {
  if (other_value.tbf__starting__time().ispresent()) single_value->field_tbf__starting__time = other_value.tbf__starting__time()();
  else single_value->field_tbf__starting__time = OMIT_VALUE;
} else {
  single_value->field_tbf__starting__time.clean_up();
}
if (other_value.ts__allocation().is_bound()) {
  single_value->field_ts__allocation = other_value.ts__allocation();
} else {
  single_value->field_ts__allocation.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void DynamicAllocation_template::copy_template(const DynamicAllocation_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.extd__dyn__alloc().get_selection()) {
single_value->field_extd__dyn__alloc = other_value.extd__dyn__alloc();
} else {
single_value->field_extd__dyn__alloc.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.p0__present().get_selection()) {
single_value->field_p0__present = other_value.p0__present();
} else {
single_value->field_p0__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.p0().get_selection()) {
single_value->field_p0 = other_value.p0();
} else {
single_value->field_p0.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pr__mode().get_selection()) {
single_value->field_pr__mode = other_value.pr__mode();
} else {
single_value->field_pr__mode.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.usf__granularity().get_selection()) {
single_value->field_usf__granularity = other_value.usf__granularity();
} else {
single_value->field_usf__granularity.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ul__tfi__ass__present().get_selection()) {
single_value->field_ul__tfi__ass__present = other_value.ul__tfi__ass__present();
} else {
single_value->field_ul__tfi__ass__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ul__tfi__assignment().get_selection()) {
single_value->field_ul__tfi__assignment = other_value.ul__tfi__assignment();
} else {
single_value->field_ul__tfi__assignment.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.reserved().get_selection()) {
single_value->field_reserved = other_value.reserved();
} else {
single_value->field_reserved.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tbf__starting__time__present().get_selection()) {
single_value->field_tbf__starting__time__present = other_value.tbf__starting__time__present();
} else {
single_value->field_tbf__starting__time__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tbf__starting__time().get_selection()) {
single_value->field_tbf__starting__time = other_value.tbf__starting__time();
} else {
single_value->field_tbf__starting__time.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ts__allocation().get_selection()) {
single_value->field_ts__allocation = other_value.ts__allocation();
} else {
single_value->field_ts__allocation.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 DynamicAllocation_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 DynamicAllocation_template(*other_value.implication_.precondition);
implication_.implied_template = new DynamicAllocation_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_CSN1_Types.DynamicAllocation.");
break;
}
set_selection(other_value);
}

DynamicAllocation_template::DynamicAllocation_template()
{
}

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

DynamicAllocation_template::DynamicAllocation_template(const DynamicAllocation& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean DynamicAllocation_template::match(const DynamicAllocation& 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.extd__dyn__alloc().is_bound()) return FALSE;
if(!single_value->field_extd__dyn__alloc.match(other_value.extd__dyn__alloc(), legacy))return FALSE;
if(!other_value.p0__present().is_bound()) return FALSE;
if(!single_value->field_p0__present.match(other_value.p0__present(), legacy))return FALSE;
if(!other_value.p0().is_bound()) return FALSE;
if((other_value.p0().ispresent() ? !single_value->field_p0.match((const INTEGER&)other_value.p0(), legacy) : !single_value->field_p0.match_omit(legacy)))return FALSE;
if(!other_value.pr__mode().is_bound()) return FALSE;
if((other_value.pr__mode().ispresent() ? !single_value->field_pr__mode.match((const BITSTRING&)other_value.pr__mode(), legacy) : !single_value->field_pr__mode.match_omit(legacy)))return FALSE;
if(!other_value.usf__granularity().is_bound()) return FALSE;
if(!single_value->field_usf__granularity.match(other_value.usf__granularity(), legacy))return FALSE;
if(!other_value.ul__tfi__ass__present().is_bound()) return FALSE;
if(!single_value->field_ul__tfi__ass__present.match(other_value.ul__tfi__ass__present(), legacy))return FALSE;
if(!other_value.ul__tfi__assignment().is_bound()) return FALSE;
if((other_value.ul__tfi__assignment().ispresent() ? !single_value->field_ul__tfi__assignment.match((const INTEGER&)other_value.ul__tfi__assignment(), legacy) : !single_value->field_ul__tfi__assignment.match_omit(legacy)))return FALSE;
if(!other_value.reserved().is_bound()) return FALSE;
if(!single_value->field_reserved.match(other_value.reserved(), legacy))return FALSE;
if(!other_value.tbf__starting__time__present().is_bound()) return FALSE;
if(!single_value->field_tbf__starting__time__present.match(other_value.tbf__starting__time__present(), legacy))return FALSE;
if(!other_value.tbf__starting__time().is_bound()) return FALSE;
if((other_value.tbf__starting__time().ispresent() ? !single_value->field_tbf__starting__time.match((const StartingFnDesc&)other_value.tbf__starting__time(), legacy) : !single_value->field_tbf__starting__time.match_omit(legacy)))return FALSE;
if(!other_value.ts__allocation().is_bound()) return FALSE;
if(!single_value->field_ts__allocation.match(other_value.ts__allocation(), 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_CSN1_Types.DynamicAllocation.");
}
return FALSE;
}

boolean DynamicAllocation_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_extd__dyn__alloc.is_bound()
 || single_value->field_p0__present.is_bound()
 || (single_value->field_p0.is_omit() || single_value->field_p0.is_bound())
 || (single_value->field_pr__mode.is_omit() || single_value->field_pr__mode.is_bound())
 || single_value->field_usf__granularity.is_bound()
 || single_value->field_ul__tfi__ass__present.is_bound()
 || (single_value->field_ul__tfi__assignment.is_omit() || single_value->field_ul__tfi__assignment.is_bound())
 || single_value->field_reserved.is_bound()
 || single_value->field_tbf__starting__time__present.is_bound()
 || (single_value->field_tbf__starting__time.is_omit() || single_value->field_tbf__starting__time.is_bound())
 || single_value->field_ts__allocation.is_bound();
}

boolean DynamicAllocation_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_extd__dyn__alloc.is_value()
 && single_value->field_p0__present.is_value()
 && (single_value->field_p0.is_omit() || single_value->field_p0.is_value())
 && (single_value->field_pr__mode.is_omit() || single_value->field_pr__mode.is_value())
 && single_value->field_usf__granularity.is_value()
 && single_value->field_ul__tfi__ass__present.is_value()
 && (single_value->field_ul__tfi__assignment.is_omit() || single_value->field_ul__tfi__assignment.is_value())
 && single_value->field_reserved.is_value()
 && single_value->field_tbf__starting__time__present.is_value()
 && (single_value->field_tbf__starting__time.is_omit() || single_value->field_tbf__starting__time.is_value())
 && single_value->field_ts__allocation.is_value();
}

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

DynamicAllocation DynamicAllocation_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_CSN1_Types.DynamicAllocation.");
DynamicAllocation ret_val;
if (single_value->field_extd__dyn__alloc.is_bound()) {
ret_val.extd__dyn__alloc() = single_value->field_extd__dyn__alloc.valueof();
}
if (single_value->field_p0__present.is_bound()) {
ret_val.p0__present() = single_value->field_p0__present.valueof();
}
if (single_value->field_p0.is_omit()) ret_val.p0() = OMIT_VALUE;
else if (single_value->field_p0.is_bound()) {
ret_val.p0() = single_value->field_p0.valueof();
}
if (single_value->field_pr__mode.is_omit()) ret_val.pr__mode() = OMIT_VALUE;
else if (single_value->field_pr__mode.is_bound()) {
ret_val.pr__mode() = single_value->field_pr__mode.valueof();
}
if (single_value->field_usf__granularity.is_bound()) {
ret_val.usf__granularity() = single_value->field_usf__granularity.valueof();
}
if (single_value->field_ul__tfi__ass__present.is_bound()) {
ret_val.ul__tfi__ass__present() = single_value->field_ul__tfi__ass__present.valueof();
}
if (single_value->field_ul__tfi__assignment.is_omit()) ret_val.ul__tfi__assignment() = OMIT_VALUE;
else if (single_value->field_ul__tfi__assignment.is_bound()) {
ret_val.ul__tfi__assignment() = single_value->field_ul__tfi__assignment.valueof();
}
if (single_value->field_reserved.is_bound()) {
ret_val.reserved() = single_value->field_reserved.valueof();
}
if (single_value->field_tbf__starting__time__present.is_bound()) {
ret_val.tbf__starting__time__present() = single_value->field_tbf__starting__time__present.valueof();
}
if (single_value->field_tbf__starting__time.is_omit()) ret_val.tbf__starting__time() = OMIT_VALUE;
else if (single_value->field_tbf__starting__time.is_bound()) {
ret_val.tbf__starting__time() = single_value->field_tbf__starting__time.valueof();
}
if (single_value->field_ts__allocation.is_bound()) {
ret_val.ts__allocation() = single_value->field_ts__allocation.valueof();
}
return ret_val;
}

void DynamicAllocation_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_CSN1_Types.DynamicAllocation.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new DynamicAllocation_template[list_length];
}

DynamicAllocation_template& DynamicAllocation_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_CSN1_Types.DynamicAllocation.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.DynamicAllocation.");
return value_list.list_value[list_index];
}

BITSTRING_template& DynamicAllocation_template::extd__dyn__alloc()
{
set_specific();
return single_value->field_extd__dyn__alloc;
}

const BITSTRING_template& DynamicAllocation_template::extd__dyn__alloc() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field extd_dyn_alloc of a non-specific template of type @RLCMAC_CSN1_Types.DynamicAllocation.");
return single_value->field_extd__dyn__alloc;
}

BITSTRING_template& DynamicAllocation_template::p0__present()
{
set_specific();
return single_value->field_p0__present;
}

const BITSTRING_template& DynamicAllocation_template::p0__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field p0_present of a non-specific template of type @RLCMAC_CSN1_Types.DynamicAllocation.");
return single_value->field_p0__present;
}

INTEGER_template& DynamicAllocation_template::p0()
{
set_specific();
return single_value->field_p0;
}

const INTEGER_template& DynamicAllocation_template::p0() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field p0 of a non-specific template of type @RLCMAC_CSN1_Types.DynamicAllocation.");
return single_value->field_p0;
}

BITSTRING_template& DynamicAllocation_template::pr__mode()
{
set_specific();
return single_value->field_pr__mode;
}

const BITSTRING_template& DynamicAllocation_template::pr__mode() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pr_mode of a non-specific template of type @RLCMAC_CSN1_Types.DynamicAllocation.");
return single_value->field_pr__mode;
}

BITSTRING_template& DynamicAllocation_template::usf__granularity()
{
set_specific();
return single_value->field_usf__granularity;
}

const BITSTRING_template& DynamicAllocation_template::usf__granularity() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field usf_granularity of a non-specific template of type @RLCMAC_CSN1_Types.DynamicAllocation.");
return single_value->field_usf__granularity;
}

BITSTRING_template& DynamicAllocation_template::ul__tfi__ass__present()
{
set_specific();
return single_value->field_ul__tfi__ass__present;
}

const BITSTRING_template& DynamicAllocation_template::ul__tfi__ass__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ul_tfi_ass_present of a non-specific template of type @RLCMAC_CSN1_Types.DynamicAllocation.");
return single_value->field_ul__tfi__ass__present;
}

INTEGER_template& DynamicAllocation_template::ul__tfi__assignment()
{
set_specific();
return single_value->field_ul__tfi__assignment;
}

const INTEGER_template& DynamicAllocation_template::ul__tfi__assignment() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ul_tfi_assignment of a non-specific template of type @RLCMAC_CSN1_Types.DynamicAllocation.");
return single_value->field_ul__tfi__assignment;
}

BITSTRING_template& DynamicAllocation_template::reserved()
{
set_specific();
return single_value->field_reserved;
}

const BITSTRING_template& DynamicAllocation_template::reserved() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field reserved of a non-specific template of type @RLCMAC_CSN1_Types.DynamicAllocation.");
return single_value->field_reserved;
}

BITSTRING_template& DynamicAllocation_template::tbf__starting__time__present()
{
set_specific();
return single_value->field_tbf__starting__time__present;
}

const BITSTRING_template& DynamicAllocation_template::tbf__starting__time__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tbf_starting_time_present of a non-specific template of type @RLCMAC_CSN1_Types.DynamicAllocation.");
return single_value->field_tbf__starting__time__present;
}

StartingFnDesc_template& DynamicAllocation_template::tbf__starting__time()
{
set_specific();
return single_value->field_tbf__starting__time;
}

const StartingFnDesc_template& DynamicAllocation_template::tbf__starting__time() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tbf_starting_time of a non-specific template of type @RLCMAC_CSN1_Types.DynamicAllocation.");
return single_value->field_tbf__starting__time;
}

TsAllocationUnion_template& DynamicAllocation_template::ts__allocation()
{
set_specific();
return single_value->field_ts__allocation;
}

const TsAllocationUnion_template& DynamicAllocation_template::ts__allocation() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ts_allocation of a non-specific template of type @RLCMAC_CSN1_Types.DynamicAllocation.");
return single_value->field_ts__allocation;
}

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

void DynamicAllocation_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ extd_dyn_alloc := ");
single_value->field_extd__dyn__alloc.log();
TTCN_Logger::log_event_str(", p0_present := ");
single_value->field_p0__present.log();
TTCN_Logger::log_event_str(", p0 := ");
single_value->field_p0.log();
TTCN_Logger::log_event_str(", pr_mode := ");
single_value->field_pr__mode.log();
TTCN_Logger::log_event_str(", usf_granularity := ");
single_value->field_usf__granularity.log();
TTCN_Logger::log_event_str(", ul_tfi_ass_present := ");
single_value->field_ul__tfi__ass__present.log();
TTCN_Logger::log_event_str(", ul_tfi_assignment := ");
single_value->field_ul__tfi__assignment.log();
TTCN_Logger::log_event_str(", reserved := ");
single_value->field_reserved.log();
TTCN_Logger::log_event_str(", tbf_starting_time_present := ");
single_value->field_tbf__starting__time__present.log();
TTCN_Logger::log_event_str(", tbf_starting_time := ");
single_value->field_tbf__starting__time.log();
TTCN_Logger::log_event_str(", ts_allocation := ");
single_value->field_ts__allocation.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 DynamicAllocation_template::log_match(const DynamicAllocation& 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_extd__dyn__alloc.match(match_value.extd__dyn__alloc(), legacy)){
TTCN_Logger::log_logmatch_info(".extd_dyn_alloc");
single_value->field_extd__dyn__alloc.log_match(match_value.extd__dyn__alloc(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_p0__present.match(match_value.p0__present(), legacy)){
TTCN_Logger::log_logmatch_info(".p0_present");
single_value->field_p0__present.log_match(match_value.p0__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.p0().ispresent()){
if(!single_value->field_p0.match(match_value.p0(), legacy)){
TTCN_Logger::log_logmatch_info(".p0");
single_value->field_p0.log_match(match_value.p0(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_p0.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".p0 := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_p0.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.pr__mode().ispresent()){
if(!single_value->field_pr__mode.match(match_value.pr__mode(), legacy)){
TTCN_Logger::log_logmatch_info(".pr_mode");
single_value->field_pr__mode.log_match(match_value.pr__mode(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_pr__mode.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".pr_mode := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_pr__mode.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_usf__granularity.match(match_value.usf__granularity(), legacy)){
TTCN_Logger::log_logmatch_info(".usf_granularity");
single_value->field_usf__granularity.log_match(match_value.usf__granularity(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ul__tfi__ass__present.match(match_value.ul__tfi__ass__present(), legacy)){
TTCN_Logger::log_logmatch_info(".ul_tfi_ass_present");
single_value->field_ul__tfi__ass__present.log_match(match_value.ul__tfi__ass__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.ul__tfi__assignment().ispresent()){
if(!single_value->field_ul__tfi__assignment.match(match_value.ul__tfi__assignment(), legacy)){
TTCN_Logger::log_logmatch_info(".ul_tfi_assignment");
single_value->field_ul__tfi__assignment.log_match(match_value.ul__tfi__assignment(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_ul__tfi__assignment.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".ul_tfi_assignment := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_ul__tfi__assignment.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_reserved.match(match_value.reserved(), legacy)){
TTCN_Logger::log_logmatch_info(".reserved");
single_value->field_reserved.log_match(match_value.reserved(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tbf__starting__time__present.match(match_value.tbf__starting__time__present(), legacy)){
TTCN_Logger::log_logmatch_info(".tbf_starting_time_present");
single_value->field_tbf__starting__time__present.log_match(match_value.tbf__starting__time__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.tbf__starting__time().ispresent()){
if(!single_value->field_tbf__starting__time.match(match_value.tbf__starting__time(), legacy)){
TTCN_Logger::log_logmatch_info(".tbf_starting_time");
single_value->field_tbf__starting__time.log_match(match_value.tbf__starting__time(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_tbf__starting__time.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".tbf_starting_time := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_tbf__starting__time.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_ts__allocation.match(match_value.ts__allocation(), legacy)){
TTCN_Logger::log_logmatch_info(".ts_allocation");
single_value->field_ts__allocation.log_match(match_value.ts__allocation(), 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("{ extd_dyn_alloc := ");
single_value->field_extd__dyn__alloc.log_match(match_value.extd__dyn__alloc(), legacy);
TTCN_Logger::log_event_str(", p0_present := ");
single_value->field_p0__present.log_match(match_value.p0__present(), legacy);
TTCN_Logger::log_event_str(", p0 := ");
if (match_value.p0().ispresent()) {
single_value->field_p0.log_match(match_value.p0(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_p0.log();
if (single_value->field_p0.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", pr_mode := ");
if (match_value.pr__mode().ispresent()) {
single_value->field_pr__mode.log_match(match_value.pr__mode(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_pr__mode.log();
if (single_value->field_pr__mode.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", usf_granularity := ");
single_value->field_usf__granularity.log_match(match_value.usf__granularity(), legacy);
TTCN_Logger::log_event_str(", ul_tfi_ass_present := ");
single_value->field_ul__tfi__ass__present.log_match(match_value.ul__tfi__ass__present(), legacy);
TTCN_Logger::log_event_str(", ul_tfi_assignment := ");
if (match_value.ul__tfi__assignment().ispresent()) {
single_value->field_ul__tfi__assignment.log_match(match_value.ul__tfi__assignment(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_ul__tfi__assignment.log();
if (single_value->field_ul__tfi__assignment.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", reserved := ");
single_value->field_reserved.log_match(match_value.reserved(), legacy);
TTCN_Logger::log_event_str(", tbf_starting_time_present := ");
single_value->field_tbf__starting__time__present.log_match(match_value.tbf__starting__time__present(), legacy);
TTCN_Logger::log_event_str(", tbf_starting_time := ");
if (match_value.tbf__starting__time().ispresent()) {
single_value->field_tbf__starting__time.log_match(match_value.tbf__starting__time(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_tbf__starting__time.log();
if (single_value->field_tbf__starting__time.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", ts_allocation := ");
single_value->field_ts__allocation.log_match(match_value.ts__allocation(), 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 DynamicAllocation_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (extd__dyn__alloc().is_bound()) extd__dyn__alloc().set_implicit_omit();
if (p0__present().is_bound()) p0__present().set_implicit_omit();
if (!p0().is_bound()) p0() = OMIT_VALUE;
else p0().set_implicit_omit();
if (!pr__mode().is_bound()) pr__mode() = OMIT_VALUE;
else pr__mode().set_implicit_omit();
if (usf__granularity().is_bound()) usf__granularity().set_implicit_omit();
if (ul__tfi__ass__present().is_bound()) ul__tfi__ass__present().set_implicit_omit();
if (!ul__tfi__assignment().is_bound()) ul__tfi__assignment() = OMIT_VALUE;
else ul__tfi__assignment().set_implicit_omit();
if (reserved().is_bound()) reserved().set_implicit_omit();
if (tbf__starting__time__present().is_bound()) tbf__starting__time__present().set_implicit_omit();
if (!tbf__starting__time().is_bound()) tbf__starting__time() = OMIT_VALUE;
else tbf__starting__time().set_implicit_omit();
if (ts__allocation().is_bound()) ts__allocation().set_implicit_omit();
}

void DynamicAllocation_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_extd__dyn__alloc.encode_text(text_buf);
single_value->field_p0__present.encode_text(text_buf);
single_value->field_p0.encode_text(text_buf);
single_value->field_pr__mode.encode_text(text_buf);
single_value->field_usf__granularity.encode_text(text_buf);
single_value->field_ul__tfi__ass__present.encode_text(text_buf);
single_value->field_ul__tfi__assignment.encode_text(text_buf);
single_value->field_reserved.encode_text(text_buf);
single_value->field_tbf__starting__time__present.encode_text(text_buf);
single_value->field_tbf__starting__time.encode_text(text_buf);
single_value->field_ts__allocation.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_CSN1_Types.DynamicAllocation.");
}
}

void DynamicAllocation_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_extd__dyn__alloc.decode_text(text_buf);
single_value->field_p0__present.decode_text(text_buf);
single_value->field_p0.decode_text(text_buf);
single_value->field_pr__mode.decode_text(text_buf);
single_value->field_usf__granularity.decode_text(text_buf);
single_value->field_ul__tfi__ass__present.decode_text(text_buf);
single_value->field_ul__tfi__assignment.decode_text(text_buf);
single_value->field_reserved.decode_text(text_buf);
single_value->field_tbf__starting__time__present.decode_text(text_buf);
single_value->field_tbf__starting__time.decode_text(text_buf);
single_value->field_ts__allocation.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 DynamicAllocation_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_CSN1_Types.DynamicAllocation.");
}
}

void DynamicAllocation_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: {
    DynamicAllocation_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_CSN1_Types.DynamicAllocation 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) extd__dyn__alloc().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) p0__present().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) p0().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) pr__mode().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) usf__granularity().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) ul__tfi__ass__present().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) ul__tfi__assignment().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) reserved().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) tbf__starting__time__present().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) tbf__starting__time().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) ts__allocation().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(), "extd_dyn_alloc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          extd__dyn__alloc().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "p0_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          p0__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(), "p0")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          p0().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pr__mode().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "usf_granularity")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          usf__granularity().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ul_tfi_ass_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ul__tfi__ass__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(), "ul_tfi_assignment")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ul__tfi__assignment().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "reserved")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          reserved().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tbf_starting_time_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tbf__starting__time__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(), "tbf_starting_time")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tbf__starting__time().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ts_allocation")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ts__allocation().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_CSN1_Types.DynamicAllocation: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    DynamicAllocation_template* precondition = new DynamicAllocation_template;
    precondition->set_param(*param.get_elem(0));
    DynamicAllocation_template* implied_template = new DynamicAllocation_template;
    implied_template->set_param(*param.get_elem(1));
    *this = DynamicAllocation_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.DynamicAllocation");
  }
  is_ifpresent = param.get_ifpresent();
}

void DynamicAllocation_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_extd__dyn__alloc.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.DynamicAllocation");
single_value->field_p0__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.DynamicAllocation");
single_value->field_p0.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.DynamicAllocation");
single_value->field_pr__mode.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.DynamicAllocation");
single_value->field_usf__granularity.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.DynamicAllocation");
single_value->field_ul__tfi__ass__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.DynamicAllocation");
single_value->field_ul__tfi__assignment.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.DynamicAllocation");
single_value->field_reserved.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.DynamicAllocation");
single_value->field_tbf__starting__time__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.DynamicAllocation");
single_value->field_tbf__starting__time.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.DynamicAllocation");
single_value->field_ts__allocation.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.DynamicAllocation");
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_CSN1_Types.DynamicAllocation");
}

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

boolean DynamicAllocation_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 TnGamma TnGamma8::UNBOUND_ELEM;
TnGamma8::TnGamma8()
{
val_ptr = NULL;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

void TnGamma8_template::copy_template(const TnGamma8_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 = (TnGamma_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 TnGamma_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new TnGamma_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 TnGamma8_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 TnGamma8_template(*other_value.implication_.precondition);
implication_.implied_template = new TnGamma8_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_CSN1_Types.TnGamma8.");
break;
}
set_selection(other_value);
}

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

TnGamma8_template::TnGamma8_template()
{
}

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

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

TnGamma8_template::TnGamma8_template(const TnGamma8& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

const TnGamma_template& TnGamma8_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @RLCMAC_CSN1_Types.TnGamma8 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_CSN1_Types.TnGamma8.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @RLCMAC_CSN1_Types.TnGamma8: 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 TnGamma_template& TnGamma8_template::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @RLCMAC_CSN1_Types.TnGamma8.");
return (*this)[(int)index_value];
}

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

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

boolean TnGamma8_template::match(const TnGamma8& 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_CSN1_Types.TnGamma8.");
}
return FALSE;
}

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

TnGamma8 TnGamma8_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_CSN1_Types.TnGamma8.");
TnGamma8 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;
}

TnGamma8 TnGamma8_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);
}

TnGamma8 TnGamma8_template::replace(int index, int len, const TnGamma8_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());
}

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

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

void TnGamma8_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 TnGamma8_template::log_match(const TnGamma8& 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 TnGamma8_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_CSN1_Types.TnGamma8.");
}
}

void TnGamma8_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_CSN1_Types.TnGamma8.");
single_value.value_elements = (TnGamma_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 TnGamma_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 TnGamma8_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_CSN1_Types.TnGamma8.");
}
}

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

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

void TnGamma8_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_CSN1_Types.TnGamma8");
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_CSN1_Types.TnGamma8");
}

boolean TnGamma8_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);
}
}
SingleBlockAllocation::SingleBlockAllocation()
{
}

SingleBlockAllocation::SingleBlockAllocation(const INTEGER& par_timeslot__nr,
    const BITSTRING& par_alpha__present,
    const OPTIONAL< INTEGER >& par_alpha,
    const INTEGER& par_gamma__tn,
    const BITSTRING& par_p0__present,
    const OPTIONAL< INTEGER >& par_p0,
    const OPTIONAL< BITSTRING >& par_reserved,
    const OPTIONAL< BITSTRING >& par_pr__mode,
    const StartingFnDesc& par_tbf__starting__time)
  :   field_timeslot__nr(par_timeslot__nr),
  field_alpha__present(par_alpha__present),
  field_alpha(par_alpha),
  field_gamma__tn(par_gamma__tn),
  field_p0__present(par_p0__present),
  field_p0(par_p0),
  field_reserved(par_reserved),
  field_pr__mode(par_pr__mode),
  field_tbf__starting__time(par_tbf__starting__time)
{
}

SingleBlockAllocation::SingleBlockAllocation(const SingleBlockAllocation& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.SingleBlockAllocation.");
if (other_value.timeslot__nr().is_bound()) field_timeslot__nr = other_value.timeslot__nr();
else field_timeslot__nr.clean_up();
if (other_value.alpha__present().is_bound()) field_alpha__present = other_value.alpha__present();
else field_alpha__present.clean_up();
if (other_value.alpha().is_bound()) field_alpha = other_value.alpha();
else field_alpha.clean_up();
if (other_value.gamma__tn().is_bound()) field_gamma__tn = other_value.gamma__tn();
else field_gamma__tn.clean_up();
if (other_value.p0__present().is_bound()) field_p0__present = other_value.p0__present();
else field_p0__present.clean_up();
if (other_value.p0().is_bound()) field_p0 = other_value.p0();
else field_p0.clean_up();
if (other_value.reserved().is_bound()) field_reserved = other_value.reserved();
else field_reserved.clean_up();
if (other_value.pr__mode().is_bound()) field_pr__mode = other_value.pr__mode();
else field_pr__mode.clean_up();
if (other_value.tbf__starting__time().is_bound()) field_tbf__starting__time = other_value.tbf__starting__time();
else field_tbf__starting__time.clean_up();
}

void SingleBlockAllocation::clean_up()
{
field_timeslot__nr.clean_up();
field_alpha__present.clean_up();
field_alpha.clean_up();
field_gamma__tn.clean_up();
field_p0__present.clean_up();
field_p0.clean_up();
field_reserved.clean_up();
field_pr__mode.clean_up();
field_tbf__starting__time.clean_up();
}

const TTCN_Typedescriptor_t* SingleBlockAllocation::get_descriptor() const { return &SingleBlockAllocation_descr_; }
SingleBlockAllocation& SingleBlockAllocation::operator=(const SingleBlockAllocation& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.SingleBlockAllocation.");
  if (other_value.timeslot__nr().is_bound()) field_timeslot__nr = other_value.timeslot__nr();
  else field_timeslot__nr.clean_up();
  if (other_value.alpha__present().is_bound()) field_alpha__present = other_value.alpha__present();
  else field_alpha__present.clean_up();
  if (other_value.alpha().is_bound()) field_alpha = other_value.alpha();
  else field_alpha.clean_up();
  if (other_value.gamma__tn().is_bound()) field_gamma__tn = other_value.gamma__tn();
  else field_gamma__tn.clean_up();
  if (other_value.p0__present().is_bound()) field_p0__present = other_value.p0__present();
  else field_p0__present.clean_up();
  if (other_value.p0().is_bound()) field_p0 = other_value.p0();
  else field_p0.clean_up();
  if (other_value.reserved().is_bound()) field_reserved = other_value.reserved();
  else field_reserved.clean_up();
  if (other_value.pr__mode().is_bound()) field_pr__mode = other_value.pr__mode();
  else field_pr__mode.clean_up();
  if (other_value.tbf__starting__time().is_bound()) field_tbf__starting__time = other_value.tbf__starting__time();
  else field_tbf__starting__time.clean_up();
}
return *this;
}

boolean SingleBlockAllocation::operator==(const SingleBlockAllocation& other_value) const
{
return field_timeslot__nr==other_value.field_timeslot__nr
  && field_alpha__present==other_value.field_alpha__present
  && field_alpha==other_value.field_alpha
  && field_gamma__tn==other_value.field_gamma__tn
  && field_p0__present==other_value.field_p0__present
  && field_p0==other_value.field_p0
  && field_reserved==other_value.field_reserved
  && field_pr__mode==other_value.field_pr__mode
  && field_tbf__starting__time==other_value.field_tbf__starting__time;
}

boolean SingleBlockAllocation::is_bound() const
{
return (field_timeslot__nr.is_bound())
  || (field_alpha__present.is_bound())
  || (OPTIONAL_OMIT == field_alpha.get_selection() || field_alpha.is_bound())
  || (field_gamma__tn.is_bound())
  || (field_p0__present.is_bound())
  || (OPTIONAL_OMIT == field_p0.get_selection() || field_p0.is_bound())
  || (OPTIONAL_OMIT == field_reserved.get_selection() || field_reserved.is_bound())
  || (OPTIONAL_OMIT == field_pr__mode.get_selection() || field_pr__mode.is_bound())
  || (field_tbf__starting__time.is_bound());
}
boolean SingleBlockAllocation::is_value() const
{
return field_timeslot__nr.is_value()
  && field_alpha__present.is_value()
  && (OPTIONAL_OMIT == field_alpha.get_selection() || field_alpha.is_value())
  && field_gamma__tn.is_value()
  && field_p0__present.is_value()
  && (OPTIONAL_OMIT == field_p0.get_selection() || field_p0.is_value())
  && (OPTIONAL_OMIT == field_reserved.get_selection() || field_reserved.is_value())
  && (OPTIONAL_OMIT == field_pr__mode.get_selection() || field_pr__mode.is_value())
  && field_tbf__starting__time.is_value();
}
int SingleBlockAllocation::size_of() const
{
  int ret_val = 5;
  if (field_alpha.ispresent()) ret_val++;
  if (field_p0.ispresent()) ret_val++;
  if (field_reserved.ispresent()) ret_val++;
  if (field_pr__mode.ispresent()) ret_val++;
  return ret_val;
}

void SingleBlockAllocation::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ timeslot_nr := ");
field_timeslot__nr.log();
TTCN_Logger::log_event_str(", alpha_present := ");
field_alpha__present.log();
TTCN_Logger::log_event_str(", alpha := ");
field_alpha.log();
TTCN_Logger::log_event_str(", gamma_tn := ");
field_gamma__tn.log();
TTCN_Logger::log_event_str(", p0_present := ");
field_p0__present.log();
TTCN_Logger::log_event_str(", p0 := ");
field_p0.log();
TTCN_Logger::log_event_str(", reserved := ");
field_reserved.log();
TTCN_Logger::log_event_str(", pr_mode := ");
field_pr__mode.log();
TTCN_Logger::log_event_str(", tbf_starting_time := ");
field_tbf__starting__time.log();
TTCN_Logger::log_event_str(" }");
}

void SingleBlockAllocation::set_implicit_omit()
{
if (timeslot__nr().is_bound()) timeslot__nr().set_implicit_omit();
if (alpha__present().is_bound()) alpha__present().set_implicit_omit();
if (!alpha().is_bound()) alpha() = OMIT_VALUE;
else alpha().set_implicit_omit();
if (gamma__tn().is_bound()) gamma__tn().set_implicit_omit();
if (p0__present().is_bound()) p0__present().set_implicit_omit();
if (!p0().is_bound()) p0() = OMIT_VALUE;
else p0().set_implicit_omit();
if (!reserved().is_bound()) reserved() = OMIT_VALUE;
else reserved().set_implicit_omit();
if (!pr__mode().is_bound()) pr__mode() = OMIT_VALUE;
else pr__mode().set_implicit_omit();
if (tbf__starting__time().is_bound()) tbf__starting__time().set_implicit_omit();
}

void SingleBlockAllocation::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (9<param.get_size()) {
      param.error("record value of type @RLCMAC_CSN1_Types.SingleBlockAllocation has 9 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) timeslot__nr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) alpha__present().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) alpha().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) gamma__tn().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) p0__present().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) p0().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) reserved().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) pr__mode().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) tbf__starting__time().set_param(*param.get_elem(8));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "timeslot_nr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          timeslot__nr().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "alpha_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          alpha__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(), "alpha")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          alpha().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gamma_tn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gamma__tn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "p0_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          p0__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(), "p0")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          p0().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "reserved")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          reserved().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pr__mode().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tbf_starting_time")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tbf__starting__time().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_CSN1_Types.SingleBlockAllocation: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.SingleBlockAllocation");
  }
}

void SingleBlockAllocation::encode_text(Text_Buf& text_buf) const
{
field_timeslot__nr.encode_text(text_buf);
field_alpha__present.encode_text(text_buf);
field_alpha.encode_text(text_buf);
field_gamma__tn.encode_text(text_buf);
field_p0__present.encode_text(text_buf);
field_p0.encode_text(text_buf);
field_reserved.encode_text(text_buf);
field_pr__mode.encode_text(text_buf);
field_tbf__starting__time.encode_text(text_buf);
}

void SingleBlockAllocation::decode_text(Text_Buf& text_buf)
{
field_timeslot__nr.decode_text(text_buf);
field_alpha__present.decode_text(text_buf);
field_alpha.decode_text(text_buf);
field_gamma__tn.decode_text(text_buf);
field_p0__present.decode_text(text_buf);
field_p0.decode_text(text_buf);
field_reserved.decode_text(text_buf);
field_pr__mode.decode_text(text_buf);
field_tbf__starting__time.decode_text(text_buf);
}

void SingleBlockAllocation::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 SingleBlockAllocation::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 SingleBlockAllocation::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, SingleBlockAllocation_timeslot__nr_descr_.raw->forceomit);
  decoded_field_length = field_timeslot__nr.RAW_decode(SingleBlockAllocation_timeslot__nr_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, SingleBlockAllocation_alpha__present_descr_.raw->forceomit);
  decoded_field_length = field_alpha__present.RAW_decode(SingleBlockAllocation_alpha__present_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_alpha__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(2)) {
    field_alpha = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_2_force_omit(2, force_omit, SingleBlockAllocation_alpha_descr_.raw->forceomit);
  decoded_field_length = field_alpha().RAW_decode(SingleBlockAllocation_alpha_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 1) {
  field_alpha = 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_alpha=OMIT_VALUE;
  RAW_Force_Omit field_3_force_omit(3, force_omit, SingleBlockAllocation_gamma__tn_descr_.raw->forceomit);
  decoded_field_length = field_gamma__tn.RAW_decode(SingleBlockAllocation_gamma__tn_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, SingleBlockAllocation_p0__present_descr_.raw->forceomit);
  decoded_field_length = field_p0__present.RAW_decode(SingleBlockAllocation_p0__present_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());
  if (limit > 0 && field_p0__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(5)) {
    field_p0 = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_5_force_omit(5, force_omit, SingleBlockAllocation_p0_descr_.raw->forceomit);
  decoded_field_length = field_p0().RAW_decode(SingleBlockAllocation_p0_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 1) {
  field_p0 = 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_p0=OMIT_VALUE;
  if (limit > 0 && field_p0__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(6)) {
    field_reserved = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_6_force_omit(6, force_omit, SingleBlockAllocation_reserved_descr_.raw->forceomit);
  decoded_field_length = field_reserved().RAW_decode(SingleBlockAllocation_reserved_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_6_force_omit);
  if (decoded_field_length < 1) {
  field_reserved = 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_reserved=OMIT_VALUE;
  if (limit > 0 && field_p0__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(7)) {
    field_pr__mode = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_7_force_omit(7, force_omit, SingleBlockAllocation_pr__mode_descr_.raw->forceomit);
  decoded_field_length = field_pr__mode().RAW_decode(SingleBlockAllocation_pr__mode_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_7_force_omit);
  if (decoded_field_length < 1) {
  field_pr__mode = 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_pr__mode=OMIT_VALUE;
  RAW_Force_Omit field_8_force_omit(8, force_omit, SingleBlockAllocation_tbf__starting__time_descr_.raw->forceomit);
  decoded_field_length = field_tbf__starting__time.RAW_decode(SingleBlockAllocation_tbf__starting__time_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_8_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int SingleBlockAllocation::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 9;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(9);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, SingleBlockAllocation_timeslot__nr_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SingleBlockAllocation_alpha__present_descr_.raw);
  if (field_alpha.ispresent()) {
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SingleBlockAllocation_alpha_descr_.raw);
  }
  else myleaf.body.node.nodes[2] = NULL;
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, SingleBlockAllocation_gamma__tn_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, SingleBlockAllocation_p0__present_descr_.raw);
  if (field_p0.ispresent()) {
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, SingleBlockAllocation_p0_descr_.raw);
  }
  else myleaf.body.node.nodes[5] = NULL;
  if (field_reserved.ispresent()) {
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, SingleBlockAllocation_reserved_descr_.raw);
  }
  else myleaf.body.node.nodes[6] = NULL;
  if (field_pr__mode.ispresent()) {
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, SingleBlockAllocation_pr__mode_descr_.raw);
  }
  else myleaf.body.node.nodes[7] = NULL;
  myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, SingleBlockAllocation_tbf__starting__time_descr_.raw);
  encoded_length += field_timeslot__nr.RAW_encode(SingleBlockAllocation_timeslot__nr_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_alpha__present.RAW_encode(SingleBlockAllocation_alpha__present_descr_, *myleaf.body.node.nodes[1]);
  if (field_alpha.ispresent()) {
  encoded_length += field_alpha().RAW_encode(SingleBlockAllocation_alpha_descr_, *myleaf.body.node.nodes[2]);
  }
  encoded_length += field_gamma__tn.RAW_encode(SingleBlockAllocation_gamma__tn_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_p0__present.RAW_encode(SingleBlockAllocation_p0__present_descr_, *myleaf.body.node.nodes[4]);
  if (field_p0.ispresent()) {
  encoded_length += field_p0().RAW_encode(SingleBlockAllocation_p0_descr_, *myleaf.body.node.nodes[5]);
  }
  if (field_reserved.ispresent()) {
  encoded_length += field_reserved().RAW_encode(SingleBlockAllocation_reserved_descr_, *myleaf.body.node.nodes[6]);
  }
  if (field_pr__mode.ispresent()) {
  encoded_length += field_pr__mode().RAW_encode(SingleBlockAllocation_pr__mode_descr_, *myleaf.body.node.nodes[7]);
  }
  encoded_length += field_tbf__starting__time.RAW_encode(SingleBlockAllocation_tbf__starting__time_descr_, *myleaf.body.node.nodes[8]);
  if (field_alpha.ispresent() && (field_alpha__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={1};
  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(SingleBlockAllocation_alpha__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_p0.ispresent() && (field_p0__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={4};
  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(SingleBlockAllocation_p0__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_reserved.ispresent() && (field_p0__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={4};
  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(SingleBlockAllocation_p0__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_pr__mode.ispresent() && (field_p0__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={4};
  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(SingleBlockAllocation_p0__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);
  }
  }
  return myleaf.length = encoded_length;
}

struct SingleBlockAllocation_template::single_value_struct {
INTEGER_template field_timeslot__nr;
BITSTRING_template field_alpha__present;
INTEGER_template field_alpha;
INTEGER_template field_gamma__tn;
BITSTRING_template field_p0__present;
INTEGER_template field_p0;
BITSTRING_template field_reserved;
BITSTRING_template field_pr__mode;
StartingFnDesc_template field_tbf__starting__time;
};

void SingleBlockAllocation_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_timeslot__nr = ANY_VALUE;
single_value->field_alpha__present = ANY_VALUE;
single_value->field_alpha = ANY_OR_OMIT;
single_value->field_gamma__tn = ANY_VALUE;
single_value->field_p0__present = ANY_VALUE;
single_value->field_p0 = ANY_OR_OMIT;
single_value->field_reserved = ANY_OR_OMIT;
single_value->field_pr__mode = ANY_OR_OMIT;
single_value->field_tbf__starting__time = ANY_VALUE;
}
}
}

void SingleBlockAllocation_template::copy_value(const SingleBlockAllocation& other_value)
{
single_value = new single_value_struct;
if (other_value.timeslot__nr().is_bound()) {
  single_value->field_timeslot__nr = other_value.timeslot__nr();
} else {
  single_value->field_timeslot__nr.clean_up();
}
if (other_value.alpha__present().is_bound()) {
  single_value->field_alpha__present = other_value.alpha__present();
} else {
  single_value->field_alpha__present.clean_up();
}
if (other_value.alpha().is_bound()) {
  if (other_value.alpha().ispresent()) single_value->field_alpha = other_value.alpha()();
  else single_value->field_alpha = OMIT_VALUE;
} else {
  single_value->field_alpha.clean_up();
}
if (other_value.gamma__tn().is_bound()) {
  single_value->field_gamma__tn = other_value.gamma__tn();
} else {
  single_value->field_gamma__tn.clean_up();
}
if (other_value.p0__present().is_bound()) {
  single_value->field_p0__present = other_value.p0__present();
} else {
  single_value->field_p0__present.clean_up();
}
if (other_value.p0().is_bound()) {
  if (other_value.p0().ispresent()) single_value->field_p0 = other_value.p0()();
  else single_value->field_p0 = OMIT_VALUE;
} else {
  single_value->field_p0.clean_up();
}
if (other_value.reserved().is_bound()) {
  if (other_value.reserved().ispresent()) single_value->field_reserved = other_value.reserved()();
  else single_value->field_reserved = OMIT_VALUE;
} else {
  single_value->field_reserved.clean_up();
}
if (other_value.pr__mode().is_bound()) {
  if (other_value.pr__mode().ispresent()) single_value->field_pr__mode = other_value.pr__mode()();
  else single_value->field_pr__mode = OMIT_VALUE;
} else {
  single_value->field_pr__mode.clean_up();
}
if (other_value.tbf__starting__time().is_bound()) {
  single_value->field_tbf__starting__time = other_value.tbf__starting__time();
} else {
  single_value->field_tbf__starting__time.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void SingleBlockAllocation_template::copy_template(const SingleBlockAllocation_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.timeslot__nr().get_selection()) {
single_value->field_timeslot__nr = other_value.timeslot__nr();
} else {
single_value->field_timeslot__nr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.alpha__present().get_selection()) {
single_value->field_alpha__present = other_value.alpha__present();
} else {
single_value->field_alpha__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.alpha().get_selection()) {
single_value->field_alpha = other_value.alpha();
} else {
single_value->field_alpha.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.gamma__tn().get_selection()) {
single_value->field_gamma__tn = other_value.gamma__tn();
} else {
single_value->field_gamma__tn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.p0__present().get_selection()) {
single_value->field_p0__present = other_value.p0__present();
} else {
single_value->field_p0__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.p0().get_selection()) {
single_value->field_p0 = other_value.p0();
} else {
single_value->field_p0.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.reserved().get_selection()) {
single_value->field_reserved = other_value.reserved();
} else {
single_value->field_reserved.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pr__mode().get_selection()) {
single_value->field_pr__mode = other_value.pr__mode();
} else {
single_value->field_pr__mode.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tbf__starting__time().get_selection()) {
single_value->field_tbf__starting__time = other_value.tbf__starting__time();
} else {
single_value->field_tbf__starting__time.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 SingleBlockAllocation_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 SingleBlockAllocation_template(*other_value.implication_.precondition);
implication_.implied_template = new SingleBlockAllocation_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_CSN1_Types.SingleBlockAllocation.");
break;
}
set_selection(other_value);
}

SingleBlockAllocation_template::SingleBlockAllocation_template()
{
}

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

SingleBlockAllocation_template::SingleBlockAllocation_template(const SingleBlockAllocation& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean SingleBlockAllocation_template::match(const SingleBlockAllocation& 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.timeslot__nr().is_bound()) return FALSE;
if(!single_value->field_timeslot__nr.match(other_value.timeslot__nr(), legacy))return FALSE;
if(!other_value.alpha__present().is_bound()) return FALSE;
if(!single_value->field_alpha__present.match(other_value.alpha__present(), legacy))return FALSE;
if(!other_value.alpha().is_bound()) return FALSE;
if((other_value.alpha().ispresent() ? !single_value->field_alpha.match((const INTEGER&)other_value.alpha(), legacy) : !single_value->field_alpha.match_omit(legacy)))return FALSE;
if(!other_value.gamma__tn().is_bound()) return FALSE;
if(!single_value->field_gamma__tn.match(other_value.gamma__tn(), legacy))return FALSE;
if(!other_value.p0__present().is_bound()) return FALSE;
if(!single_value->field_p0__present.match(other_value.p0__present(), legacy))return FALSE;
if(!other_value.p0().is_bound()) return FALSE;
if((other_value.p0().ispresent() ? !single_value->field_p0.match((const INTEGER&)other_value.p0(), legacy) : !single_value->field_p0.match_omit(legacy)))return FALSE;
if(!other_value.reserved().is_bound()) return FALSE;
if((other_value.reserved().ispresent() ? !single_value->field_reserved.match((const BITSTRING&)other_value.reserved(), legacy) : !single_value->field_reserved.match_omit(legacy)))return FALSE;
if(!other_value.pr__mode().is_bound()) return FALSE;
if((other_value.pr__mode().ispresent() ? !single_value->field_pr__mode.match((const BITSTRING&)other_value.pr__mode(), legacy) : !single_value->field_pr__mode.match_omit(legacy)))return FALSE;
if(!other_value.tbf__starting__time().is_bound()) return FALSE;
if(!single_value->field_tbf__starting__time.match(other_value.tbf__starting__time(), 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_CSN1_Types.SingleBlockAllocation.");
}
return FALSE;
}

boolean SingleBlockAllocation_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_timeslot__nr.is_bound()
 || single_value->field_alpha__present.is_bound()
 || (single_value->field_alpha.is_omit() || single_value->field_alpha.is_bound())
 || single_value->field_gamma__tn.is_bound()
 || single_value->field_p0__present.is_bound()
 || (single_value->field_p0.is_omit() || single_value->field_p0.is_bound())
 || (single_value->field_reserved.is_omit() || single_value->field_reserved.is_bound())
 || (single_value->field_pr__mode.is_omit() || single_value->field_pr__mode.is_bound())
 || single_value->field_tbf__starting__time.is_bound();
}

boolean SingleBlockAllocation_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_timeslot__nr.is_value()
 && single_value->field_alpha__present.is_value()
 && (single_value->field_alpha.is_omit() || single_value->field_alpha.is_value())
 && single_value->field_gamma__tn.is_value()
 && single_value->field_p0__present.is_value()
 && (single_value->field_p0.is_omit() || single_value->field_p0.is_value())
 && (single_value->field_reserved.is_omit() || single_value->field_reserved.is_value())
 && (single_value->field_pr__mode.is_omit() || single_value->field_pr__mode.is_value())
 && single_value->field_tbf__starting__time.is_value();
}

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

SingleBlockAllocation SingleBlockAllocation_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_CSN1_Types.SingleBlockAllocation.");
SingleBlockAllocation ret_val;
if (single_value->field_timeslot__nr.is_bound()) {
ret_val.timeslot__nr() = single_value->field_timeslot__nr.valueof();
}
if (single_value->field_alpha__present.is_bound()) {
ret_val.alpha__present() = single_value->field_alpha__present.valueof();
}
if (single_value->field_alpha.is_omit()) ret_val.alpha() = OMIT_VALUE;
else if (single_value->field_alpha.is_bound()) {
ret_val.alpha() = single_value->field_alpha.valueof();
}
if (single_value->field_gamma__tn.is_bound()) {
ret_val.gamma__tn() = single_value->field_gamma__tn.valueof();
}
if (single_value->field_p0__present.is_bound()) {
ret_val.p0__present() = single_value->field_p0__present.valueof();
}
if (single_value->field_p0.is_omit()) ret_val.p0() = OMIT_VALUE;
else if (single_value->field_p0.is_bound()) {
ret_val.p0() = single_value->field_p0.valueof();
}
if (single_value->field_reserved.is_omit()) ret_val.reserved() = OMIT_VALUE;
else if (single_value->field_reserved.is_bound()) {
ret_val.reserved() = single_value->field_reserved.valueof();
}
if (single_value->field_pr__mode.is_omit()) ret_val.pr__mode() = OMIT_VALUE;
else if (single_value->field_pr__mode.is_bound()) {
ret_val.pr__mode() = single_value->field_pr__mode.valueof();
}
if (single_value->field_tbf__starting__time.is_bound()) {
ret_val.tbf__starting__time() = single_value->field_tbf__starting__time.valueof();
}
return ret_val;
}

void SingleBlockAllocation_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_CSN1_Types.SingleBlockAllocation.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new SingleBlockAllocation_template[list_length];
}

SingleBlockAllocation_template& SingleBlockAllocation_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_CSN1_Types.SingleBlockAllocation.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.SingleBlockAllocation.");
return value_list.list_value[list_index];
}

INTEGER_template& SingleBlockAllocation_template::timeslot__nr()
{
set_specific();
return single_value->field_timeslot__nr;
}

const INTEGER_template& SingleBlockAllocation_template::timeslot__nr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field timeslot_nr of a non-specific template of type @RLCMAC_CSN1_Types.SingleBlockAllocation.");
return single_value->field_timeslot__nr;
}

BITSTRING_template& SingleBlockAllocation_template::alpha__present()
{
set_specific();
return single_value->field_alpha__present;
}

const BITSTRING_template& SingleBlockAllocation_template::alpha__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field alpha_present of a non-specific template of type @RLCMAC_CSN1_Types.SingleBlockAllocation.");
return single_value->field_alpha__present;
}

INTEGER_template& SingleBlockAllocation_template::alpha()
{
set_specific();
return single_value->field_alpha;
}

const INTEGER_template& SingleBlockAllocation_template::alpha() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field alpha of a non-specific template of type @RLCMAC_CSN1_Types.SingleBlockAllocation.");
return single_value->field_alpha;
}

INTEGER_template& SingleBlockAllocation_template::gamma__tn()
{
set_specific();
return single_value->field_gamma__tn;
}

const INTEGER_template& SingleBlockAllocation_template::gamma__tn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field gamma_tn of a non-specific template of type @RLCMAC_CSN1_Types.SingleBlockAllocation.");
return single_value->field_gamma__tn;
}

BITSTRING_template& SingleBlockAllocation_template::p0__present()
{
set_specific();
return single_value->field_p0__present;
}

const BITSTRING_template& SingleBlockAllocation_template::p0__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field p0_present of a non-specific template of type @RLCMAC_CSN1_Types.SingleBlockAllocation.");
return single_value->field_p0__present;
}

INTEGER_template& SingleBlockAllocation_template::p0()
{
set_specific();
return single_value->field_p0;
}

const INTEGER_template& SingleBlockAllocation_template::p0() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field p0 of a non-specific template of type @RLCMAC_CSN1_Types.SingleBlockAllocation.");
return single_value->field_p0;
}

BITSTRING_template& SingleBlockAllocation_template::reserved()
{
set_specific();
return single_value->field_reserved;
}

const BITSTRING_template& SingleBlockAllocation_template::reserved() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field reserved of a non-specific template of type @RLCMAC_CSN1_Types.SingleBlockAllocation.");
return single_value->field_reserved;
}

BITSTRING_template& SingleBlockAllocation_template::pr__mode()
{
set_specific();
return single_value->field_pr__mode;
}

const BITSTRING_template& SingleBlockAllocation_template::pr__mode() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pr_mode of a non-specific template of type @RLCMAC_CSN1_Types.SingleBlockAllocation.");
return single_value->field_pr__mode;
}

StartingFnDesc_template& SingleBlockAllocation_template::tbf__starting__time()
{
set_specific();
return single_value->field_tbf__starting__time;
}

const StartingFnDesc_template& SingleBlockAllocation_template::tbf__starting__time() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tbf_starting_time of a non-specific template of type @RLCMAC_CSN1_Types.SingleBlockAllocation.");
return single_value->field_tbf__starting__time;
}

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

void SingleBlockAllocation_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ timeslot_nr := ");
single_value->field_timeslot__nr.log();
TTCN_Logger::log_event_str(", alpha_present := ");
single_value->field_alpha__present.log();
TTCN_Logger::log_event_str(", alpha := ");
single_value->field_alpha.log();
TTCN_Logger::log_event_str(", gamma_tn := ");
single_value->field_gamma__tn.log();
TTCN_Logger::log_event_str(", p0_present := ");
single_value->field_p0__present.log();
TTCN_Logger::log_event_str(", p0 := ");
single_value->field_p0.log();
TTCN_Logger::log_event_str(", reserved := ");
single_value->field_reserved.log();
TTCN_Logger::log_event_str(", pr_mode := ");
single_value->field_pr__mode.log();
TTCN_Logger::log_event_str(", tbf_starting_time := ");
single_value->field_tbf__starting__time.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 SingleBlockAllocation_template::log_match(const SingleBlockAllocation& 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_timeslot__nr.match(match_value.timeslot__nr(), legacy)){
TTCN_Logger::log_logmatch_info(".timeslot_nr");
single_value->field_timeslot__nr.log_match(match_value.timeslot__nr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_alpha__present.match(match_value.alpha__present(), legacy)){
TTCN_Logger::log_logmatch_info(".alpha_present");
single_value->field_alpha__present.log_match(match_value.alpha__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.alpha().ispresent()){
if(!single_value->field_alpha.match(match_value.alpha(), legacy)){
TTCN_Logger::log_logmatch_info(".alpha");
single_value->field_alpha.log_match(match_value.alpha(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_alpha.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".alpha := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_alpha.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_gamma__tn.match(match_value.gamma__tn(), legacy)){
TTCN_Logger::log_logmatch_info(".gamma_tn");
single_value->field_gamma__tn.log_match(match_value.gamma__tn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_p0__present.match(match_value.p0__present(), legacy)){
TTCN_Logger::log_logmatch_info(".p0_present");
single_value->field_p0__present.log_match(match_value.p0__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.p0().ispresent()){
if(!single_value->field_p0.match(match_value.p0(), legacy)){
TTCN_Logger::log_logmatch_info(".p0");
single_value->field_p0.log_match(match_value.p0(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_p0.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".p0 := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_p0.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.reserved().ispresent()){
if(!single_value->field_reserved.match(match_value.reserved(), legacy)){
TTCN_Logger::log_logmatch_info(".reserved");
single_value->field_reserved.log_match(match_value.reserved(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_reserved.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".reserved := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_reserved.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.pr__mode().ispresent()){
if(!single_value->field_pr__mode.match(match_value.pr__mode(), legacy)){
TTCN_Logger::log_logmatch_info(".pr_mode");
single_value->field_pr__mode.log_match(match_value.pr__mode(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_pr__mode.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".pr_mode := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_pr__mode.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_tbf__starting__time.match(match_value.tbf__starting__time(), legacy)){
TTCN_Logger::log_logmatch_info(".tbf_starting_time");
single_value->field_tbf__starting__time.log_match(match_value.tbf__starting__time(), 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("{ timeslot_nr := ");
single_value->field_timeslot__nr.log_match(match_value.timeslot__nr(), legacy);
TTCN_Logger::log_event_str(", alpha_present := ");
single_value->field_alpha__present.log_match(match_value.alpha__present(), legacy);
TTCN_Logger::log_event_str(", alpha := ");
if (match_value.alpha().ispresent()) {
single_value->field_alpha.log_match(match_value.alpha(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_alpha.log();
if (single_value->field_alpha.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", gamma_tn := ");
single_value->field_gamma__tn.log_match(match_value.gamma__tn(), legacy);
TTCN_Logger::log_event_str(", p0_present := ");
single_value->field_p0__present.log_match(match_value.p0__present(), legacy);
TTCN_Logger::log_event_str(", p0 := ");
if (match_value.p0().ispresent()) {
single_value->field_p0.log_match(match_value.p0(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_p0.log();
if (single_value->field_p0.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", reserved := ");
if (match_value.reserved().ispresent()) {
single_value->field_reserved.log_match(match_value.reserved(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_reserved.log();
if (single_value->field_reserved.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", pr_mode := ");
if (match_value.pr__mode().ispresent()) {
single_value->field_pr__mode.log_match(match_value.pr__mode(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_pr__mode.log();
if (single_value->field_pr__mode.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", tbf_starting_time := ");
single_value->field_tbf__starting__time.log_match(match_value.tbf__starting__time(), 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 SingleBlockAllocation_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (timeslot__nr().is_bound()) timeslot__nr().set_implicit_omit();
if (alpha__present().is_bound()) alpha__present().set_implicit_omit();
if (!alpha().is_bound()) alpha() = OMIT_VALUE;
else alpha().set_implicit_omit();
if (gamma__tn().is_bound()) gamma__tn().set_implicit_omit();
if (p0__present().is_bound()) p0__present().set_implicit_omit();
if (!p0().is_bound()) p0() = OMIT_VALUE;
else p0().set_implicit_omit();
if (!reserved().is_bound()) reserved() = OMIT_VALUE;
else reserved().set_implicit_omit();
if (!pr__mode().is_bound()) pr__mode() = OMIT_VALUE;
else pr__mode().set_implicit_omit();
if (tbf__starting__time().is_bound()) tbf__starting__time().set_implicit_omit();
}

void SingleBlockAllocation_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_timeslot__nr.encode_text(text_buf);
single_value->field_alpha__present.encode_text(text_buf);
single_value->field_alpha.encode_text(text_buf);
single_value->field_gamma__tn.encode_text(text_buf);
single_value->field_p0__present.encode_text(text_buf);
single_value->field_p0.encode_text(text_buf);
single_value->field_reserved.encode_text(text_buf);
single_value->field_pr__mode.encode_text(text_buf);
single_value->field_tbf__starting__time.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_CSN1_Types.SingleBlockAllocation.");
}
}

void SingleBlockAllocation_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_timeslot__nr.decode_text(text_buf);
single_value->field_alpha__present.decode_text(text_buf);
single_value->field_alpha.decode_text(text_buf);
single_value->field_gamma__tn.decode_text(text_buf);
single_value->field_p0__present.decode_text(text_buf);
single_value->field_p0.decode_text(text_buf);
single_value->field_reserved.decode_text(text_buf);
single_value->field_pr__mode.decode_text(text_buf);
single_value->field_tbf__starting__time.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 SingleBlockAllocation_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_CSN1_Types.SingleBlockAllocation.");
}
}

void SingleBlockAllocation_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: {
    SingleBlockAllocation_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (9<param.get_size()) {
      param.error("record template of type @RLCMAC_CSN1_Types.SingleBlockAllocation has 9 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) timeslot__nr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) alpha__present().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) alpha().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) gamma__tn().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) p0__present().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) p0().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) reserved().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) pr__mode().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) tbf__starting__time().set_param(*param.get_elem(8));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "timeslot_nr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          timeslot__nr().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "alpha_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          alpha__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(), "alpha")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          alpha().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gamma_tn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gamma__tn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "p0_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          p0__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(), "p0")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          p0().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "reserved")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          reserved().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pr__mode().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tbf_starting_time")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tbf__starting__time().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_CSN1_Types.SingleBlockAllocation: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    SingleBlockAllocation_template* precondition = new SingleBlockAllocation_template;
    precondition->set_param(*param.get_elem(0));
    SingleBlockAllocation_template* implied_template = new SingleBlockAllocation_template;
    implied_template->set_param(*param.get_elem(1));
    *this = SingleBlockAllocation_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.SingleBlockAllocation");
  }
  is_ifpresent = param.get_ifpresent();
}

void SingleBlockAllocation_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_timeslot__nr.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.SingleBlockAllocation");
single_value->field_alpha__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.SingleBlockAllocation");
single_value->field_alpha.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.SingleBlockAllocation");
single_value->field_gamma__tn.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.SingleBlockAllocation");
single_value->field_p0__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.SingleBlockAllocation");
single_value->field_p0.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.SingleBlockAllocation");
single_value->field_reserved.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.SingleBlockAllocation");
single_value->field_pr__mode.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.SingleBlockAllocation");
single_value->field_tbf__starting__time.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.SingleBlockAllocation");
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_CSN1_Types.SingleBlockAllocation");
}

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

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

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

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

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

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

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

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

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

boolean ChCodingCommand::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_CSN1_Types.ChCodingCommand.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @RLCMAC_CSN1_Types.ChCodingCommand comparison is an unknown numeric value %d", other_value);
return enum_value == other_value;
}

boolean ChCodingCommand::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_CSN1_Types.ChCodingCommand.");
return enum_value == other_value;
}

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

boolean ChCodingCommand::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_CSN1_Types.ChCodingCommand.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @RLCMAC_CSN1_Types.ChCodingCommand comparison is an unknown numeric value %d", other_value);
return enum_value < other_value;
}

boolean ChCodingCommand::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_CSN1_Types.ChCodingCommand.");
return enum_value < other_value;
}

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

boolean ChCodingCommand::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_CSN1_Types.ChCodingCommand.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @RLCMAC_CSN1_Types.ChCodingCommand comparison is an unknown numeric value %d", other_value);
return enum_value > other_value;
}

boolean ChCodingCommand::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_CSN1_Types.ChCodingCommand.");
return enum_value > other_value;
}

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

const char *ChCodingCommand::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case CH__CODING__CS1: return "CH_CODING_CS1";
case CH__CODING__CS2: return "CH_CODING_CS2";
case CH__CODING__CS3: return "CH_CODING_CS3";
case CH__CODING__CS4: return "CH_CODING_CS4";
default:
return "<unknown>";
}
}

ChCodingCommand::enum_type ChCodingCommand::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, "CH_CODING_CS1")) return CH__CODING__CS1;
if (!strcmp(str_par, "CH_CODING_CS2")) return CH__CODING__CS2;
if (!strcmp(str_par, "CH_CODING_CS3")) return CH__CODING__CS3;
if (!strcmp(str_par, "CH_CODING_CS4")) return CH__CODING__CS4;
}
return UNKNOWN_VALUE;
}

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

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

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

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

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

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

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

void ChCodingCommand::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_CSN1_Types.ChCodingCommand.", enum_value);
}

void ChCodingCommand::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 ChCodingCommand::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 ChCodingCommand::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 ChCodingCommand::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 ChCodingCommand_template::copy_template(const ChCodingCommand_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 ChCodingCommand_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 ChCodingCommand_template(*other_value.implication_.precondition);
implication_.implied_template = new ChCodingCommand_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_CSN1_Types.ChCodingCommand.");
}
}

ChCodingCommand_template::ChCodingCommand_template()
{
}

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

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

ChCodingCommand_template::ChCodingCommand_template(ChCodingCommand::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

boolean ChCodingCommand_template::match(ChCodingCommand::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_CSN1_Types.ChCodingCommand.");
}
return FALSE;
}

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

ChCodingCommand::enum_type ChCodingCommand_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_CSN1_Types.ChCodingCommand.");
return single_value;
}

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

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

void ChCodingCommand_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(ChCodingCommand::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 ChCodingCommand_template::log_match(const ChCodingCommand& 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 ChCodingCommand_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_CSN1_Types.ChCodingCommand.");
}
}

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

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

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

void ChCodingCommand_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_CSN1_Types.ChCodingCommand");
}

PktUlAssGprs::PktUlAssGprs()
{
}

PktUlAssGprs::PktUlAssGprs(const ChCodingCommand& par_ch__coding__cmd,
    const BITSTRING& par_tlli__block__chan__coding,
    const PacketTimingAdvance& par_pkt__ta,
    const BITSTRING& par_freq__par__present,
    const OPTIONAL< FrequencyParameters >& par_freq__par,
    const BITSTRING& par_alloc__present,
    const OPTIONAL< DynamicAllocation >& par_dyn__block__alloc,
    const OPTIONAL< SingleBlockAllocation >& par_sgl__block__alloc)
  :   field_ch__coding__cmd(par_ch__coding__cmd),
  field_tlli__block__chan__coding(par_tlli__block__chan__coding),
  field_pkt__ta(par_pkt__ta),
  field_freq__par__present(par_freq__par__present),
  field_freq__par(par_freq__par),
  field_alloc__present(par_alloc__present),
  field_dyn__block__alloc(par_dyn__block__alloc),
  field_sgl__block__alloc(par_sgl__block__alloc)
{
}

PktUlAssGprs::PktUlAssGprs(const PktUlAssGprs& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PktUlAssGprs.");
if (other_value.ch__coding__cmd().is_bound()) field_ch__coding__cmd = other_value.ch__coding__cmd();
else field_ch__coding__cmd.clean_up();
if (other_value.tlli__block__chan__coding().is_bound()) field_tlli__block__chan__coding = other_value.tlli__block__chan__coding();
else field_tlli__block__chan__coding.clean_up();
if (other_value.pkt__ta().is_bound()) field_pkt__ta = other_value.pkt__ta();
else field_pkt__ta.clean_up();
if (other_value.freq__par__present().is_bound()) field_freq__par__present = other_value.freq__par__present();
else field_freq__par__present.clean_up();
if (other_value.freq__par().is_bound()) field_freq__par = other_value.freq__par();
else field_freq__par.clean_up();
if (other_value.alloc__present().is_bound()) field_alloc__present = other_value.alloc__present();
else field_alloc__present.clean_up();
if (other_value.dyn__block__alloc().is_bound()) field_dyn__block__alloc = other_value.dyn__block__alloc();
else field_dyn__block__alloc.clean_up();
if (other_value.sgl__block__alloc().is_bound()) field_sgl__block__alloc = other_value.sgl__block__alloc();
else field_sgl__block__alloc.clean_up();
}

void PktUlAssGprs::clean_up()
{
field_ch__coding__cmd.clean_up();
field_tlli__block__chan__coding.clean_up();
field_pkt__ta.clean_up();
field_freq__par__present.clean_up();
field_freq__par.clean_up();
field_alloc__present.clean_up();
field_dyn__block__alloc.clean_up();
field_sgl__block__alloc.clean_up();
}

const TTCN_Typedescriptor_t* PktUlAssGprs::get_descriptor() const { return &PktUlAssGprs_descr_; }
PktUlAssGprs& PktUlAssGprs::operator=(const PktUlAssGprs& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PktUlAssGprs.");
  if (other_value.ch__coding__cmd().is_bound()) field_ch__coding__cmd = other_value.ch__coding__cmd();
  else field_ch__coding__cmd.clean_up();
  if (other_value.tlli__block__chan__coding().is_bound()) field_tlli__block__chan__coding = other_value.tlli__block__chan__coding();
  else field_tlli__block__chan__coding.clean_up();
  if (other_value.pkt__ta().is_bound()) field_pkt__ta = other_value.pkt__ta();
  else field_pkt__ta.clean_up();
  if (other_value.freq__par__present().is_bound()) field_freq__par__present = other_value.freq__par__present();
  else field_freq__par__present.clean_up();
  if (other_value.freq__par().is_bound()) field_freq__par = other_value.freq__par();
  else field_freq__par.clean_up();
  if (other_value.alloc__present().is_bound()) field_alloc__present = other_value.alloc__present();
  else field_alloc__present.clean_up();
  if (other_value.dyn__block__alloc().is_bound()) field_dyn__block__alloc = other_value.dyn__block__alloc();
  else field_dyn__block__alloc.clean_up();
  if (other_value.sgl__block__alloc().is_bound()) field_sgl__block__alloc = other_value.sgl__block__alloc();
  else field_sgl__block__alloc.clean_up();
}
return *this;
}

boolean PktUlAssGprs::operator==(const PktUlAssGprs& other_value) const
{
return field_ch__coding__cmd==other_value.field_ch__coding__cmd
  && field_tlli__block__chan__coding==other_value.field_tlli__block__chan__coding
  && field_pkt__ta==other_value.field_pkt__ta
  && field_freq__par__present==other_value.field_freq__par__present
  && field_freq__par==other_value.field_freq__par
  && field_alloc__present==other_value.field_alloc__present
  && field_dyn__block__alloc==other_value.field_dyn__block__alloc
  && field_sgl__block__alloc==other_value.field_sgl__block__alloc;
}

boolean PktUlAssGprs::is_bound() const
{
return (field_ch__coding__cmd.is_bound())
  || (field_tlli__block__chan__coding.is_bound())
  || (field_pkt__ta.is_bound())
  || (field_freq__par__present.is_bound())
  || (OPTIONAL_OMIT == field_freq__par.get_selection() || field_freq__par.is_bound())
  || (field_alloc__present.is_bound())
  || (OPTIONAL_OMIT == field_dyn__block__alloc.get_selection() || field_dyn__block__alloc.is_bound())
  || (OPTIONAL_OMIT == field_sgl__block__alloc.get_selection() || field_sgl__block__alloc.is_bound());
}
boolean PktUlAssGprs::is_value() const
{
return field_ch__coding__cmd.is_value()
  && field_tlli__block__chan__coding.is_value()
  && field_pkt__ta.is_value()
  && field_freq__par__present.is_value()
  && (OPTIONAL_OMIT == field_freq__par.get_selection() || field_freq__par.is_value())
  && field_alloc__present.is_value()
  && (OPTIONAL_OMIT == field_dyn__block__alloc.get_selection() || field_dyn__block__alloc.is_value())
  && (OPTIONAL_OMIT == field_sgl__block__alloc.get_selection() || field_sgl__block__alloc.is_value());
}
int PktUlAssGprs::size_of() const
{
  int ret_val = 5;
  if (field_freq__par.ispresent()) ret_val++;
  if (field_dyn__block__alloc.ispresent()) ret_val++;
  if (field_sgl__block__alloc.ispresent()) ret_val++;
  return ret_val;
}

void PktUlAssGprs::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ ch_coding_cmd := ");
field_ch__coding__cmd.log();
TTCN_Logger::log_event_str(", tlli_block_chan_coding := ");
field_tlli__block__chan__coding.log();
TTCN_Logger::log_event_str(", pkt_ta := ");
field_pkt__ta.log();
TTCN_Logger::log_event_str(", freq_par_present := ");
field_freq__par__present.log();
TTCN_Logger::log_event_str(", freq_par := ");
field_freq__par.log();
TTCN_Logger::log_event_str(", alloc_present := ");
field_alloc__present.log();
TTCN_Logger::log_event_str(", dyn_block_alloc := ");
field_dyn__block__alloc.log();
TTCN_Logger::log_event_str(", sgl_block_alloc := ");
field_sgl__block__alloc.log();
TTCN_Logger::log_event_str(" }");
}

void PktUlAssGprs::set_implicit_omit()
{
if (ch__coding__cmd().is_bound()) ch__coding__cmd().set_implicit_omit();
if (tlli__block__chan__coding().is_bound()) tlli__block__chan__coding().set_implicit_omit();
if (pkt__ta().is_bound()) pkt__ta().set_implicit_omit();
if (freq__par__present().is_bound()) freq__par__present().set_implicit_omit();
if (!freq__par().is_bound()) freq__par() = OMIT_VALUE;
else freq__par().set_implicit_omit();
if (alloc__present().is_bound()) alloc__present().set_implicit_omit();
if (!dyn__block__alloc().is_bound()) dyn__block__alloc() = OMIT_VALUE;
else dyn__block__alloc().set_implicit_omit();
if (!sgl__block__alloc().is_bound()) sgl__block__alloc() = OMIT_VALUE;
else sgl__block__alloc().set_implicit_omit();
}

void PktUlAssGprs::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (8<param.get_size()) {
      param.error("record value of type @RLCMAC_CSN1_Types.PktUlAssGprs has 8 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) ch__coding__cmd().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tlli__block__chan__coding().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) pkt__ta().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) freq__par__present().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) freq__par().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) alloc__present().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) dyn__block__alloc().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) sgl__block__alloc().set_param(*param.get_elem(7));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ch_coding_cmd")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ch__coding__cmd().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_block_chan_coding")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tlli__block__chan__coding().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pkt_ta")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pkt__ta().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "freq_par_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          freq__par__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(), "freq_par")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          freq__par().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "alloc_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          alloc__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(), "dyn_block_alloc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          dyn__block__alloc().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "sgl_block_alloc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sgl__block__alloc().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_CSN1_Types.PktUlAssGprs: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.PktUlAssGprs");
  }
}

void PktUlAssGprs::encode_text(Text_Buf& text_buf) const
{
field_ch__coding__cmd.encode_text(text_buf);
field_tlli__block__chan__coding.encode_text(text_buf);
field_pkt__ta.encode_text(text_buf);
field_freq__par__present.encode_text(text_buf);
field_freq__par.encode_text(text_buf);
field_alloc__present.encode_text(text_buf);
field_dyn__block__alloc.encode_text(text_buf);
field_sgl__block__alloc.encode_text(text_buf);
}

void PktUlAssGprs::decode_text(Text_Buf& text_buf)
{
field_ch__coding__cmd.decode_text(text_buf);
field_tlli__block__chan__coding.decode_text(text_buf);
field_pkt__ta.decode_text(text_buf);
field_freq__par__present.decode_text(text_buf);
field_freq__par.decode_text(text_buf);
field_alloc__present.decode_text(text_buf);
field_dyn__block__alloc.decode_text(text_buf);
field_sgl__block__alloc.decode_text(text_buf);
}

void PktUlAssGprs::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 PktUlAssGprs::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 PktUlAssGprs::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, PktUlAssGprs_ch__coding__cmd_descr_.raw->forceomit);
  decoded_field_length = field_ch__coding__cmd.RAW_decode(PktUlAssGprs_ch__coding__cmd_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, PktUlAssGprs_tlli__block__chan__coding_descr_.raw->forceomit);
  decoded_field_length = field_tlli__block__chan__coding.RAW_decode(PktUlAssGprs_tlli__block__chan__coding_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, PktUlAssGprs_pkt__ta_descr_.raw->forceomit);
  decoded_field_length = field_pkt__ta.RAW_decode(PktUlAssGprs_pkt__ta_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, PktUlAssGprs_freq__par__present_descr_.raw->forceomit);
  decoded_field_length = field_freq__par__present.RAW_decode(PktUlAssGprs_freq__par__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_freq__par__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(4)) {
    field_freq__par = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_4_force_omit(4, force_omit, PktUlAssGprs_freq__par_descr_.raw->forceomit);
  decoded_field_length = field_freq__par().RAW_decode(PktUlAssGprs_freq__par_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit);
  if (decoded_field_length < 1) {
  field_freq__par = 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_freq__par=OMIT_VALUE;
  RAW_Force_Omit field_5_force_omit(5, force_omit, PktUlAssGprs_alloc__present_descr_.raw->forceomit);
  decoded_field_length = field_alloc__present.RAW_decode(PktUlAssGprs_alloc__present_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());
  if (limit > 0 && field_alloc__present ==  bs_3){
  if (force_omit != NULL && (*force_omit)(6)) {
    field_dyn__block__alloc = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_6_force_omit(6, force_omit, PktUlAssGprs_dyn__block__alloc_descr_.raw->forceomit);
  decoded_field_length = field_dyn__block__alloc().RAW_decode(PktUlAssGprs_dyn__block__alloc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_6_force_omit);
  if (decoded_field_length < 1) {
  field_dyn__block__alloc = 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_dyn__block__alloc=OMIT_VALUE;
  if (limit > 0 && field_alloc__present ==  bs_4){
  if (force_omit != NULL && (*force_omit)(7)) {
    field_sgl__block__alloc = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_7_force_omit(7, force_omit, PktUlAssGprs_sgl__block__alloc_descr_.raw->forceomit);
  decoded_field_length = field_sgl__block__alloc().RAW_decode(PktUlAssGprs_sgl__block__alloc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_7_force_omit);
  if (decoded_field_length < 1) {
  field_sgl__block__alloc = 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_sgl__block__alloc=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int PktUlAssGprs::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 8;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(8);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, PktUlAssGprs_ch__coding__cmd_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PktUlAssGprs_tlli__block__chan__coding_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PktUlAssGprs_pkt__ta_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, PktUlAssGprs_freq__par__present_descr_.raw);
  if (field_freq__par.ispresent()) {
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, PktUlAssGprs_freq__par_descr_.raw);
  }
  else myleaf.body.node.nodes[4] = NULL;
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, PktUlAssGprs_alloc__present_descr_.raw);
  if (field_dyn__block__alloc.ispresent()) {
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, PktUlAssGprs_dyn__block__alloc_descr_.raw);
  }
  else myleaf.body.node.nodes[6] = NULL;
  if (field_sgl__block__alloc.ispresent()) {
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, PktUlAssGprs_sgl__block__alloc_descr_.raw);
  }
  else myleaf.body.node.nodes[7] = NULL;
  encoded_length += field_ch__coding__cmd.RAW_encode(PktUlAssGprs_ch__coding__cmd_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_tlli__block__chan__coding.RAW_encode(PktUlAssGprs_tlli__block__chan__coding_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_pkt__ta.RAW_encode(PktUlAssGprs_pkt__ta_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_freq__par__present.RAW_encode(PktUlAssGprs_freq__par__present_descr_, *myleaf.body.node.nodes[3]);
  if (field_freq__par.ispresent()) {
  encoded_length += field_freq__par().RAW_encode(PktUlAssGprs_freq__par_descr_, *myleaf.body.node.nodes[4]);
  }
  encoded_length += field_alloc__present.RAW_encode(PktUlAssGprs_alloc__present_descr_, *myleaf.body.node.nodes[5]);
  if (field_dyn__block__alloc.ispresent()) {
  encoded_length += field_dyn__block__alloc().RAW_encode(PktUlAssGprs_dyn__block__alloc_descr_, *myleaf.body.node.nodes[6]);
  }
  if (field_sgl__block__alloc.ispresent()) {
  encoded_length += field_sgl__block__alloc().RAW_encode(PktUlAssGprs_sgl__block__alloc_descr_, *myleaf.body.node.nodes[7]);
  }
  if (field_freq__par.ispresent() && (field_freq__par__present !=  bs_0)) {
  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){
   bs_0.RAW_encode(PktUlAssGprs_freq__par__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_dyn__block__alloc.ispresent() && (field_alloc__present !=  bs_3)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={5};
  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_3.RAW_encode(PktUlAssGprs_alloc__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_sgl__block__alloc.ispresent() && (field_alloc__present !=  bs_4)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={5};
  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_4.RAW_encode(PktUlAssGprs_alloc__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);
  }
  }
  return myleaf.length = encoded_length;
}

struct PktUlAssGprs_template::single_value_struct {
ChCodingCommand_template field_ch__coding__cmd;
BITSTRING_template field_tlli__block__chan__coding;
PacketTimingAdvance_template field_pkt__ta;
BITSTRING_template field_freq__par__present;
FrequencyParameters_template field_freq__par;
BITSTRING_template field_alloc__present;
DynamicAllocation_template field_dyn__block__alloc;
SingleBlockAllocation_template field_sgl__block__alloc;
};

void PktUlAssGprs_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_ch__coding__cmd = ANY_VALUE;
single_value->field_tlli__block__chan__coding = ANY_VALUE;
single_value->field_pkt__ta = ANY_VALUE;
single_value->field_freq__par__present = ANY_VALUE;
single_value->field_freq__par = ANY_OR_OMIT;
single_value->field_alloc__present = ANY_VALUE;
single_value->field_dyn__block__alloc = ANY_OR_OMIT;
single_value->field_sgl__block__alloc = ANY_OR_OMIT;
}
}
}

void PktUlAssGprs_template::copy_value(const PktUlAssGprs& other_value)
{
single_value = new single_value_struct;
if (other_value.ch__coding__cmd().is_bound()) {
  single_value->field_ch__coding__cmd = other_value.ch__coding__cmd();
} else {
  single_value->field_ch__coding__cmd.clean_up();
}
if (other_value.tlli__block__chan__coding().is_bound()) {
  single_value->field_tlli__block__chan__coding = other_value.tlli__block__chan__coding();
} else {
  single_value->field_tlli__block__chan__coding.clean_up();
}
if (other_value.pkt__ta().is_bound()) {
  single_value->field_pkt__ta = other_value.pkt__ta();
} else {
  single_value->field_pkt__ta.clean_up();
}
if (other_value.freq__par__present().is_bound()) {
  single_value->field_freq__par__present = other_value.freq__par__present();
} else {
  single_value->field_freq__par__present.clean_up();
}
if (other_value.freq__par().is_bound()) {
  if (other_value.freq__par().ispresent()) single_value->field_freq__par = other_value.freq__par()();
  else single_value->field_freq__par = OMIT_VALUE;
} else {
  single_value->field_freq__par.clean_up();
}
if (other_value.alloc__present().is_bound()) {
  single_value->field_alloc__present = other_value.alloc__present();
} else {
  single_value->field_alloc__present.clean_up();
}
if (other_value.dyn__block__alloc().is_bound()) {
  if (other_value.dyn__block__alloc().ispresent()) single_value->field_dyn__block__alloc = other_value.dyn__block__alloc()();
  else single_value->field_dyn__block__alloc = OMIT_VALUE;
} else {
  single_value->field_dyn__block__alloc.clean_up();
}
if (other_value.sgl__block__alloc().is_bound()) {
  if (other_value.sgl__block__alloc().ispresent()) single_value->field_sgl__block__alloc = other_value.sgl__block__alloc()();
  else single_value->field_sgl__block__alloc = OMIT_VALUE;
} else {
  single_value->field_sgl__block__alloc.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PktUlAssGprs_template::copy_template(const PktUlAssGprs_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.ch__coding__cmd().get_selection()) {
single_value->field_ch__coding__cmd = other_value.ch__coding__cmd();
} else {
single_value->field_ch__coding__cmd.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tlli__block__chan__coding().get_selection()) {
single_value->field_tlli__block__chan__coding = other_value.tlli__block__chan__coding();
} else {
single_value->field_tlli__block__chan__coding.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pkt__ta().get_selection()) {
single_value->field_pkt__ta = other_value.pkt__ta();
} else {
single_value->field_pkt__ta.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.freq__par__present().get_selection()) {
single_value->field_freq__par__present = other_value.freq__par__present();
} else {
single_value->field_freq__par__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.freq__par().get_selection()) {
single_value->field_freq__par = other_value.freq__par();
} else {
single_value->field_freq__par.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.alloc__present().get_selection()) {
single_value->field_alloc__present = other_value.alloc__present();
} else {
single_value->field_alloc__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.dyn__block__alloc().get_selection()) {
single_value->field_dyn__block__alloc = other_value.dyn__block__alloc();
} else {
single_value->field_dyn__block__alloc.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.sgl__block__alloc().get_selection()) {
single_value->field_sgl__block__alloc = other_value.sgl__block__alloc();
} else {
single_value->field_sgl__block__alloc.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 PktUlAssGprs_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 PktUlAssGprs_template(*other_value.implication_.precondition);
implication_.implied_template = new PktUlAssGprs_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_CSN1_Types.PktUlAssGprs.");
break;
}
set_selection(other_value);
}

PktUlAssGprs_template::PktUlAssGprs_template()
{
}

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

PktUlAssGprs_template::PktUlAssGprs_template(const PktUlAssGprs& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PktUlAssGprs_template::match(const PktUlAssGprs& 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.ch__coding__cmd().is_bound()) return FALSE;
if(!single_value->field_ch__coding__cmd.match(other_value.ch__coding__cmd(), legacy))return FALSE;
if(!other_value.tlli__block__chan__coding().is_bound()) return FALSE;
if(!single_value->field_tlli__block__chan__coding.match(other_value.tlli__block__chan__coding(), legacy))return FALSE;
if(!other_value.pkt__ta().is_bound()) return FALSE;
if(!single_value->field_pkt__ta.match(other_value.pkt__ta(), legacy))return FALSE;
if(!other_value.freq__par__present().is_bound()) return FALSE;
if(!single_value->field_freq__par__present.match(other_value.freq__par__present(), legacy))return FALSE;
if(!other_value.freq__par().is_bound()) return FALSE;
if((other_value.freq__par().ispresent() ? !single_value->field_freq__par.match((const FrequencyParameters&)other_value.freq__par(), legacy) : !single_value->field_freq__par.match_omit(legacy)))return FALSE;
if(!other_value.alloc__present().is_bound()) return FALSE;
if(!single_value->field_alloc__present.match(other_value.alloc__present(), legacy))return FALSE;
if(!other_value.dyn__block__alloc().is_bound()) return FALSE;
if((other_value.dyn__block__alloc().ispresent() ? !single_value->field_dyn__block__alloc.match((const DynamicAllocation&)other_value.dyn__block__alloc(), legacy) : !single_value->field_dyn__block__alloc.match_omit(legacy)))return FALSE;
if(!other_value.sgl__block__alloc().is_bound()) return FALSE;
if((other_value.sgl__block__alloc().ispresent() ? !single_value->field_sgl__block__alloc.match((const SingleBlockAllocation&)other_value.sgl__block__alloc(), legacy) : !single_value->field_sgl__block__alloc.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_CSN1_Types.PktUlAssGprs.");
}
return FALSE;
}

boolean PktUlAssGprs_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_ch__coding__cmd.is_bound()
 || single_value->field_tlli__block__chan__coding.is_bound()
 || single_value->field_pkt__ta.is_bound()
 || single_value->field_freq__par__present.is_bound()
 || (single_value->field_freq__par.is_omit() || single_value->field_freq__par.is_bound())
 || single_value->field_alloc__present.is_bound()
 || (single_value->field_dyn__block__alloc.is_omit() || single_value->field_dyn__block__alloc.is_bound())
 || (single_value->field_sgl__block__alloc.is_omit() || single_value->field_sgl__block__alloc.is_bound());
}

boolean PktUlAssGprs_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_ch__coding__cmd.is_value()
 && single_value->field_tlli__block__chan__coding.is_value()
 && single_value->field_pkt__ta.is_value()
 && single_value->field_freq__par__present.is_value()
 && (single_value->field_freq__par.is_omit() || single_value->field_freq__par.is_value())
 && single_value->field_alloc__present.is_value()
 && (single_value->field_dyn__block__alloc.is_omit() || single_value->field_dyn__block__alloc.is_value())
 && (single_value->field_sgl__block__alloc.is_omit() || single_value->field_sgl__block__alloc.is_value());
}

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

PktUlAssGprs PktUlAssGprs_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_CSN1_Types.PktUlAssGprs.");
PktUlAssGprs ret_val;
if (single_value->field_ch__coding__cmd.is_bound()) {
ret_val.ch__coding__cmd() = single_value->field_ch__coding__cmd.valueof();
}
if (single_value->field_tlli__block__chan__coding.is_bound()) {
ret_val.tlli__block__chan__coding() = single_value->field_tlli__block__chan__coding.valueof();
}
if (single_value->field_pkt__ta.is_bound()) {
ret_val.pkt__ta() = single_value->field_pkt__ta.valueof();
}
if (single_value->field_freq__par__present.is_bound()) {
ret_val.freq__par__present() = single_value->field_freq__par__present.valueof();
}
if (single_value->field_freq__par.is_omit()) ret_val.freq__par() = OMIT_VALUE;
else if (single_value->field_freq__par.is_bound()) {
ret_val.freq__par() = single_value->field_freq__par.valueof();
}
if (single_value->field_alloc__present.is_bound()) {
ret_val.alloc__present() = single_value->field_alloc__present.valueof();
}
if (single_value->field_dyn__block__alloc.is_omit()) ret_val.dyn__block__alloc() = OMIT_VALUE;
else if (single_value->field_dyn__block__alloc.is_bound()) {
ret_val.dyn__block__alloc() = single_value->field_dyn__block__alloc.valueof();
}
if (single_value->field_sgl__block__alloc.is_omit()) ret_val.sgl__block__alloc() = OMIT_VALUE;
else if (single_value->field_sgl__block__alloc.is_bound()) {
ret_val.sgl__block__alloc() = single_value->field_sgl__block__alloc.valueof();
}
return ret_val;
}

void PktUlAssGprs_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_CSN1_Types.PktUlAssGprs.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PktUlAssGprs_template[list_length];
}

PktUlAssGprs_template& PktUlAssGprs_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_CSN1_Types.PktUlAssGprs.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.PktUlAssGprs.");
return value_list.list_value[list_index];
}

ChCodingCommand_template& PktUlAssGprs_template::ch__coding__cmd()
{
set_specific();
return single_value->field_ch__coding__cmd;
}

const ChCodingCommand_template& PktUlAssGprs_template::ch__coding__cmd() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ch_coding_cmd of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssGprs.");
return single_value->field_ch__coding__cmd;
}

BITSTRING_template& PktUlAssGprs_template::tlli__block__chan__coding()
{
set_specific();
return single_value->field_tlli__block__chan__coding;
}

const BITSTRING_template& PktUlAssGprs_template::tlli__block__chan__coding() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tlli_block_chan_coding of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssGprs.");
return single_value->field_tlli__block__chan__coding;
}

PacketTimingAdvance_template& PktUlAssGprs_template::pkt__ta()
{
set_specific();
return single_value->field_pkt__ta;
}

const PacketTimingAdvance_template& PktUlAssGprs_template::pkt__ta() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pkt_ta of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssGprs.");
return single_value->field_pkt__ta;
}

BITSTRING_template& PktUlAssGprs_template::freq__par__present()
{
set_specific();
return single_value->field_freq__par__present;
}

const BITSTRING_template& PktUlAssGprs_template::freq__par__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field freq_par_present of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssGprs.");
return single_value->field_freq__par__present;
}

FrequencyParameters_template& PktUlAssGprs_template::freq__par()
{
set_specific();
return single_value->field_freq__par;
}

const FrequencyParameters_template& PktUlAssGprs_template::freq__par() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field freq_par of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssGprs.");
return single_value->field_freq__par;
}

BITSTRING_template& PktUlAssGprs_template::alloc__present()
{
set_specific();
return single_value->field_alloc__present;
}

const BITSTRING_template& PktUlAssGprs_template::alloc__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field alloc_present of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssGprs.");
return single_value->field_alloc__present;
}

DynamicAllocation_template& PktUlAssGprs_template::dyn__block__alloc()
{
set_specific();
return single_value->field_dyn__block__alloc;
}

const DynamicAllocation_template& PktUlAssGprs_template::dyn__block__alloc() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field dyn_block_alloc of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssGprs.");
return single_value->field_dyn__block__alloc;
}

SingleBlockAllocation_template& PktUlAssGprs_template::sgl__block__alloc()
{
set_specific();
return single_value->field_sgl__block__alloc;
}

const SingleBlockAllocation_template& PktUlAssGprs_template::sgl__block__alloc() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field sgl_block_alloc of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssGprs.");
return single_value->field_sgl__block__alloc;
}

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

void PktUlAssGprs_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ ch_coding_cmd := ");
single_value->field_ch__coding__cmd.log();
TTCN_Logger::log_event_str(", tlli_block_chan_coding := ");
single_value->field_tlli__block__chan__coding.log();
TTCN_Logger::log_event_str(", pkt_ta := ");
single_value->field_pkt__ta.log();
TTCN_Logger::log_event_str(", freq_par_present := ");
single_value->field_freq__par__present.log();
TTCN_Logger::log_event_str(", freq_par := ");
single_value->field_freq__par.log();
TTCN_Logger::log_event_str(", alloc_present := ");
single_value->field_alloc__present.log();
TTCN_Logger::log_event_str(", dyn_block_alloc := ");
single_value->field_dyn__block__alloc.log();
TTCN_Logger::log_event_str(", sgl_block_alloc := ");
single_value->field_sgl__block__alloc.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 PktUlAssGprs_template::log_match(const PktUlAssGprs& 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_ch__coding__cmd.match(match_value.ch__coding__cmd(), legacy)){
TTCN_Logger::log_logmatch_info(".ch_coding_cmd");
single_value->field_ch__coding__cmd.log_match(match_value.ch__coding__cmd(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tlli__block__chan__coding.match(match_value.tlli__block__chan__coding(), legacy)){
TTCN_Logger::log_logmatch_info(".tlli_block_chan_coding");
single_value->field_tlli__block__chan__coding.log_match(match_value.tlli__block__chan__coding(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pkt__ta.match(match_value.pkt__ta(), legacy)){
TTCN_Logger::log_logmatch_info(".pkt_ta");
single_value->field_pkt__ta.log_match(match_value.pkt__ta(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_freq__par__present.match(match_value.freq__par__present(), legacy)){
TTCN_Logger::log_logmatch_info(".freq_par_present");
single_value->field_freq__par__present.log_match(match_value.freq__par__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.freq__par().ispresent()){
if(!single_value->field_freq__par.match(match_value.freq__par(), legacy)){
TTCN_Logger::log_logmatch_info(".freq_par");
single_value->field_freq__par.log_match(match_value.freq__par(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_freq__par.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".freq_par := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_freq__par.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_alloc__present.match(match_value.alloc__present(), legacy)){
TTCN_Logger::log_logmatch_info(".alloc_present");
single_value->field_alloc__present.log_match(match_value.alloc__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.dyn__block__alloc().ispresent()){
if(!single_value->field_dyn__block__alloc.match(match_value.dyn__block__alloc(), legacy)){
TTCN_Logger::log_logmatch_info(".dyn_block_alloc");
single_value->field_dyn__block__alloc.log_match(match_value.dyn__block__alloc(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_dyn__block__alloc.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".dyn_block_alloc := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_dyn__block__alloc.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.sgl__block__alloc().ispresent()){
if(!single_value->field_sgl__block__alloc.match(match_value.sgl__block__alloc(), legacy)){
TTCN_Logger::log_logmatch_info(".sgl_block_alloc");
single_value->field_sgl__block__alloc.log_match(match_value.sgl__block__alloc(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_sgl__block__alloc.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".sgl_block_alloc := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_sgl__block__alloc.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("{ ch_coding_cmd := ");
single_value->field_ch__coding__cmd.log_match(match_value.ch__coding__cmd(), legacy);
TTCN_Logger::log_event_str(", tlli_block_chan_coding := ");
single_value->field_tlli__block__chan__coding.log_match(match_value.tlli__block__chan__coding(), legacy);
TTCN_Logger::log_event_str(", pkt_ta := ");
single_value->field_pkt__ta.log_match(match_value.pkt__ta(), legacy);
TTCN_Logger::log_event_str(", freq_par_present := ");
single_value->field_freq__par__present.log_match(match_value.freq__par__present(), legacy);
TTCN_Logger::log_event_str(", freq_par := ");
if (match_value.freq__par().ispresent()) {
single_value->field_freq__par.log_match(match_value.freq__par(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_freq__par.log();
if (single_value->field_freq__par.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", alloc_present := ");
single_value->field_alloc__present.log_match(match_value.alloc__present(), legacy);
TTCN_Logger::log_event_str(", dyn_block_alloc := ");
if (match_value.dyn__block__alloc().ispresent()) {
single_value->field_dyn__block__alloc.log_match(match_value.dyn__block__alloc(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_dyn__block__alloc.log();
if (single_value->field_dyn__block__alloc.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", sgl_block_alloc := ");
if (match_value.sgl__block__alloc().ispresent()) {
single_value->field_sgl__block__alloc.log_match(match_value.sgl__block__alloc(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_sgl__block__alloc.log();
if (single_value->field_sgl__block__alloc.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 PktUlAssGprs_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (ch__coding__cmd().is_bound()) ch__coding__cmd().set_implicit_omit();
if (tlli__block__chan__coding().is_bound()) tlli__block__chan__coding().set_implicit_omit();
if (pkt__ta().is_bound()) pkt__ta().set_implicit_omit();
if (freq__par__present().is_bound()) freq__par__present().set_implicit_omit();
if (!freq__par().is_bound()) freq__par() = OMIT_VALUE;
else freq__par().set_implicit_omit();
if (alloc__present().is_bound()) alloc__present().set_implicit_omit();
if (!dyn__block__alloc().is_bound()) dyn__block__alloc() = OMIT_VALUE;
else dyn__block__alloc().set_implicit_omit();
if (!sgl__block__alloc().is_bound()) sgl__block__alloc() = OMIT_VALUE;
else sgl__block__alloc().set_implicit_omit();
}

void PktUlAssGprs_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_ch__coding__cmd.encode_text(text_buf);
single_value->field_tlli__block__chan__coding.encode_text(text_buf);
single_value->field_pkt__ta.encode_text(text_buf);
single_value->field_freq__par__present.encode_text(text_buf);
single_value->field_freq__par.encode_text(text_buf);
single_value->field_alloc__present.encode_text(text_buf);
single_value->field_dyn__block__alloc.encode_text(text_buf);
single_value->field_sgl__block__alloc.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_CSN1_Types.PktUlAssGprs.");
}
}

void PktUlAssGprs_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_ch__coding__cmd.decode_text(text_buf);
single_value->field_tlli__block__chan__coding.decode_text(text_buf);
single_value->field_pkt__ta.decode_text(text_buf);
single_value->field_freq__par__present.decode_text(text_buf);
single_value->field_freq__par.decode_text(text_buf);
single_value->field_alloc__present.decode_text(text_buf);
single_value->field_dyn__block__alloc.decode_text(text_buf);
single_value->field_sgl__block__alloc.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 PktUlAssGprs_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_CSN1_Types.PktUlAssGprs.");
}
}

void PktUlAssGprs_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: {
    PktUlAssGprs_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (8<param.get_size()) {
      param.error("record template of type @RLCMAC_CSN1_Types.PktUlAssGprs has 8 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) ch__coding__cmd().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tlli__block__chan__coding().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) pkt__ta().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) freq__par__present().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) freq__par().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) alloc__present().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) dyn__block__alloc().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) sgl__block__alloc().set_param(*param.get_elem(7));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ch_coding_cmd")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ch__coding__cmd().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_block_chan_coding")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tlli__block__chan__coding().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pkt_ta")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pkt__ta().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "freq_par_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          freq__par__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(), "freq_par")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          freq__par().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "alloc_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          alloc__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(), "dyn_block_alloc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          dyn__block__alloc().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "sgl_block_alloc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sgl__block__alloc().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_CSN1_Types.PktUlAssGprs: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PktUlAssGprs_template* precondition = new PktUlAssGprs_template;
    precondition->set_param(*param.get_elem(0));
    PktUlAssGprs_template* implied_template = new PktUlAssGprs_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PktUlAssGprs_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.PktUlAssGprs");
  }
  is_ifpresent = param.get_ifpresent();
}

void PktUlAssGprs_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_ch__coding__cmd.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssGprs");
single_value->field_tlli__block__chan__coding.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssGprs");
single_value->field_pkt__ta.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssGprs");
single_value->field_freq__par__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssGprs");
single_value->field_freq__par.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssGprs");
single_value->field_alloc__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssGprs");
single_value->field_dyn__block__alloc.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssGprs");
single_value->field_sgl__block__alloc.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssGprs");
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_CSN1_Types.PktUlAssGprs");
}

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

boolean PktUlAssGprs_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 AccessTechnologiesRequest AccessTechnologiesRequestRepetition::UNBOUND_ELEM;
AccessTechnologiesRequestRepetition::AccessTechnologiesRequestRepetition()
{
val_ptr = NULL;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

void AccessTechnologiesRequestRepetition::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 AccessTechnologiesRequestRepetition::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 AccessTechnologiesRequestRepetition::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++;
      if (!p_buf.get_last_bit())
        return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength;
    }
  }
 return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength;
}

int AccessTechnologiesRequestRepetition::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 AccessTechnologiesRequestRepetition_template::copy_value(const AccessTechnologiesRequestRepetition& other_value)
{
if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @RLCMAC_CSN1_Types.AccessTechnologiesRequestRepetition with an unbound value.");
single_value.n_elements = other_value.size_of();
single_value.value_elements = (AccessTechnologiesRequest_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 AccessTechnologiesRequest_template(other_value[elem_count]);
} else {
single_value.value_elements[elem_count] = new AccessTechnologiesRequest_template;
}
}
set_selection(SPECIFIC_VALUE);
}

void AccessTechnologiesRequestRepetition_template::copy_template(const AccessTechnologiesRequestRepetition_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 = (AccessTechnologiesRequest_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 AccessTechnologiesRequest_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new AccessTechnologiesRequest_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 AccessTechnologiesRequestRepetition_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 AccessTechnologiesRequestRepetition_template(*other_value.implication_.precondition);
implication_.implied_template = new AccessTechnologiesRequestRepetition_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_CSN1_Types.AccessTechnologiesRequestRepetition.");
break;
}
set_selection(other_value);
}

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

AccessTechnologiesRequestRepetition_template::AccessTechnologiesRequestRepetition_template()
{
}

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

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

AccessTechnologiesRequestRepetition_template::AccessTechnologiesRequestRepetition_template(const AccessTechnologiesRequestRepetition& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

const AccessTechnologiesRequest_template& AccessTechnologiesRequestRepetition_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @RLCMAC_CSN1_Types.AccessTechnologiesRequestRepetition 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_CSN1_Types.AccessTechnologiesRequestRepetition.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @RLCMAC_CSN1_Types.AccessTechnologiesRequestRepetition: 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 AccessTechnologiesRequest_template& AccessTechnologiesRequestRepetition_template::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a template of type @RLCMAC_CSN1_Types.AccessTechnologiesRequestRepetition.");
return (*this)[(int)index_value];
}

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

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

boolean AccessTechnologiesRequestRepetition_template::match(const AccessTechnologiesRequestRepetition& 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_CSN1_Types.AccessTechnologiesRequestRepetition.");
}
return FALSE;
}

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

AccessTechnologiesRequestRepetition AccessTechnologiesRequestRepetition_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_CSN1_Types.AccessTechnologiesRequestRepetition.");
AccessTechnologiesRequestRepetition 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;
}

AccessTechnologiesRequestRepetition AccessTechnologiesRequestRepetition_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);
}

AccessTechnologiesRequestRepetition AccessTechnologiesRequestRepetition_template::replace(int index, int len, const AccessTechnologiesRequestRepetition_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());
}

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

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

void AccessTechnologiesRequestRepetition_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 AccessTechnologiesRequestRepetition_template::log_match(const AccessTechnologiesRequestRepetition& 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 AccessTechnologiesRequestRepetition_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_CSN1_Types.AccessTechnologiesRequestRepetition.");
}
}

void AccessTechnologiesRequestRepetition_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_CSN1_Types.AccessTechnologiesRequestRepetition.");
single_value.value_elements = (AccessTechnologiesRequest_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 AccessTechnologiesRequest_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 AccessTechnologiesRequestRepetition_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_CSN1_Types.AccessTechnologiesRequestRepetition.");
}
}

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

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

void AccessTechnologiesRequestRepetition_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_CSN1_Types.AccessTechnologiesRequestRepetition");
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_CSN1_Types.AccessTechnologiesRequestRepetition");
}

boolean AccessTechnologiesRequestRepetition_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);
}
}
AccessTechnologiesRequest::AccessTechnologiesRequest()
{
}

AccessTechnologiesRequest::AccessTechnologiesRequest(const BITSTRING& par_accessTechnType,
    const BITSTRING& par_extensionBit)
  :   field_accessTechnType(par_accessTechnType),
  field_extensionBit(par_extensionBit)
{
}

AccessTechnologiesRequest::AccessTechnologiesRequest(const AccessTechnologiesRequest& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.AccessTechnologiesRequest.");
if (other_value.accessTechnType().is_bound()) field_accessTechnType = other_value.accessTechnType();
else field_accessTechnType.clean_up();
if (other_value.extensionBit().is_bound()) field_extensionBit = other_value.extensionBit();
else field_extensionBit.clean_up();
}

void AccessTechnologiesRequest::clean_up()
{
field_accessTechnType.clean_up();
field_extensionBit.clean_up();
}

const TTCN_Typedescriptor_t* AccessTechnologiesRequest::get_descriptor() const { return &AccessTechnologiesRequest_descr_; }
AccessTechnologiesRequest& AccessTechnologiesRequest::operator=(const AccessTechnologiesRequest& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.AccessTechnologiesRequest.");
  if (other_value.accessTechnType().is_bound()) field_accessTechnType = other_value.accessTechnType();
  else field_accessTechnType.clean_up();
  if (other_value.extensionBit().is_bound()) field_extensionBit = other_value.extensionBit();
  else field_extensionBit.clean_up();
}
return *this;
}

boolean AccessTechnologiesRequest::operator==(const AccessTechnologiesRequest& other_value) const
{
return field_accessTechnType==other_value.field_accessTechnType
  && field_extensionBit==other_value.field_extensionBit;
}

boolean AccessTechnologiesRequest::is_bound() const
{
return (field_accessTechnType.is_bound())
  || (field_extensionBit.is_bound());
}
boolean AccessTechnologiesRequest::is_value() const
{
return field_accessTechnType.is_value()
  && field_extensionBit.is_value();
}
void AccessTechnologiesRequest::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ accessTechnType := ");
field_accessTechnType.log();
TTCN_Logger::log_event_str(", extensionBit := ");
field_extensionBit.log();
TTCN_Logger::log_event_str(" }");
}

void AccessTechnologiesRequest::set_implicit_omit()
{
if (accessTechnType().is_bound()) accessTechnType().set_implicit_omit();
if (extensionBit().is_bound()) extensionBit().set_implicit_omit();
}

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

void AccessTechnologiesRequest::encode_text(Text_Buf& text_buf) const
{
field_accessTechnType.encode_text(text_buf);
field_extensionBit.encode_text(text_buf);
}

void AccessTechnologiesRequest::decode_text(Text_Buf& text_buf)
{
field_accessTechnType.decode_text(text_buf);
field_extensionBit.decode_text(text_buf);
}

void AccessTechnologiesRequest::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 AccessTechnologiesRequest::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 AccessTechnologiesRequest::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, AccessTechnologiesRequest_accessTechnType_descr_.raw->forceomit);
  decoded_field_length = field_accessTechnType.RAW_decode(AccessTechnologiesRequest_accessTechnType_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, AccessTechnologiesRequest_extensionBit_descr_.raw->forceomit);
  decoded_field_length = field_extensionBit.RAW_decode(AccessTechnologiesRequest_extensionBit_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 AccessTechnologiesRequest::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, AccessTechnologiesRequest_accessTechnType_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, AccessTechnologiesRequest_extensionBit_descr_.raw);
  encoded_length += field_accessTechnType.RAW_encode(AccessTechnologiesRequest_accessTechnType_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_extensionBit.RAW_encode(AccessTechnologiesRequest_extensionBit_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct AccessTechnologiesRequest_template::single_value_struct {
BITSTRING_template field_accessTechnType;
BITSTRING_template field_extensionBit;
};

void AccessTechnologiesRequest_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_accessTechnType = ANY_VALUE;
single_value->field_extensionBit = ANY_VALUE;
}
}
}

void AccessTechnologiesRequest_template::copy_value(const AccessTechnologiesRequest& other_value)
{
single_value = new single_value_struct;
if (other_value.accessTechnType().is_bound()) {
  single_value->field_accessTechnType = other_value.accessTechnType();
} else {
  single_value->field_accessTechnType.clean_up();
}
if (other_value.extensionBit().is_bound()) {
  single_value->field_extensionBit = other_value.extensionBit();
} else {
  single_value->field_extensionBit.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void AccessTechnologiesRequest_template::copy_template(const AccessTechnologiesRequest_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.accessTechnType().get_selection()) {
single_value->field_accessTechnType = other_value.accessTechnType();
} else {
single_value->field_accessTechnType.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.extensionBit().get_selection()) {
single_value->field_extensionBit = other_value.extensionBit();
} else {
single_value->field_extensionBit.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 AccessTechnologiesRequest_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 AccessTechnologiesRequest_template(*other_value.implication_.precondition);
implication_.implied_template = new AccessTechnologiesRequest_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_CSN1_Types.AccessTechnologiesRequest.");
break;
}
set_selection(other_value);
}

AccessTechnologiesRequest_template::AccessTechnologiesRequest_template()
{
}

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

AccessTechnologiesRequest_template::AccessTechnologiesRequest_template(const AccessTechnologiesRequest& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean AccessTechnologiesRequest_template::match(const AccessTechnologiesRequest& 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.accessTechnType().is_bound()) return FALSE;
if(!single_value->field_accessTechnType.match(other_value.accessTechnType(), legacy))return FALSE;
if(!other_value.extensionBit().is_bound()) return FALSE;
if(!single_value->field_extensionBit.match(other_value.extensionBit(), 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_CSN1_Types.AccessTechnologiesRequest.");
}
return FALSE;
}

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

boolean AccessTechnologiesRequest_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_accessTechnType.is_value()
 && single_value->field_extensionBit.is_value();
}

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

AccessTechnologiesRequest AccessTechnologiesRequest_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_CSN1_Types.AccessTechnologiesRequest.");
AccessTechnologiesRequest ret_val;
if (single_value->field_accessTechnType.is_bound()) {
ret_val.accessTechnType() = single_value->field_accessTechnType.valueof();
}
if (single_value->field_extensionBit.is_bound()) {
ret_val.extensionBit() = single_value->field_extensionBit.valueof();
}
return ret_val;
}

void AccessTechnologiesRequest_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_CSN1_Types.AccessTechnologiesRequest.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new AccessTechnologiesRequest_template[list_length];
}

AccessTechnologiesRequest_template& AccessTechnologiesRequest_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_CSN1_Types.AccessTechnologiesRequest.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.AccessTechnologiesRequest.");
return value_list.list_value[list_index];
}

BITSTRING_template& AccessTechnologiesRequest_template::accessTechnType()
{
set_specific();
return single_value->field_accessTechnType;
}

const BITSTRING_template& AccessTechnologiesRequest_template::accessTechnType() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field accessTechnType of a non-specific template of type @RLCMAC_CSN1_Types.AccessTechnologiesRequest.");
return single_value->field_accessTechnType;
}

BITSTRING_template& AccessTechnologiesRequest_template::extensionBit()
{
set_specific();
return single_value->field_extensionBit;
}

const BITSTRING_template& AccessTechnologiesRequest_template::extensionBit() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field extensionBit of a non-specific template of type @RLCMAC_CSN1_Types.AccessTechnologiesRequest.");
return single_value->field_extensionBit;
}

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

void AccessTechnologiesRequest_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ accessTechnType := ");
single_value->field_accessTechnType.log();
TTCN_Logger::log_event_str(", extensionBit := ");
single_value->field_extensionBit.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 AccessTechnologiesRequest_template::log_match(const AccessTechnologiesRequest& 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_accessTechnType.match(match_value.accessTechnType(), legacy)){
TTCN_Logger::log_logmatch_info(".accessTechnType");
single_value->field_accessTechnType.log_match(match_value.accessTechnType(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_extensionBit.match(match_value.extensionBit(), legacy)){
TTCN_Logger::log_logmatch_info(".extensionBit");
single_value->field_extensionBit.log_match(match_value.extensionBit(), 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("{ accessTechnType := ");
single_value->field_accessTechnType.log_match(match_value.accessTechnType(), legacy);
TTCN_Logger::log_event_str(", extensionBit := ");
single_value->field_extensionBit.log_match(match_value.extensionBit(), 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 AccessTechnologiesRequest_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (accessTechnType().is_bound()) accessTechnType().set_implicit_omit();
if (extensionBit().is_bound()) extensionBit().set_implicit_omit();
}

void AccessTechnologiesRequest_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_accessTechnType.encode_text(text_buf);
single_value->field_extensionBit.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_CSN1_Types.AccessTechnologiesRequest.");
}
}

void AccessTechnologiesRequest_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_accessTechnType.decode_text(text_buf);
single_value->field_extensionBit.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 AccessTechnologiesRequest_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_CSN1_Types.AccessTechnologiesRequest.");
}
}

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

void AccessTechnologiesRequest_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_accessTechnType.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.AccessTechnologiesRequest");
single_value->field_extensionBit.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.AccessTechnologiesRequest");
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_CSN1_Types.AccessTechnologiesRequest");
}

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

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

MultiBlockAllocation::MultiBlockAllocation()
{
}

MultiBlockAllocation::MultiBlockAllocation(const INTEGER& par_timeslot__nr,
    const BITSTRING& par_alpha__gamma__present,
    const OPTIONAL< INTEGER >& par_alpha,
    const OPTIONAL< INTEGER >& par_gamma__tn,
    const BITSTRING& par_p0__present,
    const OPTIONAL< INTEGER >& par_p0,
    const OPTIONAL< BITSTRING >& par_reserved,
    const OPTIONAL< BITSTRING >& par_pr__mode,
    const StartingFnDesc& par_tbf__starting__time,
    const INTEGER& par_num__radio__blocks__alloc)
  :   field_timeslot__nr(par_timeslot__nr),
  field_alpha__gamma__present(par_alpha__gamma__present),
  field_alpha(par_alpha),
  field_gamma__tn(par_gamma__tn),
  field_p0__present(par_p0__present),
  field_p0(par_p0),
  field_reserved(par_reserved),
  field_pr__mode(par_pr__mode),
  field_tbf__starting__time(par_tbf__starting__time),
  field_num__radio__blocks__alloc(par_num__radio__blocks__alloc)
{
}

MultiBlockAllocation::MultiBlockAllocation(const MultiBlockAllocation& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.MultiBlockAllocation.");
if (other_value.timeslot__nr().is_bound()) field_timeslot__nr = other_value.timeslot__nr();
else field_timeslot__nr.clean_up();
if (other_value.alpha__gamma__present().is_bound()) field_alpha__gamma__present = other_value.alpha__gamma__present();
else field_alpha__gamma__present.clean_up();
if (other_value.alpha().is_bound()) field_alpha = other_value.alpha();
else field_alpha.clean_up();
if (other_value.gamma__tn().is_bound()) field_gamma__tn = other_value.gamma__tn();
else field_gamma__tn.clean_up();
if (other_value.p0__present().is_bound()) field_p0__present = other_value.p0__present();
else field_p0__present.clean_up();
if (other_value.p0().is_bound()) field_p0 = other_value.p0();
else field_p0.clean_up();
if (other_value.reserved().is_bound()) field_reserved = other_value.reserved();
else field_reserved.clean_up();
if (other_value.pr__mode().is_bound()) field_pr__mode = other_value.pr__mode();
else field_pr__mode.clean_up();
if (other_value.tbf__starting__time().is_bound()) field_tbf__starting__time = other_value.tbf__starting__time();
else field_tbf__starting__time.clean_up();
if (other_value.num__radio__blocks__alloc().is_bound()) field_num__radio__blocks__alloc = other_value.num__radio__blocks__alloc();
else field_num__radio__blocks__alloc.clean_up();
}

void MultiBlockAllocation::clean_up()
{
field_timeslot__nr.clean_up();
field_alpha__gamma__present.clean_up();
field_alpha.clean_up();
field_gamma__tn.clean_up();
field_p0__present.clean_up();
field_p0.clean_up();
field_reserved.clean_up();
field_pr__mode.clean_up();
field_tbf__starting__time.clean_up();
field_num__radio__blocks__alloc.clean_up();
}

const TTCN_Typedescriptor_t* MultiBlockAllocation::get_descriptor() const { return &MultiBlockAllocation_descr_; }
MultiBlockAllocation& MultiBlockAllocation::operator=(const MultiBlockAllocation& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.MultiBlockAllocation.");
  if (other_value.timeslot__nr().is_bound()) field_timeslot__nr = other_value.timeslot__nr();
  else field_timeslot__nr.clean_up();
  if (other_value.alpha__gamma__present().is_bound()) field_alpha__gamma__present = other_value.alpha__gamma__present();
  else field_alpha__gamma__present.clean_up();
  if (other_value.alpha().is_bound()) field_alpha = other_value.alpha();
  else field_alpha.clean_up();
  if (other_value.gamma__tn().is_bound()) field_gamma__tn = other_value.gamma__tn();
  else field_gamma__tn.clean_up();
  if (other_value.p0__present().is_bound()) field_p0__present = other_value.p0__present();
  else field_p0__present.clean_up();
  if (other_value.p0().is_bound()) field_p0 = other_value.p0();
  else field_p0.clean_up();
  if (other_value.reserved().is_bound()) field_reserved = other_value.reserved();
  else field_reserved.clean_up();
  if (other_value.pr__mode().is_bound()) field_pr__mode = other_value.pr__mode();
  else field_pr__mode.clean_up();
  if (other_value.tbf__starting__time().is_bound()) field_tbf__starting__time = other_value.tbf__starting__time();
  else field_tbf__starting__time.clean_up();
  if (other_value.num__radio__blocks__alloc().is_bound()) field_num__radio__blocks__alloc = other_value.num__radio__blocks__alloc();
  else field_num__radio__blocks__alloc.clean_up();
}
return *this;
}

boolean MultiBlockAllocation::operator==(const MultiBlockAllocation& other_value) const
{
return field_timeslot__nr==other_value.field_timeslot__nr
  && field_alpha__gamma__present==other_value.field_alpha__gamma__present
  && field_alpha==other_value.field_alpha
  && field_gamma__tn==other_value.field_gamma__tn
  && field_p0__present==other_value.field_p0__present
  && field_p0==other_value.field_p0
  && field_reserved==other_value.field_reserved
  && field_pr__mode==other_value.field_pr__mode
  && field_tbf__starting__time==other_value.field_tbf__starting__time
  && field_num__radio__blocks__alloc==other_value.field_num__radio__blocks__alloc;
}

boolean MultiBlockAllocation::is_bound() const
{
return (field_timeslot__nr.is_bound())
  || (field_alpha__gamma__present.is_bound())
  || (OPTIONAL_OMIT == field_alpha.get_selection() || field_alpha.is_bound())
  || (OPTIONAL_OMIT == field_gamma__tn.get_selection() || field_gamma__tn.is_bound())
  || (field_p0__present.is_bound())
  || (OPTIONAL_OMIT == field_p0.get_selection() || field_p0.is_bound())
  || (OPTIONAL_OMIT == field_reserved.get_selection() || field_reserved.is_bound())
  || (OPTIONAL_OMIT == field_pr__mode.get_selection() || field_pr__mode.is_bound())
  || (field_tbf__starting__time.is_bound())
  || (field_num__radio__blocks__alloc.is_bound());
}
boolean MultiBlockAllocation::is_value() const
{
return field_timeslot__nr.is_value()
  && field_alpha__gamma__present.is_value()
  && (OPTIONAL_OMIT == field_alpha.get_selection() || field_alpha.is_value())
  && (OPTIONAL_OMIT == field_gamma__tn.get_selection() || field_gamma__tn.is_value())
  && field_p0__present.is_value()
  && (OPTIONAL_OMIT == field_p0.get_selection() || field_p0.is_value())
  && (OPTIONAL_OMIT == field_reserved.get_selection() || field_reserved.is_value())
  && (OPTIONAL_OMIT == field_pr__mode.get_selection() || field_pr__mode.is_value())
  && field_tbf__starting__time.is_value()
  && field_num__radio__blocks__alloc.is_value();
}
int MultiBlockAllocation::size_of() const
{
  int ret_val = 5;
  if (field_alpha.ispresent()) ret_val++;
  if (field_gamma__tn.ispresent()) ret_val++;
  if (field_p0.ispresent()) ret_val++;
  if (field_reserved.ispresent()) ret_val++;
  if (field_pr__mode.ispresent()) ret_val++;
  return ret_val;
}

void MultiBlockAllocation::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ timeslot_nr := ");
field_timeslot__nr.log();
TTCN_Logger::log_event_str(", alpha_gamma_present := ");
field_alpha__gamma__present.log();
TTCN_Logger::log_event_str(", alpha := ");
field_alpha.log();
TTCN_Logger::log_event_str(", gamma_tn := ");
field_gamma__tn.log();
TTCN_Logger::log_event_str(", p0_present := ");
field_p0__present.log();
TTCN_Logger::log_event_str(", p0 := ");
field_p0.log();
TTCN_Logger::log_event_str(", reserved := ");
field_reserved.log();
TTCN_Logger::log_event_str(", pr_mode := ");
field_pr__mode.log();
TTCN_Logger::log_event_str(", tbf_starting_time := ");
field_tbf__starting__time.log();
TTCN_Logger::log_event_str(", num_radio_blocks_alloc := ");
field_num__radio__blocks__alloc.log();
TTCN_Logger::log_event_str(" }");
}

void MultiBlockAllocation::set_implicit_omit()
{
if (timeslot__nr().is_bound()) timeslot__nr().set_implicit_omit();
if (alpha__gamma__present().is_bound()) alpha__gamma__present().set_implicit_omit();
if (!alpha().is_bound()) alpha() = OMIT_VALUE;
else alpha().set_implicit_omit();
if (!gamma__tn().is_bound()) gamma__tn() = OMIT_VALUE;
else gamma__tn().set_implicit_omit();
if (p0__present().is_bound()) p0__present().set_implicit_omit();
if (!p0().is_bound()) p0() = OMIT_VALUE;
else p0().set_implicit_omit();
if (!reserved().is_bound()) reserved() = OMIT_VALUE;
else reserved().set_implicit_omit();
if (!pr__mode().is_bound()) pr__mode() = OMIT_VALUE;
else pr__mode().set_implicit_omit();
if (tbf__starting__time().is_bound()) tbf__starting__time().set_implicit_omit();
if (num__radio__blocks__alloc().is_bound()) num__radio__blocks__alloc().set_implicit_omit();
}

void MultiBlockAllocation::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_CSN1_Types.MultiBlockAllocation 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) timeslot__nr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) alpha__gamma__present().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) alpha().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) gamma__tn().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) p0__present().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) p0().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) reserved().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) pr__mode().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) tbf__starting__time().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) num__radio__blocks__alloc().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(), "timeslot_nr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          timeslot__nr().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "alpha_gamma_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          alpha__gamma__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(), "alpha")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          alpha().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gamma_tn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gamma__tn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "p0_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          p0__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(), "p0")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          p0().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "reserved")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          reserved().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pr__mode().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tbf_starting_time")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tbf__starting__time().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "num_radio_blocks_alloc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          num__radio__blocks__alloc().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_CSN1_Types.MultiBlockAllocation: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.MultiBlockAllocation");
  }
}

void MultiBlockAllocation::encode_text(Text_Buf& text_buf) const
{
field_timeslot__nr.encode_text(text_buf);
field_alpha__gamma__present.encode_text(text_buf);
field_alpha.encode_text(text_buf);
field_gamma__tn.encode_text(text_buf);
field_p0__present.encode_text(text_buf);
field_p0.encode_text(text_buf);
field_reserved.encode_text(text_buf);
field_pr__mode.encode_text(text_buf);
field_tbf__starting__time.encode_text(text_buf);
field_num__radio__blocks__alloc.encode_text(text_buf);
}

void MultiBlockAllocation::decode_text(Text_Buf& text_buf)
{
field_timeslot__nr.decode_text(text_buf);
field_alpha__gamma__present.decode_text(text_buf);
field_alpha.decode_text(text_buf);
field_gamma__tn.decode_text(text_buf);
field_p0__present.decode_text(text_buf);
field_p0.decode_text(text_buf);
field_reserved.decode_text(text_buf);
field_pr__mode.decode_text(text_buf);
field_tbf__starting__time.decode_text(text_buf);
field_num__radio__blocks__alloc.decode_text(text_buf);
}

void MultiBlockAllocation::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 MultiBlockAllocation::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 MultiBlockAllocation::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, MultiBlockAllocation_timeslot__nr_descr_.raw->forceomit);
  decoded_field_length = field_timeslot__nr.RAW_decode(MultiBlockAllocation_timeslot__nr_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, MultiBlockAllocation_alpha__gamma__present_descr_.raw->forceomit);
  decoded_field_length = field_alpha__gamma__present.RAW_decode(MultiBlockAllocation_alpha__gamma__present_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_alpha__gamma__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(2)) {
    field_alpha = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_2_force_omit(2, force_omit, MultiBlockAllocation_alpha_descr_.raw->forceomit);
  decoded_field_length = field_alpha().RAW_decode(MultiBlockAllocation_alpha_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 1) {
  field_alpha = 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_alpha=OMIT_VALUE;
  if (limit > 0 && field_alpha__gamma__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(3)) {
    field_gamma__tn = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_3_force_omit(3, force_omit, MultiBlockAllocation_gamma__tn_descr_.raw->forceomit);
  decoded_field_length = field_gamma__tn().RAW_decode(MultiBlockAllocation_gamma__tn_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 1) {
  field_gamma__tn = 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_gamma__tn=OMIT_VALUE;
  RAW_Force_Omit field_4_force_omit(4, force_omit, MultiBlockAllocation_p0__present_descr_.raw->forceomit);
  decoded_field_length = field_p0__present.RAW_decode(MultiBlockAllocation_p0__present_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());
  if (limit > 0 && field_p0__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(5)) {
    field_p0 = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_5_force_omit(5, force_omit, MultiBlockAllocation_p0_descr_.raw->forceomit);
  decoded_field_length = field_p0().RAW_decode(MultiBlockAllocation_p0_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 1) {
  field_p0 = 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_p0=OMIT_VALUE;
  if (limit > 0 && field_p0__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(6)) {
    field_reserved = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_6_force_omit(6, force_omit, MultiBlockAllocation_reserved_descr_.raw->forceomit);
  decoded_field_length = field_reserved().RAW_decode(MultiBlockAllocation_reserved_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_6_force_omit);
  if (decoded_field_length < 1) {
  field_reserved = 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_reserved=OMIT_VALUE;
  if (limit > 0 && field_p0__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(7)) {
    field_pr__mode = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_7_force_omit(7, force_omit, MultiBlockAllocation_pr__mode_descr_.raw->forceomit);
  decoded_field_length = field_pr__mode().RAW_decode(MultiBlockAllocation_pr__mode_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_7_force_omit);
  if (decoded_field_length < 1) {
  field_pr__mode = 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_pr__mode=OMIT_VALUE;
  RAW_Force_Omit field_8_force_omit(8, force_omit, MultiBlockAllocation_tbf__starting__time_descr_.raw->forceomit);
  decoded_field_length = field_tbf__starting__time.RAW_decode(MultiBlockAllocation_tbf__starting__time_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, MultiBlockAllocation_num__radio__blocks__alloc_descr_.raw->forceomit);
  decoded_field_length = field_num__radio__blocks__alloc.RAW_decode(MultiBlockAllocation_num__radio__blocks__alloc_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 MultiBlockAllocation::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, MultiBlockAllocation_timeslot__nr_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, MultiBlockAllocation_alpha__gamma__present_descr_.raw);
  if (field_alpha.ispresent()) {
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, MultiBlockAllocation_alpha_descr_.raw);
  }
  else myleaf.body.node.nodes[2] = NULL;
  if (field_gamma__tn.ispresent()) {
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, MultiBlockAllocation_gamma__tn_descr_.raw);
  }
  else myleaf.body.node.nodes[3] = NULL;
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, MultiBlockAllocation_p0__present_descr_.raw);
  if (field_p0.ispresent()) {
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, MultiBlockAllocation_p0_descr_.raw);
  }
  else myleaf.body.node.nodes[5] = NULL;
  if (field_reserved.ispresent()) {
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, MultiBlockAllocation_reserved_descr_.raw);
  }
  else myleaf.body.node.nodes[6] = NULL;
  if (field_pr__mode.ispresent()) {
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, MultiBlockAllocation_pr__mode_descr_.raw);
  }
  else myleaf.body.node.nodes[7] = NULL;
  myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, MultiBlockAllocation_tbf__starting__time_descr_.raw);
  myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, MultiBlockAllocation_num__radio__blocks__alloc_descr_.raw);
  encoded_length += field_timeslot__nr.RAW_encode(MultiBlockAllocation_timeslot__nr_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_alpha__gamma__present.RAW_encode(MultiBlockAllocation_alpha__gamma__present_descr_, *myleaf.body.node.nodes[1]);
  if (field_alpha.ispresent()) {
  encoded_length += field_alpha().RAW_encode(MultiBlockAllocation_alpha_descr_, *myleaf.body.node.nodes[2]);
  }
  if (field_gamma__tn.ispresent()) {
  encoded_length += field_gamma__tn().RAW_encode(MultiBlockAllocation_gamma__tn_descr_, *myleaf.body.node.nodes[3]);
  }
  encoded_length += field_p0__present.RAW_encode(MultiBlockAllocation_p0__present_descr_, *myleaf.body.node.nodes[4]);
  if (field_p0.ispresent()) {
  encoded_length += field_p0().RAW_encode(MultiBlockAllocation_p0_descr_, *myleaf.body.node.nodes[5]);
  }
  if (field_reserved.ispresent()) {
  encoded_length += field_reserved().RAW_encode(MultiBlockAllocation_reserved_descr_, *myleaf.body.node.nodes[6]);
  }
  if (field_pr__mode.ispresent()) {
  encoded_length += field_pr__mode().RAW_encode(MultiBlockAllocation_pr__mode_descr_, *myleaf.body.node.nodes[7]);
  }
  encoded_length += field_tbf__starting__time.RAW_encode(MultiBlockAllocation_tbf__starting__time_descr_, *myleaf.body.node.nodes[8]);
  encoded_length += field_num__radio__blocks__alloc.RAW_encode(MultiBlockAllocation_num__radio__blocks__alloc_descr_, *myleaf.body.node.nodes[9]);
  if (field_alpha.ispresent() && (field_alpha__gamma__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={1};
  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(MultiBlockAllocation_alpha__gamma__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_gamma__tn.ispresent() && (field_alpha__gamma__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={1};
  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(MultiBlockAllocation_alpha__gamma__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_p0.ispresent() && (field_p0__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={4};
  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(MultiBlockAllocation_p0__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_reserved.ispresent() && (field_p0__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={4};
  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(MultiBlockAllocation_p0__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_pr__mode.ispresent() && (field_p0__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={4};
  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(MultiBlockAllocation_p0__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);
  }
  }
  return myleaf.length = encoded_length;
}

struct MultiBlockAllocation_template::single_value_struct {
INTEGER_template field_timeslot__nr;
BITSTRING_template field_alpha__gamma__present;
INTEGER_template field_alpha;
INTEGER_template field_gamma__tn;
BITSTRING_template field_p0__present;
INTEGER_template field_p0;
BITSTRING_template field_reserved;
BITSTRING_template field_pr__mode;
StartingFnDesc_template field_tbf__starting__time;
INTEGER_template field_num__radio__blocks__alloc;
};

void MultiBlockAllocation_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_timeslot__nr = ANY_VALUE;
single_value->field_alpha__gamma__present = ANY_VALUE;
single_value->field_alpha = ANY_OR_OMIT;
single_value->field_gamma__tn = ANY_OR_OMIT;
single_value->field_p0__present = ANY_VALUE;
single_value->field_p0 = ANY_OR_OMIT;
single_value->field_reserved = ANY_OR_OMIT;
single_value->field_pr__mode = ANY_OR_OMIT;
single_value->field_tbf__starting__time = ANY_VALUE;
single_value->field_num__radio__blocks__alloc = ANY_VALUE;
}
}
}

void MultiBlockAllocation_template::copy_value(const MultiBlockAllocation& other_value)
{
single_value = new single_value_struct;
if (other_value.timeslot__nr().is_bound()) {
  single_value->field_timeslot__nr = other_value.timeslot__nr();
} else {
  single_value->field_timeslot__nr.clean_up();
}
if (other_value.alpha__gamma__present().is_bound()) {
  single_value->field_alpha__gamma__present = other_value.alpha__gamma__present();
} else {
  single_value->field_alpha__gamma__present.clean_up();
}
if (other_value.alpha().is_bound()) {
  if (other_value.alpha().ispresent()) single_value->field_alpha = other_value.alpha()();
  else single_value->field_alpha = OMIT_VALUE;
} else {
  single_value->field_alpha.clean_up();
}
if (other_value.gamma__tn().is_bound()) {
  if (other_value.gamma__tn().ispresent()) single_value->field_gamma__tn = other_value.gamma__tn()();
  else single_value->field_gamma__tn = OMIT_VALUE;
} else {
  single_value->field_gamma__tn.clean_up();
}
if (other_value.p0__present().is_bound()) {
  single_value->field_p0__present = other_value.p0__present();
} else {
  single_value->field_p0__present.clean_up();
}
if (other_value.p0().is_bound()) {
  if (other_value.p0().ispresent()) single_value->field_p0 = other_value.p0()();
  else single_value->field_p0 = OMIT_VALUE;
} else {
  single_value->field_p0.clean_up();
}
if (other_value.reserved().is_bound()) {
  if (other_value.reserved().ispresent()) single_value->field_reserved = other_value.reserved()();
  else single_value->field_reserved = OMIT_VALUE;
} else {
  single_value->field_reserved.clean_up();
}
if (other_value.pr__mode().is_bound()) {
  if (other_value.pr__mode().ispresent()) single_value->field_pr__mode = other_value.pr__mode()();
  else single_value->field_pr__mode = OMIT_VALUE;
} else {
  single_value->field_pr__mode.clean_up();
}
if (other_value.tbf__starting__time().is_bound()) {
  single_value->field_tbf__starting__time = other_value.tbf__starting__time();
} else {
  single_value->field_tbf__starting__time.clean_up();
}
if (other_value.num__radio__blocks__alloc().is_bound()) {
  single_value->field_num__radio__blocks__alloc = other_value.num__radio__blocks__alloc();
} else {
  single_value->field_num__radio__blocks__alloc.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void MultiBlockAllocation_template::copy_template(const MultiBlockAllocation_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.timeslot__nr().get_selection()) {
single_value->field_timeslot__nr = other_value.timeslot__nr();
} else {
single_value->field_timeslot__nr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.alpha__gamma__present().get_selection()) {
single_value->field_alpha__gamma__present = other_value.alpha__gamma__present();
} else {
single_value->field_alpha__gamma__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.alpha().get_selection()) {
single_value->field_alpha = other_value.alpha();
} else {
single_value->field_alpha.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.gamma__tn().get_selection()) {
single_value->field_gamma__tn = other_value.gamma__tn();
} else {
single_value->field_gamma__tn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.p0__present().get_selection()) {
single_value->field_p0__present = other_value.p0__present();
} else {
single_value->field_p0__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.p0().get_selection()) {
single_value->field_p0 = other_value.p0();
} else {
single_value->field_p0.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.reserved().get_selection()) {
single_value->field_reserved = other_value.reserved();
} else {
single_value->field_reserved.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pr__mode().get_selection()) {
single_value->field_pr__mode = other_value.pr__mode();
} else {
single_value->field_pr__mode.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tbf__starting__time().get_selection()) {
single_value->field_tbf__starting__time = other_value.tbf__starting__time();
} else {
single_value->field_tbf__starting__time.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.num__radio__blocks__alloc().get_selection()) {
single_value->field_num__radio__blocks__alloc = other_value.num__radio__blocks__alloc();
} else {
single_value->field_num__radio__blocks__alloc.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 MultiBlockAllocation_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 MultiBlockAllocation_template(*other_value.implication_.precondition);
implication_.implied_template = new MultiBlockAllocation_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_CSN1_Types.MultiBlockAllocation.");
break;
}
set_selection(other_value);
}

MultiBlockAllocation_template::MultiBlockAllocation_template()
{
}

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

MultiBlockAllocation_template::MultiBlockAllocation_template(const MultiBlockAllocation& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean MultiBlockAllocation_template::match(const MultiBlockAllocation& 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.timeslot__nr().is_bound()) return FALSE;
if(!single_value->field_timeslot__nr.match(other_value.timeslot__nr(), legacy))return FALSE;
if(!other_value.alpha__gamma__present().is_bound()) return FALSE;
if(!single_value->field_alpha__gamma__present.match(other_value.alpha__gamma__present(), legacy))return FALSE;
if(!other_value.alpha().is_bound()) return FALSE;
if((other_value.alpha().ispresent() ? !single_value->field_alpha.match((const INTEGER&)other_value.alpha(), legacy) : !single_value->field_alpha.match_omit(legacy)))return FALSE;
if(!other_value.gamma__tn().is_bound()) return FALSE;
if((other_value.gamma__tn().ispresent() ? !single_value->field_gamma__tn.match((const INTEGER&)other_value.gamma__tn(), legacy) : !single_value->field_gamma__tn.match_omit(legacy)))return FALSE;
if(!other_value.p0__present().is_bound()) return FALSE;
if(!single_value->field_p0__present.match(other_value.p0__present(), legacy))return FALSE;
if(!other_value.p0().is_bound()) return FALSE;
if((other_value.p0().ispresent() ? !single_value->field_p0.match((const INTEGER&)other_value.p0(), legacy) : !single_value->field_p0.match_omit(legacy)))return FALSE;
if(!other_value.reserved().is_bound()) return FALSE;
if((other_value.reserved().ispresent() ? !single_value->field_reserved.match((const BITSTRING&)other_value.reserved(), legacy) : !single_value->field_reserved.match_omit(legacy)))return FALSE;
if(!other_value.pr__mode().is_bound()) return FALSE;
if((other_value.pr__mode().ispresent() ? !single_value->field_pr__mode.match((const BITSTRING&)other_value.pr__mode(), legacy) : !single_value->field_pr__mode.match_omit(legacy)))return FALSE;
if(!other_value.tbf__starting__time().is_bound()) return FALSE;
if(!single_value->field_tbf__starting__time.match(other_value.tbf__starting__time(), legacy))return FALSE;
if(!other_value.num__radio__blocks__alloc().is_bound()) return FALSE;
if(!single_value->field_num__radio__blocks__alloc.match(other_value.num__radio__blocks__alloc(), 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_CSN1_Types.MultiBlockAllocation.");
}
return FALSE;
}

boolean MultiBlockAllocation_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_timeslot__nr.is_bound()
 || single_value->field_alpha__gamma__present.is_bound()
 || (single_value->field_alpha.is_omit() || single_value->field_alpha.is_bound())
 || (single_value->field_gamma__tn.is_omit() || single_value->field_gamma__tn.is_bound())
 || single_value->field_p0__present.is_bound()
 || (single_value->field_p0.is_omit() || single_value->field_p0.is_bound())
 || (single_value->field_reserved.is_omit() || single_value->field_reserved.is_bound())
 || (single_value->field_pr__mode.is_omit() || single_value->field_pr__mode.is_bound())
 || single_value->field_tbf__starting__time.is_bound()
 || single_value->field_num__radio__blocks__alloc.is_bound();
}

boolean MultiBlockAllocation_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_timeslot__nr.is_value()
 && single_value->field_alpha__gamma__present.is_value()
 && (single_value->field_alpha.is_omit() || single_value->field_alpha.is_value())
 && (single_value->field_gamma__tn.is_omit() || single_value->field_gamma__tn.is_value())
 && single_value->field_p0__present.is_value()
 && (single_value->field_p0.is_omit() || single_value->field_p0.is_value())
 && (single_value->field_reserved.is_omit() || single_value->field_reserved.is_value())
 && (single_value->field_pr__mode.is_omit() || single_value->field_pr__mode.is_value())
 && single_value->field_tbf__starting__time.is_value()
 && single_value->field_num__radio__blocks__alloc.is_value();
}

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

MultiBlockAllocation MultiBlockAllocation_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_CSN1_Types.MultiBlockAllocation.");
MultiBlockAllocation ret_val;
if (single_value->field_timeslot__nr.is_bound()) {
ret_val.timeslot__nr() = single_value->field_timeslot__nr.valueof();
}
if (single_value->field_alpha__gamma__present.is_bound()) {
ret_val.alpha__gamma__present() = single_value->field_alpha__gamma__present.valueof();
}
if (single_value->field_alpha.is_omit()) ret_val.alpha() = OMIT_VALUE;
else if (single_value->field_alpha.is_bound()) {
ret_val.alpha() = single_value->field_alpha.valueof();
}
if (single_value->field_gamma__tn.is_omit()) ret_val.gamma__tn() = OMIT_VALUE;
else if (single_value->field_gamma__tn.is_bound()) {
ret_val.gamma__tn() = single_value->field_gamma__tn.valueof();
}
if (single_value->field_p0__present.is_bound()) {
ret_val.p0__present() = single_value->field_p0__present.valueof();
}
if (single_value->field_p0.is_omit()) ret_val.p0() = OMIT_VALUE;
else if (single_value->field_p0.is_bound()) {
ret_val.p0() = single_value->field_p0.valueof();
}
if (single_value->field_reserved.is_omit()) ret_val.reserved() = OMIT_VALUE;
else if (single_value->field_reserved.is_bound()) {
ret_val.reserved() = single_value->field_reserved.valueof();
}
if (single_value->field_pr__mode.is_omit()) ret_val.pr__mode() = OMIT_VALUE;
else if (single_value->field_pr__mode.is_bound()) {
ret_val.pr__mode() = single_value->field_pr__mode.valueof();
}
if (single_value->field_tbf__starting__time.is_bound()) {
ret_val.tbf__starting__time() = single_value->field_tbf__starting__time.valueof();
}
if (single_value->field_num__radio__blocks__alloc.is_bound()) {
ret_val.num__radio__blocks__alloc() = single_value->field_num__radio__blocks__alloc.valueof();
}
return ret_val;
}

void MultiBlockAllocation_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_CSN1_Types.MultiBlockAllocation.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new MultiBlockAllocation_template[list_length];
}

MultiBlockAllocation_template& MultiBlockAllocation_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_CSN1_Types.MultiBlockAllocation.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.MultiBlockAllocation.");
return value_list.list_value[list_index];
}

INTEGER_template& MultiBlockAllocation_template::timeslot__nr()
{
set_specific();
return single_value->field_timeslot__nr;
}

const INTEGER_template& MultiBlockAllocation_template::timeslot__nr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field timeslot_nr of a non-specific template of type @RLCMAC_CSN1_Types.MultiBlockAllocation.");
return single_value->field_timeslot__nr;
}

BITSTRING_template& MultiBlockAllocation_template::alpha__gamma__present()
{
set_specific();
return single_value->field_alpha__gamma__present;
}

const BITSTRING_template& MultiBlockAllocation_template::alpha__gamma__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field alpha_gamma_present of a non-specific template of type @RLCMAC_CSN1_Types.MultiBlockAllocation.");
return single_value->field_alpha__gamma__present;
}

INTEGER_template& MultiBlockAllocation_template::alpha()
{
set_specific();
return single_value->field_alpha;
}

const INTEGER_template& MultiBlockAllocation_template::alpha() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field alpha of a non-specific template of type @RLCMAC_CSN1_Types.MultiBlockAllocation.");
return single_value->field_alpha;
}

INTEGER_template& MultiBlockAllocation_template::gamma__tn()
{
set_specific();
return single_value->field_gamma__tn;
}

const INTEGER_template& MultiBlockAllocation_template::gamma__tn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field gamma_tn of a non-specific template of type @RLCMAC_CSN1_Types.MultiBlockAllocation.");
return single_value->field_gamma__tn;
}

BITSTRING_template& MultiBlockAllocation_template::p0__present()
{
set_specific();
return single_value->field_p0__present;
}

const BITSTRING_template& MultiBlockAllocation_template::p0__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field p0_present of a non-specific template of type @RLCMAC_CSN1_Types.MultiBlockAllocation.");
return single_value->field_p0__present;
}

INTEGER_template& MultiBlockAllocation_template::p0()
{
set_specific();
return single_value->field_p0;
}

const INTEGER_template& MultiBlockAllocation_template::p0() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field p0 of a non-specific template of type @RLCMAC_CSN1_Types.MultiBlockAllocation.");
return single_value->field_p0;
}

BITSTRING_template& MultiBlockAllocation_template::reserved()
{
set_specific();
return single_value->field_reserved;
}

const BITSTRING_template& MultiBlockAllocation_template::reserved() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field reserved of a non-specific template of type @RLCMAC_CSN1_Types.MultiBlockAllocation.");
return single_value->field_reserved;
}

BITSTRING_template& MultiBlockAllocation_template::pr__mode()
{
set_specific();
return single_value->field_pr__mode;
}

const BITSTRING_template& MultiBlockAllocation_template::pr__mode() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pr_mode of a non-specific template of type @RLCMAC_CSN1_Types.MultiBlockAllocation.");
return single_value->field_pr__mode;
}

StartingFnDesc_template& MultiBlockAllocation_template::tbf__starting__time()
{
set_specific();
return single_value->field_tbf__starting__time;
}

const StartingFnDesc_template& MultiBlockAllocation_template::tbf__starting__time() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tbf_starting_time of a non-specific template of type @RLCMAC_CSN1_Types.MultiBlockAllocation.");
return single_value->field_tbf__starting__time;
}

INTEGER_template& MultiBlockAllocation_template::num__radio__blocks__alloc()
{
set_specific();
return single_value->field_num__radio__blocks__alloc;
}

const INTEGER_template& MultiBlockAllocation_template::num__radio__blocks__alloc() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field num_radio_blocks_alloc of a non-specific template of type @RLCMAC_CSN1_Types.MultiBlockAllocation.");
return single_value->field_num__radio__blocks__alloc;
}

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

void MultiBlockAllocation_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ timeslot_nr := ");
single_value->field_timeslot__nr.log();
TTCN_Logger::log_event_str(", alpha_gamma_present := ");
single_value->field_alpha__gamma__present.log();
TTCN_Logger::log_event_str(", alpha := ");
single_value->field_alpha.log();
TTCN_Logger::log_event_str(", gamma_tn := ");
single_value->field_gamma__tn.log();
TTCN_Logger::log_event_str(", p0_present := ");
single_value->field_p0__present.log();
TTCN_Logger::log_event_str(", p0 := ");
single_value->field_p0.log();
TTCN_Logger::log_event_str(", reserved := ");
single_value->field_reserved.log();
TTCN_Logger::log_event_str(", pr_mode := ");
single_value->field_pr__mode.log();
TTCN_Logger::log_event_str(", tbf_starting_time := ");
single_value->field_tbf__starting__time.log();
TTCN_Logger::log_event_str(", num_radio_blocks_alloc := ");
single_value->field_num__radio__blocks__alloc.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 MultiBlockAllocation_template::log_match(const MultiBlockAllocation& 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_timeslot__nr.match(match_value.timeslot__nr(), legacy)){
TTCN_Logger::log_logmatch_info(".timeslot_nr");
single_value->field_timeslot__nr.log_match(match_value.timeslot__nr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_alpha__gamma__present.match(match_value.alpha__gamma__present(), legacy)){
TTCN_Logger::log_logmatch_info(".alpha_gamma_present");
single_value->field_alpha__gamma__present.log_match(match_value.alpha__gamma__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.alpha().ispresent()){
if(!single_value->field_alpha.match(match_value.alpha(), legacy)){
TTCN_Logger::log_logmatch_info(".alpha");
single_value->field_alpha.log_match(match_value.alpha(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_alpha.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".alpha := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_alpha.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.gamma__tn().ispresent()){
if(!single_value->field_gamma__tn.match(match_value.gamma__tn(), legacy)){
TTCN_Logger::log_logmatch_info(".gamma_tn");
single_value->field_gamma__tn.log_match(match_value.gamma__tn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_gamma__tn.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".gamma_tn := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_gamma__tn.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_p0__present.match(match_value.p0__present(), legacy)){
TTCN_Logger::log_logmatch_info(".p0_present");
single_value->field_p0__present.log_match(match_value.p0__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.p0().ispresent()){
if(!single_value->field_p0.match(match_value.p0(), legacy)){
TTCN_Logger::log_logmatch_info(".p0");
single_value->field_p0.log_match(match_value.p0(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_p0.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".p0 := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_p0.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.reserved().ispresent()){
if(!single_value->field_reserved.match(match_value.reserved(), legacy)){
TTCN_Logger::log_logmatch_info(".reserved");
single_value->field_reserved.log_match(match_value.reserved(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_reserved.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".reserved := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_reserved.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.pr__mode().ispresent()){
if(!single_value->field_pr__mode.match(match_value.pr__mode(), legacy)){
TTCN_Logger::log_logmatch_info(".pr_mode");
single_value->field_pr__mode.log_match(match_value.pr__mode(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_pr__mode.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".pr_mode := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_pr__mode.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_tbf__starting__time.match(match_value.tbf__starting__time(), legacy)){
TTCN_Logger::log_logmatch_info(".tbf_starting_time");
single_value->field_tbf__starting__time.log_match(match_value.tbf__starting__time(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_num__radio__blocks__alloc.match(match_value.num__radio__blocks__alloc(), legacy)){
TTCN_Logger::log_logmatch_info(".num_radio_blocks_alloc");
single_value->field_num__radio__blocks__alloc.log_match(match_value.num__radio__blocks__alloc(), 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("{ timeslot_nr := ");
single_value->field_timeslot__nr.log_match(match_value.timeslot__nr(), legacy);
TTCN_Logger::log_event_str(", alpha_gamma_present := ");
single_value->field_alpha__gamma__present.log_match(match_value.alpha__gamma__present(), legacy);
TTCN_Logger::log_event_str(", alpha := ");
if (match_value.alpha().ispresent()) {
single_value->field_alpha.log_match(match_value.alpha(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_alpha.log();
if (single_value->field_alpha.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", gamma_tn := ");
if (match_value.gamma__tn().ispresent()) {
single_value->field_gamma__tn.log_match(match_value.gamma__tn(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_gamma__tn.log();
if (single_value->field_gamma__tn.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", p0_present := ");
single_value->field_p0__present.log_match(match_value.p0__present(), legacy);
TTCN_Logger::log_event_str(", p0 := ");
if (match_value.p0().ispresent()) {
single_value->field_p0.log_match(match_value.p0(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_p0.log();
if (single_value->field_p0.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", reserved := ");
if (match_value.reserved().ispresent()) {
single_value->field_reserved.log_match(match_value.reserved(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_reserved.log();
if (single_value->field_reserved.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", pr_mode := ");
if (match_value.pr__mode().ispresent()) {
single_value->field_pr__mode.log_match(match_value.pr__mode(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_pr__mode.log();
if (single_value->field_pr__mode.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", tbf_starting_time := ");
single_value->field_tbf__starting__time.log_match(match_value.tbf__starting__time(), legacy);
TTCN_Logger::log_event_str(", num_radio_blocks_alloc := ");
single_value->field_num__radio__blocks__alloc.log_match(match_value.num__radio__blocks__alloc(), 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 MultiBlockAllocation_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (timeslot__nr().is_bound()) timeslot__nr().set_implicit_omit();
if (alpha__gamma__present().is_bound()) alpha__gamma__present().set_implicit_omit();
if (!alpha().is_bound()) alpha() = OMIT_VALUE;
else alpha().set_implicit_omit();
if (!gamma__tn().is_bound()) gamma__tn() = OMIT_VALUE;
else gamma__tn().set_implicit_omit();
if (p0__present().is_bound()) p0__present().set_implicit_omit();
if (!p0().is_bound()) p0() = OMIT_VALUE;
else p0().set_implicit_omit();
if (!reserved().is_bound()) reserved() = OMIT_VALUE;
else reserved().set_implicit_omit();
if (!pr__mode().is_bound()) pr__mode() = OMIT_VALUE;
else pr__mode().set_implicit_omit();
if (tbf__starting__time().is_bound()) tbf__starting__time().set_implicit_omit();
if (num__radio__blocks__alloc().is_bound()) num__radio__blocks__alloc().set_implicit_omit();
}

void MultiBlockAllocation_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_timeslot__nr.encode_text(text_buf);
single_value->field_alpha__gamma__present.encode_text(text_buf);
single_value->field_alpha.encode_text(text_buf);
single_value->field_gamma__tn.encode_text(text_buf);
single_value->field_p0__present.encode_text(text_buf);
single_value->field_p0.encode_text(text_buf);
single_value->field_reserved.encode_text(text_buf);
single_value->field_pr__mode.encode_text(text_buf);
single_value->field_tbf__starting__time.encode_text(text_buf);
single_value->field_num__radio__blocks__alloc.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_CSN1_Types.MultiBlockAllocation.");
}
}

void MultiBlockAllocation_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_timeslot__nr.decode_text(text_buf);
single_value->field_alpha__gamma__present.decode_text(text_buf);
single_value->field_alpha.decode_text(text_buf);
single_value->field_gamma__tn.decode_text(text_buf);
single_value->field_p0__present.decode_text(text_buf);
single_value->field_p0.decode_text(text_buf);
single_value->field_reserved.decode_text(text_buf);
single_value->field_pr__mode.decode_text(text_buf);
single_value->field_tbf__starting__time.decode_text(text_buf);
single_value->field_num__radio__blocks__alloc.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 MultiBlockAllocation_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_CSN1_Types.MultiBlockAllocation.");
}
}

void MultiBlockAllocation_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: {
    MultiBlockAllocation_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_CSN1_Types.MultiBlockAllocation 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) timeslot__nr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) alpha__gamma__present().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) alpha().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) gamma__tn().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) p0__present().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) p0().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) reserved().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) pr__mode().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) tbf__starting__time().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) num__radio__blocks__alloc().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(), "timeslot_nr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          timeslot__nr().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "alpha_gamma_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          alpha__gamma__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(), "alpha")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          alpha().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gamma_tn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gamma__tn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "p0_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          p0__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(), "p0")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          p0().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "reserved")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          reserved().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pr__mode().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tbf_starting_time")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tbf__starting__time().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "num_radio_blocks_alloc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          num__radio__blocks__alloc().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_CSN1_Types.MultiBlockAllocation: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    MultiBlockAllocation_template* precondition = new MultiBlockAllocation_template;
    precondition->set_param(*param.get_elem(0));
    MultiBlockAllocation_template* implied_template = new MultiBlockAllocation_template;
    implied_template->set_param(*param.get_elem(1));
    *this = MultiBlockAllocation_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.MultiBlockAllocation");
  }
  is_ifpresent = param.get_ifpresent();
}

void MultiBlockAllocation_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_timeslot__nr.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.MultiBlockAllocation");
single_value->field_alpha__gamma__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.MultiBlockAllocation");
single_value->field_alpha.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.MultiBlockAllocation");
single_value->field_gamma__tn.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.MultiBlockAllocation");
single_value->field_p0__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.MultiBlockAllocation");
single_value->field_p0.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.MultiBlockAllocation");
single_value->field_reserved.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.MultiBlockAllocation");
single_value->field_pr__mode.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.MultiBlockAllocation");
single_value->field_tbf__starting__time.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.MultiBlockAllocation");
single_value->field_num__radio__blocks__alloc.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.MultiBlockAllocation");
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_CSN1_Types.MultiBlockAllocation");
}

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

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

PktUlAssEgprs::PktUlAssEgprs()
{
}

PktUlAssEgprs::PktUlAssEgprs(const BITSTRING& par_dual__carrier,
    const BITSTRING& par_tlli__present,
    const OPTIONAL< OCTETSTRING >& par_tlli,
    const BITSTRING& par_compact__reduced__ma__present,
    const OPTIONAL< COMPACTreducedMA >& par_compact__reduced__ma,
    const EgprsChCodingCommand& par_chan__coding__cmd,
    const BITSTRING& par_resegment,
    const EgprsWindowSize& par_window__size,
    const BITSTRING& par_ats__present,
    const OPTIONAL< AccessTechnologiesRequestRepetition >& par_ats,
    const BITSTRING& par_arac__retrans__req,
    const BITSTRING& par_tlli__block__chan__coding,
    const BITSTRING& par_bep__period2__present,
    const OPTIONAL< BITSTRING >& par_bep__period2,
    const PacketTimingAdvance& par_pkt__ta,
    const BITSTRING& par_pkt__ext__ta__present,
    const OPTIONAL< BITSTRING >& par_pkt__ext__ta,
    const BITSTRING& par_freq__par__present,
    const OPTIONAL< FrequencyParameters >& par_freq__par,
    const BITSTRING& par_alloc__present,
    const OPTIONAL< DynamicAllocation >& par_dyn__block__alloc,
    const OPTIONAL< MultiBlockAllocation >& par_multi__block__alloc)
  :   field_dual__carrier(par_dual__carrier),
  field_tlli__present(par_tlli__present),
  field_tlli(par_tlli),
  field_compact__reduced__ma__present(par_compact__reduced__ma__present),
  field_compact__reduced__ma(par_compact__reduced__ma),
  field_chan__coding__cmd(par_chan__coding__cmd),
  field_resegment(par_resegment),
  field_window__size(par_window__size),
  field_ats__present(par_ats__present),
  field_ats(par_ats),
  field_arac__retrans__req(par_arac__retrans__req),
  field_tlli__block__chan__coding(par_tlli__block__chan__coding),
  field_bep__period2__present(par_bep__period2__present),
  field_bep__period2(par_bep__period2),
  field_pkt__ta(par_pkt__ta),
  field_pkt__ext__ta__present(par_pkt__ext__ta__present),
  field_pkt__ext__ta(par_pkt__ext__ta),
  field_freq__par__present(par_freq__par__present),
  field_freq__par(par_freq__par),
  field_alloc__present(par_alloc__present),
  field_dyn__block__alloc(par_dyn__block__alloc),
  field_multi__block__alloc(par_multi__block__alloc)
{
}

PktUlAssEgprs::PktUlAssEgprs(const PktUlAssEgprs& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
if (other_value.dual__carrier().is_bound()) field_dual__carrier = other_value.dual__carrier();
else field_dual__carrier.clean_up();
if (other_value.tlli__present().is_bound()) field_tlli__present = other_value.tlli__present();
else field_tlli__present.clean_up();
if (other_value.tlli().is_bound()) field_tlli = other_value.tlli();
else field_tlli.clean_up();
if (other_value.compact__reduced__ma__present().is_bound()) field_compact__reduced__ma__present = other_value.compact__reduced__ma__present();
else field_compact__reduced__ma__present.clean_up();
if (other_value.compact__reduced__ma().is_bound()) field_compact__reduced__ma = other_value.compact__reduced__ma();
else field_compact__reduced__ma.clean_up();
if (other_value.chan__coding__cmd().is_bound()) field_chan__coding__cmd = other_value.chan__coding__cmd();
else field_chan__coding__cmd.clean_up();
if (other_value.resegment().is_bound()) field_resegment = other_value.resegment();
else field_resegment.clean_up();
if (other_value.window__size().is_bound()) field_window__size = other_value.window__size();
else field_window__size.clean_up();
if (other_value.ats__present().is_bound()) field_ats__present = other_value.ats__present();
else field_ats__present.clean_up();
if (other_value.ats().is_bound()) field_ats = other_value.ats();
else field_ats.clean_up();
if (other_value.arac__retrans__req().is_bound()) field_arac__retrans__req = other_value.arac__retrans__req();
else field_arac__retrans__req.clean_up();
if (other_value.tlli__block__chan__coding().is_bound()) field_tlli__block__chan__coding = other_value.tlli__block__chan__coding();
else field_tlli__block__chan__coding.clean_up();
if (other_value.bep__period2__present().is_bound()) field_bep__period2__present = other_value.bep__period2__present();
else field_bep__period2__present.clean_up();
if (other_value.bep__period2().is_bound()) field_bep__period2 = other_value.bep__period2();
else field_bep__period2.clean_up();
if (other_value.pkt__ta().is_bound()) field_pkt__ta = other_value.pkt__ta();
else field_pkt__ta.clean_up();
if (other_value.pkt__ext__ta__present().is_bound()) field_pkt__ext__ta__present = other_value.pkt__ext__ta__present();
else field_pkt__ext__ta__present.clean_up();
if (other_value.pkt__ext__ta().is_bound()) field_pkt__ext__ta = other_value.pkt__ext__ta();
else field_pkt__ext__ta.clean_up();
if (other_value.freq__par__present().is_bound()) field_freq__par__present = other_value.freq__par__present();
else field_freq__par__present.clean_up();
if (other_value.freq__par().is_bound()) field_freq__par = other_value.freq__par();
else field_freq__par.clean_up();
if (other_value.alloc__present().is_bound()) field_alloc__present = other_value.alloc__present();
else field_alloc__present.clean_up();
if (other_value.dyn__block__alloc().is_bound()) field_dyn__block__alloc = other_value.dyn__block__alloc();
else field_dyn__block__alloc.clean_up();
if (other_value.multi__block__alloc().is_bound()) field_multi__block__alloc = other_value.multi__block__alloc();
else field_multi__block__alloc.clean_up();
}

void PktUlAssEgprs::clean_up()
{
field_dual__carrier.clean_up();
field_tlli__present.clean_up();
field_tlli.clean_up();
field_compact__reduced__ma__present.clean_up();
field_compact__reduced__ma.clean_up();
field_chan__coding__cmd.clean_up();
field_resegment.clean_up();
field_window__size.clean_up();
field_ats__present.clean_up();
field_ats.clean_up();
field_arac__retrans__req.clean_up();
field_tlli__block__chan__coding.clean_up();
field_bep__period2__present.clean_up();
field_bep__period2.clean_up();
field_pkt__ta.clean_up();
field_pkt__ext__ta__present.clean_up();
field_pkt__ext__ta.clean_up();
field_freq__par__present.clean_up();
field_freq__par.clean_up();
field_alloc__present.clean_up();
field_dyn__block__alloc.clean_up();
field_multi__block__alloc.clean_up();
}

const TTCN_Typedescriptor_t* PktUlAssEgprs::get_descriptor() const { return &PktUlAssEgprs_descr_; }
PktUlAssEgprs& PktUlAssEgprs::operator=(const PktUlAssEgprs& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
  if (other_value.dual__carrier().is_bound()) field_dual__carrier = other_value.dual__carrier();
  else field_dual__carrier.clean_up();
  if (other_value.tlli__present().is_bound()) field_tlli__present = other_value.tlli__present();
  else field_tlli__present.clean_up();
  if (other_value.tlli().is_bound()) field_tlli = other_value.tlli();
  else field_tlli.clean_up();
  if (other_value.compact__reduced__ma__present().is_bound()) field_compact__reduced__ma__present = other_value.compact__reduced__ma__present();
  else field_compact__reduced__ma__present.clean_up();
  if (other_value.compact__reduced__ma().is_bound()) field_compact__reduced__ma = other_value.compact__reduced__ma();
  else field_compact__reduced__ma.clean_up();
  if (other_value.chan__coding__cmd().is_bound()) field_chan__coding__cmd = other_value.chan__coding__cmd();
  else field_chan__coding__cmd.clean_up();
  if (other_value.resegment().is_bound()) field_resegment = other_value.resegment();
  else field_resegment.clean_up();
  if (other_value.window__size().is_bound()) field_window__size = other_value.window__size();
  else field_window__size.clean_up();
  if (other_value.ats__present().is_bound()) field_ats__present = other_value.ats__present();
  else field_ats__present.clean_up();
  if (other_value.ats().is_bound()) field_ats = other_value.ats();
  else field_ats.clean_up();
  if (other_value.arac__retrans__req().is_bound()) field_arac__retrans__req = other_value.arac__retrans__req();
  else field_arac__retrans__req.clean_up();
  if (other_value.tlli__block__chan__coding().is_bound()) field_tlli__block__chan__coding = other_value.tlli__block__chan__coding();
  else field_tlli__block__chan__coding.clean_up();
  if (other_value.bep__period2__present().is_bound()) field_bep__period2__present = other_value.bep__period2__present();
  else field_bep__period2__present.clean_up();
  if (other_value.bep__period2().is_bound()) field_bep__period2 = other_value.bep__period2();
  else field_bep__period2.clean_up();
  if (other_value.pkt__ta().is_bound()) field_pkt__ta = other_value.pkt__ta();
  else field_pkt__ta.clean_up();
  if (other_value.pkt__ext__ta__present().is_bound()) field_pkt__ext__ta__present = other_value.pkt__ext__ta__present();
  else field_pkt__ext__ta__present.clean_up();
  if (other_value.pkt__ext__ta().is_bound()) field_pkt__ext__ta = other_value.pkt__ext__ta();
  else field_pkt__ext__ta.clean_up();
  if (other_value.freq__par__present().is_bound()) field_freq__par__present = other_value.freq__par__present();
  else field_freq__par__present.clean_up();
  if (other_value.freq__par().is_bound()) field_freq__par = other_value.freq__par();
  else field_freq__par.clean_up();
  if (other_value.alloc__present().is_bound()) field_alloc__present = other_value.alloc__present();
  else field_alloc__present.clean_up();
  if (other_value.dyn__block__alloc().is_bound()) field_dyn__block__alloc = other_value.dyn__block__alloc();
  else field_dyn__block__alloc.clean_up();
  if (other_value.multi__block__alloc().is_bound()) field_multi__block__alloc = other_value.multi__block__alloc();
  else field_multi__block__alloc.clean_up();
}
return *this;
}

boolean PktUlAssEgprs::operator==(const PktUlAssEgprs& other_value) const
{
return field_dual__carrier==other_value.field_dual__carrier
  && field_tlli__present==other_value.field_tlli__present
  && field_tlli==other_value.field_tlli
  && field_compact__reduced__ma__present==other_value.field_compact__reduced__ma__present
  && field_compact__reduced__ma==other_value.field_compact__reduced__ma
  && field_chan__coding__cmd==other_value.field_chan__coding__cmd
  && field_resegment==other_value.field_resegment
  && field_window__size==other_value.field_window__size
  && field_ats__present==other_value.field_ats__present
  && field_ats==other_value.field_ats
  && field_arac__retrans__req==other_value.field_arac__retrans__req
  && field_tlli__block__chan__coding==other_value.field_tlli__block__chan__coding
  && field_bep__period2__present==other_value.field_bep__period2__present
  && field_bep__period2==other_value.field_bep__period2
  && field_pkt__ta==other_value.field_pkt__ta
  && field_pkt__ext__ta__present==other_value.field_pkt__ext__ta__present
  && field_pkt__ext__ta==other_value.field_pkt__ext__ta
  && field_freq__par__present==other_value.field_freq__par__present
  && field_freq__par==other_value.field_freq__par
  && field_alloc__present==other_value.field_alloc__present
  && field_dyn__block__alloc==other_value.field_dyn__block__alloc
  && field_multi__block__alloc==other_value.field_multi__block__alloc;
}

boolean PktUlAssEgprs::is_bound() const
{
return (field_dual__carrier.is_bound())
  || (field_tlli__present.is_bound())
  || (OPTIONAL_OMIT == field_tlli.get_selection() || field_tlli.is_bound())
  || (field_compact__reduced__ma__present.is_bound())
  || (OPTIONAL_OMIT == field_compact__reduced__ma.get_selection() || field_compact__reduced__ma.is_bound())
  || (field_chan__coding__cmd.is_bound())
  || (field_resegment.is_bound())
  || (field_window__size.is_bound())
  || (field_ats__present.is_bound())
  || (OPTIONAL_OMIT == field_ats.get_selection() || field_ats.is_bound())
  || (field_arac__retrans__req.is_bound())
  || (field_tlli__block__chan__coding.is_bound())
  || (field_bep__period2__present.is_bound())
  || (OPTIONAL_OMIT == field_bep__period2.get_selection() || field_bep__period2.is_bound())
  || (field_pkt__ta.is_bound())
  || (field_pkt__ext__ta__present.is_bound())
  || (OPTIONAL_OMIT == field_pkt__ext__ta.get_selection() || field_pkt__ext__ta.is_bound())
  || (field_freq__par__present.is_bound())
  || (OPTIONAL_OMIT == field_freq__par.get_selection() || field_freq__par.is_bound())
  || (field_alloc__present.is_bound())
  || (OPTIONAL_OMIT == field_dyn__block__alloc.get_selection() || field_dyn__block__alloc.is_bound())
  || (OPTIONAL_OMIT == field_multi__block__alloc.get_selection() || field_multi__block__alloc.is_bound());
}
boolean PktUlAssEgprs::is_value() const
{
return field_dual__carrier.is_value()
  && field_tlli__present.is_value()
  && (OPTIONAL_OMIT == field_tlli.get_selection() || field_tlli.is_value())
  && field_compact__reduced__ma__present.is_value()
  && (OPTIONAL_OMIT == field_compact__reduced__ma.get_selection() || field_compact__reduced__ma.is_value())
  && field_chan__coding__cmd.is_value()
  && field_resegment.is_value()
  && field_window__size.is_value()
  && field_ats__present.is_value()
  && (OPTIONAL_OMIT == field_ats.get_selection() || field_ats.is_value())
  && field_arac__retrans__req.is_value()
  && field_tlli__block__chan__coding.is_value()
  && field_bep__period2__present.is_value()
  && (OPTIONAL_OMIT == field_bep__period2.get_selection() || field_bep__period2.is_value())
  && field_pkt__ta.is_value()
  && field_pkt__ext__ta__present.is_value()
  && (OPTIONAL_OMIT == field_pkt__ext__ta.get_selection() || field_pkt__ext__ta.is_value())
  && field_freq__par__present.is_value()
  && (OPTIONAL_OMIT == field_freq__par.get_selection() || field_freq__par.is_value())
  && field_alloc__present.is_value()
  && (OPTIONAL_OMIT == field_dyn__block__alloc.get_selection() || field_dyn__block__alloc.is_value())
  && (OPTIONAL_OMIT == field_multi__block__alloc.get_selection() || field_multi__block__alloc.is_value());
}
int PktUlAssEgprs::size_of() const
{
  int ret_val = 14;
  if (field_tlli.ispresent()) ret_val++;
  if (field_compact__reduced__ma.ispresent()) ret_val++;
  if (field_ats.ispresent()) ret_val++;
  if (field_bep__period2.ispresent()) ret_val++;
  if (field_pkt__ext__ta.ispresent()) ret_val++;
  if (field_freq__par.ispresent()) ret_val++;
  if (field_dyn__block__alloc.ispresent()) ret_val++;
  if (field_multi__block__alloc.ispresent()) ret_val++;
  return ret_val;
}

void PktUlAssEgprs::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ dual_carrier := ");
field_dual__carrier.log();
TTCN_Logger::log_event_str(", tlli_present := ");
field_tlli__present.log();
TTCN_Logger::log_event_str(", tlli := ");
field_tlli.log();
TTCN_Logger::log_event_str(", compact_reduced_ma_present := ");
field_compact__reduced__ma__present.log();
TTCN_Logger::log_event_str(", compact_reduced_ma := ");
field_compact__reduced__ma.log();
TTCN_Logger::log_event_str(", chan_coding_cmd := ");
field_chan__coding__cmd.log();
TTCN_Logger::log_event_str(", resegment := ");
field_resegment.log();
TTCN_Logger::log_event_str(", window_size := ");
field_window__size.log();
TTCN_Logger::log_event_str(", ats_present := ");
field_ats__present.log();
TTCN_Logger::log_event_str(", ats := ");
field_ats.log();
TTCN_Logger::log_event_str(", arac_retrans_req := ");
field_arac__retrans__req.log();
TTCN_Logger::log_event_str(", tlli_block_chan_coding := ");
field_tlli__block__chan__coding.log();
TTCN_Logger::log_event_str(", bep_period2_present := ");
field_bep__period2__present.log();
TTCN_Logger::log_event_str(", bep_period2 := ");
field_bep__period2.log();
TTCN_Logger::log_event_str(", pkt_ta := ");
field_pkt__ta.log();
TTCN_Logger::log_event_str(", pkt_ext_ta_present := ");
field_pkt__ext__ta__present.log();
TTCN_Logger::log_event_str(", pkt_ext_ta := ");
field_pkt__ext__ta.log();
TTCN_Logger::log_event_str(", freq_par_present := ");
field_freq__par__present.log();
TTCN_Logger::log_event_str(", freq_par := ");
field_freq__par.log();
TTCN_Logger::log_event_str(", alloc_present := ");
field_alloc__present.log();
TTCN_Logger::log_event_str(", dyn_block_alloc := ");
field_dyn__block__alloc.log();
TTCN_Logger::log_event_str(", multi_block_alloc := ");
field_multi__block__alloc.log();
TTCN_Logger::log_event_str(" }");
}

void PktUlAssEgprs::set_implicit_omit()
{
if (dual__carrier().is_bound()) dual__carrier().set_implicit_omit();
if (tlli__present().is_bound()) tlli__present().set_implicit_omit();
if (!tlli().is_bound()) tlli() = OMIT_VALUE;
else tlli().set_implicit_omit();
if (compact__reduced__ma__present().is_bound()) compact__reduced__ma__present().set_implicit_omit();
if (!compact__reduced__ma().is_bound()) compact__reduced__ma() = OMIT_VALUE;
else compact__reduced__ma().set_implicit_omit();
if (chan__coding__cmd().is_bound()) chan__coding__cmd().set_implicit_omit();
if (resegment().is_bound()) resegment().set_implicit_omit();
if (window__size().is_bound()) window__size().set_implicit_omit();
if (ats__present().is_bound()) ats__present().set_implicit_omit();
if (!ats().is_bound()) ats() = OMIT_VALUE;
else ats().set_implicit_omit();
if (arac__retrans__req().is_bound()) arac__retrans__req().set_implicit_omit();
if (tlli__block__chan__coding().is_bound()) tlli__block__chan__coding().set_implicit_omit();
if (bep__period2__present().is_bound()) bep__period2__present().set_implicit_omit();
if (!bep__period2().is_bound()) bep__period2() = OMIT_VALUE;
else bep__period2().set_implicit_omit();
if (pkt__ta().is_bound()) pkt__ta().set_implicit_omit();
if (pkt__ext__ta__present().is_bound()) pkt__ext__ta__present().set_implicit_omit();
if (!pkt__ext__ta().is_bound()) pkt__ext__ta() = OMIT_VALUE;
else pkt__ext__ta().set_implicit_omit();
if (freq__par__present().is_bound()) freq__par__present().set_implicit_omit();
if (!freq__par().is_bound()) freq__par() = OMIT_VALUE;
else freq__par().set_implicit_omit();
if (alloc__present().is_bound()) alloc__present().set_implicit_omit();
if (!dyn__block__alloc().is_bound()) dyn__block__alloc() = OMIT_VALUE;
else dyn__block__alloc().set_implicit_omit();
if (!multi__block__alloc().is_bound()) multi__block__alloc() = OMIT_VALUE;
else multi__block__alloc().set_implicit_omit();
}

void PktUlAssEgprs::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 (22<param.get_size()) {
      param.error("record value of type @RLCMAC_CSN1_Types.PktUlAssEgprs has 22 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) dual__carrier().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tlli__present().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) compact__reduced__ma__present().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) compact__reduced__ma().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) chan__coding__cmd().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) resegment().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) window__size().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) ats__present().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) ats().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) arac__retrans__req().set_param(*param.get_elem(10));
    if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) tlli__block__chan__coding().set_param(*param.get_elem(11));
    if (param.get_size()>12 && param.get_elem(12)->get_type()!=Module_Param::MP_NotUsed) bep__period2__present().set_param(*param.get_elem(12));
    if (param.get_size()>13 && param.get_elem(13)->get_type()!=Module_Param::MP_NotUsed) bep__period2().set_param(*param.get_elem(13));
    if (param.get_size()>14 && param.get_elem(14)->get_type()!=Module_Param::MP_NotUsed) pkt__ta().set_param(*param.get_elem(14));
    if (param.get_size()>15 && param.get_elem(15)->get_type()!=Module_Param::MP_NotUsed) pkt__ext__ta__present().set_param(*param.get_elem(15));
    if (param.get_size()>16 && param.get_elem(16)->get_type()!=Module_Param::MP_NotUsed) pkt__ext__ta().set_param(*param.get_elem(16));
    if (param.get_size()>17 && param.get_elem(17)->get_type()!=Module_Param::MP_NotUsed) freq__par__present().set_param(*param.get_elem(17));
    if (param.get_size()>18 && param.get_elem(18)->get_type()!=Module_Param::MP_NotUsed) freq__par().set_param(*param.get_elem(18));
    if (param.get_size()>19 && param.get_elem(19)->get_type()!=Module_Param::MP_NotUsed) alloc__present().set_param(*param.get_elem(19));
    if (param.get_size()>20 && param.get_elem(20)->get_type()!=Module_Param::MP_NotUsed) dyn__block__alloc().set_param(*param.get_elem(20));
    if (param.get_size()>21 && param.get_elem(21)->get_type()!=Module_Param::MP_NotUsed) multi__block__alloc().set_param(*param.get_elem(21));
    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(), "dual_carrier")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          dual__carrier().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tlli__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(), "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(), "compact_reduced_ma_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          compact__reduced__ma__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(), "compact_reduced_ma")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          compact__reduced__ma().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "chan_coding_cmd")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          chan__coding__cmd().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "resegment")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          resegment().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "window_size")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          window__size().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ats_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ats__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(), "ats")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ats().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "arac_retrans_req")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          arac__retrans__req().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tlli_block_chan_coding")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tlli__block__chan__coding().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "bep_period2_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bep__period2__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(), "bep_period2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bep__period2().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pkt_ta")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pkt__ta().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pkt_ext_ta_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pkt__ext__ta__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(), "pkt_ext_ta")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pkt__ext__ta().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "freq_par_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          freq__par__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(), "freq_par")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          freq__par().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "alloc_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          alloc__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(), "dyn_block_alloc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          dyn__block__alloc().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "multi_block_alloc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          multi__block__alloc().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_CSN1_Types.PktUlAssEgprs: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.PktUlAssEgprs");
  }
}

void PktUlAssEgprs::encode_text(Text_Buf& text_buf) const
{
field_dual__carrier.encode_text(text_buf);
field_tlli__present.encode_text(text_buf);
field_tlli.encode_text(text_buf);
field_compact__reduced__ma__present.encode_text(text_buf);
field_compact__reduced__ma.encode_text(text_buf);
field_chan__coding__cmd.encode_text(text_buf);
field_resegment.encode_text(text_buf);
field_window__size.encode_text(text_buf);
field_ats__present.encode_text(text_buf);
field_ats.encode_text(text_buf);
field_arac__retrans__req.encode_text(text_buf);
field_tlli__block__chan__coding.encode_text(text_buf);
field_bep__period2__present.encode_text(text_buf);
field_bep__period2.encode_text(text_buf);
field_pkt__ta.encode_text(text_buf);
field_pkt__ext__ta__present.encode_text(text_buf);
field_pkt__ext__ta.encode_text(text_buf);
field_freq__par__present.encode_text(text_buf);
field_freq__par.encode_text(text_buf);
field_alloc__present.encode_text(text_buf);
field_dyn__block__alloc.encode_text(text_buf);
field_multi__block__alloc.encode_text(text_buf);
}

void PktUlAssEgprs::decode_text(Text_Buf& text_buf)
{
field_dual__carrier.decode_text(text_buf);
field_tlli__present.decode_text(text_buf);
field_tlli.decode_text(text_buf);
field_compact__reduced__ma__present.decode_text(text_buf);
field_compact__reduced__ma.decode_text(text_buf);
field_chan__coding__cmd.decode_text(text_buf);
field_resegment.decode_text(text_buf);
field_window__size.decode_text(text_buf);
field_ats__present.decode_text(text_buf);
field_ats.decode_text(text_buf);
field_arac__retrans__req.decode_text(text_buf);
field_tlli__block__chan__coding.decode_text(text_buf);
field_bep__period2__present.decode_text(text_buf);
field_bep__period2.decode_text(text_buf);
field_pkt__ta.decode_text(text_buf);
field_pkt__ext__ta__present.decode_text(text_buf);
field_pkt__ext__ta.decode_text(text_buf);
field_freq__par__present.decode_text(text_buf);
field_freq__par.decode_text(text_buf);
field_alloc__present.decode_text(text_buf);
field_dyn__block__alloc.decode_text(text_buf);
field_multi__block__alloc.decode_text(text_buf);
}

void PktUlAssEgprs::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 PktUlAssEgprs::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 PktUlAssEgprs::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, PktUlAssEgprs_dual__carrier_descr_.raw->forceomit);
  decoded_field_length = field_dual__carrier.RAW_decode(PktUlAssEgprs_dual__carrier_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, PktUlAssEgprs_tlli__present_descr_.raw->forceomit);
  decoded_field_length = field_tlli__present.RAW_decode(PktUlAssEgprs_tlli__present_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_tlli__present ==  bs_0){
  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, PktUlAssEgprs_tlli_descr_.raw->forceomit);
  decoded_field_length = field_tlli().RAW_decode(PktUlAssEgprs_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;
  RAW_Force_Omit field_3_force_omit(3, force_omit, PktUlAssEgprs_compact__reduced__ma__present_descr_.raw->forceomit);
  decoded_field_length = field_compact__reduced__ma__present.RAW_decode(PktUlAssEgprs_compact__reduced__ma__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_compact__reduced__ma__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(4)) {
    field_compact__reduced__ma = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_4_force_omit(4, force_omit, PktUlAssEgprs_compact__reduced__ma_descr_.raw->forceomit);
  decoded_field_length = field_compact__reduced__ma().RAW_decode(PktUlAssEgprs_compact__reduced__ma_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit);
  if (decoded_field_length < 1) {
  field_compact__reduced__ma = 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_compact__reduced__ma=OMIT_VALUE;
  RAW_Force_Omit field_5_force_omit(5, force_omit, PktUlAssEgprs_chan__coding__cmd_descr_.raw->forceomit);
  decoded_field_length = field_chan__coding__cmd.RAW_decode(PktUlAssEgprs_chan__coding__cmd_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, PktUlAssEgprs_resegment_descr_.raw->forceomit);
  decoded_field_length = field_resegment.RAW_decode(PktUlAssEgprs_resegment_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, PktUlAssEgprs_window__size_descr_.raw->forceomit);
  decoded_field_length = field_window__size.RAW_decode(PktUlAssEgprs_window__size_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, PktUlAssEgprs_ats__present_descr_.raw->forceomit);
  decoded_field_length = field_ats__present.RAW_decode(PktUlAssEgprs_ats__present_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());
  if (limit > 0 && field_ats__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(9)) {
    field_ats = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_9_force_omit(9, force_omit, PktUlAssEgprs_ats_descr_.raw->forceomit);
  decoded_field_length = field_ats().RAW_decode(PktUlAssEgprs_ats_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_9_force_omit);
  if (decoded_field_length < 1) {
  field_ats = 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_ats=OMIT_VALUE;
  RAW_Force_Omit field_10_force_omit(10, force_omit, PktUlAssEgprs_arac__retrans__req_descr_.raw->forceomit);
  decoded_field_length = field_arac__retrans__req.RAW_decode(PktUlAssEgprs_arac__retrans__req_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_10_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_11_force_omit(11, force_omit, PktUlAssEgprs_tlli__block__chan__coding_descr_.raw->forceomit);
  decoded_field_length = field_tlli__block__chan__coding.RAW_decode(PktUlAssEgprs_tlli__block__chan__coding_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_11_force_omit);
  if (decoded_field_length < 0) return 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_12_force_omit(12, force_omit, PktUlAssEgprs_bep__period2__present_descr_.raw->forceomit);
  decoded_field_length = field_bep__period2__present.RAW_decode(PktUlAssEgprs_bep__period2__present_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_12_force_omit);
  if (decoded_field_length < 0) return 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_bep__period2__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(13)) {
    field_bep__period2 = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_13_force_omit(13, force_omit, PktUlAssEgprs_bep__period2_descr_.raw->forceomit);
  decoded_field_length = field_bep__period2().RAW_decode(PktUlAssEgprs_bep__period2_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_13_force_omit);
  if (decoded_field_length < 1) {
  field_bep__period2 = 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_bep__period2=OMIT_VALUE;
  RAW_Force_Omit field_14_force_omit(14, force_omit, PktUlAssEgprs_pkt__ta_descr_.raw->forceomit);
  decoded_field_length = field_pkt__ta.RAW_decode(PktUlAssEgprs_pkt__ta_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_14_force_omit);
  if (decoded_field_length < 0) return 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_15_force_omit(15, force_omit, PktUlAssEgprs_pkt__ext__ta__present_descr_.raw->forceomit);
  decoded_field_length = field_pkt__ext__ta__present.RAW_decode(PktUlAssEgprs_pkt__ext__ta__present_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_15_force_omit);
  if (decoded_field_length < 0) return 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_pkt__ext__ta__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(16)) {
    field_pkt__ext__ta = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_16_force_omit(16, force_omit, PktUlAssEgprs_pkt__ext__ta_descr_.raw->forceomit);
  decoded_field_length = field_pkt__ext__ta().RAW_decode(PktUlAssEgprs_pkt__ext__ta_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_16_force_omit);
  if (decoded_field_length < 1) {
  field_pkt__ext__ta = 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_pkt__ext__ta=OMIT_VALUE;
  RAW_Force_Omit field_17_force_omit(17, force_omit, PktUlAssEgprs_freq__par__present_descr_.raw->forceomit);
  decoded_field_length = field_freq__par__present.RAW_decode(PktUlAssEgprs_freq__par__present_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_17_force_omit);
  if (decoded_field_length < 0) return 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_freq__par__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(18)) {
    field_freq__par = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_18_force_omit(18, force_omit, PktUlAssEgprs_freq__par_descr_.raw->forceomit);
  decoded_field_length = field_freq__par().RAW_decode(PktUlAssEgprs_freq__par_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_18_force_omit);
  if (decoded_field_length < 1) {
  field_freq__par = 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_freq__par=OMIT_VALUE;
  RAW_Force_Omit field_19_force_omit(19, force_omit, PktUlAssEgprs_alloc__present_descr_.raw->forceomit);
  decoded_field_length = field_alloc__present.RAW_decode(PktUlAssEgprs_alloc__present_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_19_force_omit);
  if (decoded_field_length < 0) return 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_alloc__present ==  bs_3){
  if (force_omit != NULL && (*force_omit)(20)) {
    field_dyn__block__alloc = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_20_force_omit(20, force_omit, PktUlAssEgprs_dyn__block__alloc_descr_.raw->forceomit);
  decoded_field_length = field_dyn__block__alloc().RAW_decode(PktUlAssEgprs_dyn__block__alloc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_20_force_omit);
  if (decoded_field_length < 1) {
  field_dyn__block__alloc = 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_dyn__block__alloc=OMIT_VALUE;
  if (limit > 0 && field_alloc__present ==  bs_4){
  if (force_omit != NULL && (*force_omit)(21)) {
    field_multi__block__alloc = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_21_force_omit(21, force_omit, PktUlAssEgprs_multi__block__alloc_descr_.raw->forceomit);
  decoded_field_length = field_multi__block__alloc().RAW_decode(PktUlAssEgprs_multi__block__alloc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_21_force_omit);
  if (decoded_field_length < 1) {
  field_multi__block__alloc = 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_multi__block__alloc=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int PktUlAssEgprs::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 = 22;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(22);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, PktUlAssEgprs_dual__carrier_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PktUlAssEgprs_tlli__present_descr_.raw);
  if (field_tlli.ispresent()) {
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PktUlAssEgprs_tlli_descr_.raw);
  }
  else myleaf.body.node.nodes[2] = NULL;
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, PktUlAssEgprs_compact__reduced__ma__present_descr_.raw);
  if (field_compact__reduced__ma.ispresent()) {
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, PktUlAssEgprs_compact__reduced__ma_descr_.raw);
  }
  else myleaf.body.node.nodes[4] = NULL;
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, PktUlAssEgprs_chan__coding__cmd_descr_.raw);
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, PktUlAssEgprs_resegment_descr_.raw);
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, PktUlAssEgprs_window__size_descr_.raw);
  myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, PktUlAssEgprs_ats__present_descr_.raw);
  if (field_ats.ispresent()) {
  myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, PktUlAssEgprs_ats_descr_.raw);
  }
  else myleaf.body.node.nodes[9] = NULL;
  myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 10, PktUlAssEgprs_arac__retrans__req_descr_.raw);
  myleaf.body.node.nodes[11] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 11, PktUlAssEgprs_tlli__block__chan__coding_descr_.raw);
  myleaf.body.node.nodes[12] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 12, PktUlAssEgprs_bep__period2__present_descr_.raw);
  if (field_bep__period2.ispresent()) {
  myleaf.body.node.nodes[13] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 13, PktUlAssEgprs_bep__period2_descr_.raw);
  }
  else myleaf.body.node.nodes[13] = NULL;
  myleaf.body.node.nodes[14] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 14, PktUlAssEgprs_pkt__ta_descr_.raw);
  myleaf.body.node.nodes[15] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 15, PktUlAssEgprs_pkt__ext__ta__present_descr_.raw);
  if (field_pkt__ext__ta.ispresent()) {
  myleaf.body.node.nodes[16] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 16, PktUlAssEgprs_pkt__ext__ta_descr_.raw);
  }
  else myleaf.body.node.nodes[16] = NULL;
  myleaf.body.node.nodes[17] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 17, PktUlAssEgprs_freq__par__present_descr_.raw);
  if (field_freq__par.ispresent()) {
  myleaf.body.node.nodes[18] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 18, PktUlAssEgprs_freq__par_descr_.raw);
  }
  else myleaf.body.node.nodes[18] = NULL;
  myleaf.body.node.nodes[19] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 19, PktUlAssEgprs_alloc__present_descr_.raw);
  if (field_dyn__block__alloc.ispresent()) {
  myleaf.body.node.nodes[20] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 20, PktUlAssEgprs_dyn__block__alloc_descr_.raw);
  }
  else myleaf.body.node.nodes[20] = NULL;
  if (field_multi__block__alloc.ispresent()) {
  myleaf.body.node.nodes[21] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 21, PktUlAssEgprs_multi__block__alloc_descr_.raw);
  }
  else myleaf.body.node.nodes[21] = NULL;
  encoded_length += field_dual__carrier.RAW_encode(PktUlAssEgprs_dual__carrier_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_tlli__present.RAW_encode(PktUlAssEgprs_tlli__present_descr_, *myleaf.body.node.nodes[1]);
  if (field_tlli.ispresent()) {
  encoded_length += field_tlli().RAW_encode(PktUlAssEgprs_tlli_descr_, *myleaf.body.node.nodes[2]);
  }
  encoded_length += field_compact__reduced__ma__present.RAW_encode(PktUlAssEgprs_compact__reduced__ma__present_descr_, *myleaf.body.node.nodes[3]);
  if (field_compact__reduced__ma.ispresent()) {
  encoded_length += field_compact__reduced__ma().RAW_encode(PktUlAssEgprs_compact__reduced__ma_descr_, *myleaf.body.node.nodes[4]);
  }
  encoded_length += field_chan__coding__cmd.RAW_encode(PktUlAssEgprs_chan__coding__cmd_descr_, *myleaf.body.node.nodes[5]);
  encoded_length += field_resegment.RAW_encode(PktUlAssEgprs_resegment_descr_, *myleaf.body.node.nodes[6]);
  encoded_length += field_window__size.RAW_encode(PktUlAssEgprs_window__size_descr_, *myleaf.body.node.nodes[7]);
  encoded_length += field_ats__present.RAW_encode(PktUlAssEgprs_ats__present_descr_, *myleaf.body.node.nodes[8]);
  if (field_ats.ispresent()) {
  encoded_length += field_ats().RAW_encode(PktUlAssEgprs_ats_descr_, *myleaf.body.node.nodes[9]);
  }
  encoded_length += field_arac__retrans__req.RAW_encode(PktUlAssEgprs_arac__retrans__req_descr_, *myleaf.body.node.nodes[10]);
  encoded_length += field_tlli__block__chan__coding.RAW_encode(PktUlAssEgprs_tlli__block__chan__coding_descr_, *myleaf.body.node.nodes[11]);
  encoded_length += field_bep__period2__present.RAW_encode(PktUlAssEgprs_bep__period2__present_descr_, *myleaf.body.node.nodes[12]);
  if (field_bep__period2.ispresent()) {
  encoded_length += field_bep__period2().RAW_encode(PktUlAssEgprs_bep__period2_descr_, *myleaf.body.node.nodes[13]);
  }
  encoded_length += field_pkt__ta.RAW_encode(PktUlAssEgprs_pkt__ta_descr_, *myleaf.body.node.nodes[14]);
  encoded_length += field_pkt__ext__ta__present.RAW_encode(PktUlAssEgprs_pkt__ext__ta__present_descr_, *myleaf.body.node.nodes[15]);
  if (field_pkt__ext__ta.ispresent()) {
  encoded_length += field_pkt__ext__ta().RAW_encode(PktUlAssEgprs_pkt__ext__ta_descr_, *myleaf.body.node.nodes[16]);
  }
  encoded_length += field_freq__par__present.RAW_encode(PktUlAssEgprs_freq__par__present_descr_, *myleaf.body.node.nodes[17]);
  if (field_freq__par.ispresent()) {
  encoded_length += field_freq__par().RAW_encode(PktUlAssEgprs_freq__par_descr_, *myleaf.body.node.nodes[18]);
  }
  encoded_length += field_alloc__present.RAW_encode(PktUlAssEgprs_alloc__present_descr_, *myleaf.body.node.nodes[19]);
  if (field_dyn__block__alloc.ispresent()) {
  encoded_length += field_dyn__block__alloc().RAW_encode(PktUlAssEgprs_dyn__block__alloc_descr_, *myleaf.body.node.nodes[20]);
  }
  if (field_multi__block__alloc.ispresent()) {
  encoded_length += field_multi__block__alloc().RAW_encode(PktUlAssEgprs_multi__block__alloc_descr_, *myleaf.body.node.nodes[21]);
  }
  if (field_tlli.ispresent() && (field_tlli__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={1};
  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(PktUlAssEgprs_tlli__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_compact__reduced__ma.ispresent() && (field_compact__reduced__ma__present !=  bs_0)) {
  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){
   bs_0.RAW_encode(PktUlAssEgprs_compact__reduced__ma__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_ats.ispresent() && (field_ats__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={8};
  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(PktUlAssEgprs_ats__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_bep__period2.ispresent() && (field_bep__period2__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={12};
  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(PktUlAssEgprs_bep__period2__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_pkt__ext__ta.ispresent() && (field_pkt__ext__ta__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={15};
  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(PktUlAssEgprs_pkt__ext__ta__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_freq__par.ispresent() && (field_freq__par__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={17};
  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(PktUlAssEgprs_freq__par__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_dyn__block__alloc.ispresent() && (field_alloc__present !=  bs_3)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={19};
  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_3.RAW_encode(PktUlAssEgprs_alloc__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_multi__block__alloc.ispresent() && (field_alloc__present !=  bs_4)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={19};
  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_4.RAW_encode(PktUlAssEgprs_alloc__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);
  }
  }
  return myleaf.length = encoded_length;
}

struct PktUlAssEgprs_template::single_value_struct {
BITSTRING_template field_dual__carrier;
BITSTRING_template field_tlli__present;
OCTETSTRING_template field_tlli;
BITSTRING_template field_compact__reduced__ma__present;
COMPACTreducedMA_template field_compact__reduced__ma;
EgprsChCodingCommand_template field_chan__coding__cmd;
BITSTRING_template field_resegment;
EgprsWindowSize_template field_window__size;
BITSTRING_template field_ats__present;
AccessTechnologiesRequestRepetition_template field_ats;
BITSTRING_template field_arac__retrans__req;
BITSTRING_template field_tlli__block__chan__coding;
BITSTRING_template field_bep__period2__present;
BITSTRING_template field_bep__period2;
PacketTimingAdvance_template field_pkt__ta;
BITSTRING_template field_pkt__ext__ta__present;
BITSTRING_template field_pkt__ext__ta;
BITSTRING_template field_freq__par__present;
FrequencyParameters_template field_freq__par;
BITSTRING_template field_alloc__present;
DynamicAllocation_template field_dyn__block__alloc;
MultiBlockAllocation_template field_multi__block__alloc;
};

void PktUlAssEgprs_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_dual__carrier = ANY_VALUE;
single_value->field_tlli__present = ANY_VALUE;
single_value->field_tlli = ANY_OR_OMIT;
single_value->field_compact__reduced__ma__present = ANY_VALUE;
single_value->field_compact__reduced__ma = ANY_OR_OMIT;
single_value->field_chan__coding__cmd = ANY_VALUE;
single_value->field_resegment = ANY_VALUE;
single_value->field_window__size = ANY_VALUE;
single_value->field_ats__present = ANY_VALUE;
single_value->field_ats = ANY_OR_OMIT;
single_value->field_arac__retrans__req = ANY_VALUE;
single_value->field_tlli__block__chan__coding = ANY_VALUE;
single_value->field_bep__period2__present = ANY_VALUE;
single_value->field_bep__period2 = ANY_OR_OMIT;
single_value->field_pkt__ta = ANY_VALUE;
single_value->field_pkt__ext__ta__present = ANY_VALUE;
single_value->field_pkt__ext__ta = ANY_OR_OMIT;
single_value->field_freq__par__present = ANY_VALUE;
single_value->field_freq__par = ANY_OR_OMIT;
single_value->field_alloc__present = ANY_VALUE;
single_value->field_dyn__block__alloc = ANY_OR_OMIT;
single_value->field_multi__block__alloc = ANY_OR_OMIT;
}
}
}

void PktUlAssEgprs_template::copy_value(const PktUlAssEgprs& other_value)
{
single_value = new single_value_struct;
if (other_value.dual__carrier().is_bound()) {
  single_value->field_dual__carrier = other_value.dual__carrier();
} else {
  single_value->field_dual__carrier.clean_up();
}
if (other_value.tlli__present().is_bound()) {
  single_value->field_tlli__present = other_value.tlli__present();
} else {
  single_value->field_tlli__present.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.compact__reduced__ma__present().is_bound()) {
  single_value->field_compact__reduced__ma__present = other_value.compact__reduced__ma__present();
} else {
  single_value->field_compact__reduced__ma__present.clean_up();
}
if (other_value.compact__reduced__ma().is_bound()) {
  if (other_value.compact__reduced__ma().ispresent()) single_value->field_compact__reduced__ma = other_value.compact__reduced__ma()();
  else single_value->field_compact__reduced__ma = OMIT_VALUE;
} else {
  single_value->field_compact__reduced__ma.clean_up();
}
if (other_value.chan__coding__cmd().is_bound()) {
  single_value->field_chan__coding__cmd = other_value.chan__coding__cmd();
} else {
  single_value->field_chan__coding__cmd.clean_up();
}
if (other_value.resegment().is_bound()) {
  single_value->field_resegment = other_value.resegment();
} else {
  single_value->field_resegment.clean_up();
}
if (other_value.window__size().is_bound()) {
  single_value->field_window__size = other_value.window__size();
} else {
  single_value->field_window__size.clean_up();
}
if (other_value.ats__present().is_bound()) {
  single_value->field_ats__present = other_value.ats__present();
} else {
  single_value->field_ats__present.clean_up();
}
if (other_value.ats().is_bound()) {
  if (other_value.ats().ispresent()) single_value->field_ats = other_value.ats()();
  else single_value->field_ats = OMIT_VALUE;
} else {
  single_value->field_ats.clean_up();
}
if (other_value.arac__retrans__req().is_bound()) {
  single_value->field_arac__retrans__req = other_value.arac__retrans__req();
} else {
  single_value->field_arac__retrans__req.clean_up();
}
if (other_value.tlli__block__chan__coding().is_bound()) {
  single_value->field_tlli__block__chan__coding = other_value.tlli__block__chan__coding();
} else {
  single_value->field_tlli__block__chan__coding.clean_up();
}
if (other_value.bep__period2__present().is_bound()) {
  single_value->field_bep__period2__present = other_value.bep__period2__present();
} else {
  single_value->field_bep__period2__present.clean_up();
}
if (other_value.bep__period2().is_bound()) {
  if (other_value.bep__period2().ispresent()) single_value->field_bep__period2 = other_value.bep__period2()();
  else single_value->field_bep__period2 = OMIT_VALUE;
} else {
  single_value->field_bep__period2.clean_up();
}
if (other_value.pkt__ta().is_bound()) {
  single_value->field_pkt__ta = other_value.pkt__ta();
} else {
  single_value->field_pkt__ta.clean_up();
}
if (other_value.pkt__ext__ta__present().is_bound()) {
  single_value->field_pkt__ext__ta__present = other_value.pkt__ext__ta__present();
} else {
  single_value->field_pkt__ext__ta__present.clean_up();
}
if (other_value.pkt__ext__ta().is_bound()) {
  if (other_value.pkt__ext__ta().ispresent()) single_value->field_pkt__ext__ta = other_value.pkt__ext__ta()();
  else single_value->field_pkt__ext__ta = OMIT_VALUE;
} else {
  single_value->field_pkt__ext__ta.clean_up();
}
if (other_value.freq__par__present().is_bound()) {
  single_value->field_freq__par__present = other_value.freq__par__present();
} else {
  single_value->field_freq__par__present.clean_up();
}
if (other_value.freq__par().is_bound()) {
  if (other_value.freq__par().ispresent()) single_value->field_freq__par = other_value.freq__par()();
  else single_value->field_freq__par = OMIT_VALUE;
} else {
  single_value->field_freq__par.clean_up();
}
if (other_value.alloc__present().is_bound()) {
  single_value->field_alloc__present = other_value.alloc__present();
} else {
  single_value->field_alloc__present.clean_up();
}
if (other_value.dyn__block__alloc().is_bound()) {
  if (other_value.dyn__block__alloc().ispresent()) single_value->field_dyn__block__alloc = other_value.dyn__block__alloc()();
  else single_value->field_dyn__block__alloc = OMIT_VALUE;
} else {
  single_value->field_dyn__block__alloc.clean_up();
}
if (other_value.multi__block__alloc().is_bound()) {
  if (other_value.multi__block__alloc().ispresent()) single_value->field_multi__block__alloc = other_value.multi__block__alloc()();
  else single_value->field_multi__block__alloc = OMIT_VALUE;
} else {
  single_value->field_multi__block__alloc.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PktUlAssEgprs_template::copy_template(const PktUlAssEgprs_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.dual__carrier().get_selection()) {
single_value->field_dual__carrier = other_value.dual__carrier();
} else {
single_value->field_dual__carrier.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tlli__present().get_selection()) {
single_value->field_tlli__present = other_value.tlli__present();
} else {
single_value->field_tlli__present.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.compact__reduced__ma__present().get_selection()) {
single_value->field_compact__reduced__ma__present = other_value.compact__reduced__ma__present();
} else {
single_value->field_compact__reduced__ma__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.compact__reduced__ma().get_selection()) {
single_value->field_compact__reduced__ma = other_value.compact__reduced__ma();
} else {
single_value->field_compact__reduced__ma.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.chan__coding__cmd().get_selection()) {
single_value->field_chan__coding__cmd = other_value.chan__coding__cmd();
} else {
single_value->field_chan__coding__cmd.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.resegment().get_selection()) {
single_value->field_resegment = other_value.resegment();
} else {
single_value->field_resegment.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.window__size().get_selection()) {
single_value->field_window__size = other_value.window__size();
} else {
single_value->field_window__size.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ats__present().get_selection()) {
single_value->field_ats__present = other_value.ats__present();
} else {
single_value->field_ats__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ats().get_selection()) {
single_value->field_ats = other_value.ats();
} else {
single_value->field_ats.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.arac__retrans__req().get_selection()) {
single_value->field_arac__retrans__req = other_value.arac__retrans__req();
} else {
single_value->field_arac__retrans__req.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tlli__block__chan__coding().get_selection()) {
single_value->field_tlli__block__chan__coding = other_value.tlli__block__chan__coding();
} else {
single_value->field_tlli__block__chan__coding.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.bep__period2__present().get_selection()) {
single_value->field_bep__period2__present = other_value.bep__period2__present();
} else {
single_value->field_bep__period2__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.bep__period2().get_selection()) {
single_value->field_bep__period2 = other_value.bep__period2();
} else {
single_value->field_bep__period2.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pkt__ta().get_selection()) {
single_value->field_pkt__ta = other_value.pkt__ta();
} else {
single_value->field_pkt__ta.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pkt__ext__ta__present().get_selection()) {
single_value->field_pkt__ext__ta__present = other_value.pkt__ext__ta__present();
} else {
single_value->field_pkt__ext__ta__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pkt__ext__ta().get_selection()) {
single_value->field_pkt__ext__ta = other_value.pkt__ext__ta();
} else {
single_value->field_pkt__ext__ta.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.freq__par__present().get_selection()) {
single_value->field_freq__par__present = other_value.freq__par__present();
} else {
single_value->field_freq__par__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.freq__par().get_selection()) {
single_value->field_freq__par = other_value.freq__par();
} else {
single_value->field_freq__par.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.alloc__present().get_selection()) {
single_value->field_alloc__present = other_value.alloc__present();
} else {
single_value->field_alloc__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.dyn__block__alloc().get_selection()) {
single_value->field_dyn__block__alloc = other_value.dyn__block__alloc();
} else {
single_value->field_dyn__block__alloc.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.multi__block__alloc().get_selection()) {
single_value->field_multi__block__alloc = other_value.multi__block__alloc();
} else {
single_value->field_multi__block__alloc.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 PktUlAssEgprs_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 PktUlAssEgprs_template(*other_value.implication_.precondition);
implication_.implied_template = new PktUlAssEgprs_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_CSN1_Types.PktUlAssEgprs.");
break;
}
set_selection(other_value);
}

PktUlAssEgprs_template::PktUlAssEgprs_template()
{
}

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

PktUlAssEgprs_template::PktUlAssEgprs_template(const PktUlAssEgprs& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PktUlAssEgprs_template::match(const PktUlAssEgprs& 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.dual__carrier().is_bound()) return FALSE;
if(!single_value->field_dual__carrier.match(other_value.dual__carrier(), legacy))return FALSE;
if(!other_value.tlli__present().is_bound()) return FALSE;
if(!single_value->field_tlli__present.match(other_value.tlli__present(), 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.compact__reduced__ma__present().is_bound()) return FALSE;
if(!single_value->field_compact__reduced__ma__present.match(other_value.compact__reduced__ma__present(), legacy))return FALSE;
if(!other_value.compact__reduced__ma().is_bound()) return FALSE;
if((other_value.compact__reduced__ma().ispresent() ? !single_value->field_compact__reduced__ma.match((const COMPACTreducedMA&)other_value.compact__reduced__ma(), legacy) : !single_value->field_compact__reduced__ma.match_omit(legacy)))return FALSE;
if(!other_value.chan__coding__cmd().is_bound()) return FALSE;
if(!single_value->field_chan__coding__cmd.match(other_value.chan__coding__cmd(), legacy))return FALSE;
if(!other_value.resegment().is_bound()) return FALSE;
if(!single_value->field_resegment.match(other_value.resegment(), legacy))return FALSE;
if(!other_value.window__size().is_bound()) return FALSE;
if(!single_value->field_window__size.match(other_value.window__size(), legacy))return FALSE;
if(!other_value.ats__present().is_bound()) return FALSE;
if(!single_value->field_ats__present.match(other_value.ats__present(), legacy))return FALSE;
if(!other_value.ats().is_bound()) return FALSE;
if((other_value.ats().ispresent() ? !single_value->field_ats.match((const AccessTechnologiesRequestRepetition&)other_value.ats(), legacy) : !single_value->field_ats.match_omit(legacy)))return FALSE;
if(!other_value.arac__retrans__req().is_bound()) return FALSE;
if(!single_value->field_arac__retrans__req.match(other_value.arac__retrans__req(), legacy))return FALSE;
if(!other_value.tlli__block__chan__coding().is_bound()) return FALSE;
if(!single_value->field_tlli__block__chan__coding.match(other_value.tlli__block__chan__coding(), legacy))return FALSE;
if(!other_value.bep__period2__present().is_bound()) return FALSE;
if(!single_value->field_bep__period2__present.match(other_value.bep__period2__present(), legacy))return FALSE;
if(!other_value.bep__period2().is_bound()) return FALSE;
if((other_value.bep__period2().ispresent() ? !single_value->field_bep__period2.match((const BITSTRING&)other_value.bep__period2(), legacy) : !single_value->field_bep__period2.match_omit(legacy)))return FALSE;
if(!other_value.pkt__ta().is_bound()) return FALSE;
if(!single_value->field_pkt__ta.match(other_value.pkt__ta(), legacy))return FALSE;
if(!other_value.pkt__ext__ta__present().is_bound()) return FALSE;
if(!single_value->field_pkt__ext__ta__present.match(other_value.pkt__ext__ta__present(), legacy))return FALSE;
if(!other_value.pkt__ext__ta().is_bound()) return FALSE;
if((other_value.pkt__ext__ta().ispresent() ? !single_value->field_pkt__ext__ta.match((const BITSTRING&)other_value.pkt__ext__ta(), legacy) : !single_value->field_pkt__ext__ta.match_omit(legacy)))return FALSE;
if(!other_value.freq__par__present().is_bound()) return FALSE;
if(!single_value->field_freq__par__present.match(other_value.freq__par__present(), legacy))return FALSE;
if(!other_value.freq__par().is_bound()) return FALSE;
if((other_value.freq__par().ispresent() ? !single_value->field_freq__par.match((const FrequencyParameters&)other_value.freq__par(), legacy) : !single_value->field_freq__par.match_omit(legacy)))return FALSE;
if(!other_value.alloc__present().is_bound()) return FALSE;
if(!single_value->field_alloc__present.match(other_value.alloc__present(), legacy))return FALSE;
if(!other_value.dyn__block__alloc().is_bound()) return FALSE;
if((other_value.dyn__block__alloc().ispresent() ? !single_value->field_dyn__block__alloc.match((const DynamicAllocation&)other_value.dyn__block__alloc(), legacy) : !single_value->field_dyn__block__alloc.match_omit(legacy)))return FALSE;
if(!other_value.multi__block__alloc().is_bound()) return FALSE;
if((other_value.multi__block__alloc().ispresent() ? !single_value->field_multi__block__alloc.match((const MultiBlockAllocation&)other_value.multi__block__alloc(), legacy) : !single_value->field_multi__block__alloc.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_CSN1_Types.PktUlAssEgprs.");
}
return FALSE;
}

boolean PktUlAssEgprs_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_dual__carrier.is_bound()
 || single_value->field_tlli__present.is_bound()
 || (single_value->field_tlli.is_omit() || single_value->field_tlli.is_bound())
 || single_value->field_compact__reduced__ma__present.is_bound()
 || (single_value->field_compact__reduced__ma.is_omit() || single_value->field_compact__reduced__ma.is_bound())
 || single_value->field_chan__coding__cmd.is_bound()
 || single_value->field_resegment.is_bound()
 || single_value->field_window__size.is_bound()
 || single_value->field_ats__present.is_bound()
 || (single_value->field_ats.is_omit() || single_value->field_ats.is_bound())
 || single_value->field_arac__retrans__req.is_bound()
 || single_value->field_tlli__block__chan__coding.is_bound()
 || single_value->field_bep__period2__present.is_bound()
 || (single_value->field_bep__period2.is_omit() || single_value->field_bep__period2.is_bound())
 || single_value->field_pkt__ta.is_bound()
 || single_value->field_pkt__ext__ta__present.is_bound()
 || (single_value->field_pkt__ext__ta.is_omit() || single_value->field_pkt__ext__ta.is_bound())
 || single_value->field_freq__par__present.is_bound()
 || (single_value->field_freq__par.is_omit() || single_value->field_freq__par.is_bound())
 || single_value->field_alloc__present.is_bound()
 || (single_value->field_dyn__block__alloc.is_omit() || single_value->field_dyn__block__alloc.is_bound())
 || (single_value->field_multi__block__alloc.is_omit() || single_value->field_multi__block__alloc.is_bound());
}

boolean PktUlAssEgprs_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_dual__carrier.is_value()
 && single_value->field_tlli__present.is_value()
 && (single_value->field_tlli.is_omit() || single_value->field_tlli.is_value())
 && single_value->field_compact__reduced__ma__present.is_value()
 && (single_value->field_compact__reduced__ma.is_omit() || single_value->field_compact__reduced__ma.is_value())
 && single_value->field_chan__coding__cmd.is_value()
 && single_value->field_resegment.is_value()
 && single_value->field_window__size.is_value()
 && single_value->field_ats__present.is_value()
 && (single_value->field_ats.is_omit() || single_value->field_ats.is_value())
 && single_value->field_arac__retrans__req.is_value()
 && single_value->field_tlli__block__chan__coding.is_value()
 && single_value->field_bep__period2__present.is_value()
 && (single_value->field_bep__period2.is_omit() || single_value->field_bep__period2.is_value())
 && single_value->field_pkt__ta.is_value()
 && single_value->field_pkt__ext__ta__present.is_value()
 && (single_value->field_pkt__ext__ta.is_omit() || single_value->field_pkt__ext__ta.is_value())
 && single_value->field_freq__par__present.is_value()
 && (single_value->field_freq__par.is_omit() || single_value->field_freq__par.is_value())
 && single_value->field_alloc__present.is_value()
 && (single_value->field_dyn__block__alloc.is_omit() || single_value->field_dyn__block__alloc.is_value())
 && (single_value->field_multi__block__alloc.is_omit() || single_value->field_multi__block__alloc.is_value());
}

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

PktUlAssEgprs PktUlAssEgprs_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_CSN1_Types.PktUlAssEgprs.");
PktUlAssEgprs ret_val;
if (single_value->field_dual__carrier.is_bound()) {
ret_val.dual__carrier() = single_value->field_dual__carrier.valueof();
}
if (single_value->field_tlli__present.is_bound()) {
ret_val.tlli__present() = single_value->field_tlli__present.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_compact__reduced__ma__present.is_bound()) {
ret_val.compact__reduced__ma__present() = single_value->field_compact__reduced__ma__present.valueof();
}
if (single_value->field_compact__reduced__ma.is_omit()) ret_val.compact__reduced__ma() = OMIT_VALUE;
else if (single_value->field_compact__reduced__ma.is_bound()) {
ret_val.compact__reduced__ma() = single_value->field_compact__reduced__ma.valueof();
}
if (single_value->field_chan__coding__cmd.is_bound()) {
ret_val.chan__coding__cmd() = single_value->field_chan__coding__cmd.valueof();
}
if (single_value->field_resegment.is_bound()) {
ret_val.resegment() = single_value->field_resegment.valueof();
}
if (single_value->field_window__size.is_bound()) {
ret_val.window__size() = single_value->field_window__size.valueof();
}
if (single_value->field_ats__present.is_bound()) {
ret_val.ats__present() = single_value->field_ats__present.valueof();
}
if (single_value->field_ats.is_omit()) ret_val.ats() = OMIT_VALUE;
else if (single_value->field_ats.is_bound()) {
ret_val.ats() = single_value->field_ats.valueof();
}
if (single_value->field_arac__retrans__req.is_bound()) {
ret_val.arac__retrans__req() = single_value->field_arac__retrans__req.valueof();
}
if (single_value->field_tlli__block__chan__coding.is_bound()) {
ret_val.tlli__block__chan__coding() = single_value->field_tlli__block__chan__coding.valueof();
}
if (single_value->field_bep__period2__present.is_bound()) {
ret_val.bep__period2__present() = single_value->field_bep__period2__present.valueof();
}
if (single_value->field_bep__period2.is_omit()) ret_val.bep__period2() = OMIT_VALUE;
else if (single_value->field_bep__period2.is_bound()) {
ret_val.bep__period2() = single_value->field_bep__period2.valueof();
}
if (single_value->field_pkt__ta.is_bound()) {
ret_val.pkt__ta() = single_value->field_pkt__ta.valueof();
}
if (single_value->field_pkt__ext__ta__present.is_bound()) {
ret_val.pkt__ext__ta__present() = single_value->field_pkt__ext__ta__present.valueof();
}
if (single_value->field_pkt__ext__ta.is_omit()) ret_val.pkt__ext__ta() = OMIT_VALUE;
else if (single_value->field_pkt__ext__ta.is_bound()) {
ret_val.pkt__ext__ta() = single_value->field_pkt__ext__ta.valueof();
}
if (single_value->field_freq__par__present.is_bound()) {
ret_val.freq__par__present() = single_value->field_freq__par__present.valueof();
}
if (single_value->field_freq__par.is_omit()) ret_val.freq__par() = OMIT_VALUE;
else if (single_value->field_freq__par.is_bound()) {
ret_val.freq__par() = single_value->field_freq__par.valueof();
}
if (single_value->field_alloc__present.is_bound()) {
ret_val.alloc__present() = single_value->field_alloc__present.valueof();
}
if (single_value->field_dyn__block__alloc.is_omit()) ret_val.dyn__block__alloc() = OMIT_VALUE;
else if (single_value->field_dyn__block__alloc.is_bound()) {
ret_val.dyn__block__alloc() = single_value->field_dyn__block__alloc.valueof();
}
if (single_value->field_multi__block__alloc.is_omit()) ret_val.multi__block__alloc() = OMIT_VALUE;
else if (single_value->field_multi__block__alloc.is_bound()) {
ret_val.multi__block__alloc() = single_value->field_multi__block__alloc.valueof();
}
return ret_val;
}

void PktUlAssEgprs_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_CSN1_Types.PktUlAssEgprs.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PktUlAssEgprs_template[list_length];
}

PktUlAssEgprs_template& PktUlAssEgprs_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_CSN1_Types.PktUlAssEgprs.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return value_list.list_value[list_index];
}

BITSTRING_template& PktUlAssEgprs_template::dual__carrier()
{
set_specific();
return single_value->field_dual__carrier;
}

const BITSTRING_template& PktUlAssEgprs_template::dual__carrier() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field dual_carrier of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_dual__carrier;
}

BITSTRING_template& PktUlAssEgprs_template::tlli__present()
{
set_specific();
return single_value->field_tlli__present;
}

const BITSTRING_template& PktUlAssEgprs_template::tlli__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tlli_present of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_tlli__present;
}

OCTETSTRING_template& PktUlAssEgprs_template::tlli()
{
set_specific();
return single_value->field_tlli;
}

const OCTETSTRING_template& PktUlAssEgprs_template::tlli() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tlli of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_tlli;
}

BITSTRING_template& PktUlAssEgprs_template::compact__reduced__ma__present()
{
set_specific();
return single_value->field_compact__reduced__ma__present;
}

const BITSTRING_template& PktUlAssEgprs_template::compact__reduced__ma__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field compact_reduced_ma_present of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_compact__reduced__ma__present;
}

COMPACTreducedMA_template& PktUlAssEgprs_template::compact__reduced__ma()
{
set_specific();
return single_value->field_compact__reduced__ma;
}

const COMPACTreducedMA_template& PktUlAssEgprs_template::compact__reduced__ma() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field compact_reduced_ma of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_compact__reduced__ma;
}

EgprsChCodingCommand_template& PktUlAssEgprs_template::chan__coding__cmd()
{
set_specific();
return single_value->field_chan__coding__cmd;
}

const EgprsChCodingCommand_template& PktUlAssEgprs_template::chan__coding__cmd() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field chan_coding_cmd of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_chan__coding__cmd;
}

BITSTRING_template& PktUlAssEgprs_template::resegment()
{
set_specific();
return single_value->field_resegment;
}

const BITSTRING_template& PktUlAssEgprs_template::resegment() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field resegment of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_resegment;
}

EgprsWindowSize_template& PktUlAssEgprs_template::window__size()
{
set_specific();
return single_value->field_window__size;
}

const EgprsWindowSize_template& PktUlAssEgprs_template::window__size() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field window_size of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_window__size;
}

BITSTRING_template& PktUlAssEgprs_template::ats__present()
{
set_specific();
return single_value->field_ats__present;
}

const BITSTRING_template& PktUlAssEgprs_template::ats__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ats_present of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_ats__present;
}

AccessTechnologiesRequestRepetition_template& PktUlAssEgprs_template::ats()
{
set_specific();
return single_value->field_ats;
}

const AccessTechnologiesRequestRepetition_template& PktUlAssEgprs_template::ats() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ats of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_ats;
}

BITSTRING_template& PktUlAssEgprs_template::arac__retrans__req()
{
set_specific();
return single_value->field_arac__retrans__req;
}

const BITSTRING_template& PktUlAssEgprs_template::arac__retrans__req() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field arac_retrans_req of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_arac__retrans__req;
}

BITSTRING_template& PktUlAssEgprs_template::tlli__block__chan__coding()
{
set_specific();
return single_value->field_tlli__block__chan__coding;
}

const BITSTRING_template& PktUlAssEgprs_template::tlli__block__chan__coding() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tlli_block_chan_coding of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_tlli__block__chan__coding;
}

BITSTRING_template& PktUlAssEgprs_template::bep__period2__present()
{
set_specific();
return single_value->field_bep__period2__present;
}

const BITSTRING_template& PktUlAssEgprs_template::bep__period2__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field bep_period2_present of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_bep__period2__present;
}

BITSTRING_template& PktUlAssEgprs_template::bep__period2()
{
set_specific();
return single_value->field_bep__period2;
}

const BITSTRING_template& PktUlAssEgprs_template::bep__period2() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field bep_period2 of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_bep__period2;
}

PacketTimingAdvance_template& PktUlAssEgprs_template::pkt__ta()
{
set_specific();
return single_value->field_pkt__ta;
}

const PacketTimingAdvance_template& PktUlAssEgprs_template::pkt__ta() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pkt_ta of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_pkt__ta;
}

BITSTRING_template& PktUlAssEgprs_template::pkt__ext__ta__present()
{
set_specific();
return single_value->field_pkt__ext__ta__present;
}

const BITSTRING_template& PktUlAssEgprs_template::pkt__ext__ta__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pkt_ext_ta_present of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_pkt__ext__ta__present;
}

BITSTRING_template& PktUlAssEgprs_template::pkt__ext__ta()
{
set_specific();
return single_value->field_pkt__ext__ta;
}

const BITSTRING_template& PktUlAssEgprs_template::pkt__ext__ta() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pkt_ext_ta of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_pkt__ext__ta;
}

BITSTRING_template& PktUlAssEgprs_template::freq__par__present()
{
set_specific();
return single_value->field_freq__par__present;
}

const BITSTRING_template& PktUlAssEgprs_template::freq__par__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field freq_par_present of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_freq__par__present;
}

FrequencyParameters_template& PktUlAssEgprs_template::freq__par()
{
set_specific();
return single_value->field_freq__par;
}

const FrequencyParameters_template& PktUlAssEgprs_template::freq__par() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field freq_par of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_freq__par;
}

BITSTRING_template& PktUlAssEgprs_template::alloc__present()
{
set_specific();
return single_value->field_alloc__present;
}

const BITSTRING_template& PktUlAssEgprs_template::alloc__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field alloc_present of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_alloc__present;
}

DynamicAllocation_template& PktUlAssEgprs_template::dyn__block__alloc()
{
set_specific();
return single_value->field_dyn__block__alloc;
}

const DynamicAllocation_template& PktUlAssEgprs_template::dyn__block__alloc() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field dyn_block_alloc of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_dyn__block__alloc;
}

MultiBlockAllocation_template& PktUlAssEgprs_template::multi__block__alloc()
{
set_specific();
return single_value->field_multi__block__alloc;
}

const MultiBlockAllocation_template& PktUlAssEgprs_template::multi__block__alloc() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field multi_block_alloc of a non-specific template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
return single_value->field_multi__block__alloc;
}

int PktUlAssEgprs_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.PktUlAssEgprs which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
  {    int ret_val = 14;
      if (single_value->field_tlli.is_present()) ret_val++;
      if (single_value->field_compact__reduced__ma.is_present()) ret_val++;
      if (single_value->field_ats.is_present()) ret_val++;
      if (single_value->field_bep__period2.is_present()) ret_val++;
      if (single_value->field_pkt__ext__ta.is_present()) ret_val++;
      if (single_value->field_freq__par.is_present()) ret_val++;
      if (single_value->field_dyn__block__alloc.is_present()) ret_val++;
      if (single_value->field_multi__block__alloc.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_CSN1_Types.PktUlAssEgprs 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_CSN1_Types.PktUlAssEgprs containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.PktUlAssEgprs containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.PktUlAssEgprs containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.PktUlAssEgprs containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.PktUlAssEgprs containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.PktUlAssEgprs containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.PktUlAssEgprs containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @RLCMAC_CSN1_Types.PktUlAssEgprs.");
  }
  return 0;
}

void PktUlAssEgprs_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ dual_carrier := ");
single_value->field_dual__carrier.log();
TTCN_Logger::log_event_str(", tlli_present := ");
single_value->field_tlli__present.log();
TTCN_Logger::log_event_str(", tlli := ");
single_value->field_tlli.log();
TTCN_Logger::log_event_str(", compact_reduced_ma_present := ");
single_value->field_compact__reduced__ma__present.log();
TTCN_Logger::log_event_str(", compact_reduced_ma := ");
single_value->field_compact__reduced__ma.log();
TTCN_Logger::log_event_str(", chan_coding_cmd := ");
single_value->field_chan__coding__cmd.log();
TTCN_Logger::log_event_str(", resegment := ");
single_value->field_resegment.log();
TTCN_Logger::log_event_str(", window_size := ");
single_value->field_window__size.log();
TTCN_Logger::log_event_str(", ats_present := ");
single_value->field_ats__present.log();
TTCN_Logger::log_event_str(", ats := ");
single_value->field_ats.log();
TTCN_Logger::log_event_str(", arac_retrans_req := ");
single_value->field_arac__retrans__req.log();
TTCN_Logger::log_event_str(", tlli_block_chan_coding := ");
single_value->field_tlli__block__chan__coding.log();
TTCN_Logger::log_event_str(", bep_period2_present := ");
single_value->field_bep__period2__present.log();
TTCN_Logger::log_event_str(", bep_period2 := ");
single_value->field_bep__period2.log();
TTCN_Logger::log_event_str(", pkt_ta := ");
single_value->field_pkt__ta.log();
TTCN_Logger::log_event_str(", pkt_ext_ta_present := ");
single_value->field_pkt__ext__ta__present.log();
TTCN_Logger::log_event_str(", pkt_ext_ta := ");
single_value->field_pkt__ext__ta.log();
TTCN_Logger::log_event_str(", freq_par_present := ");
single_value->field_freq__par__present.log();
TTCN_Logger::log_event_str(", freq_par := ");
single_value->field_freq__par.log();
TTCN_Logger::log_event_str(", alloc_present := ");
single_value->field_alloc__present.log();
TTCN_Logger::log_event_str(", dyn_block_alloc := ");
single_value->field_dyn__block__alloc.log();
TTCN_Logger::log_event_str(", multi_block_alloc := ");
single_value->field_multi__block__alloc.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 PktUlAssEgprs_template::log_match(const PktUlAssEgprs& 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_dual__carrier.match(match_value.dual__carrier(), legacy)){
TTCN_Logger::log_logmatch_info(".dual_carrier");
single_value->field_dual__carrier.log_match(match_value.dual__carrier(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tlli__present.match(match_value.tlli__present(), legacy)){
TTCN_Logger::log_logmatch_info(".tlli_present");
single_value->field_tlli__present.log_match(match_value.tlli__present(), 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(!single_value->field_compact__reduced__ma__present.match(match_value.compact__reduced__ma__present(), legacy)){
TTCN_Logger::log_logmatch_info(".compact_reduced_ma_present");
single_value->field_compact__reduced__ma__present.log_match(match_value.compact__reduced__ma__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.compact__reduced__ma().ispresent()){
if(!single_value->field_compact__reduced__ma.match(match_value.compact__reduced__ma(), legacy)){
TTCN_Logger::log_logmatch_info(".compact_reduced_ma");
single_value->field_compact__reduced__ma.log_match(match_value.compact__reduced__ma(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_compact__reduced__ma.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".compact_reduced_ma := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_compact__reduced__ma.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_chan__coding__cmd.match(match_value.chan__coding__cmd(), legacy)){
TTCN_Logger::log_logmatch_info(".chan_coding_cmd");
single_value->field_chan__coding__cmd.log_match(match_value.chan__coding__cmd(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_resegment.match(match_value.resegment(), legacy)){
TTCN_Logger::log_logmatch_info(".resegment");
single_value->field_resegment.log_match(match_value.resegment(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_window__size.match(match_value.window__size(), legacy)){
TTCN_Logger::log_logmatch_info(".window_size");
single_value->field_window__size.log_match(match_value.window__size(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ats__present.match(match_value.ats__present(), legacy)){
TTCN_Logger::log_logmatch_info(".ats_present");
single_value->field_ats__present.log_match(match_value.ats__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.ats().ispresent()){
if(!single_value->field_ats.match(match_value.ats(), legacy)){
TTCN_Logger::log_logmatch_info(".ats");
single_value->field_ats.log_match(match_value.ats(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_ats.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".ats := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_ats.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_arac__retrans__req.match(match_value.arac__retrans__req(), legacy)){
TTCN_Logger::log_logmatch_info(".arac_retrans_req");
single_value->field_arac__retrans__req.log_match(match_value.arac__retrans__req(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tlli__block__chan__coding.match(match_value.tlli__block__chan__coding(), legacy)){
TTCN_Logger::log_logmatch_info(".tlli_block_chan_coding");
single_value->field_tlli__block__chan__coding.log_match(match_value.tlli__block__chan__coding(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_bep__period2__present.match(match_value.bep__period2__present(), legacy)){
TTCN_Logger::log_logmatch_info(".bep_period2_present");
single_value->field_bep__period2__present.log_match(match_value.bep__period2__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.bep__period2().ispresent()){
if(!single_value->field_bep__period2.match(match_value.bep__period2(), legacy)){
TTCN_Logger::log_logmatch_info(".bep_period2");
single_value->field_bep__period2.log_match(match_value.bep__period2(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_bep__period2.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".bep_period2 := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_bep__period2.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_pkt__ta.match(match_value.pkt__ta(), legacy)){
TTCN_Logger::log_logmatch_info(".pkt_ta");
single_value->field_pkt__ta.log_match(match_value.pkt__ta(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pkt__ext__ta__present.match(match_value.pkt__ext__ta__present(), legacy)){
TTCN_Logger::log_logmatch_info(".pkt_ext_ta_present");
single_value->field_pkt__ext__ta__present.log_match(match_value.pkt__ext__ta__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.pkt__ext__ta().ispresent()){
if(!single_value->field_pkt__ext__ta.match(match_value.pkt__ext__ta(), legacy)){
TTCN_Logger::log_logmatch_info(".pkt_ext_ta");
single_value->field_pkt__ext__ta.log_match(match_value.pkt__ext__ta(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_pkt__ext__ta.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".pkt_ext_ta := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_pkt__ext__ta.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_freq__par__present.match(match_value.freq__par__present(), legacy)){
TTCN_Logger::log_logmatch_info(".freq_par_present");
single_value->field_freq__par__present.log_match(match_value.freq__par__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.freq__par().ispresent()){
if(!single_value->field_freq__par.match(match_value.freq__par(), legacy)){
TTCN_Logger::log_logmatch_info(".freq_par");
single_value->field_freq__par.log_match(match_value.freq__par(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_freq__par.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".freq_par := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_freq__par.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_alloc__present.match(match_value.alloc__present(), legacy)){
TTCN_Logger::log_logmatch_info(".alloc_present");
single_value->field_alloc__present.log_match(match_value.alloc__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.dyn__block__alloc().ispresent()){
if(!single_value->field_dyn__block__alloc.match(match_value.dyn__block__alloc(), legacy)){
TTCN_Logger::log_logmatch_info(".dyn_block_alloc");
single_value->field_dyn__block__alloc.log_match(match_value.dyn__block__alloc(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_dyn__block__alloc.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".dyn_block_alloc := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_dyn__block__alloc.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.multi__block__alloc().ispresent()){
if(!single_value->field_multi__block__alloc.match(match_value.multi__block__alloc(), legacy)){
TTCN_Logger::log_logmatch_info(".multi_block_alloc");
single_value->field_multi__block__alloc.log_match(match_value.multi__block__alloc(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_multi__block__alloc.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".multi_block_alloc := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_multi__block__alloc.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("{ dual_carrier := ");
single_value->field_dual__carrier.log_match(match_value.dual__carrier(), legacy);
TTCN_Logger::log_event_str(", tlli_present := ");
single_value->field_tlli__present.log_match(match_value.tlli__present(), 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(", compact_reduced_ma_present := ");
single_value->field_compact__reduced__ma__present.log_match(match_value.compact__reduced__ma__present(), legacy);
TTCN_Logger::log_event_str(", compact_reduced_ma := ");
if (match_value.compact__reduced__ma().ispresent()) {
single_value->field_compact__reduced__ma.log_match(match_value.compact__reduced__ma(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_compact__reduced__ma.log();
if (single_value->field_compact__reduced__ma.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", chan_coding_cmd := ");
single_value->field_chan__coding__cmd.log_match(match_value.chan__coding__cmd(), legacy);
TTCN_Logger::log_event_str(", resegment := ");
single_value->field_resegment.log_match(match_value.resegment(), legacy);
TTCN_Logger::log_event_str(", window_size := ");
single_value->field_window__size.log_match(match_value.window__size(), legacy);
TTCN_Logger::log_event_str(", ats_present := ");
single_value->field_ats__present.log_match(match_value.ats__present(), legacy);
TTCN_Logger::log_event_str(", ats := ");
if (match_value.ats().ispresent()) {
single_value->field_ats.log_match(match_value.ats(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_ats.log();
if (single_value->field_ats.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", arac_retrans_req := ");
single_value->field_arac__retrans__req.log_match(match_value.arac__retrans__req(), legacy);
TTCN_Logger::log_event_str(", tlli_block_chan_coding := ");
single_value->field_tlli__block__chan__coding.log_match(match_value.tlli__block__chan__coding(), legacy);
TTCN_Logger::log_event_str(", bep_period2_present := ");
single_value->field_bep__period2__present.log_match(match_value.bep__period2__present(), legacy);
TTCN_Logger::log_event_str(", bep_period2 := ");
if (match_value.bep__period2().ispresent()) {
single_value->field_bep__period2.log_match(match_value.bep__period2(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_bep__period2.log();
if (single_value->field_bep__period2.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", pkt_ta := ");
single_value->field_pkt__ta.log_match(match_value.pkt__ta(), legacy);
TTCN_Logger::log_event_str(", pkt_ext_ta_present := ");
single_value->field_pkt__ext__ta__present.log_match(match_value.pkt__ext__ta__present(), legacy);
TTCN_Logger::log_event_str(", pkt_ext_ta := ");
if (match_value.pkt__ext__ta().ispresent()) {
single_value->field_pkt__ext__ta.log_match(match_value.pkt__ext__ta(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_pkt__ext__ta.log();
if (single_value->field_pkt__ext__ta.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", freq_par_present := ");
single_value->field_freq__par__present.log_match(match_value.freq__par__present(), legacy);
TTCN_Logger::log_event_str(", freq_par := ");
if (match_value.freq__par().ispresent()) {
single_value->field_freq__par.log_match(match_value.freq__par(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_freq__par.log();
if (single_value->field_freq__par.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", alloc_present := ");
single_value->field_alloc__present.log_match(match_value.alloc__present(), legacy);
TTCN_Logger::log_event_str(", dyn_block_alloc := ");
if (match_value.dyn__block__alloc().ispresent()) {
single_value->field_dyn__block__alloc.log_match(match_value.dyn__block__alloc(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_dyn__block__alloc.log();
if (single_value->field_dyn__block__alloc.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", multi_block_alloc := ");
if (match_value.multi__block__alloc().ispresent()) {
single_value->field_multi__block__alloc.log_match(match_value.multi__block__alloc(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_multi__block__alloc.log();
if (single_value->field_multi__block__alloc.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 PktUlAssEgprs_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (dual__carrier().is_bound()) dual__carrier().set_implicit_omit();
if (tlli__present().is_bound()) tlli__present().set_implicit_omit();
if (!tlli().is_bound()) tlli() = OMIT_VALUE;
else tlli().set_implicit_omit();
if (compact__reduced__ma__present().is_bound()) compact__reduced__ma__present().set_implicit_omit();
if (!compact__reduced__ma().is_bound()) compact__reduced__ma() = OMIT_VALUE;
else compact__reduced__ma().set_implicit_omit();
if (chan__coding__cmd().is_bound()) chan__coding__cmd().set_implicit_omit();
if (resegment().is_bound()) resegment().set_implicit_omit();
if (window__size().is_bound()) window__size().set_implicit_omit();
if (ats__present().is_bound()) ats__present().set_implicit_omit();
if (!ats().is_bound()) ats() = OMIT_VALUE;
else ats().set_implicit_omit();
if (arac__retrans__req().is_bound()) arac__retrans__req().set_implicit_omit();
if (tlli__block__chan__coding().is_bound()) tlli__block__chan__coding().set_implicit_omit();
if (bep__period2__present().is_bound()) bep__period2__present().set_implicit_omit();
if (!bep__period2().is_bound()) bep__period2() = OMIT_VALUE;
else bep__period2().set_implicit_omit();
if (pkt__ta().is_bound()) pkt__ta().set_implicit_omit();
if (pkt__ext__ta__present().is_bound()) pkt__ext__ta__present().set_implicit_omit();
if (!pkt__ext__ta().is_bound()) pkt__ext__ta() = OMIT_VALUE;
else pkt__ext__ta().set_implicit_omit();
if (freq__par__present().is_bound()) freq__par__present().set_implicit_omit();
if (!freq__par().is_bound()) freq__par() = OMIT_VALUE;
else freq__par().set_implicit_omit();
if (alloc__present().is_bound()) alloc__present().set_implicit_omit();
if (!dyn__block__alloc().is_bound()) dyn__block__alloc() = OMIT_VALUE;
else dyn__block__alloc().set_implicit_omit();
if (!multi__block__alloc().is_bound()) multi__block__alloc() = OMIT_VALUE;
else multi__block__alloc().set_implicit_omit();
}

void PktUlAssEgprs_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_dual__carrier.encode_text(text_buf);
single_value->field_tlli__present.encode_text(text_buf);
single_value->field_tlli.encode_text(text_buf);
single_value->field_compact__reduced__ma__present.encode_text(text_buf);
single_value->field_compact__reduced__ma.encode_text(text_buf);
single_value->field_chan__coding__cmd.encode_text(text_buf);
single_value->field_resegment.encode_text(text_buf);
single_value->field_window__size.encode_text(text_buf);
single_value->field_ats__present.encode_text(text_buf);
single_value->field_ats.encode_text(text_buf);
single_value->field_arac__retrans__req.encode_text(text_buf);
single_value->field_tlli__block__chan__coding.encode_text(text_buf);
single_value->field_bep__period2__present.encode_text(text_buf);
single_value->field_bep__period2.encode_text(text_buf);
single_value->field_pkt__ta.encode_text(text_buf);
single_value->field_pkt__ext__ta__present.encode_text(text_buf);
single_value->field_pkt__ext__ta.encode_text(text_buf);
single_value->field_freq__par__present.encode_text(text_buf);
single_value->field_freq__par.encode_text(text_buf);
single_value->field_alloc__present.encode_text(text_buf);
single_value->field_dyn__block__alloc.encode_text(text_buf);
single_value->field_multi__block__alloc.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_CSN1_Types.PktUlAssEgprs.");
}
}

void PktUlAssEgprs_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_dual__carrier.decode_text(text_buf);
single_value->field_tlli__present.decode_text(text_buf);
single_value->field_tlli.decode_text(text_buf);
single_value->field_compact__reduced__ma__present.decode_text(text_buf);
single_value->field_compact__reduced__ma.decode_text(text_buf);
single_value->field_chan__coding__cmd.decode_text(text_buf);
single_value->field_resegment.decode_text(text_buf);
single_value->field_window__size.decode_text(text_buf);
single_value->field_ats__present.decode_text(text_buf);
single_value->field_ats.decode_text(text_buf);
single_value->field_arac__retrans__req.decode_text(text_buf);
single_value->field_tlli__block__chan__coding.decode_text(text_buf);
single_value->field_bep__period2__present.decode_text(text_buf);
single_value->field_bep__period2.decode_text(text_buf);
single_value->field_pkt__ta.decode_text(text_buf);
single_value->field_pkt__ext__ta__present.decode_text(text_buf);
single_value->field_pkt__ext__ta.decode_text(text_buf);
single_value->field_freq__par__present.decode_text(text_buf);
single_value->field_freq__par.decode_text(text_buf);
single_value->field_alloc__present.decode_text(text_buf);
single_value->field_dyn__block__alloc.decode_text(text_buf);
single_value->field_multi__block__alloc.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 PktUlAssEgprs_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_CSN1_Types.PktUlAssEgprs.");
}
}

void PktUlAssEgprs_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: {
    PktUlAssEgprs_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 (22<param.get_size()) {
      param.error("record template of type @RLCMAC_CSN1_Types.PktUlAssEgprs has 22 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) dual__carrier().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tlli__present().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) compact__reduced__ma__present().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) compact__reduced__ma().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) chan__coding__cmd().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) resegment().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) window__size().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) ats__present().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) ats().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) arac__retrans__req().set_param(*param.get_elem(10));
    if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) tlli__block__chan__coding().set_param(*param.get_elem(11));
    if (param.get_size()>12 && param.get_elem(12)->get_type()!=Module_Param::MP_NotUsed) bep__period2__present().set_param(*param.get_elem(12));
    if (param.get_size()>13 && param.get_elem(13)->get_type()!=Module_Param::MP_NotUsed) bep__period2().set_param(*param.get_elem(13));
    if (param.get_size()>14 && param.get_elem(14)->get_type()!=Module_Param::MP_NotUsed) pkt__ta().set_param(*param.get_elem(14));
    if (param.get_size()>15 && param.get_elem(15)->get_type()!=Module_Param::MP_NotUsed) pkt__ext__ta__present().set_param(*param.get_elem(15));
    if (param.get_size()>16 && param.get_elem(16)->get_type()!=Module_Param::MP_NotUsed) pkt__ext__ta().set_param(*param.get_elem(16));
    if (param.get_size()>17 && param.get_elem(17)->get_type()!=Module_Param::MP_NotUsed) freq__par__present().set_param(*param.get_elem(17));
    if (param.get_size()>18 && param.get_elem(18)->get_type()!=Module_Param::MP_NotUsed) freq__par().set_param(*param.get_elem(18));
    if (param.get_size()>19 && param.get_elem(19)->get_type()!=Module_Param::MP_NotUsed) alloc__present().set_param(*param.get_elem(19));
    if (param.get_size()>20 && param.get_elem(20)->get_type()!=Module_Param::MP_NotUsed) dyn__block__alloc().set_param(*param.get_elem(20));
    if (param.get_size()>21 && param.get_elem(21)->get_type()!=Module_Param::MP_NotUsed) multi__block__alloc().set_param(*param.get_elem(21));
    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(), "dual_carrier")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          dual__carrier().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tlli__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(), "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(), "compact_reduced_ma_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          compact__reduced__ma__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(), "compact_reduced_ma")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          compact__reduced__ma().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "chan_coding_cmd")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          chan__coding__cmd().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "resegment")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          resegment().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "window_size")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          window__size().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ats_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ats__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(), "ats")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ats().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "arac_retrans_req")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          arac__retrans__req().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tlli_block_chan_coding")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tlli__block__chan__coding().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "bep_period2_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bep__period2__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(), "bep_period2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bep__period2().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pkt_ta")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pkt__ta().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pkt_ext_ta_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pkt__ext__ta__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(), "pkt_ext_ta")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pkt__ext__ta().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "freq_par_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          freq__par__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(), "freq_par")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          freq__par().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "alloc_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          alloc__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(), "dyn_block_alloc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          dyn__block__alloc().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "multi_block_alloc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          multi__block__alloc().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_CSN1_Types.PktUlAssEgprs: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PktUlAssEgprs_template* precondition = new PktUlAssEgprs_template;
    precondition->set_param(*param.get_elem(0));
    PktUlAssEgprs_template* implied_template = new PktUlAssEgprs_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PktUlAssEgprs_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.PktUlAssEgprs");
  }
  is_ifpresent = param.get_ifpresent();
}

void PktUlAssEgprs_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_dual__carrier.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_tlli__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_tlli.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_compact__reduced__ma__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_compact__reduced__ma.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_chan__coding__cmd.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_resegment.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_window__size.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_ats__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_ats.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_arac__retrans__req.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_tlli__block__chan__coding.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_bep__period2__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_bep__period2.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_pkt__ta.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_pkt__ext__ta__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_pkt__ext__ta.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_freq__par__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_freq__par.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_alloc__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_dyn__block__alloc.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
single_value->field_multi__block__alloc.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PktUlAssEgprs");
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_CSN1_Types.PktUlAssEgprs");
}

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

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

PacketUlAssignment::PacketUlAssignment()
{
}

PacketUlAssignment::PacketUlAssignment(const PageMode& par_page__mode,
    const BITSTRING& par_persistence__levels__present,
    const OPTIONAL< PersistenceLevels >& par_persistence__levels,
    const PktUlAssUnion& par_identity,
    const BITSTRING& par_is__egprs,
    const OPTIONAL< PktUlAssGprs >& par_gprs,
    const OPTIONAL< PktUlAssEgprs >& par_egprs)
  :   field_page__mode(par_page__mode),
  field_persistence__levels__present(par_persistence__levels__present),
  field_persistence__levels(par_persistence__levels),
  field_identity(par_identity),
  field_is__egprs(par_is__egprs),
  field_gprs(par_gprs),
  field_egprs(par_egprs)
{
}

PacketUlAssignment::PacketUlAssignment(const PacketUlAssignment& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PacketUlAssignment.");
if (other_value.page__mode().is_bound()) field_page__mode = other_value.page__mode();
else field_page__mode.clean_up();
if (other_value.persistence__levels__present().is_bound()) field_persistence__levels__present = other_value.persistence__levels__present();
else field_persistence__levels__present.clean_up();
if (other_value.persistence__levels().is_bound()) field_persistence__levels = other_value.persistence__levels();
else field_persistence__levels.clean_up();
if (other_value.identity().is_bound()) field_identity = other_value.identity();
else field_identity.clean_up();
if (other_value.is__egprs().is_bound()) field_is__egprs = other_value.is__egprs();
else field_is__egprs.clean_up();
if (other_value.gprs().is_bound()) field_gprs = other_value.gprs();
else field_gprs.clean_up();
if (other_value.egprs().is_bound()) field_egprs = other_value.egprs();
else field_egprs.clean_up();
}

void PacketUlAssignment::clean_up()
{
field_page__mode.clean_up();
field_persistence__levels__present.clean_up();
field_persistence__levels.clean_up();
field_identity.clean_up();
field_is__egprs.clean_up();
field_gprs.clean_up();
field_egprs.clean_up();
}

const TTCN_Typedescriptor_t* PacketUlAssignment::get_descriptor() const { return &PacketUlAssignment_descr_; }
PacketUlAssignment& PacketUlAssignment::operator=(const PacketUlAssignment& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PacketUlAssignment.");
  if (other_value.page__mode().is_bound()) field_page__mode = other_value.page__mode();
  else field_page__mode.clean_up();
  if (other_value.persistence__levels__present().is_bound()) field_persistence__levels__present = other_value.persistence__levels__present();
  else field_persistence__levels__present.clean_up();
  if (other_value.persistence__levels().is_bound()) field_persistence__levels = other_value.persistence__levels();
  else field_persistence__levels.clean_up();
  if (other_value.identity().is_bound()) field_identity = other_value.identity();
  else field_identity.clean_up();
  if (other_value.is__egprs().is_bound()) field_is__egprs = other_value.is__egprs();
  else field_is__egprs.clean_up();
  if (other_value.gprs().is_bound()) field_gprs = other_value.gprs();
  else field_gprs.clean_up();
  if (other_value.egprs().is_bound()) field_egprs = other_value.egprs();
  else field_egprs.clean_up();
}
return *this;
}

boolean PacketUlAssignment::operator==(const PacketUlAssignment& other_value) const
{
return field_page__mode==other_value.field_page__mode
  && field_persistence__levels__present==other_value.field_persistence__levels__present
  && field_persistence__levels==other_value.field_persistence__levels
  && field_identity==other_value.field_identity
  && field_is__egprs==other_value.field_is__egprs
  && field_gprs==other_value.field_gprs
  && field_egprs==other_value.field_egprs;
}

boolean PacketUlAssignment::is_bound() const
{
return (field_page__mode.is_bound())
  || (field_persistence__levels__present.is_bound())
  || (OPTIONAL_OMIT == field_persistence__levels.get_selection() || field_persistence__levels.is_bound())
  || (field_identity.is_bound())
  || (field_is__egprs.is_bound())
  || (OPTIONAL_OMIT == field_gprs.get_selection() || field_gprs.is_bound())
  || (OPTIONAL_OMIT == field_egprs.get_selection() || field_egprs.is_bound());
}
boolean PacketUlAssignment::is_value() const
{
return field_page__mode.is_value()
  && field_persistence__levels__present.is_value()
  && (OPTIONAL_OMIT == field_persistence__levels.get_selection() || field_persistence__levels.is_value())
  && field_identity.is_value()
  && field_is__egprs.is_value()
  && (OPTIONAL_OMIT == field_gprs.get_selection() || field_gprs.is_value())
  && (OPTIONAL_OMIT == field_egprs.get_selection() || field_egprs.is_value());
}
int PacketUlAssignment::size_of() const
{
  int ret_val = 4;
  if (field_persistence__levels.ispresent()) ret_val++;
  if (field_gprs.ispresent()) ret_val++;
  if (field_egprs.ispresent()) ret_val++;
  return ret_val;
}

void PacketUlAssignment::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ page_mode := ");
field_page__mode.log();
TTCN_Logger::log_event_str(", persistence_levels_present := ");
field_persistence__levels__present.log();
TTCN_Logger::log_event_str(", persistence_levels := ");
field_persistence__levels.log();
TTCN_Logger::log_event_str(", identity := ");
field_identity.log();
TTCN_Logger::log_event_str(", is_egprs := ");
field_is__egprs.log();
TTCN_Logger::log_event_str(", gprs := ");
field_gprs.log();
TTCN_Logger::log_event_str(", egprs := ");
field_egprs.log();
TTCN_Logger::log_event_str(" }");
}

void PacketUlAssignment::set_implicit_omit()
{
if (page__mode().is_bound()) page__mode().set_implicit_omit();
if (persistence__levels__present().is_bound()) persistence__levels__present().set_implicit_omit();
if (!persistence__levels().is_bound()) persistence__levels() = OMIT_VALUE;
else persistence__levels().set_implicit_omit();
if (identity().is_bound()) identity().set_implicit_omit();
if (is__egprs().is_bound()) is__egprs().set_implicit_omit();
if (!gprs().is_bound()) gprs() = OMIT_VALUE;
else gprs().set_implicit_omit();
if (!egprs().is_bound()) egprs() = OMIT_VALUE;
else egprs().set_implicit_omit();
}

void PacketUlAssignment::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_CSN1_Types.PacketUlAssignment 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) page__mode().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) persistence__levels__present().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) persistence__levels().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) identity().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) is__egprs().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) gprs().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) egprs().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(), "page_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          page__mode().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "persistence_levels_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          persistence__levels__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(), "persistence_levels")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          persistence__levels().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "identity")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          identity().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "is_egprs")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          is__egprs().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gprs")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gprs().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "egprs")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          egprs().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_CSN1_Types.PacketUlAssignment: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.PacketUlAssignment");
  }
}

void PacketUlAssignment::encode_text(Text_Buf& text_buf) const
{
field_page__mode.encode_text(text_buf);
field_persistence__levels__present.encode_text(text_buf);
field_persistence__levels.encode_text(text_buf);
field_identity.encode_text(text_buf);
field_is__egprs.encode_text(text_buf);
field_gprs.encode_text(text_buf);
field_egprs.encode_text(text_buf);
}

void PacketUlAssignment::decode_text(Text_Buf& text_buf)
{
field_page__mode.decode_text(text_buf);
field_persistence__levels__present.decode_text(text_buf);
field_persistence__levels.decode_text(text_buf);
field_identity.decode_text(text_buf);
field_is__egprs.decode_text(text_buf);
field_gprs.decode_text(text_buf);
field_egprs.decode_text(text_buf);
}

void PacketUlAssignment::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 PacketUlAssignment::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 PacketUlAssignment::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, PacketUlAssignment_page__mode_descr_.raw->forceomit);
  decoded_field_length = field_page__mode.RAW_decode(PacketUlAssignment_page__mode_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, PacketUlAssignment_persistence__levels__present_descr_.raw->forceomit);
  decoded_field_length = field_persistence__levels__present.RAW_decode(PacketUlAssignment_persistence__levels__present_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_persistence__levels__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(2)) {
    field_persistence__levels = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_2_force_omit(2, force_omit, PacketUlAssignment_persistence__levels_descr_.raw->forceomit);
  decoded_field_length = field_persistence__levels().RAW_decode(PacketUlAssignment_persistence__levels_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 1) {
  field_persistence__levels = 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_persistence__levels=OMIT_VALUE;
  RAW_Force_Omit field_3_force_omit(3, force_omit, PacketUlAssignment_identity_descr_.raw->forceomit);
  decoded_field_length = field_identity.RAW_decode(PacketUlAssignment_identity_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, PacketUlAssignment_is__egprs_descr_.raw->forceomit);
  decoded_field_length = field_is__egprs.RAW_decode(PacketUlAssignment_is__egprs_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());
  if (limit > 0 && field_is__egprs ==  bs_1){
  if (force_omit != NULL && (*force_omit)(5)) {
    field_gprs = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_5_force_omit(5, force_omit, PacketUlAssignment_gprs_descr_.raw->forceomit);
  decoded_field_length = field_gprs().RAW_decode(PacketUlAssignment_gprs_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 1) {
  field_gprs = 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_gprs=OMIT_VALUE;
  if (limit > 0 && field_is__egprs ==  bs_0){
  if (force_omit != NULL && (*force_omit)(6)) {
    field_egprs = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_6_force_omit(6, force_omit, PacketUlAssignment_egprs_descr_.raw->forceomit);
  decoded_field_length = field_egprs().RAW_decode(PacketUlAssignment_egprs_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_6_force_omit);
  if (decoded_field_length < 1) {
  field_egprs = 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_egprs=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int PacketUlAssignment::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, PacketUlAssignment_page__mode_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PacketUlAssignment_persistence__levels__present_descr_.raw);
  if (field_persistence__levels.ispresent()) {
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PacketUlAssignment_persistence__levels_descr_.raw);
  }
  else myleaf.body.node.nodes[2] = NULL;
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, PacketUlAssignment_identity_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, PacketUlAssignment_is__egprs_descr_.raw);
  if (field_gprs.ispresent()) {
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, PacketUlAssignment_gprs_descr_.raw);
  }
  else myleaf.body.node.nodes[5] = NULL;
  if (field_egprs.ispresent()) {
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, PacketUlAssignment_egprs_descr_.raw);
  }
  else myleaf.body.node.nodes[6] = NULL;
  encoded_length += field_page__mode.RAW_encode(PacketUlAssignment_page__mode_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_persistence__levels__present.RAW_encode(PacketUlAssignment_persistence__levels__present_descr_, *myleaf.body.node.nodes[1]);
  if (field_persistence__levels.ispresent()) {
  encoded_length += field_persistence__levels().RAW_encode(PacketUlAssignment_persistence__levels_descr_, *myleaf.body.node.nodes[2]);
  }
  encoded_length += field_identity.RAW_encode(PacketUlAssignment_identity_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_is__egprs.RAW_encode(PacketUlAssignment_is__egprs_descr_, *myleaf.body.node.nodes[4]);
  if (field_gprs.ispresent()) {
  encoded_length += field_gprs().RAW_encode(PacketUlAssignment_gprs_descr_, *myleaf.body.node.nodes[5]);
  }
  if (field_egprs.ispresent()) {
  encoded_length += field_egprs().RAW_encode(PacketUlAssignment_egprs_descr_, *myleaf.body.node.nodes[6]);
  }
  if (field_persistence__levels.ispresent() && (field_persistence__levels__present !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={1};
  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(PacketUlAssignment_persistence__levels__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_gprs.ispresent() && (field_is__egprs !=  bs_1)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={4};
  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_1.RAW_encode(PacketUlAssignment_is__egprs_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_egprs.ispresent() && (field_is__egprs !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={4};
  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(PacketUlAssignment_is__egprs_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 PacketUlAssignment_template::single_value_struct {
PageMode_template field_page__mode;
BITSTRING_template field_persistence__levels__present;
PersistenceLevels_template field_persistence__levels;
PktUlAssUnion_template field_identity;
BITSTRING_template field_is__egprs;
PktUlAssGprs_template field_gprs;
PktUlAssEgprs_template field_egprs;
};

void PacketUlAssignment_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_page__mode = ANY_VALUE;
single_value->field_persistence__levels__present = ANY_VALUE;
single_value->field_persistence__levels = ANY_OR_OMIT;
single_value->field_identity = ANY_VALUE;
single_value->field_is__egprs = ANY_VALUE;
single_value->field_gprs = ANY_OR_OMIT;
single_value->field_egprs = ANY_OR_OMIT;
}
}
}

void PacketUlAssignment_template::copy_value(const PacketUlAssignment& other_value)
{
single_value = new single_value_struct;
if (other_value.page__mode().is_bound()) {
  single_value->field_page__mode = other_value.page__mode();
} else {
  single_value->field_page__mode.clean_up();
}
if (other_value.persistence__levels__present().is_bound()) {
  single_value->field_persistence__levels__present = other_value.persistence__levels__present();
} else {
  single_value->field_persistence__levels__present.clean_up();
}
if (other_value.persistence__levels().is_bound()) {
  if (other_value.persistence__levels().ispresent()) single_value->field_persistence__levels = other_value.persistence__levels()();
  else single_value->field_persistence__levels = OMIT_VALUE;
} else {
  single_value->field_persistence__levels.clean_up();
}
if (other_value.identity().is_bound()) {
  single_value->field_identity = other_value.identity();
} else {
  single_value->field_identity.clean_up();
}
if (other_value.is__egprs().is_bound()) {
  single_value->field_is__egprs = other_value.is__egprs();
} else {
  single_value->field_is__egprs.clean_up();
}
if (other_value.gprs().is_bound()) {
  if (other_value.gprs().ispresent()) single_value->field_gprs = other_value.gprs()();
  else single_value->field_gprs = OMIT_VALUE;
} else {
  single_value->field_gprs.clean_up();
}
if (other_value.egprs().is_bound()) {
  if (other_value.egprs().ispresent()) single_value->field_egprs = other_value.egprs()();
  else single_value->field_egprs = OMIT_VALUE;
} else {
  single_value->field_egprs.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PacketUlAssignment_template::copy_template(const PacketUlAssignment_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.page__mode().get_selection()) {
single_value->field_page__mode = other_value.page__mode();
} else {
single_value->field_page__mode.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.persistence__levels__present().get_selection()) {
single_value->field_persistence__levels__present = other_value.persistence__levels__present();
} else {
single_value->field_persistence__levels__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.persistence__levels().get_selection()) {
single_value->field_persistence__levels = other_value.persistence__levels();
} else {
single_value->field_persistence__levels.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.identity().get_selection()) {
single_value->field_identity = other_value.identity();
} else {
single_value->field_identity.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.is__egprs().get_selection()) {
single_value->field_is__egprs = other_value.is__egprs();
} else {
single_value->field_is__egprs.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.gprs().get_selection()) {
single_value->field_gprs = other_value.gprs();
} else {
single_value->field_gprs.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.egprs().get_selection()) {
single_value->field_egprs = other_value.egprs();
} else {
single_value->field_egprs.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 PacketUlAssignment_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 PacketUlAssignment_template(*other_value.implication_.precondition);
implication_.implied_template = new PacketUlAssignment_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_CSN1_Types.PacketUlAssignment.");
break;
}
set_selection(other_value);
}

PacketUlAssignment_template::PacketUlAssignment_template()
{
}

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

PacketUlAssignment_template::PacketUlAssignment_template(const PacketUlAssignment& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PacketUlAssignment_template::match(const PacketUlAssignment& 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.page__mode().is_bound()) return FALSE;
if(!single_value->field_page__mode.match(other_value.page__mode(), legacy))return FALSE;
if(!other_value.persistence__levels__present().is_bound()) return FALSE;
if(!single_value->field_persistence__levels__present.match(other_value.persistence__levels__present(), legacy))return FALSE;
if(!other_value.persistence__levels().is_bound()) return FALSE;
if((other_value.persistence__levels().ispresent() ? !single_value->field_persistence__levels.match((const PersistenceLevels&)other_value.persistence__levels(), legacy) : !single_value->field_persistence__levels.match_omit(legacy)))return FALSE;
if(!other_value.identity().is_bound()) return FALSE;
if(!single_value->field_identity.match(other_value.identity(), legacy))return FALSE;
if(!other_value.is__egprs().is_bound()) return FALSE;
if(!single_value->field_is__egprs.match(other_value.is__egprs(), legacy))return FALSE;
if(!other_value.gprs().is_bound()) return FALSE;
if((other_value.gprs().ispresent() ? !single_value->field_gprs.match((const PktUlAssGprs&)other_value.gprs(), legacy) : !single_value->field_gprs.match_omit(legacy)))return FALSE;
if(!other_value.egprs().is_bound()) return FALSE;
if((other_value.egprs().ispresent() ? !single_value->field_egprs.match((const PktUlAssEgprs&)other_value.egprs(), legacy) : !single_value->field_egprs.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_CSN1_Types.PacketUlAssignment.");
}
return FALSE;
}

boolean PacketUlAssignment_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_page__mode.is_bound()
 || single_value->field_persistence__levels__present.is_bound()
 || (single_value->field_persistence__levels.is_omit() || single_value->field_persistence__levels.is_bound())
 || single_value->field_identity.is_bound()
 || single_value->field_is__egprs.is_bound()
 || (single_value->field_gprs.is_omit() || single_value->field_gprs.is_bound())
 || (single_value->field_egprs.is_omit() || single_value->field_egprs.is_bound());
}

boolean PacketUlAssignment_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_page__mode.is_value()
 && single_value->field_persistence__levels__present.is_value()
 && (single_value->field_persistence__levels.is_omit() || single_value->field_persistence__levels.is_value())
 && single_value->field_identity.is_value()
 && single_value->field_is__egprs.is_value()
 && (single_value->field_gprs.is_omit() || single_value->field_gprs.is_value())
 && (single_value->field_egprs.is_omit() || single_value->field_egprs.is_value());
}

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

PacketUlAssignment PacketUlAssignment_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_CSN1_Types.PacketUlAssignment.");
PacketUlAssignment ret_val;
if (single_value->field_page__mode.is_bound()) {
ret_val.page__mode() = single_value->field_page__mode.valueof();
}
if (single_value->field_persistence__levels__present.is_bound()) {
ret_val.persistence__levels__present() = single_value->field_persistence__levels__present.valueof();
}
if (single_value->field_persistence__levels.is_omit()) ret_val.persistence__levels() = OMIT_VALUE;
else if (single_value->field_persistence__levels.is_bound()) {
ret_val.persistence__levels() = single_value->field_persistence__levels.valueof();
}
if (single_value->field_identity.is_bound()) {
ret_val.identity() = single_value->field_identity.valueof();
}
if (single_value->field_is__egprs.is_bound()) {
ret_val.is__egprs() = single_value->field_is__egprs.valueof();
}
if (single_value->field_gprs.is_omit()) ret_val.gprs() = OMIT_VALUE;
else if (single_value->field_gprs.is_bound()) {
ret_val.gprs() = single_value->field_gprs.valueof();
}
if (single_value->field_egprs.is_omit()) ret_val.egprs() = OMIT_VALUE;
else if (single_value->field_egprs.is_bound()) {
ret_val.egprs() = single_value->field_egprs.valueof();
}
return ret_val;
}

void PacketUlAssignment_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_CSN1_Types.PacketUlAssignment.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PacketUlAssignment_template[list_length];
}

PacketUlAssignment_template& PacketUlAssignment_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_CSN1_Types.PacketUlAssignment.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.PacketUlAssignment.");
return value_list.list_value[list_index];
}

PageMode_template& PacketUlAssignment_template::page__mode()
{
set_specific();
return single_value->field_page__mode;
}

const PageMode_template& PacketUlAssignment_template::page__mode() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field page_mode of a non-specific template of type @RLCMAC_CSN1_Types.PacketUlAssignment.");
return single_value->field_page__mode;
}

BITSTRING_template& PacketUlAssignment_template::persistence__levels__present()
{
set_specific();
return single_value->field_persistence__levels__present;
}

const BITSTRING_template& PacketUlAssignment_template::persistence__levels__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field persistence_levels_present of a non-specific template of type @RLCMAC_CSN1_Types.PacketUlAssignment.");
return single_value->field_persistence__levels__present;
}

PersistenceLevels_template& PacketUlAssignment_template::persistence__levels()
{
set_specific();
return single_value->field_persistence__levels;
}

const PersistenceLevels_template& PacketUlAssignment_template::persistence__levels() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field persistence_levels of a non-specific template of type @RLCMAC_CSN1_Types.PacketUlAssignment.");
return single_value->field_persistence__levels;
}

PktUlAssUnion_template& PacketUlAssignment_template::identity()
{
set_specific();
return single_value->field_identity;
}

const PktUlAssUnion_template& PacketUlAssignment_template::identity() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field identity of a non-specific template of type @RLCMAC_CSN1_Types.PacketUlAssignment.");
return single_value->field_identity;
}

BITSTRING_template& PacketUlAssignment_template::is__egprs()
{
set_specific();
return single_value->field_is__egprs;
}

const BITSTRING_template& PacketUlAssignment_template::is__egprs() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field is_egprs of a non-specific template of type @RLCMAC_CSN1_Types.PacketUlAssignment.");
return single_value->field_is__egprs;
}

PktUlAssGprs_template& PacketUlAssignment_template::gprs()
{
set_specific();
return single_value->field_gprs;
}

const PktUlAssGprs_template& PacketUlAssignment_template::gprs() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field gprs of a non-specific template of type @RLCMAC_CSN1_Types.PacketUlAssignment.");
return single_value->field_gprs;
}

PktUlAssEgprs_template& PacketUlAssignment_template::egprs()
{
set_specific();
return single_value->field_egprs;
}

const PktUlAssEgprs_template& PacketUlAssignment_template::egprs() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field egprs of a non-specific template of type @RLCMAC_CSN1_Types.PacketUlAssignment.");
return single_value->field_egprs;
}

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

void PacketUlAssignment_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ page_mode := ");
single_value->field_page__mode.log();
TTCN_Logger::log_event_str(", persistence_levels_present := ");
single_value->field_persistence__levels__present.log();
TTCN_Logger::log_event_str(", persistence_levels := ");
single_value->field_persistence__levels.log();
TTCN_Logger::log_event_str(", identity := ");
single_value->field_identity.log();
TTCN_Logger::log_event_str(", is_egprs := ");
single_value->field_is__egprs.log();
TTCN_Logger::log_event_str(", gprs := ");
single_value->field_gprs.log();
TTCN_Logger::log_event_str(", egprs := ");
single_value->field_egprs.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 PacketUlAssignment_template::log_match(const PacketUlAssignment& 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_page__mode.match(match_value.page__mode(), legacy)){
TTCN_Logger::log_logmatch_info(".page_mode");
single_value->field_page__mode.log_match(match_value.page__mode(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_persistence__levels__present.match(match_value.persistence__levels__present(), legacy)){
TTCN_Logger::log_logmatch_info(".persistence_levels_present");
single_value->field_persistence__levels__present.log_match(match_value.persistence__levels__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.persistence__levels().ispresent()){
if(!single_value->field_persistence__levels.match(match_value.persistence__levels(), legacy)){
TTCN_Logger::log_logmatch_info(".persistence_levels");
single_value->field_persistence__levels.log_match(match_value.persistence__levels(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_persistence__levels.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".persistence_levels := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_persistence__levels.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_identity.match(match_value.identity(), legacy)){
TTCN_Logger::log_logmatch_info(".identity");
single_value->field_identity.log_match(match_value.identity(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_is__egprs.match(match_value.is__egprs(), legacy)){
TTCN_Logger::log_logmatch_info(".is_egprs");
single_value->field_is__egprs.log_match(match_value.is__egprs(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.gprs().ispresent()){
if(!single_value->field_gprs.match(match_value.gprs(), legacy)){
TTCN_Logger::log_logmatch_info(".gprs");
single_value->field_gprs.log_match(match_value.gprs(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_gprs.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".gprs := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_gprs.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.egprs().ispresent()){
if(!single_value->field_egprs.match(match_value.egprs(), legacy)){
TTCN_Logger::log_logmatch_info(".egprs");
single_value->field_egprs.log_match(match_value.egprs(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_egprs.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".egprs := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_egprs.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("{ page_mode := ");
single_value->field_page__mode.log_match(match_value.page__mode(), legacy);
TTCN_Logger::log_event_str(", persistence_levels_present := ");
single_value->field_persistence__levels__present.log_match(match_value.persistence__levels__present(), legacy);
TTCN_Logger::log_event_str(", persistence_levels := ");
if (match_value.persistence__levels().ispresent()) {
single_value->field_persistence__levels.log_match(match_value.persistence__levels(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_persistence__levels.log();
if (single_value->field_persistence__levels.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", identity := ");
single_value->field_identity.log_match(match_value.identity(), legacy);
TTCN_Logger::log_event_str(", is_egprs := ");
single_value->field_is__egprs.log_match(match_value.is__egprs(), legacy);
TTCN_Logger::log_event_str(", gprs := ");
if (match_value.gprs().ispresent()) {
single_value->field_gprs.log_match(match_value.gprs(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_gprs.log();
if (single_value->field_gprs.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", egprs := ");
if (match_value.egprs().ispresent()) {
single_value->field_egprs.log_match(match_value.egprs(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_egprs.log();
if (single_value->field_egprs.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 PacketUlAssignment_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (page__mode().is_bound()) page__mode().set_implicit_omit();
if (persistence__levels__present().is_bound()) persistence__levels__present().set_implicit_omit();
if (!persistence__levels().is_bound()) persistence__levels() = OMIT_VALUE;
else persistence__levels().set_implicit_omit();
if (identity().is_bound()) identity().set_implicit_omit();
if (is__egprs().is_bound()) is__egprs().set_implicit_omit();
if (!gprs().is_bound()) gprs() = OMIT_VALUE;
else gprs().set_implicit_omit();
if (!egprs().is_bound()) egprs() = OMIT_VALUE;
else egprs().set_implicit_omit();
}

void PacketUlAssignment_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_page__mode.encode_text(text_buf);
single_value->field_persistence__levels__present.encode_text(text_buf);
single_value->field_persistence__levels.encode_text(text_buf);
single_value->field_identity.encode_text(text_buf);
single_value->field_is__egprs.encode_text(text_buf);
single_value->field_gprs.encode_text(text_buf);
single_value->field_egprs.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_CSN1_Types.PacketUlAssignment.");
}
}

void PacketUlAssignment_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_page__mode.decode_text(text_buf);
single_value->field_persistence__levels__present.decode_text(text_buf);
single_value->field_persistence__levels.decode_text(text_buf);
single_value->field_identity.decode_text(text_buf);
single_value->field_is__egprs.decode_text(text_buf);
single_value->field_gprs.decode_text(text_buf);
single_value->field_egprs.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 PacketUlAssignment_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_CSN1_Types.PacketUlAssignment.");
}
}

void PacketUlAssignment_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: {
    PacketUlAssignment_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_CSN1_Types.PacketUlAssignment 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) page__mode().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) persistence__levels__present().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) persistence__levels().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) identity().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) is__egprs().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) gprs().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) egprs().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(), "page_mode")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          page__mode().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "persistence_levels_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          persistence__levels__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(), "persistence_levels")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          persistence__levels().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "identity")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          identity().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "is_egprs")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          is__egprs().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gprs")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gprs().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "egprs")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          egprs().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_CSN1_Types.PacketUlAssignment: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PacketUlAssignment_template* precondition = new PacketUlAssignment_template;
    precondition->set_param(*param.get_elem(0));
    PacketUlAssignment_template* implied_template = new PacketUlAssignment_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PacketUlAssignment_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.PacketUlAssignment");
  }
  is_ifpresent = param.get_ifpresent();
}

void PacketUlAssignment_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_page__mode.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketUlAssignment");
single_value->field_persistence__levels__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketUlAssignment");
single_value->field_persistence__levels.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketUlAssignment");
single_value->field_identity.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketUlAssignment");
single_value->field_is__egprs.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketUlAssignment");
single_value->field_gprs.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketUlAssignment");
single_value->field_egprs.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketUlAssignment");
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_CSN1_Types.PacketUlAssignment");
}

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

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

MobileIdentityLV__Paging::MobileIdentityLV__Paging()
{
}

MobileIdentityLV__Paging::MobileIdentityLV__Paging(const INTEGER& par_len,
    const OCTETSTRING& par_mobile__id)
  :   field_len(par_len),
  field_mobile__id(par_mobile__id)
{
}

MobileIdentityLV__Paging::MobileIdentityLV__Paging(const MobileIdentityLV__Paging& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.MobileIdentityLV_Paging.");
if (other_value.len().is_bound()) field_len = other_value.len();
else field_len.clean_up();
if (other_value.mobile__id().is_bound()) field_mobile__id = other_value.mobile__id();
else field_mobile__id.clean_up();
}

void MobileIdentityLV__Paging::clean_up()
{
field_len.clean_up();
field_mobile__id.clean_up();
}

const TTCN_Typedescriptor_t* MobileIdentityLV__Paging::get_descriptor() const { return &MobileIdentityLV__Paging_descr_; }
MobileIdentityLV__Paging& MobileIdentityLV__Paging::operator=(const MobileIdentityLV__Paging& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.MobileIdentityLV_Paging.");
  if (other_value.len().is_bound()) field_len = other_value.len();
  else field_len.clean_up();
  if (other_value.mobile__id().is_bound()) field_mobile__id = other_value.mobile__id();
  else field_mobile__id.clean_up();
}
return *this;
}

boolean MobileIdentityLV__Paging::operator==(const MobileIdentityLV__Paging& other_value) const
{
return field_len==other_value.field_len
  && field_mobile__id==other_value.field_mobile__id;
}

boolean MobileIdentityLV__Paging::is_bound() const
{
return (field_len.is_bound())
  || (field_mobile__id.is_bound());
}
boolean MobileIdentityLV__Paging::is_value() const
{
return field_len.is_value()
  && field_mobile__id.is_value();
}
void MobileIdentityLV__Paging::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ len := ");
field_len.log();
TTCN_Logger::log_event_str(", mobile_id := ");
field_mobile__id.log();
TTCN_Logger::log_event_str(" }");
}

void MobileIdentityLV__Paging::set_implicit_omit()
{
if (len().is_bound()) len().set_implicit_omit();
if (mobile__id().is_bound()) mobile__id().set_implicit_omit();
}

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

void MobileIdentityLV__Paging::encode_text(Text_Buf& text_buf) const
{
field_len.encode_text(text_buf);
field_mobile__id.encode_text(text_buf);
}

void MobileIdentityLV__Paging::decode_text(Text_Buf& text_buf)
{
field_len.decode_text(text_buf);
field_mobile__id.decode_text(text_buf);
}

void MobileIdentityLV__Paging::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 MobileIdentityLV__Paging::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 MobileIdentityLV__Paging::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  int value_of_length_field0 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, MobileIdentityLV__Paging_len_descr_.raw->forceomit);
  decoded_field_length = field_len.RAW_decode(MobileIdentityLV__Paging_len_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());
  INTEGER tmp0 = field_len.convert_to_Integer(MobileIdentityLV__Paging_len_descr_);
  field_len = tmp0;
  value_of_length_field0 += tmp0.get_long_long_val() * 8;
  RAW_Force_Omit field_1_force_omit(1, force_omit, MobileIdentityLV__Paging_mobile__id_descr_.raw->forceomit);
  decoded_field_length = field_mobile__id.RAW_decode(MobileIdentityLV__Paging_mobile__id_descr_, p_buf, min_of_ints(2, limit, value_of_length_field0), 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());
  value_of_length_field0 -= decoded_field_length;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int MobileIdentityLV__Paging::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, MobileIdentityLV__Paging_len_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, MobileIdentityLV__Paging_mobile__id_descr_.raw);
  encoded_length += 4;
  myleaf.body.node.nodes[0]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[0]->coding_descr = &MobileIdentityLV__Paging_len_descr_;
  myleaf.body.node.nodes[0]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[0]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[0]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[0]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[0]->length = 4;
  myleaf.body.node.nodes[0]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[1]->curr_pos.level;
  myleaf.body.node.nodes[0]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[1]->curr_pos.pos;
  encoded_length += field_mobile__id.RAW_encode(MobileIdentityLV__Paging_mobile__id_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct MobileIdentityLV__Paging_template::single_value_struct {
INTEGER_template field_len;
OCTETSTRING_template field_mobile__id;
};

void MobileIdentityLV__Paging_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_len = ANY_VALUE;
single_value->field_mobile__id = ANY_VALUE;
}
}
}

void MobileIdentityLV__Paging_template::copy_value(const MobileIdentityLV__Paging& other_value)
{
single_value = new single_value_struct;
if (other_value.len().is_bound()) {
  single_value->field_len = other_value.len();
} else {
  single_value->field_len.clean_up();
}
if (other_value.mobile__id().is_bound()) {
  single_value->field_mobile__id = other_value.mobile__id();
} else {
  single_value->field_mobile__id.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void MobileIdentityLV__Paging_template::copy_template(const MobileIdentityLV__Paging_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.len().get_selection()) {
single_value->field_len = other_value.len();
} else {
single_value->field_len.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.mobile__id().get_selection()) {
single_value->field_mobile__id = other_value.mobile__id();
} else {
single_value->field_mobile__id.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 MobileIdentityLV__Paging_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 MobileIdentityLV__Paging_template(*other_value.implication_.precondition);
implication_.implied_template = new MobileIdentityLV__Paging_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_CSN1_Types.MobileIdentityLV_Paging.");
break;
}
set_selection(other_value);
}

MobileIdentityLV__Paging_template::MobileIdentityLV__Paging_template()
{
}

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

MobileIdentityLV__Paging_template::MobileIdentityLV__Paging_template(const MobileIdentityLV__Paging& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

MobileIdentityLV__Paging_template& MobileIdentityLV__Paging_template::operator=(const OPTIONAL<MobileIdentityLV__Paging>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const MobileIdentityLV__Paging&)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_CSN1_Types.MobileIdentityLV_Paging.");
}
return *this;
}

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

boolean MobileIdentityLV__Paging_template::match(const MobileIdentityLV__Paging& 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.len().is_bound()) return FALSE;
if(!single_value->field_len.match(other_value.len(), legacy))return FALSE;
if(!other_value.mobile__id().is_bound()) return FALSE;
if(!single_value->field_mobile__id.match(other_value.mobile__id(), 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_CSN1_Types.MobileIdentityLV_Paging.");
}
return FALSE;
}

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

boolean MobileIdentityLV__Paging_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_len.is_value()
 && single_value->field_mobile__id.is_value();
}

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

MobileIdentityLV__Paging MobileIdentityLV__Paging_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_CSN1_Types.MobileIdentityLV_Paging.");
MobileIdentityLV__Paging ret_val;
if (single_value->field_len.is_bound()) {
ret_val.len() = single_value->field_len.valueof();
}
if (single_value->field_mobile__id.is_bound()) {
ret_val.mobile__id() = single_value->field_mobile__id.valueof();
}
return ret_val;
}

void MobileIdentityLV__Paging_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_CSN1_Types.MobileIdentityLV_Paging.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new MobileIdentityLV__Paging_template[list_length];
}

MobileIdentityLV__Paging_template& MobileIdentityLV__Paging_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_CSN1_Types.MobileIdentityLV_Paging.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.MobileIdentityLV_Paging.");
return value_list.list_value[list_index];
}

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

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

OCTETSTRING_template& MobileIdentityLV__Paging_template::mobile__id()
{
set_specific();
return single_value->field_mobile__id;
}

const OCTETSTRING_template& MobileIdentityLV__Paging_template::mobile__id() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mobile_id of a non-specific template of type @RLCMAC_CSN1_Types.MobileIdentityLV_Paging.");
return single_value->field_mobile__id;
}

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

void MobileIdentityLV__Paging_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ len := ");
single_value->field_len.log();
TTCN_Logger::log_event_str(", mobile_id := ");
single_value->field_mobile__id.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 MobileIdentityLV__Paging_template::log_match(const MobileIdentityLV__Paging& 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_len.match(match_value.len(), legacy)){
TTCN_Logger::log_logmatch_info(".len");
single_value->field_len.log_match(match_value.len(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_mobile__id.match(match_value.mobile__id(), legacy)){
TTCN_Logger::log_logmatch_info(".mobile_id");
single_value->field_mobile__id.log_match(match_value.mobile__id(), 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("{ len := ");
single_value->field_len.log_match(match_value.len(), legacy);
TTCN_Logger::log_event_str(", mobile_id := ");
single_value->field_mobile__id.log_match(match_value.mobile__id(), 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 MobileIdentityLV__Paging_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (len().is_bound()) len().set_implicit_omit();
if (mobile__id().is_bound()) mobile__id().set_implicit_omit();
}

void MobileIdentityLV__Paging_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_len.encode_text(text_buf);
single_value->field_mobile__id.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_CSN1_Types.MobileIdentityLV_Paging.");
}
}

void MobileIdentityLV__Paging_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_len.decode_text(text_buf);
single_value->field_mobile__id.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 MobileIdentityLV__Paging_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_CSN1_Types.MobileIdentityLV_Paging.");
}
}

void MobileIdentityLV__Paging_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: {
    MobileIdentityLV__Paging_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_CSN1_Types.MobileIdentityLV_Paging 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) len().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mobile__id().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(), "len")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          len().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mobile_id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mobile__id().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_CSN1_Types.MobileIdentityLV_Paging: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    MobileIdentityLV__Paging_template* precondition = new MobileIdentityLV__Paging_template;
    precondition->set_param(*param.get_elem(0));
    MobileIdentityLV__Paging_template* implied_template = new MobileIdentityLV__Paging_template;
    implied_template->set_param(*param.get_elem(1));
    *this = MobileIdentityLV__Paging_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.MobileIdentityLV_Paging");
  }
  is_ifpresent = param.get_ifpresent();
}

void MobileIdentityLV__Paging_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_len.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.MobileIdentityLV_Paging");
single_value->field_mobile__id.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.MobileIdentityLV_Paging");
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_CSN1_Types.MobileIdentityLV_Paging");
}

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

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

PageInfoPs::PageInfoPs()
{
}

PageInfoPs::PageInfoPs(const BITSTRING& par_presence,
    const BITSTRING& par_ptmsi__or__mobile__id,
    const OPTIONAL< INTEGER >& par_ptmsi,
    const OPTIONAL< MobileIdentityLV__Paging >& par_mobile__identity)
  :   field_presence(par_presence),
  field_ptmsi__or__mobile__id(par_ptmsi__or__mobile__id),
  field_ptmsi(par_ptmsi),
  field_mobile__identity(par_mobile__identity)
{
}

PageInfoPs::PageInfoPs(const PageInfoPs& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PageInfoPs.");
if (other_value.presence().is_bound()) field_presence = other_value.presence();
else field_presence.clean_up();
if (other_value.ptmsi__or__mobile__id().is_bound()) field_ptmsi__or__mobile__id = other_value.ptmsi__or__mobile__id();
else field_ptmsi__or__mobile__id.clean_up();
if (other_value.ptmsi().is_bound()) field_ptmsi = other_value.ptmsi();
else field_ptmsi.clean_up();
if (other_value.mobile__identity().is_bound()) field_mobile__identity = other_value.mobile__identity();
else field_mobile__identity.clean_up();
}

void PageInfoPs::clean_up()
{
field_presence.clean_up();
field_ptmsi__or__mobile__id.clean_up();
field_ptmsi.clean_up();
field_mobile__identity.clean_up();
}

const TTCN_Typedescriptor_t* PageInfoPs::get_descriptor() const { return &PageInfoPs_descr_; }
PageInfoPs& PageInfoPs::operator=(const PageInfoPs& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PageInfoPs.");
  if (other_value.presence().is_bound()) field_presence = other_value.presence();
  else field_presence.clean_up();
  if (other_value.ptmsi__or__mobile__id().is_bound()) field_ptmsi__or__mobile__id = other_value.ptmsi__or__mobile__id();
  else field_ptmsi__or__mobile__id.clean_up();
  if (other_value.ptmsi().is_bound()) field_ptmsi = other_value.ptmsi();
  else field_ptmsi.clean_up();
  if (other_value.mobile__identity().is_bound()) field_mobile__identity = other_value.mobile__identity();
  else field_mobile__identity.clean_up();
}
return *this;
}

boolean PageInfoPs::operator==(const PageInfoPs& other_value) const
{
return field_presence==other_value.field_presence
  && field_ptmsi__or__mobile__id==other_value.field_ptmsi__or__mobile__id
  && field_ptmsi==other_value.field_ptmsi
  && field_mobile__identity==other_value.field_mobile__identity;
}

boolean PageInfoPs::is_bound() const
{
return (field_presence.is_bound())
  || (field_ptmsi__or__mobile__id.is_bound())
  || (OPTIONAL_OMIT == field_ptmsi.get_selection() || field_ptmsi.is_bound())
  || (OPTIONAL_OMIT == field_mobile__identity.get_selection() || field_mobile__identity.is_bound());
}
boolean PageInfoPs::is_value() const
{
return field_presence.is_value()
  && field_ptmsi__or__mobile__id.is_value()
  && (OPTIONAL_OMIT == field_ptmsi.get_selection() || field_ptmsi.is_value())
  && (OPTIONAL_OMIT == field_mobile__identity.get_selection() || field_mobile__identity.is_value());
}
int PageInfoPs::size_of() const
{
  int ret_val = 2;
  if (field_ptmsi.ispresent()) ret_val++;
  if (field_mobile__identity.ispresent()) ret_val++;
  return ret_val;
}

void PageInfoPs::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ presence := ");
field_presence.log();
TTCN_Logger::log_event_str(", ptmsi_or_mobile_id := ");
field_ptmsi__or__mobile__id.log();
TTCN_Logger::log_event_str(", ptmsi := ");
field_ptmsi.log();
TTCN_Logger::log_event_str(", mobile_identity := ");
field_mobile__identity.log();
TTCN_Logger::log_event_str(" }");
}

void PageInfoPs::set_implicit_omit()
{
if (presence().is_bound()) presence().set_implicit_omit();
if (ptmsi__or__mobile__id().is_bound()) ptmsi__or__mobile__id().set_implicit_omit();
if (!ptmsi().is_bound()) ptmsi() = OMIT_VALUE;
else ptmsi().set_implicit_omit();
if (!mobile__identity().is_bound()) mobile__identity() = OMIT_VALUE;
else mobile__identity().set_implicit_omit();
}

void PageInfoPs::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_CSN1_Types.PageInfoPs 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) presence().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ptmsi__or__mobile__id().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ptmsi().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) mobile__identity().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(), "presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          presence().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ptmsi_or_mobile_id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ptmsi__or__mobile__id().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ptmsi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ptmsi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mobile_identity")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mobile__identity().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_CSN1_Types.PageInfoPs: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.PageInfoPs");
  }
}

void PageInfoPs::encode_text(Text_Buf& text_buf) const
{
field_presence.encode_text(text_buf);
field_ptmsi__or__mobile__id.encode_text(text_buf);
field_ptmsi.encode_text(text_buf);
field_mobile__identity.encode_text(text_buf);
}

void PageInfoPs::decode_text(Text_Buf& text_buf)
{
field_presence.decode_text(text_buf);
field_ptmsi__or__mobile__id.decode_text(text_buf);
field_ptmsi.decode_text(text_buf);
field_mobile__identity.decode_text(text_buf);
}

void PageInfoPs::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 PageInfoPs::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 PageInfoPs::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, PageInfoPs_presence_descr_.raw->forceomit);
  decoded_field_length = field_presence.RAW_decode(PageInfoPs_presence_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, PageInfoPs_ptmsi__or__mobile__id_descr_.raw->forceomit);
  decoded_field_length = field_ptmsi__or__mobile__id.RAW_decode(PageInfoPs_ptmsi__or__mobile__id_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_ptmsi__or__mobile__id ==  bs_1){
  if (force_omit != NULL && (*force_omit)(2)) {
    field_ptmsi = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_2_force_omit(2, force_omit, PageInfoPs_ptmsi_descr_.raw->forceomit);
  decoded_field_length = field_ptmsi().RAW_decode(PageInfoPs_ptmsi_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 1) {
  field_ptmsi = 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_ptmsi=OMIT_VALUE;
  if (limit > 0 && field_ptmsi__or__mobile__id ==  bs_0){
  if (force_omit != NULL && (*force_omit)(3)) {
    field_mobile__identity = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_3_force_omit(3, force_omit, PageInfoPs_mobile__identity_descr_.raw->forceomit);
  decoded_field_length = field_mobile__identity().RAW_decode(PageInfoPs_mobile__identity_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 1) {
  field_mobile__identity = 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_mobile__identity=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int PageInfoPs::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, PageInfoPs_presence_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PageInfoPs_ptmsi__or__mobile__id_descr_.raw);
  if (field_ptmsi.ispresent()) {
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PageInfoPs_ptmsi_descr_.raw);
  }
  else myleaf.body.node.nodes[2] = NULL;
  if (field_mobile__identity.ispresent()) {
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, PageInfoPs_mobile__identity_descr_.raw);
  }
  else myleaf.body.node.nodes[3] = NULL;
  encoded_length += field_presence.RAW_encode(PageInfoPs_presence_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ptmsi__or__mobile__id.RAW_encode(PageInfoPs_ptmsi__or__mobile__id_descr_, *myleaf.body.node.nodes[1]);
  if (field_ptmsi.ispresent()) {
  encoded_length += field_ptmsi().RAW_encode(PageInfoPs_ptmsi_descr_, *myleaf.body.node.nodes[2]);
  }
  if (field_mobile__identity.ispresent()) {
  encoded_length += field_mobile__identity().RAW_encode(PageInfoPs_mobile__identity_descr_, *myleaf.body.node.nodes[3]);
  }
  if (field_ptmsi.ispresent() && (field_ptmsi__or__mobile__id !=  bs_1)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={1};
  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_1.RAW_encode(PageInfoPs_ptmsi__or__mobile__id_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_mobile__identity.ispresent() && (field_ptmsi__or__mobile__id !=  bs_0)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+1;
  int new_pos0[]={1};
  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(PageInfoPs_ptmsi__or__mobile__id_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 PageInfoPs_template::single_value_struct {
BITSTRING_template field_presence;
BITSTRING_template field_ptmsi__or__mobile__id;
INTEGER_template field_ptmsi;
MobileIdentityLV__Paging_template field_mobile__identity;
};

void PageInfoPs_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_presence = ANY_VALUE;
single_value->field_ptmsi__or__mobile__id = ANY_VALUE;
single_value->field_ptmsi = ANY_OR_OMIT;
single_value->field_mobile__identity = ANY_OR_OMIT;
}
}
}

void PageInfoPs_template::copy_value(const PageInfoPs& other_value)
{
single_value = new single_value_struct;
if (other_value.presence().is_bound()) {
  single_value->field_presence = other_value.presence();
} else {
  single_value->field_presence.clean_up();
}
if (other_value.ptmsi__or__mobile__id().is_bound()) {
  single_value->field_ptmsi__or__mobile__id = other_value.ptmsi__or__mobile__id();
} else {
  single_value->field_ptmsi__or__mobile__id.clean_up();
}
if (other_value.ptmsi().is_bound()) {
  if (other_value.ptmsi().ispresent()) single_value->field_ptmsi = other_value.ptmsi()();
  else single_value->field_ptmsi = OMIT_VALUE;
} else {
  single_value->field_ptmsi.clean_up();
}
if (other_value.mobile__identity().is_bound()) {
  if (other_value.mobile__identity().ispresent()) single_value->field_mobile__identity = other_value.mobile__identity()();
  else single_value->field_mobile__identity = OMIT_VALUE;
} else {
  single_value->field_mobile__identity.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PageInfoPs_template::copy_template(const PageInfoPs_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) {
single_value->field_presence = other_value.presence();
} else {
single_value->field_presence.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ptmsi__or__mobile__id().get_selection()) {
single_value->field_ptmsi__or__mobile__id = other_value.ptmsi__or__mobile__id();
} else {
single_value->field_ptmsi__or__mobile__id.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ptmsi().get_selection()) {
single_value->field_ptmsi = other_value.ptmsi();
} else {
single_value->field_ptmsi.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.mobile__identity().get_selection()) {
single_value->field_mobile__identity = other_value.mobile__identity();
} else {
single_value->field_mobile__identity.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 PageInfoPs_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 PageInfoPs_template(*other_value.implication_.precondition);
implication_.implied_template = new PageInfoPs_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_CSN1_Types.PageInfoPs.");
break;
}
set_selection(other_value);
}

PageInfoPs_template::PageInfoPs_template()
{
}

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

PageInfoPs_template::PageInfoPs_template(const PageInfoPs& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PageInfoPs_template::match(const PageInfoPs& 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.presence().is_bound()) return FALSE;
if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE;
if(!other_value.ptmsi__or__mobile__id().is_bound()) return FALSE;
if(!single_value->field_ptmsi__or__mobile__id.match(other_value.ptmsi__or__mobile__id(), legacy))return FALSE;
if(!other_value.ptmsi().is_bound()) return FALSE;
if((other_value.ptmsi().ispresent() ? !single_value->field_ptmsi.match((const INTEGER&)other_value.ptmsi(), legacy) : !single_value->field_ptmsi.match_omit(legacy)))return FALSE;
if(!other_value.mobile__identity().is_bound()) return FALSE;
if((other_value.mobile__identity().ispresent() ? !single_value->field_mobile__identity.match((const MobileIdentityLV__Paging&)other_value.mobile__identity(), legacy) : !single_value->field_mobile__identity.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_CSN1_Types.PageInfoPs.");
}
return FALSE;
}

boolean PageInfoPs_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_presence.is_bound()
 || single_value->field_ptmsi__or__mobile__id.is_bound()
 || (single_value->field_ptmsi.is_omit() || single_value->field_ptmsi.is_bound())
 || (single_value->field_mobile__identity.is_omit() || single_value->field_mobile__identity.is_bound());
}

boolean PageInfoPs_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_presence.is_value()
 && single_value->field_ptmsi__or__mobile__id.is_value()
 && (single_value->field_ptmsi.is_omit() || single_value->field_ptmsi.is_value())
 && (single_value->field_mobile__identity.is_omit() || single_value->field_mobile__identity.is_value());
}

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

PageInfoPs PageInfoPs_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_CSN1_Types.PageInfoPs.");
PageInfoPs ret_val;
if (single_value->field_presence.is_bound()) {
ret_val.presence() = single_value->field_presence.valueof();
}
if (single_value->field_ptmsi__or__mobile__id.is_bound()) {
ret_val.ptmsi__or__mobile__id() = single_value->field_ptmsi__or__mobile__id.valueof();
}
if (single_value->field_ptmsi.is_omit()) ret_val.ptmsi() = OMIT_VALUE;
else if (single_value->field_ptmsi.is_bound()) {
ret_val.ptmsi() = single_value->field_ptmsi.valueof();
}
if (single_value->field_mobile__identity.is_omit()) ret_val.mobile__identity() = OMIT_VALUE;
else if (single_value->field_mobile__identity.is_bound()) {
ret_val.mobile__identity() = single_value->field_mobile__identity.valueof();
}
return ret_val;
}

void PageInfoPs_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_CSN1_Types.PageInfoPs.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PageInfoPs_template[list_length];
}

PageInfoPs_template& PageInfoPs_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_CSN1_Types.PageInfoPs.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @RLCMAC_CSN1_Types.PageInfoPs.");
return value_list.list_value[list_index];
}

BITSTRING_template& PageInfoPs_template::presence()
{
set_specific();
return single_value->field_presence;
}

const BITSTRING_template& PageInfoPs_template::presence() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field presence of a non-specific template of type @RLCMAC_CSN1_Types.PageInfoPs.");
return single_value->field_presence;
}

BITSTRING_template& PageInfoPs_template::ptmsi__or__mobile__id()
{
set_specific();
return single_value->field_ptmsi__or__mobile__id;
}

const BITSTRING_template& PageInfoPs_template::ptmsi__or__mobile__id() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ptmsi_or_mobile_id of a non-specific template of type @RLCMAC_CSN1_Types.PageInfoPs.");
return single_value->field_ptmsi__or__mobile__id;
}

INTEGER_template& PageInfoPs_template::ptmsi()
{
set_specific();
return single_value->field_ptmsi;
}

const INTEGER_template& PageInfoPs_template::ptmsi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ptmsi of a non-specific template of type @RLCMAC_CSN1_Types.PageInfoPs.");
return single_value->field_ptmsi;
}

MobileIdentityLV__Paging_template& PageInfoPs_template::mobile__identity()
{
set_specific();
return single_value->field_mobile__identity;
}

const MobileIdentityLV__Paging_template& PageInfoPs_template::mobile__identity() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mobile_identity of a non-specific template of type @RLCMAC_CSN1_Types.PageInfoPs.");
return single_value->field_mobile__identity;
}

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

void PageInfoPs_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ presence := ");
single_value->field_presence.log();
TTCN_Logger::log_event_str(", ptmsi_or_mobile_id := ");
single_value->field_ptmsi__or__mobile__id.log();
TTCN_Logger::log_event_str(", ptmsi := ");
single_value->field_ptmsi.log();
TTCN_Logger::log_event_str(", mobile_identity := ");
single_value->field_mobile__identity.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 PageInfoPs_template::log_match(const PageInfoPs& 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_presence.match(match_value.presence(), legacy)){
TTCN_Logger::log_logmatch_info(".presence");
single_value->field_presence.log_match(match_value.presence(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ptmsi__or__mobile__id.match(match_value.ptmsi__or__mobile__id(), legacy)){
TTCN_Logger::log_logmatch_info(".ptmsi_or_mobile_id");
single_value->field_ptmsi__or__mobile__id.log_match(match_value.ptmsi__or__mobile__id(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.ptmsi().ispresent()){
if(!single_value->field_ptmsi.match(match_value.ptmsi(), legacy)){
TTCN_Logger::log_logmatch_info(".ptmsi");
single_value->field_ptmsi.log_match(match_value.ptmsi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_ptmsi.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".ptmsi := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_ptmsi.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.mobile__identity().ispresent()){
if(!single_value->field_mobile__identity.match(match_value.mobile__identity(), legacy)){
TTCN_Logger::log_logmatch_info(".mobile_identity");
single_value->field_mobile__identity.log_match(match_value.mobile__identity(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_mobile__identity.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".mobile_identity := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_mobile__identity.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("{ presence := ");
single_value->field_presence.log_match(match_value.presence(), legacy);
TTCN_Logger::log_event_str(", ptmsi_or_mobile_id := ");
single_value->field_ptmsi__or__mobile__id.log_match(match_value.ptmsi__or__mobile__id(), legacy);
TTCN_Logger::log_event_str(", ptmsi := ");
if (match_value.ptmsi().ispresent()) {
single_value->field_ptmsi.log_match(match_value.ptmsi(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_ptmsi.log();
if (single_value->field_ptmsi.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", mobile_identity := ");
if (match_value.mobile__identity().ispresent()) {
single_value->field_mobile__identity.log_match(match_value.mobile__identity(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_mobile__identity.log();
if (single_value->field_mobile__identity.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 PageInfoPs_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (presence().is_bound()) presence().set_implicit_omit();
if (ptmsi__or__mobile__id().is_bound()) ptmsi__or__mobile__id().set_implicit_omit();
if (!ptmsi().is_bound()) ptmsi() = OMIT_VALUE;
else ptmsi().set_implicit_omit();
if (!mobile__identity().is_bound()) mobile__identity() = OMIT_VALUE;
else mobile__identity().set_implicit_omit();
}

void PageInfoPs_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_presence.encode_text(text_buf);
single_value->field_ptmsi__or__mobile__id.encode_text(text_buf);
single_value->field_ptmsi.encode_text(text_buf);
single_value->field_mobile__identity.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_CSN1_Types.PageInfoPs.");
}
}

void PageInfoPs_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_presence.decode_text(text_buf);
single_value->field_ptmsi__or__mobile__id.decode_text(text_buf);
single_value->field_ptmsi.decode_text(text_buf);
single_value->field_mobile__identity.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 PageInfoPs_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_CSN1_Types.PageInfoPs.");
}
}

void PageInfoPs_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: {
    PageInfoPs_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_CSN1_Types.PageInfoPs 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) presence().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ptmsi__or__mobile__id().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ptmsi().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) mobile__identity().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(), "presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          presence().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ptmsi_or_mobile_id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ptmsi__or__mobile__id().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ptmsi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ptmsi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mobile_identity")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mobile__identity().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_CSN1_Types.PageInfoPs: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PageInfoPs_template* precondition = new PageInfoPs_template;
    precondition->set_param(*param.get_elem(0));
    PageInfoPs_template* implied_template = new PageInfoPs_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PageInfoPs_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.PageInfoPs");
  }
  is_ifpresent = param.get_ifpresent();
}

void PageInfoPs_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_presence.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PageInfoPs");
single_value->field_ptmsi__or__mobile__id.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PageInfoPs");
single_value->field_ptmsi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PageInfoPs");
single_value->field_mobile__identity.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PageInfoPs");
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_CSN1_Types.PageInfoPs");
}

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

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


} /* end of namespace */
