// 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 */

PageInfoCs::PageInfoCs()
{
}

PageInfoCs::PageInfoCs(const BITSTRING& par_presence,
    const BITSTRING& par_tmsi__or__mobile__id,
    const OPTIONAL< INTEGER >& par_tmsi,
    const OPTIONAL< MobileIdentityLV__Paging >& par_mobile__identity,
    const GSM__Types::ChannelNeeded& par_chan__needed,
    const BITSTRING& par_emlpp__prio__present,
    const OPTIONAL< INTEGER >& par_emlpp__prio)
  :   field_presence(par_presence),
  field_tmsi__or__mobile__id(par_tmsi__or__mobile__id),
  field_tmsi(par_tmsi),
  field_mobile__identity(par_mobile__identity),
  field_chan__needed(par_chan__needed),
  field_emlpp__prio__present(par_emlpp__prio__present),
  field_emlpp__prio(par_emlpp__prio)
{
}

PageInfoCs::PageInfoCs(const PageInfoCs& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PageInfoCs.");
if (other_value.presence().is_bound()) field_presence = other_value.presence();
else field_presence.clean_up();
if (other_value.tmsi__or__mobile__id().is_bound()) field_tmsi__or__mobile__id = other_value.tmsi__or__mobile__id();
else field_tmsi__or__mobile__id.clean_up();
if (other_value.tmsi().is_bound()) field_tmsi = other_value.tmsi();
else field_tmsi.clean_up();
if (other_value.mobile__identity().is_bound()) field_mobile__identity = other_value.mobile__identity();
else field_mobile__identity.clean_up();
if (other_value.chan__needed().is_bound()) field_chan__needed = other_value.chan__needed();
else field_chan__needed.clean_up();
if (other_value.emlpp__prio__present().is_bound()) field_emlpp__prio__present = other_value.emlpp__prio__present();
else field_emlpp__prio__present.clean_up();
if (other_value.emlpp__prio().is_bound()) field_emlpp__prio = other_value.emlpp__prio();
else field_emlpp__prio.clean_up();
}

void PageInfoCs::clean_up()
{
field_presence.clean_up();
field_tmsi__or__mobile__id.clean_up();
field_tmsi.clean_up();
field_mobile__identity.clean_up();
field_chan__needed.clean_up();
field_emlpp__prio__present.clean_up();
field_emlpp__prio.clean_up();
}

const TTCN_Typedescriptor_t* PageInfoCs::get_descriptor() const { return &PageInfoCs_descr_; }
PageInfoCs& PageInfoCs::operator=(const PageInfoCs& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PageInfoCs.");
  if (other_value.presence().is_bound()) field_presence = other_value.presence();
  else field_presence.clean_up();
  if (other_value.tmsi__or__mobile__id().is_bound()) field_tmsi__or__mobile__id = other_value.tmsi__or__mobile__id();
  else field_tmsi__or__mobile__id.clean_up();
  if (other_value.tmsi().is_bound()) field_tmsi = other_value.tmsi();
  else field_tmsi.clean_up();
  if (other_value.mobile__identity().is_bound()) field_mobile__identity = other_value.mobile__identity();
  else field_mobile__identity.clean_up();
  if (other_value.chan__needed().is_bound()) field_chan__needed = other_value.chan__needed();
  else field_chan__needed.clean_up();
  if (other_value.emlpp__prio__present().is_bound()) field_emlpp__prio__present = other_value.emlpp__prio__present();
  else field_emlpp__prio__present.clean_up();
  if (other_value.emlpp__prio().is_bound()) field_emlpp__prio = other_value.emlpp__prio();
  else field_emlpp__prio.clean_up();
}
return *this;
}

boolean PageInfoCs::operator==(const PageInfoCs& other_value) const
{
return field_presence==other_value.field_presence
  && field_tmsi__or__mobile__id==other_value.field_tmsi__or__mobile__id
  && field_tmsi==other_value.field_tmsi
  && field_mobile__identity==other_value.field_mobile__identity
  && field_chan__needed==other_value.field_chan__needed
  && field_emlpp__prio__present==other_value.field_emlpp__prio__present
  && field_emlpp__prio==other_value.field_emlpp__prio;
}

boolean PageInfoCs::is_bound() const
{
return (field_presence.is_bound())
  || (field_tmsi__or__mobile__id.is_bound())
  || (OPTIONAL_OMIT == field_tmsi.get_selection() || field_tmsi.is_bound())
  || (OPTIONAL_OMIT == field_mobile__identity.get_selection() || field_mobile__identity.is_bound())
  || (field_chan__needed.is_bound())
  || (field_emlpp__prio__present.is_bound())
  || (OPTIONAL_OMIT == field_emlpp__prio.get_selection() || field_emlpp__prio.is_bound());
}
boolean PageInfoCs::is_value() const
{
return field_presence.is_value()
  && field_tmsi__or__mobile__id.is_value()
  && (OPTIONAL_OMIT == field_tmsi.get_selection() || field_tmsi.is_value())
  && (OPTIONAL_OMIT == field_mobile__identity.get_selection() || field_mobile__identity.is_value())
  && field_chan__needed.is_value()
  && field_emlpp__prio__present.is_value()
  && (OPTIONAL_OMIT == field_emlpp__prio.get_selection() || field_emlpp__prio.is_value());
}
int PageInfoCs::size_of() const
{
  int ret_val = 4;
  if (field_tmsi.ispresent()) ret_val++;
  if (field_mobile__identity.ispresent()) ret_val++;
  if (field_emlpp__prio.ispresent()) ret_val++;
  return ret_val;
}

void PageInfoCs::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(", tmsi_or_mobile_id := ");
field_tmsi__or__mobile__id.log();
TTCN_Logger::log_event_str(", tmsi := ");
field_tmsi.log();
TTCN_Logger::log_event_str(", mobile_identity := ");
field_mobile__identity.log();
TTCN_Logger::log_event_str(", chan_needed := ");
field_chan__needed.log();
TTCN_Logger::log_event_str(", emlpp_prio_present := ");
field_emlpp__prio__present.log();
TTCN_Logger::log_event_str(", emlpp_prio := ");
field_emlpp__prio.log();
TTCN_Logger::log_event_str(" }");
}

void PageInfoCs::set_implicit_omit()
{
if (presence().is_bound()) presence().set_implicit_omit();
if (tmsi__or__mobile__id().is_bound()) tmsi__or__mobile__id().set_implicit_omit();
if (!tmsi().is_bound()) tmsi() = OMIT_VALUE;
else tmsi().set_implicit_omit();
if (!mobile__identity().is_bound()) mobile__identity() = OMIT_VALUE;
else mobile__identity().set_implicit_omit();
if (chan__needed().is_bound()) chan__needed().set_implicit_omit();
if (emlpp__prio__present().is_bound()) emlpp__prio__present().set_implicit_omit();
if (!emlpp__prio().is_bound()) emlpp__prio() = OMIT_VALUE;
else emlpp__prio().set_implicit_omit();
}

void PageInfoCs::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.PageInfoCs 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) presence().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tmsi__or__mobile__id().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) tmsi().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));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) chan__needed().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) emlpp__prio__present().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) emlpp__prio().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(), "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(), "tmsi_or_mobile_id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tmsi__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(), "tmsi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tmsi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "chan_needed")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          chan__needed().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "emlpp_prio_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          emlpp__prio__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(), "emlpp_prio")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          emlpp__prio().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.PageInfoCs: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.PageInfoCs");
  }
}

void PageInfoCs::encode_text(Text_Buf& text_buf) const
{
field_presence.encode_text(text_buf);
field_tmsi__or__mobile__id.encode_text(text_buf);
field_tmsi.encode_text(text_buf);
field_mobile__identity.encode_text(text_buf);
field_chan__needed.encode_text(text_buf);
field_emlpp__prio__present.encode_text(text_buf);
field_emlpp__prio.encode_text(text_buf);
}

void PageInfoCs::decode_text(Text_Buf& text_buf)
{
field_presence.decode_text(text_buf);
field_tmsi__or__mobile__id.decode_text(text_buf);
field_tmsi.decode_text(text_buf);
field_mobile__identity.decode_text(text_buf);
field_chan__needed.decode_text(text_buf);
field_emlpp__prio__present.decode_text(text_buf);
field_emlpp__prio.decode_text(text_buf);
}

void PageInfoCs::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 PageInfoCs::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 PageInfoCs::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, PageInfoCs_presence_descr_.raw->forceomit);
  decoded_field_length = field_presence.RAW_decode(PageInfoCs_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, PageInfoCs_tmsi__or__mobile__id_descr_.raw->forceomit);
  decoded_field_length = field_tmsi__or__mobile__id.RAW_decode(PageInfoCs_tmsi__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_tmsi__or__mobile__id ==  bs_1){
  if (force_omit != NULL && (*force_omit)(2)) {
    field_tmsi = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_2_force_omit(2, force_omit, PageInfoCs_tmsi_descr_.raw->forceomit);
  decoded_field_length = field_tmsi().RAW_decode(PageInfoCs_tmsi_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 1) {
  field_tmsi = 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_tmsi=OMIT_VALUE;
  if (limit > 0 && field_tmsi__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, PageInfoCs_mobile__identity_descr_.raw->forceomit);
  decoded_field_length = field_mobile__identity().RAW_decode(PageInfoCs_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;
  RAW_Force_Omit field_4_force_omit(4, force_omit, PageInfoCs_chan__needed_descr_.raw->forceomit);
  decoded_field_length = field_chan__needed.RAW_decode(PageInfoCs_chan__needed_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, PageInfoCs_emlpp__prio__present_descr_.raw->forceomit);
  decoded_field_length = field_emlpp__prio__present.RAW_decode(PageInfoCs_emlpp__prio__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_emlpp__prio__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(6)) {
    field_emlpp__prio = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_6_force_omit(6, force_omit, PageInfoCs_emlpp__prio_descr_.raw->forceomit);
  decoded_field_length = field_emlpp__prio().RAW_decode(PageInfoCs_emlpp__prio_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_6_force_omit);
  if (decoded_field_length < 1) {
  field_emlpp__prio = 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_emlpp__prio=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int PageInfoCs::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, PageInfoCs_presence_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PageInfoCs_tmsi__or__mobile__id_descr_.raw);
  if (field_tmsi.ispresent()) {
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PageInfoCs_tmsi_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, PageInfoCs_mobile__identity_descr_.raw);
  }
  else myleaf.body.node.nodes[3] = NULL;
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, PageInfoCs_chan__needed_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, PageInfoCs_emlpp__prio__present_descr_.raw);
  if (field_emlpp__prio.ispresent()) {
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, PageInfoCs_emlpp__prio_descr_.raw);
  }
  else myleaf.body.node.nodes[6] = NULL;
  encoded_length += field_presence.RAW_encode(PageInfoCs_presence_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_tmsi__or__mobile__id.RAW_encode(PageInfoCs_tmsi__or__mobile__id_descr_, *myleaf.body.node.nodes[1]);
  if (field_tmsi.ispresent()) {
  encoded_length += field_tmsi().RAW_encode(PageInfoCs_tmsi_descr_, *myleaf.body.node.nodes[2]);
  }
  if (field_mobile__identity.ispresent()) {
  encoded_length += field_mobile__identity().RAW_encode(PageInfoCs_mobile__identity_descr_, *myleaf.body.node.nodes[3]);
  }
  encoded_length += field_chan__needed.RAW_encode(PageInfoCs_chan__needed_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_emlpp__prio__present.RAW_encode(PageInfoCs_emlpp__prio__present_descr_, *myleaf.body.node.nodes[5]);
  if (field_emlpp__prio.ispresent()) {
  encoded_length += field_emlpp__prio().RAW_encode(PageInfoCs_emlpp__prio_descr_, *myleaf.body.node.nodes[6]);
  }
  if (field_tmsi.ispresent() && (field_tmsi__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(PageInfoCs_tmsi__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_tmsi__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(PageInfoCs_tmsi__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_emlpp__prio.ispresent() && (field_emlpp__prio__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(PageInfoCs_emlpp__prio__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 PageInfoCs_template::single_value_struct {
BITSTRING_template field_presence;
BITSTRING_template field_tmsi__or__mobile__id;
INTEGER_template field_tmsi;
MobileIdentityLV__Paging_template field_mobile__identity;
GSM__Types::ChannelNeeded_template field_chan__needed;
BITSTRING_template field_emlpp__prio__present;
INTEGER_template field_emlpp__prio;
};

void PageInfoCs_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_tmsi__or__mobile__id = ANY_VALUE;
single_value->field_tmsi = ANY_OR_OMIT;
single_value->field_mobile__identity = ANY_OR_OMIT;
single_value->field_chan__needed = ANY_VALUE;
single_value->field_emlpp__prio__present = ANY_VALUE;
single_value->field_emlpp__prio = ANY_OR_OMIT;
}
}
}

void PageInfoCs_template::copy_value(const PageInfoCs& 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.tmsi__or__mobile__id().is_bound()) {
  single_value->field_tmsi__or__mobile__id = other_value.tmsi__or__mobile__id();
} else {
  single_value->field_tmsi__or__mobile__id.clean_up();
}
if (other_value.tmsi().is_bound()) {
  if (other_value.tmsi().ispresent()) single_value->field_tmsi = other_value.tmsi()();
  else single_value->field_tmsi = OMIT_VALUE;
} else {
  single_value->field_tmsi.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();
}
if (other_value.chan__needed().is_bound()) {
  single_value->field_chan__needed = other_value.chan__needed();
} else {
  single_value->field_chan__needed.clean_up();
}
if (other_value.emlpp__prio__present().is_bound()) {
  single_value->field_emlpp__prio__present = other_value.emlpp__prio__present();
} else {
  single_value->field_emlpp__prio__present.clean_up();
}
if (other_value.emlpp__prio().is_bound()) {
  if (other_value.emlpp__prio().ispresent()) single_value->field_emlpp__prio = other_value.emlpp__prio()();
  else single_value->field_emlpp__prio = OMIT_VALUE;
} else {
  single_value->field_emlpp__prio.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PageInfoCs_template::copy_template(const PageInfoCs_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.tmsi__or__mobile__id().get_selection()) {
single_value->field_tmsi__or__mobile__id = other_value.tmsi__or__mobile__id();
} else {
single_value->field_tmsi__or__mobile__id.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tmsi().get_selection()) {
single_value->field_tmsi = other_value.tmsi();
} else {
single_value->field_tmsi.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();
}
if (UNINITIALIZED_TEMPLATE != other_value.chan__needed().get_selection()) {
single_value->field_chan__needed = other_value.chan__needed();
} else {
single_value->field_chan__needed.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.emlpp__prio__present().get_selection()) {
single_value->field_emlpp__prio__present = other_value.emlpp__prio__present();
} else {
single_value->field_emlpp__prio__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.emlpp__prio().get_selection()) {
single_value->field_emlpp__prio = other_value.emlpp__prio();
} else {
single_value->field_emlpp__prio.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 PageInfoCs_template[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 PageInfoCs_template(*other_value.implication_.precondition);
implication_.implied_template = new PageInfoCs_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.PageInfoCs.");
break;
}
set_selection(other_value);
}

PageInfoCs_template::PageInfoCs_template()
{
}

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

PageInfoCs_template::PageInfoCs_template(const PageInfoCs& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PageInfoCs_template::match(const PageInfoCs& 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.tmsi__or__mobile__id().is_bound()) return FALSE;
if(!single_value->field_tmsi__or__mobile__id.match(other_value.tmsi__or__mobile__id(), legacy))return FALSE;
if(!other_value.tmsi().is_bound()) return FALSE;
if((other_value.tmsi().ispresent() ? !single_value->field_tmsi.match((const INTEGER&)other_value.tmsi(), legacy) : !single_value->field_tmsi.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;
if(!other_value.chan__needed().is_bound()) return FALSE;
if(!single_value->field_chan__needed.match(other_value.chan__needed(), legacy))return FALSE;
if(!other_value.emlpp__prio__present().is_bound()) return FALSE;
if(!single_value->field_emlpp__prio__present.match(other_value.emlpp__prio__present(), legacy))return FALSE;
if(!other_value.emlpp__prio().is_bound()) return FALSE;
if((other_value.emlpp__prio().ispresent() ? !single_value->field_emlpp__prio.match((const INTEGER&)other_value.emlpp__prio(), legacy) : !single_value->field_emlpp__prio.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.PageInfoCs.");
}
return FALSE;
}

boolean PageInfoCs_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_tmsi__or__mobile__id.is_bound()
 || (single_value->field_tmsi.is_omit() || single_value->field_tmsi.is_bound())
 || (single_value->field_mobile__identity.is_omit() || single_value->field_mobile__identity.is_bound())
 || single_value->field_chan__needed.is_bound()
 || single_value->field_emlpp__prio__present.is_bound()
 || (single_value->field_emlpp__prio.is_omit() || single_value->field_emlpp__prio.is_bound());
}

boolean PageInfoCs_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_presence.is_value()
 && single_value->field_tmsi__or__mobile__id.is_value()
 && (single_value->field_tmsi.is_omit() || single_value->field_tmsi.is_value())
 && (single_value->field_mobile__identity.is_omit() || single_value->field_mobile__identity.is_value())
 && single_value->field_chan__needed.is_value()
 && single_value->field_emlpp__prio__present.is_value()
 && (single_value->field_emlpp__prio.is_omit() || single_value->field_emlpp__prio.is_value());
}

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

PageInfoCs PageInfoCs_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.PageInfoCs.");
PageInfoCs ret_val;
if (single_value->field_presence.is_bound()) {
ret_val.presence() = single_value->field_presence.valueof();
}
if (single_value->field_tmsi__or__mobile__id.is_bound()) {
ret_val.tmsi__or__mobile__id() = single_value->field_tmsi__or__mobile__id.valueof();
}
if (single_value->field_tmsi.is_omit()) ret_val.tmsi() = OMIT_VALUE;
else if (single_value->field_tmsi.is_bound()) {
ret_val.tmsi() = single_value->field_tmsi.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();
}
if (single_value->field_chan__needed.is_bound()) {
ret_val.chan__needed() = single_value->field_chan__needed.valueof();
}
if (single_value->field_emlpp__prio__present.is_bound()) {
ret_val.emlpp__prio__present() = single_value->field_emlpp__prio__present.valueof();
}
if (single_value->field_emlpp__prio.is_omit()) ret_val.emlpp__prio() = OMIT_VALUE;
else if (single_value->field_emlpp__prio.is_bound()) {
ret_val.emlpp__prio() = single_value->field_emlpp__prio.valueof();
}
return ret_val;
}

void PageInfoCs_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.PageInfoCs.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PageInfoCs_template[list_length];
}

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

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

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

BITSTRING_template& PageInfoCs_template::tmsi__or__mobile__id()
{
set_specific();
return single_value->field_tmsi__or__mobile__id;
}

const BITSTRING_template& PageInfoCs_template::tmsi__or__mobile__id() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tmsi_or_mobile_id of a non-specific template of type @RLCMAC_CSN1_Types.PageInfoCs.");
return single_value->field_tmsi__or__mobile__id;
}

INTEGER_template& PageInfoCs_template::tmsi()
{
set_specific();
return single_value->field_tmsi;
}

const INTEGER_template& PageInfoCs_template::tmsi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tmsi of a non-specific template of type @RLCMAC_CSN1_Types.PageInfoCs.");
return single_value->field_tmsi;
}

MobileIdentityLV__Paging_template& PageInfoCs_template::mobile__identity()
{
set_specific();
return single_value->field_mobile__identity;
}

const MobileIdentityLV__Paging_template& PageInfoCs_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.PageInfoCs.");
return single_value->field_mobile__identity;
}

GSM__Types::ChannelNeeded_template& PageInfoCs_template::chan__needed()
{
set_specific();
return single_value->field_chan__needed;
}

const GSM__Types::ChannelNeeded_template& PageInfoCs_template::chan__needed() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field chan_needed of a non-specific template of type @RLCMAC_CSN1_Types.PageInfoCs.");
return single_value->field_chan__needed;
}

BITSTRING_template& PageInfoCs_template::emlpp__prio__present()
{
set_specific();
return single_value->field_emlpp__prio__present;
}

const BITSTRING_template& PageInfoCs_template::emlpp__prio__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field emlpp_prio_present of a non-specific template of type @RLCMAC_CSN1_Types.PageInfoCs.");
return single_value->field_emlpp__prio__present;
}

INTEGER_template& PageInfoCs_template::emlpp__prio()
{
set_specific();
return single_value->field_emlpp__prio;
}

const INTEGER_template& PageInfoCs_template::emlpp__prio() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field emlpp_prio of a non-specific template of type @RLCMAC_CSN1_Types.PageInfoCs.");
return single_value->field_emlpp__prio;
}

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

void PageInfoCs_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(", tmsi_or_mobile_id := ");
single_value->field_tmsi__or__mobile__id.log();
TTCN_Logger::log_event_str(", tmsi := ");
single_value->field_tmsi.log();
TTCN_Logger::log_event_str(", mobile_identity := ");
single_value->field_mobile__identity.log();
TTCN_Logger::log_event_str(", chan_needed := ");
single_value->field_chan__needed.log();
TTCN_Logger::log_event_str(", emlpp_prio_present := ");
single_value->field_emlpp__prio__present.log();
TTCN_Logger::log_event_str(", emlpp_prio := ");
single_value->field_emlpp__prio.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 PageInfoCs_template::log_match(const PageInfoCs& 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_tmsi__or__mobile__id.match(match_value.tmsi__or__mobile__id(), legacy)){
TTCN_Logger::log_logmatch_info(".tmsi_or_mobile_id");
single_value->field_tmsi__or__mobile__id.log_match(match_value.tmsi__or__mobile__id(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.tmsi().ispresent()){
if(!single_value->field_tmsi.match(match_value.tmsi(), legacy)){
TTCN_Logger::log_logmatch_info(".tmsi");
single_value->field_tmsi.log_match(match_value.tmsi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_tmsi.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".tmsi := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_tmsi.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);
}
}
if(!single_value->field_chan__needed.match(match_value.chan__needed(), legacy)){
TTCN_Logger::log_logmatch_info(".chan_needed");
single_value->field_chan__needed.log_match(match_value.chan__needed(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_emlpp__prio__present.match(match_value.emlpp__prio__present(), legacy)){
TTCN_Logger::log_logmatch_info(".emlpp_prio_present");
single_value->field_emlpp__prio__present.log_match(match_value.emlpp__prio__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.emlpp__prio().ispresent()){
if(!single_value->field_emlpp__prio.match(match_value.emlpp__prio(), legacy)){
TTCN_Logger::log_logmatch_info(".emlpp_prio");
single_value->field_emlpp__prio.log_match(match_value.emlpp__prio(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_emlpp__prio.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".emlpp_prio := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_emlpp__prio.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(", tmsi_or_mobile_id := ");
single_value->field_tmsi__or__mobile__id.log_match(match_value.tmsi__or__mobile__id(), legacy);
TTCN_Logger::log_event_str(", tmsi := ");
if (match_value.tmsi().ispresent()) {
single_value->field_tmsi.log_match(match_value.tmsi(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_tmsi.log();
if (single_value->field_tmsi.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(", chan_needed := ");
single_value->field_chan__needed.log_match(match_value.chan__needed(), legacy);
TTCN_Logger::log_event_str(", emlpp_prio_present := ");
single_value->field_emlpp__prio__present.log_match(match_value.emlpp__prio__present(), legacy);
TTCN_Logger::log_event_str(", emlpp_prio := ");
if (match_value.emlpp__prio().ispresent()) {
single_value->field_emlpp__prio.log_match(match_value.emlpp__prio(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_emlpp__prio.log();
if (single_value->field_emlpp__prio.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 PageInfoCs_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (presence().is_bound()) presence().set_implicit_omit();
if (tmsi__or__mobile__id().is_bound()) tmsi__or__mobile__id().set_implicit_omit();
if (!tmsi().is_bound()) tmsi() = OMIT_VALUE;
else tmsi().set_implicit_omit();
if (!mobile__identity().is_bound()) mobile__identity() = OMIT_VALUE;
else mobile__identity().set_implicit_omit();
if (chan__needed().is_bound()) chan__needed().set_implicit_omit();
if (emlpp__prio__present().is_bound()) emlpp__prio__present().set_implicit_omit();
if (!emlpp__prio().is_bound()) emlpp__prio() = OMIT_VALUE;
else emlpp__prio().set_implicit_omit();
}

void PageInfoCs_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_tmsi__or__mobile__id.encode_text(text_buf);
single_value->field_tmsi.encode_text(text_buf);
single_value->field_mobile__identity.encode_text(text_buf);
single_value->field_chan__needed.encode_text(text_buf);
single_value->field_emlpp__prio__present.encode_text(text_buf);
single_value->field_emlpp__prio.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.PageInfoCs.");
}
}

void PageInfoCs_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_tmsi__or__mobile__id.decode_text(text_buf);
single_value->field_tmsi.decode_text(text_buf);
single_value->field_mobile__identity.decode_text(text_buf);
single_value->field_chan__needed.decode_text(text_buf);
single_value->field_emlpp__prio__present.decode_text(text_buf);
single_value->field_emlpp__prio.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 PageInfoCs_template[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.PageInfoCs.");
}
}

void PageInfoCs_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: {
    PageInfoCs_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.PageInfoCs 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) presence().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tmsi__or__mobile__id().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) tmsi().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));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) chan__needed().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) emlpp__prio__present().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) emlpp__prio().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(), "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(), "tmsi_or_mobile_id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tmsi__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(), "tmsi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tmsi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "chan_needed")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          chan__needed().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "emlpp_prio_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          emlpp__prio__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(), "emlpp_prio")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          emlpp__prio().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.PageInfoCs: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PageInfoCs_template* precondition = new PageInfoCs_template;
    precondition->set_param(*param.get_elem(0));
    PageInfoCs_template* implied_template = new PageInfoCs_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PageInfoCs_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.PageInfoCs");
  }
  is_ifpresent = param.get_ifpresent();
}

void PageInfoCs_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.PageInfoCs");
single_value->field_tmsi__or__mobile__id.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PageInfoCs");
single_value->field_tmsi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PageInfoCs");
single_value->field_mobile__identity.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PageInfoCs");
single_value->field_chan__needed.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PageInfoCs");
single_value->field_emlpp__prio__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PageInfoCs");
single_value->field_emlpp__prio.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PageInfoCs");
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.PageInfoCs");
}

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

boolean PageInfoCs_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 PageInfo::copy_value(const PageInfo& other_value)
{
switch (other_value.union_selection) {
case ALT_ps:
field_ps = new PageInfoPs(*other_value.field_ps);
break;
case ALT_cs:
field_cs = new PageInfoCs(*other_value.field_cs);
break;
default:
TTCN_error("Assignment of an unbound union value of type @RLCMAC_CSN1_Types.PageInfo.");
}
union_selection = other_value.union_selection;
}

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

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

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

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

boolean PageInfo::operator==(const PageInfo& 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.PageInfo.");
if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @RLCMAC_CSN1_Types.PageInfo.");
if (union_selection != other_value.union_selection) return FALSE;
switch (union_selection) {
case ALT_ps:
return *field_ps == *other_value.field_ps;
case ALT_cs:
return *field_cs == *other_value.field_cs;
default:
return FALSE;
}
}

PageInfoPs& PageInfo::ps()
{
if (union_selection != ALT_ps) {
clean_up();
field_ps = new PageInfoPs;
union_selection = ALT_ps;
}
return *field_ps;
}

const PageInfoPs& PageInfo::ps() const
{
if (union_selection != ALT_ps) TTCN_error("Using non-selected field ps in a value of union type @RLCMAC_CSN1_Types.PageInfo.");
return *field_ps;
}

PageInfoCs& PageInfo::cs()
{
if (union_selection != ALT_cs) {
clean_up();
field_cs = new PageInfoCs;
union_selection = ALT_cs;
}
return *field_cs;
}

const PageInfoCs& PageInfo::cs() const
{
if (union_selection != ALT_cs) TTCN_error("Using non-selected field cs in a value of union type @RLCMAC_CSN1_Types.PageInfo.");
return *field_cs;
}

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

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

boolean PageInfo::is_value() const
{
switch (union_selection) {
case UNBOUND_VALUE: return FALSE;
case ALT_ps: return field_ps->is_value();
case ALT_cs: return field_cs->is_value();
default: TTCN_error("Invalid selection in union is_bound");}
}

void PageInfo::clean_up()
{
switch (union_selection) {
case ALT_ps:
  delete field_ps;
  break;
case ALT_cs:
  delete field_cs;
  break;
default:
  break;
}
union_selection = UNBOUND_VALUE;
}

void PageInfo::log() const
{
switch (union_selection) {
case ALT_ps:
TTCN_Logger::log_event_str("{ ps := ");
field_ps->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_cs:
TTCN_Logger::log_event_str("{ cs := ");
field_cs->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_unbound();
}
}

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

void PageInfo::set_implicit_omit()
{
switch (union_selection) {
case ALT_ps:
field_ps->set_implicit_omit(); break;
case ALT_cs:
field_cs->set_implicit_omit(); break;
default: break;
}
}

void PageInfo::encode_text(Text_Buf& text_buf) const
{
text_buf.push_int(union_selection);
switch (union_selection) {
case ALT_ps:
field_ps->encode_text(text_buf);
break;
case ALT_cs:
field_cs->encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an unbound value of union type @RLCMAC_CSN1_Types.PageInfo.");
}
}

void PageInfo::decode_text(Text_Buf& text_buf)
{
switch ((union_selection_type)text_buf.pull_int().get_val()) {
case ALT_ps:
ps().decode_text(text_buf);
break;
case ALT_cs:
cs().decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for type @RLCMAC_CSN1_Types.PageInfo.");
}
}

void PageInfo::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 PageInfo::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 PageInfo::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, PageInfo_ps_descr_.raw->forceomit);
      decoded_length = ps().RAW_decode(PageInfo_ps_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, PageInfo_cs_descr_.raw->forceomit);
      decoded_length = cs().RAW_decode(PageInfo_cs_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(PageInfoPs_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, PageInfo_ps_descr_.raw->forceomit);
          decoded_length = ps().RAW_decode(PageInfo_ps_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_ps).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(PageInfoCs_presence_descr_, p_buf, limit, top_bit_ord, TRUE);
      if (decoded_1_length > 0) {
        if (temporal_1 ==  bs_0) {
          p_buf.set_pos_bit(starting_pos);
          RAW_Force_Omit field_force_omit(1, force_omit, PageInfo_cs_descr_.raw->forceomit);
          decoded_length = cs().RAW_decode(PageInfo_cs_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit);
          if (decoded_length > 0) {
             if ((*field_cs).presence() ==  bs_0) {
               return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
             }else already_failed = TRUE;
          }
        }
      }
    }
 }
 clean_up();
 return -1;
}

int PageInfo::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const
{
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 2;  myleaf.body.node.nodes = init_nodes_of_enc_tree(2);
  memset(myleaf.body.node.nodes, 0, 2 * sizeof(RAW_enc_tree *));
  switch (union_selection) {
  case ALT_ps:
    myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, PageInfo_ps_descr_.raw);
    encoded_length = field_ps->RAW_encode(PageInfo_ps_descr_, *myleaf.body.node.nodes[0]);
    myleaf.body.node.nodes[0]->coding_descr = &PageInfo_ps_descr_;
    if ((*field_ps).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(PageInfoPs_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_cs:
    myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, PageInfo_cs_descr_.raw);
    encoded_length = field_cs->RAW_encode(PageInfo_cs_descr_, *myleaf.body.node.nodes[1]);
    myleaf.body.node.nodes[1]->coding_descr = &PageInfo_cs_descr_;
    if ((*field_cs).presence() !=  bs_0) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+2;
  int new_pos0[]={1,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_0.RAW_encode(PageInfoCs_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 PageInfo_template::copy_value(const PageInfo& other_value)
{
single_value.union_selection = other_value.get_selection();
switch (single_value.union_selection) {
case PageInfo::ALT_ps:
single_value.field_ps = new PageInfoPs_template(other_value.ps());
break;
case PageInfo::ALT_cs:
single_value.field_cs = new PageInfoCs_template(other_value.cs());
break;
default:
TTCN_error("Initializing a template with an unbound value of type @RLCMAC_CSN1_Types.PageInfo.");
}
set_selection(SPECIFIC_VALUE);
}

void PageInfo_template::copy_template(const PageInfo_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 PageInfo::ALT_ps:
single_value.field_ps = new PageInfoPs_template(*other_value.single_value.field_ps);
break;
case PageInfo::ALT_cs:
single_value.field_cs = new PageInfoCs_template(*other_value.single_value.field_cs);
break;
default:
TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @RLCMAC_CSN1_Types.PageInfo.");
}
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 PageInfo_template[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 PageInfo_template(*other_value.implication_.precondition);
implication_.implied_template = new PageInfo_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.PageInfo.");
}
set_selection(other_value);
}

PageInfo_template::PageInfo_template()
{
}

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

PageInfo_template::PageInfo_template(const PageInfo& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

void PageInfo_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case PageInfo::ALT_ps:
delete single_value.field_ps;
break;
case PageInfo::ALT_cs:
delete single_value.field_cs;
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;
}

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

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

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

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

boolean PageInfo_template::match(const PageInfo& 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:
{
PageInfo::union_selection_type value_selection = other_value.get_selection();
if (value_selection == PageInfo::UNBOUND_VALUE) return FALSE;
if (value_selection != single_value.union_selection) return FALSE;
switch (value_selection) {
case PageInfo::ALT_ps:
return single_value.field_ps->match(other_value.ps(), legacy);
case PageInfo::ALT_cs:
return single_value.field_cs->match(other_value.cs(), legacy);
default:
TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @RLCMAC_CSN1_Types.PageInfo.");
}
}
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.PageInfo.");
}
return FALSE;
}

boolean PageInfo_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
switch (single_value.union_selection) {
case PageInfo::ALT_ps:
return single_value.field_ps->is_value();
case PageInfo::ALT_cs:
return single_value.field_cs->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.PageInfo.");
}
}

PageInfo PageInfo_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.PageInfo.");
PageInfo ret_val;
switch (single_value.union_selection) {
case PageInfo::ALT_ps:
ret_val.ps() = single_value.field_ps->valueof();
break;
case PageInfo::ALT_cs:
ret_val.cs() = single_value.field_cs->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.PageInfo.");
}
return ret_val;
}

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

PageInfoPs_template& PageInfo_template::ps()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PageInfo::ALT_ps) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_ps = new PageInfoPs_template(ANY_VALUE);
else single_value.field_ps = new PageInfoPs_template;
single_value.union_selection = PageInfo::ALT_ps;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_ps;
}

const PageInfoPs_template& PageInfo_template::ps() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ps in a non-specific template of union type @RLCMAC_CSN1_Types.PageInfo.");
if (single_value.union_selection != PageInfo::ALT_ps) TTCN_error("Accessing non-selected field ps in a template of union type @RLCMAC_CSN1_Types.PageInfo.");
return *single_value.field_ps;
}

PageInfoCs_template& PageInfo_template::cs()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PageInfo::ALT_cs) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_cs = new PageInfoCs_template(ANY_VALUE);
else single_value.field_cs = new PageInfoCs_template;
single_value.union_selection = PageInfo::ALT_cs;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_cs;
}

const PageInfoCs_template& PageInfo_template::cs() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cs in a non-specific template of union type @RLCMAC_CSN1_Types.PageInfo.");
if (single_value.union_selection != PageInfo::ALT_cs) TTCN_error("Accessing non-selected field cs in a template of union type @RLCMAC_CSN1_Types.PageInfo.");
return *single_value.field_cs;
}

boolean PageInfo_template::ischosen(PageInfo::union_selection_type checked_selection) const
{
if (checked_selection == PageInfo::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @RLCMAC_CSN1_Types.PageInfo.");
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.union_selection == PageInfo::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.PageInfo.");
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.PageInfo 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 PageInfo_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case PageInfo::ALT_ps:
TTCN_Logger::log_event_str("{ ps := ");
single_value.field_ps->log();
TTCN_Logger::log_event_str(" }");
break;
case PageInfo::ALT_cs:
TTCN_Logger::log_event_str("{ cs := ");
single_value.field_cs->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 PageInfo_template::log_match(const PageInfo& 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 PageInfo::ALT_ps:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".ps");
single_value.field_ps->log_match(match_value.ps(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ ps := ");
single_value.field_ps->log_match(match_value.ps(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case PageInfo::ALT_cs:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".cs");
single_value.field_cs->log_match(match_value.cs(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ cs := ");
single_value.field_cs->log_match(match_value.cs(), 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 PageInfo_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
switch (single_value.union_selection) {
case PageInfo::ALT_ps:
single_value.field_ps->set_implicit_omit(); break;
case PageInfo::ALT_cs:
single_value.field_cs->set_implicit_omit(); break;
default: break;
}
}

void PageInfo_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 PageInfo::ALT_ps:
single_value.field_ps->encode_text(text_buf);
break;
case PageInfo::ALT_cs:
single_value.field_cs->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.PageInfo.");
}
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.PageInfo.");
}
}

void PageInfo_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
{
single_value.union_selection = PageInfo::UNBOUND_VALUE;
PageInfo::union_selection_type new_selection = (PageInfo::union_selection_type)text_buf.pull_int().get_val();
switch (new_selection) {
case PageInfo::ALT_ps:
single_value.field_ps = new PageInfoPs_template;
single_value.field_ps->decode_text(text_buf);
break;
case PageInfo::ALT_cs:
single_value.field_cs = new PageInfoCs_template;
single_value.field_cs->decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @RLCMAC_CSN1_Types.PageInfo.");
}
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 PageInfo_template[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.PageInfo.");
}
}

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

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

void PageInfo_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 PageInfo::ALT_ps:
single_value.field_ps->check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PageInfo");
return;
case PageInfo::ALT_cs:
single_value.field_cs->check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PageInfo");
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.PageInfo.");
}
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.PageInfo");
}

RepeatedPageInfoItem::RepeatedPageInfoItem()
{
}

RepeatedPageInfoItem::RepeatedPageInfoItem(const BITSTRING& par_presence,
    const PageInfo& par_item)
  :   field_presence(par_presence),
  field_item(par_item)
{
}

RepeatedPageInfoItem::RepeatedPageInfoItem(const RepeatedPageInfoItem& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.RepeatedPageInfoItem.");
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 RepeatedPageInfoItem::clean_up()
{
field_presence.clean_up();
field_item.clean_up();
}

const TTCN_Typedescriptor_t* RepeatedPageInfoItem::get_descriptor() const { return &RepeatedPageInfoItem_descr_; }
RepeatedPageInfoItem& RepeatedPageInfoItem::operator=(const RepeatedPageInfoItem& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.RepeatedPageInfoItem.");
  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 RepeatedPageInfoItem::operator==(const RepeatedPageInfoItem& other_value) const
{
return field_presence==other_value.field_presence
  && field_item==other_value.field_item;
}

boolean RepeatedPageInfoItem::is_bound() const
{
return (field_presence.is_bound())
  || (field_item.is_bound());
}
boolean RepeatedPageInfoItem::is_value() const
{
return field_presence.is_value()
  && field_item.is_value();
}
void RepeatedPageInfoItem::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 RepeatedPageInfoItem::set_implicit_omit()
{
if (presence().is_bound()) presence().set_implicit_omit();
if (item().is_bound()) item().set_implicit_omit();
}

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

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

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

void RepeatedPageInfoItem::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 RepeatedPageInfoItem::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 RepeatedPageInfoItem::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, RepeatedPageInfoItem_presence_descr_.raw->forceomit);
  decoded_field_length = field_presence.RAW_decode(RepeatedPageInfoItem_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, RepeatedPageInfoItem_item_descr_.raw->forceomit);
  decoded_field_length = field_item.RAW_decode(RepeatedPageInfoItem_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 RepeatedPageInfoItem::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, RepeatedPageInfoItem_presence_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RepeatedPageInfoItem_item_descr_.raw);
  encoded_length += field_presence.RAW_encode(RepeatedPageInfoItem_presence_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_item.RAW_encode(RepeatedPageInfoItem_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(RepeatedPageInfoItem_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 RepeatedPageInfoItem_template::single_value_struct {
BITSTRING_template field_presence;
PageInfo_template field_item;
};

void RepeatedPageInfoItem_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 RepeatedPageInfoItem_template::copy_value(const RepeatedPageInfoItem& 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 RepeatedPageInfoItem_template::copy_template(const RepeatedPageInfoItem_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 RepeatedPageInfoItem_template[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 RepeatedPageInfoItem_template(*other_value.implication_.precondition);
implication_.implied_template = new RepeatedPageInfoItem_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.RepeatedPageInfoItem.");
break;
}
set_selection(other_value);
}

RepeatedPageInfoItem_template::RepeatedPageInfoItem_template()
{
}

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

RepeatedPageInfoItem_template::RepeatedPageInfoItem_template(const RepeatedPageInfoItem& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

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

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

RepeatedPageInfoItem RepeatedPageInfoItem_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.RepeatedPageInfoItem.");
RepeatedPageInfoItem 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 RepeatedPageInfoItem_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.RepeatedPageInfoItem.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RepeatedPageInfoItem_template[list_length];
}

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

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

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

PageInfo_template& RepeatedPageInfoItem_template::item()
{
set_specific();
return single_value->field_item;
}

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

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

void RepeatedPageInfoItem_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 RepeatedPageInfoItem_template::log_match(const RepeatedPageInfoItem& 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 RepeatedPageInfoItem_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 RepeatedPageInfoItem_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.RepeatedPageInfoItem.");
}
}

void RepeatedPageInfoItem_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 RepeatedPageInfoItem_template[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.RepeatedPageInfoItem.");
}
}

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

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

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

boolean RepeatedPageInfoItem_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 RepeatedPageInfoItem RepeatedPageInfo::UNBOUND_ELEM;
RepeatedPageInfo::RepeatedPageInfo()
{
val_ptr = NULL;
}

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

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

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

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

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

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

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

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

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

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

const RepeatedPageInfoItem& RepeatedPageInfo::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @RLCMAC_CSN1_Types.RepeatedPageInfo.");
if (index_value < 0) TTCN_error("Accessing an element of type @RLCMAC_CSN1_Types.RepeatedPageInfo 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.RepeatedPageInfo: 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 RepeatedPageInfoItem& RepeatedPageInfo::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @RLCMAC_CSN1_Types.RepeatedPageInfo.");
return (*this)[(int)index_value];
}

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

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

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

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

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

RepeatedPageInfo RepeatedPageInfo::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.RepeatedPageInfo.");
check_substr_arguments(val_ptr->n_elements, index, returncount, "@RLCMAC_CSN1_Types.RepeatedPageInfo","element");
RepeatedPageInfo 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 RepeatedPageInfoItem(*val_ptr->value_elements[i+index]);
}
}
return ret_val;
}

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

RepeatedPageInfo RepeatedPageInfo::replace(int index, int len, const RepeatedPageInfo_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 RepeatedPageInfo::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.RepeatedPageInfo.");
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 = (RepeatedPageInfoItem**)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 RepeatedPageInfoItem(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (RepeatedPageInfoItem**)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.RepeatedPageInfo: %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 = (RepeatedPageInfoItem**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}

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

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

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

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

void RepeatedPageInfo_template::copy_template(const RepeatedPageInfo_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 = (RepeatedPageInfoItem_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 RepeatedPageInfoItem_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new RepeatedPageInfoItem_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 RepeatedPageInfo_template[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 RepeatedPageInfo_template(*other_value.implication_.precondition);
implication_.implied_template = new RepeatedPageInfo_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.RepeatedPageInfo.");
break;
}
set_selection(other_value);
}

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

RepeatedPageInfo_template::RepeatedPageInfo_template()
{
}

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

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

RepeatedPageInfo_template::RepeatedPageInfo_template(const RepeatedPageInfo& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

const RepeatedPageInfoItem_template& RepeatedPageInfo_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @RLCMAC_CSN1_Types.RepeatedPageInfo 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.RepeatedPageInfo.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @RLCMAC_CSN1_Types.RepeatedPageInfo: 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 RepeatedPageInfoItem_template& RepeatedPageInfo_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.RepeatedPageInfo.");
return (*this)[(int)index_value];
}

void RepeatedPageInfo_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.RepeatedPageInfo.");
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 = (RepeatedPageInfoItem_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 RepeatedPageInfoItem_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 RepeatedPageInfoItem_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 = (RepeatedPageInfoItem_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}

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

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

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

RepeatedPageInfo RepeatedPageInfo_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.RepeatedPageInfo.");
RepeatedPageInfo 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;
}

RepeatedPageInfo RepeatedPageInfo_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);
}

RepeatedPageInfo RepeatedPageInfo_template::replace(int index, int len, const RepeatedPageInfo_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());
}

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

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

void RepeatedPageInfo_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 RepeatedPageInfo_template::log_match(const RepeatedPageInfo& 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 RepeatedPageInfo_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.RepeatedPageInfo.");
}
}

void RepeatedPageInfo_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.RepeatedPageInfo.");
single_value.value_elements = (RepeatedPageInfoItem_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 RepeatedPageInfoItem_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 RepeatedPageInfo_template[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.RepeatedPageInfo.");
}
}

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

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

void RepeatedPageInfo_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.RepeatedPageInfo");
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.RepeatedPageInfo");
}

boolean RepeatedPageInfo_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);
}
}
PacketPagingReq::PacketPagingReq()
{
}

PacketPagingReq::PacketPagingReq(const PageMode& par_page__mode,
    const BITSTRING& par_persistence__levels__present,
    const OPTIONAL< PersistenceLevels >& par_persistence__levels,
    const BITSTRING& par_nln__present,
    const OPTIONAL< INTEGER >& par_nln,
    const OPTIONAL< RepeatedPageInfo >& par_repeated__pageinfo,
    const BITSTRING& par_repeated__pageinfo__term)
  :   field_page__mode(par_page__mode),
  field_persistence__levels__present(par_persistence__levels__present),
  field_persistence__levels(par_persistence__levels),
  field_nln__present(par_nln__present),
  field_nln(par_nln),
  field_repeated__pageinfo(par_repeated__pageinfo),
  field_repeated__pageinfo__term(par_repeated__pageinfo__term)
{
}

PacketPagingReq::PacketPagingReq(const PacketPagingReq& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PacketPagingReq.");
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.nln__present().is_bound()) field_nln__present = other_value.nln__present();
else field_nln__present.clean_up();
if (other_value.nln().is_bound()) field_nln = other_value.nln();
else field_nln.clean_up();
if (other_value.repeated__pageinfo().is_bound()) field_repeated__pageinfo = other_value.repeated__pageinfo();
else field_repeated__pageinfo.clean_up();
if (other_value.repeated__pageinfo__term().is_bound()) field_repeated__pageinfo__term = other_value.repeated__pageinfo__term();
else field_repeated__pageinfo__term.clean_up();
}

void PacketPagingReq::clean_up()
{
field_page__mode.clean_up();
field_persistence__levels__present.clean_up();
field_persistence__levels.clean_up();
field_nln__present.clean_up();
field_nln.clean_up();
field_repeated__pageinfo.clean_up();
field_repeated__pageinfo__term.clean_up();
}

const TTCN_Typedescriptor_t* PacketPagingReq::get_descriptor() const { return &PacketPagingReq_descr_; }
PacketPagingReq& PacketPagingReq::operator=(const PacketPagingReq& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PacketPagingReq.");
  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.nln__present().is_bound()) field_nln__present = other_value.nln__present();
  else field_nln__present.clean_up();
  if (other_value.nln().is_bound()) field_nln = other_value.nln();
  else field_nln.clean_up();
  if (other_value.repeated__pageinfo().is_bound()) field_repeated__pageinfo = other_value.repeated__pageinfo();
  else field_repeated__pageinfo.clean_up();
  if (other_value.repeated__pageinfo__term().is_bound()) field_repeated__pageinfo__term = other_value.repeated__pageinfo__term();
  else field_repeated__pageinfo__term.clean_up();
}
return *this;
}

boolean PacketPagingReq::operator==(const PacketPagingReq& 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_nln__present==other_value.field_nln__present
  && field_nln==other_value.field_nln
  && field_repeated__pageinfo==other_value.field_repeated__pageinfo
  && field_repeated__pageinfo__term==other_value.field_repeated__pageinfo__term;
}

boolean PacketPagingReq::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_nln__present.is_bound())
  || (OPTIONAL_OMIT == field_nln.get_selection() || field_nln.is_bound())
  || (OPTIONAL_OMIT == field_repeated__pageinfo.get_selection() || field_repeated__pageinfo.is_bound())
  || (field_repeated__pageinfo__term.is_bound());
}
boolean PacketPagingReq::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_nln__present.is_value()
  && (OPTIONAL_OMIT == field_nln.get_selection() || field_nln.is_value())
  && (OPTIONAL_OMIT == field_repeated__pageinfo.get_selection() || field_repeated__pageinfo.is_value())
  && field_repeated__pageinfo__term.is_value();
}
int PacketPagingReq::size_of() const
{
  int ret_val = 4;
  if (field_persistence__levels.ispresent()) ret_val++;
  if (field_nln.ispresent()) ret_val++;
  if (field_repeated__pageinfo.ispresent()) ret_val++;
  return ret_val;
}

void PacketPagingReq::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(", nln_present := ");
field_nln__present.log();
TTCN_Logger::log_event_str(", nln := ");
field_nln.log();
TTCN_Logger::log_event_str(", repeated_pageinfo := ");
field_repeated__pageinfo.log();
TTCN_Logger::log_event_str(", repeated_pageinfo_term := ");
field_repeated__pageinfo__term.log();
TTCN_Logger::log_event_str(" }");
}

void PacketPagingReq::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 (nln__present().is_bound()) nln__present().set_implicit_omit();
if (!nln().is_bound()) nln() = OMIT_VALUE;
else nln().set_implicit_omit();
if (!repeated__pageinfo().is_bound()) repeated__pageinfo() = OMIT_VALUE;
else repeated__pageinfo().set_implicit_omit();
if (repeated__pageinfo__term().is_bound()) repeated__pageinfo__term().set_implicit_omit();
}

void PacketPagingReq::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.PacketPagingReq 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) nln__present().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) nln().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) repeated__pageinfo().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) repeated__pageinfo__term().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(), "nln_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nln__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(), "nln")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nln().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_pageinfo")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          repeated__pageinfo().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_pageinfo_term")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          repeated__pageinfo__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.PacketPagingReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.PacketPagingReq");
  }
}

void PacketPagingReq::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_nln__present.encode_text(text_buf);
field_nln.encode_text(text_buf);
field_repeated__pageinfo.encode_text(text_buf);
field_repeated__pageinfo__term.encode_text(text_buf);
}

void PacketPagingReq::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_nln__present.decode_text(text_buf);
field_nln.decode_text(text_buf);
field_repeated__pageinfo.decode_text(text_buf);
field_repeated__pageinfo__term.decode_text(text_buf);
}

void PacketPagingReq::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 PacketPagingReq::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 PacketPagingReq::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, PacketPagingReq_page__mode_descr_.raw->forceomit);
  decoded_field_length = field_page__mode.RAW_decode(PacketPagingReq_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, PacketPagingReq_persistence__levels__present_descr_.raw->forceomit);
  decoded_field_length = field_persistence__levels__present.RAW_decode(PacketPagingReq_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, PacketPagingReq_persistence__levels_descr_.raw->forceomit);
  decoded_field_length = field_persistence__levels().RAW_decode(PacketPagingReq_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, PacketPagingReq_nln__present_descr_.raw->forceomit);
  decoded_field_length = field_nln__present.RAW_decode(PacketPagingReq_nln__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_nln__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(4)) {
    field_nln = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_4_force_omit(4, force_omit, PacketPagingReq_nln_descr_.raw->forceomit);
  decoded_field_length = field_nln().RAW_decode(PacketPagingReq_nln_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit);
  if (decoded_field_length < 1) {
  field_nln = 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_nln=OMIT_VALUE;
  if (limit > 0){
  if (force_omit != NULL && (*force_omit)(5)) {
    field_repeated__pageinfo = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_5_force_omit(5, force_omit, PacketPagingReq_repeated__pageinfo_descr_.raw->forceomit);
  decoded_field_length = field_repeated__pageinfo().RAW_decode(PacketPagingReq_repeated__pageinfo_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 1) {
  field_repeated__pageinfo = 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__pageinfo=OMIT_VALUE;
  RAW_Force_Omit field_6_force_omit(6, force_omit, PacketPagingReq_repeated__pageinfo__term_descr_.raw->forceomit);
  decoded_field_length = field_repeated__pageinfo__term.RAW_decode(PacketPagingReq_repeated__pageinfo__term_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 PacketPagingReq::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, PacketPagingReq_page__mode_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PacketPagingReq_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, PacketPagingReq_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, PacketPagingReq_nln__present_descr_.raw);
  if (field_nln.ispresent()) {
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, PacketPagingReq_nln_descr_.raw);
  }
  else myleaf.body.node.nodes[4] = NULL;
  if (field_repeated__pageinfo.ispresent()) {
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, PacketPagingReq_repeated__pageinfo_descr_.raw);
  }
  else myleaf.body.node.nodes[5] = NULL;
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, PacketPagingReq_repeated__pageinfo__term_descr_.raw);
  encoded_length += field_page__mode.RAW_encode(PacketPagingReq_page__mode_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_persistence__levels__present.RAW_encode(PacketPagingReq_persistence__levels__present_descr_, *myleaf.body.node.nodes[1]);
  if (field_persistence__levels.ispresent()) {
  encoded_length += field_persistence__levels().RAW_encode(PacketPagingReq_persistence__levels_descr_, *myleaf.body.node.nodes[2]);
  }
  encoded_length += field_nln__present.RAW_encode(PacketPagingReq_nln__present_descr_, *myleaf.body.node.nodes[3]);
  if (field_nln.ispresent()) {
  encoded_length += field_nln().RAW_encode(PacketPagingReq_nln_descr_, *myleaf.body.node.nodes[4]);
  }
  if (field_repeated__pageinfo.ispresent()) {
  encoded_length += field_repeated__pageinfo().RAW_encode(PacketPagingReq_repeated__pageinfo_descr_, *myleaf.body.node.nodes[5]);
  }
  encoded_length += field_repeated__pageinfo__term.RAW_encode(PacketPagingReq_repeated__pageinfo__term_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(PacketPagingReq_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_nln.ispresent() && (field_nln__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(PacketPagingReq_nln__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 PacketPagingReq_template::single_value_struct {
PageMode_template field_page__mode;
BITSTRING_template field_persistence__levels__present;
PersistenceLevels_template field_persistence__levels;
BITSTRING_template field_nln__present;
INTEGER_template field_nln;
RepeatedPageInfo_template field_repeated__pageinfo;
BITSTRING_template field_repeated__pageinfo__term;
};

void PacketPagingReq_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_nln__present = ANY_VALUE;
single_value->field_nln = ANY_OR_OMIT;
single_value->field_repeated__pageinfo = ANY_OR_OMIT;
single_value->field_repeated__pageinfo__term = ANY_VALUE;
}
}
}

void PacketPagingReq_template::copy_value(const PacketPagingReq& 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.nln__present().is_bound()) {
  single_value->field_nln__present = other_value.nln__present();
} else {
  single_value->field_nln__present.clean_up();
}
if (other_value.nln().is_bound()) {
  if (other_value.nln().ispresent()) single_value->field_nln = other_value.nln()();
  else single_value->field_nln = OMIT_VALUE;
} else {
  single_value->field_nln.clean_up();
}
if (other_value.repeated__pageinfo().is_bound()) {
  if (other_value.repeated__pageinfo().ispresent()) single_value->field_repeated__pageinfo = other_value.repeated__pageinfo()();
  else single_value->field_repeated__pageinfo = OMIT_VALUE;
} else {
  single_value->field_repeated__pageinfo.clean_up();
}
if (other_value.repeated__pageinfo__term().is_bound()) {
  single_value->field_repeated__pageinfo__term = other_value.repeated__pageinfo__term();
} else {
  single_value->field_repeated__pageinfo__term.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PacketPagingReq_template::copy_template(const PacketPagingReq_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.nln__present().get_selection()) {
single_value->field_nln__present = other_value.nln__present();
} else {
single_value->field_nln__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nln().get_selection()) {
single_value->field_nln = other_value.nln();
} else {
single_value->field_nln.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.repeated__pageinfo().get_selection()) {
single_value->field_repeated__pageinfo = other_value.repeated__pageinfo();
} else {
single_value->field_repeated__pageinfo.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.repeated__pageinfo__term().get_selection()) {
single_value->field_repeated__pageinfo__term = other_value.repeated__pageinfo__term();
} else {
single_value->field_repeated__pageinfo__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 PacketPagingReq_template[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 PacketPagingReq_template(*other_value.implication_.precondition);
implication_.implied_template = new PacketPagingReq_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.PacketPagingReq.");
break;
}
set_selection(other_value);
}

PacketPagingReq_template::PacketPagingReq_template()
{
}

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

PacketPagingReq_template::PacketPagingReq_template(const PacketPagingReq& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PacketPagingReq_template::match(const PacketPagingReq& 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.nln__present().is_bound()) return FALSE;
if(!single_value->field_nln__present.match(other_value.nln__present(), legacy))return FALSE;
if(!other_value.nln().is_bound()) return FALSE;
if((other_value.nln().ispresent() ? !single_value->field_nln.match((const INTEGER&)other_value.nln(), legacy) : !single_value->field_nln.match_omit(legacy)))return FALSE;
if(!other_value.repeated__pageinfo().is_bound()) return FALSE;
if((other_value.repeated__pageinfo().ispresent() ? !single_value->field_repeated__pageinfo.match((const RepeatedPageInfo&)other_value.repeated__pageinfo(), legacy) : !single_value->field_repeated__pageinfo.match_omit(legacy)))return FALSE;
if(!other_value.repeated__pageinfo__term().is_bound()) return FALSE;
if(!single_value->field_repeated__pageinfo__term.match(other_value.repeated__pageinfo__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.PacketPagingReq.");
}
return FALSE;
}

boolean PacketPagingReq_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_nln__present.is_bound()
 || (single_value->field_nln.is_omit() || single_value->field_nln.is_bound())
 || (single_value->field_repeated__pageinfo.is_omit() || single_value->field_repeated__pageinfo.is_bound())
 || single_value->field_repeated__pageinfo__term.is_bound();
}

boolean PacketPagingReq_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_nln__present.is_value()
 && (single_value->field_nln.is_omit() || single_value->field_nln.is_value())
 && (single_value->field_repeated__pageinfo.is_omit() || single_value->field_repeated__pageinfo.is_value())
 && single_value->field_repeated__pageinfo__term.is_value();
}

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

PacketPagingReq PacketPagingReq_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.PacketPagingReq.");
PacketPagingReq 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_nln__present.is_bound()) {
ret_val.nln__present() = single_value->field_nln__present.valueof();
}
if (single_value->field_nln.is_omit()) ret_val.nln() = OMIT_VALUE;
else if (single_value->field_nln.is_bound()) {
ret_val.nln() = single_value->field_nln.valueof();
}
if (single_value->field_repeated__pageinfo.is_omit()) ret_val.repeated__pageinfo() = OMIT_VALUE;
else if (single_value->field_repeated__pageinfo.is_bound()) {
ret_val.repeated__pageinfo() = single_value->field_repeated__pageinfo.valueof();
}
if (single_value->field_repeated__pageinfo__term.is_bound()) {
ret_val.repeated__pageinfo__term() = single_value->field_repeated__pageinfo__term.valueof();
}
return ret_val;
}

void PacketPagingReq_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.PacketPagingReq.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PacketPagingReq_template[list_length];
}

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

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

const PageMode_template& PacketPagingReq_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.PacketPagingReq.");
return single_value->field_page__mode;
}

BITSTRING_template& PacketPagingReq_template::persistence__levels__present()
{
set_specific();
return single_value->field_persistence__levels__present;
}

const BITSTRING_template& PacketPagingReq_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.PacketPagingReq.");
return single_value->field_persistence__levels__present;
}

PersistenceLevels_template& PacketPagingReq_template::persistence__levels()
{
set_specific();
return single_value->field_persistence__levels;
}

const PersistenceLevels_template& PacketPagingReq_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.PacketPagingReq.");
return single_value->field_persistence__levels;
}

BITSTRING_template& PacketPagingReq_template::nln__present()
{
set_specific();
return single_value->field_nln__present;
}

const BITSTRING_template& PacketPagingReq_template::nln__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nln_present of a non-specific template of type @RLCMAC_CSN1_Types.PacketPagingReq.");
return single_value->field_nln__present;
}

INTEGER_template& PacketPagingReq_template::nln()
{
set_specific();
return single_value->field_nln;
}

const INTEGER_template& PacketPagingReq_template::nln() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nln of a non-specific template of type @RLCMAC_CSN1_Types.PacketPagingReq.");
return single_value->field_nln;
}

RepeatedPageInfo_template& PacketPagingReq_template::repeated__pageinfo()
{
set_specific();
return single_value->field_repeated__pageinfo;
}

const RepeatedPageInfo_template& PacketPagingReq_template::repeated__pageinfo() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field repeated_pageinfo of a non-specific template of type @RLCMAC_CSN1_Types.PacketPagingReq.");
return single_value->field_repeated__pageinfo;
}

BITSTRING_template& PacketPagingReq_template::repeated__pageinfo__term()
{
set_specific();
return single_value->field_repeated__pageinfo__term;
}

const BITSTRING_template& PacketPagingReq_template::repeated__pageinfo__term() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field repeated_pageinfo_term of a non-specific template of type @RLCMAC_CSN1_Types.PacketPagingReq.");
return single_value->field_repeated__pageinfo__term;
}

int PacketPagingReq_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.PacketPagingReq 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_nln.is_present()) ret_val++;
      if (single_value->field_repeated__pageinfo.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.PacketPagingReq 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.PacketPagingReq 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.PacketPagingReq containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.PacketPagingReq containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.PacketPagingReq containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.PacketPagingReq containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.PacketPagingReq containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.PacketPagingReq containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @RLCMAC_CSN1_Types.PacketPagingReq.");
  }
  return 0;
}

void PacketPagingReq_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(", nln_present := ");
single_value->field_nln__present.log();
TTCN_Logger::log_event_str(", nln := ");
single_value->field_nln.log();
TTCN_Logger::log_event_str(", repeated_pageinfo := ");
single_value->field_repeated__pageinfo.log();
TTCN_Logger::log_event_str(", repeated_pageinfo_term := ");
single_value->field_repeated__pageinfo__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 PacketPagingReq_template::log_match(const PacketPagingReq& 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_nln__present.match(match_value.nln__present(), legacy)){
TTCN_Logger::log_logmatch_info(".nln_present");
single_value->field_nln__present.log_match(match_value.nln__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.nln().ispresent()){
if(!single_value->field_nln.match(match_value.nln(), legacy)){
TTCN_Logger::log_logmatch_info(".nln");
single_value->field_nln.log_match(match_value.nln(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_nln.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".nln := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_nln.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.repeated__pageinfo().ispresent()){
if(!single_value->field_repeated__pageinfo.match(match_value.repeated__pageinfo(), legacy)){
TTCN_Logger::log_logmatch_info(".repeated_pageinfo");
single_value->field_repeated__pageinfo.log_match(match_value.repeated__pageinfo(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_repeated__pageinfo.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".repeated_pageinfo := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_repeated__pageinfo.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_repeated__pageinfo__term.match(match_value.repeated__pageinfo__term(), legacy)){
TTCN_Logger::log_logmatch_info(".repeated_pageinfo_term");
single_value->field_repeated__pageinfo__term.log_match(match_value.repeated__pageinfo__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("{ 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(", nln_present := ");
single_value->field_nln__present.log_match(match_value.nln__present(), legacy);
TTCN_Logger::log_event_str(", nln := ");
if (match_value.nln().ispresent()) {
single_value->field_nln.log_match(match_value.nln(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_nln.log();
if (single_value->field_nln.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", repeated_pageinfo := ");
if (match_value.repeated__pageinfo().ispresent()) {
single_value->field_repeated__pageinfo.log_match(match_value.repeated__pageinfo(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_repeated__pageinfo.log();
if (single_value->field_repeated__pageinfo.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", repeated_pageinfo_term := ");
single_value->field_repeated__pageinfo__term.log_match(match_value.repeated__pageinfo__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 PacketPagingReq_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 (nln__present().is_bound()) nln__present().set_implicit_omit();
if (!nln().is_bound()) nln() = OMIT_VALUE;
else nln().set_implicit_omit();
if (!repeated__pageinfo().is_bound()) repeated__pageinfo() = OMIT_VALUE;
else repeated__pageinfo().set_implicit_omit();
if (repeated__pageinfo__term().is_bound()) repeated__pageinfo__term().set_implicit_omit();
}

void PacketPagingReq_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_nln__present.encode_text(text_buf);
single_value->field_nln.encode_text(text_buf);
single_value->field_repeated__pageinfo.encode_text(text_buf);
single_value->field_repeated__pageinfo__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.PacketPagingReq.");
}
}

void PacketPagingReq_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_nln__present.decode_text(text_buf);
single_value->field_nln.decode_text(text_buf);
single_value->field_repeated__pageinfo.decode_text(text_buf);
single_value->field_repeated__pageinfo__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 PacketPagingReq_template[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.PacketPagingReq.");
}
}

void PacketPagingReq_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: {
    PacketPagingReq_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.PacketPagingReq 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) nln__present().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) nln().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) repeated__pageinfo().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) repeated__pageinfo__term().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(), "nln_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nln__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(), "nln")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nln().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_pageinfo")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          repeated__pageinfo().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_pageinfo_term")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          repeated__pageinfo__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.PacketPagingReq: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PacketPagingReq_template* precondition = new PacketPagingReq_template;
    precondition->set_param(*param.get_elem(0));
    PacketPagingReq_template* implied_template = new PacketPagingReq_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PacketPagingReq_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.PacketPagingReq");
  }
  is_ifpresent = param.get_ifpresent();
}

void PacketPagingReq_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.PacketPagingReq");
single_value->field_persistence__levels__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketPagingReq");
single_value->field_persistence__levels.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketPagingReq");
single_value->field_nln__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketPagingReq");
single_value->field_nln.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketPagingReq");
single_value->field_repeated__pageinfo.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketPagingReq");
single_value->field_repeated__pageinfo__term.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketPagingReq");
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.PacketPagingReq");
}

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

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

ExtensionBits::ExtensionBits()
{
}

ExtensionBits::ExtensionBits(const INTEGER& par_extension__length,
    const BITSTRING& par_spare__bits)
  :   field_extension__length(par_extension__length),
  field_spare__bits(par_spare__bits)
{
}

ExtensionBits::ExtensionBits(const ExtensionBits& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.ExtensionBits.");
if (other_value.extension__length().is_bound()) field_extension__length = other_value.extension__length();
else field_extension__length.clean_up();
if (other_value.spare__bits().is_bound()) field_spare__bits = other_value.spare__bits();
else field_spare__bits.clean_up();
}

void ExtensionBits::clean_up()
{
field_extension__length.clean_up();
field_spare__bits.clean_up();
}

const TTCN_Typedescriptor_t* ExtensionBits::get_descriptor() const { return &ExtensionBits_descr_; }
ExtensionBits& ExtensionBits::operator=(const ExtensionBits& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.ExtensionBits.");
  if (other_value.extension__length().is_bound()) field_extension__length = other_value.extension__length();
  else field_extension__length.clean_up();
  if (other_value.spare__bits().is_bound()) field_spare__bits = other_value.spare__bits();
  else field_spare__bits.clean_up();
}
return *this;
}

boolean ExtensionBits::operator==(const ExtensionBits& other_value) const
{
return field_extension__length==other_value.field_extension__length
  && field_spare__bits==other_value.field_spare__bits;
}

boolean ExtensionBits::is_bound() const
{
return (field_extension__length.is_bound())
  || (field_spare__bits.is_bound());
}
boolean ExtensionBits::is_value() const
{
return field_extension__length.is_value()
  && field_spare__bits.is_value();
}
void ExtensionBits::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ extension_length := ");
field_extension__length.log();
TTCN_Logger::log_event_str(", spare_bits := ");
field_spare__bits.log();
TTCN_Logger::log_event_str(" }");
}

void ExtensionBits::set_implicit_omit()
{
if (extension__length().is_bound()) extension__length().set_implicit_omit();
if (spare__bits().is_bound()) spare__bits().set_implicit_omit();
}

void ExtensionBits::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.ExtensionBits 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) extension__length().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare__bits().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(), "extension_length")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          extension__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(), "spare_bits")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare__bits().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.ExtensionBits: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.ExtensionBits");
  }
}

void ExtensionBits::encode_text(Text_Buf& text_buf) const
{
field_extension__length.encode_text(text_buf);
field_spare__bits.encode_text(text_buf);
}

void ExtensionBits::decode_text(Text_Buf& text_buf)
{
field_extension__length.decode_text(text_buf);
field_spare__bits.decode_text(text_buf);
}

void ExtensionBits::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 ExtensionBits::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 ExtensionBits::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, ExtensionBits_extension__length_descr_.raw->forceomit);
  decoded_field_length = field_extension__length.RAW_decode(ExtensionBits_extension__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_extension__length.convert_to_Integer(ExtensionBits_extension__length_descr_);
  tmp0 = tmp0 - -1;
  field_extension__length = tmp0;
  value_of_length_field0 += tmp0.get_long_long_val() * 1;
  RAW_Force_Omit field_1_force_omit(1, force_omit, ExtensionBits_spare__bits_descr_.raw->forceomit);
  decoded_field_length = field_spare__bits.RAW_decode(ExtensionBits_spare__bits_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 ExtensionBits::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, ExtensionBits_extension__length_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, ExtensionBits_spare__bits_descr_.raw);
  encoded_length += 6;
  myleaf.body.node.nodes[0]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[0]->coding_descr = &ExtensionBits_extension__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 = -1;
  myleaf.body.node.nodes[0]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[0]->length = 6;
  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_spare__bits.RAW_encode(ExtensionBits_spare__bits_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct ExtensionBits_template::single_value_struct {
INTEGER_template field_extension__length;
BITSTRING_template field_spare__bits;
};

void ExtensionBits_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_extension__length = ANY_VALUE;
single_value->field_spare__bits = ANY_VALUE;
}
}
}

void ExtensionBits_template::copy_value(const ExtensionBits& other_value)
{
single_value = new single_value_struct;
if (other_value.extension__length().is_bound()) {
  single_value->field_extension__length = other_value.extension__length();
} else {
  single_value->field_extension__length.clean_up();
}
if (other_value.spare__bits().is_bound()) {
  single_value->field_spare__bits = other_value.spare__bits();
} else {
  single_value->field_spare__bits.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void ExtensionBits_template::copy_template(const ExtensionBits_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.extension__length().get_selection()) {
single_value->field_extension__length = other_value.extension__length();
} else {
single_value->field_extension__length.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare__bits().get_selection()) {
single_value->field_spare__bits = other_value.spare__bits();
} else {
single_value->field_spare__bits.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 ExtensionBits_template[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 ExtensionBits_template(*other_value.implication_.precondition);
implication_.implied_template = new ExtensionBits_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.ExtensionBits.");
break;
}
set_selection(other_value);
}

ExtensionBits_template::ExtensionBits_template()
{
}

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

ExtensionBits_template::ExtensionBits_template(const ExtensionBits& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean ExtensionBits_template::match(const ExtensionBits& 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.extension__length().is_bound()) return FALSE;
if(!single_value->field_extension__length.match(other_value.extension__length(), legacy))return FALSE;
if(!other_value.spare__bits().is_bound()) return FALSE;
if(!single_value->field_spare__bits.match(other_value.spare__bits(), 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.ExtensionBits.");
}
return FALSE;
}

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

boolean ExtensionBits_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_extension__length.is_value()
 && single_value->field_spare__bits.is_value();
}

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

ExtensionBits ExtensionBits_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.ExtensionBits.");
ExtensionBits ret_val;
if (single_value->field_extension__length.is_bound()) {
ret_val.extension__length() = single_value->field_extension__length.valueof();
}
if (single_value->field_spare__bits.is_bound()) {
ret_val.spare__bits() = single_value->field_spare__bits.valueof();
}
return ret_val;
}

void ExtensionBits_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.ExtensionBits.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new ExtensionBits_template[list_length];
}

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

INTEGER_template& ExtensionBits_template::extension__length()
{
set_specific();
return single_value->field_extension__length;
}

const INTEGER_template& ExtensionBits_template::extension__length() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field extension_length of a non-specific template of type @RLCMAC_CSN1_Types.ExtensionBits.");
return single_value->field_extension__length;
}

BITSTRING_template& ExtensionBits_template::spare__bits()
{
set_specific();
return single_value->field_spare__bits;
}

const BITSTRING_template& ExtensionBits_template::spare__bits() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare_bits of a non-specific template of type @RLCMAC_CSN1_Types.ExtensionBits.");
return single_value->field_spare__bits;
}

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

void ExtensionBits_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ extension_length := ");
single_value->field_extension__length.log();
TTCN_Logger::log_event_str(", spare_bits := ");
single_value->field_spare__bits.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 ExtensionBits_template::log_match(const ExtensionBits& 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_extension__length.match(match_value.extension__length(), legacy)){
TTCN_Logger::log_logmatch_info(".extension_length");
single_value->field_extension__length.log_match(match_value.extension__length(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare__bits.match(match_value.spare__bits(), legacy)){
TTCN_Logger::log_logmatch_info(".spare_bits");
single_value->field_spare__bits.log_match(match_value.spare__bits(), 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("{ extension_length := ");
single_value->field_extension__length.log_match(match_value.extension__length(), legacy);
TTCN_Logger::log_event_str(", spare_bits := ");
single_value->field_spare__bits.log_match(match_value.spare__bits(), 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 ExtensionBits_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (extension__length().is_bound()) extension__length().set_implicit_omit();
if (spare__bits().is_bound()) spare__bits().set_implicit_omit();
}

void ExtensionBits_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_extension__length.encode_text(text_buf);
single_value->field_spare__bits.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.ExtensionBits.");
}
}

void ExtensionBits_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_extension__length.decode_text(text_buf);
single_value->field_spare__bits.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 ExtensionBits_template[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.ExtensionBits.");
}
}

void ExtensionBits_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: {
    ExtensionBits_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.ExtensionBits 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) extension__length().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare__bits().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(), "extension_length")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          extension__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(), "spare_bits")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare__bits().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.ExtensionBits: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    ExtensionBits_template* precondition = new ExtensionBits_template;
    precondition->set_param(*param.get_elem(0));
    ExtensionBits_template* implied_template = new ExtensionBits_template;
    implied_template->set_param(*param.get_elem(1));
    *this = ExtensionBits_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.ExtensionBits");
  }
  is_ifpresent = param.get_ifpresent();
}

void ExtensionBits_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_extension__length.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.ExtensionBits");
single_value->field_spare__bits.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.ExtensionBits");
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.ExtensionBits");
}

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

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

UlAckNackGprsAdditionsRel99::UlAckNackGprsAdditionsRel99()
{
}

UlAckNackGprsAdditionsRel99::UlAckNackGprsAdditionsRel99(const BITSTRING& par_ext__pkt__ta__present,
    const OPTIONAL< BITSTRING >& par_ext__pkt__ta,
    const BOOLEAN& par_tbf__est)
  :   field_ext__pkt__ta__present(par_ext__pkt__ta__present),
  field_ext__pkt__ta(par_ext__pkt__ta),
  field_tbf__est(par_tbf__est)
{
}

UlAckNackGprsAdditionsRel99::UlAckNackGprsAdditionsRel99(const UlAckNackGprsAdditionsRel99& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.UlAckNackGprsAdditionsRel99.");
if (other_value.ext__pkt__ta__present().is_bound()) field_ext__pkt__ta__present = other_value.ext__pkt__ta__present();
else field_ext__pkt__ta__present.clean_up();
if (other_value.ext__pkt__ta().is_bound()) field_ext__pkt__ta = other_value.ext__pkt__ta();
else field_ext__pkt__ta.clean_up();
if (other_value.tbf__est().is_bound()) field_tbf__est = other_value.tbf__est();
else field_tbf__est.clean_up();
}

void UlAckNackGprsAdditionsRel99::clean_up()
{
field_ext__pkt__ta__present.clean_up();
field_ext__pkt__ta.clean_up();
field_tbf__est.clean_up();
}

const TTCN_Typedescriptor_t* UlAckNackGprsAdditionsRel99::get_descriptor() const { return &UlAckNackGprsAdditionsRel99_descr_; }
UlAckNackGprsAdditionsRel99& UlAckNackGprsAdditionsRel99::operator=(const UlAckNackGprsAdditionsRel99& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.UlAckNackGprsAdditionsRel99.");
  if (other_value.ext__pkt__ta__present().is_bound()) field_ext__pkt__ta__present = other_value.ext__pkt__ta__present();
  else field_ext__pkt__ta__present.clean_up();
  if (other_value.ext__pkt__ta().is_bound()) field_ext__pkt__ta = other_value.ext__pkt__ta();
  else field_ext__pkt__ta.clean_up();
  if (other_value.tbf__est().is_bound()) field_tbf__est = other_value.tbf__est();
  else field_tbf__est.clean_up();
}
return *this;
}

boolean UlAckNackGprsAdditionsRel99::operator==(const UlAckNackGprsAdditionsRel99& other_value) const
{
return field_ext__pkt__ta__present==other_value.field_ext__pkt__ta__present
  && field_ext__pkt__ta==other_value.field_ext__pkt__ta
  && field_tbf__est==other_value.field_tbf__est;
}

boolean UlAckNackGprsAdditionsRel99::is_bound() const
{
return (field_ext__pkt__ta__present.is_bound())
  || (OPTIONAL_OMIT == field_ext__pkt__ta.get_selection() || field_ext__pkt__ta.is_bound())
  || (field_tbf__est.is_bound());
}
boolean UlAckNackGprsAdditionsRel99::is_value() const
{
return field_ext__pkt__ta__present.is_value()
  && (OPTIONAL_OMIT == field_ext__pkt__ta.get_selection() || field_ext__pkt__ta.is_value())
  && field_tbf__est.is_value();
}
int UlAckNackGprsAdditionsRel99::size_of() const
{
  int ret_val = 2;
  if (field_ext__pkt__ta.ispresent()) ret_val++;
  return ret_val;
}

void UlAckNackGprsAdditionsRel99::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ ext_pkt_ta_present := ");
field_ext__pkt__ta__present.log();
TTCN_Logger::log_event_str(", ext_pkt_ta := ");
field_ext__pkt__ta.log();
TTCN_Logger::log_event_str(", tbf_est := ");
field_tbf__est.log();
TTCN_Logger::log_event_str(" }");
}

void UlAckNackGprsAdditionsRel99::set_implicit_omit()
{
if (ext__pkt__ta__present().is_bound()) ext__pkt__ta__present().set_implicit_omit();
if (!ext__pkt__ta().is_bound()) ext__pkt__ta() = OMIT_VALUE;
else ext__pkt__ta().set_implicit_omit();
if (tbf__est().is_bound()) tbf__est().set_implicit_omit();
}

void UlAckNackGprsAdditionsRel99::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.UlAckNackGprsAdditionsRel99 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) ext__pkt__ta__present().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext__pkt__ta().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) tbf__est().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(), "ext_pkt_ta_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext__pkt__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(), "ext_pkt_ta")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext__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(), "tbf_est")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tbf__est().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.UlAckNackGprsAdditionsRel99: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.UlAckNackGprsAdditionsRel99");
  }
}

void UlAckNackGprsAdditionsRel99::encode_text(Text_Buf& text_buf) const
{
field_ext__pkt__ta__present.encode_text(text_buf);
field_ext__pkt__ta.encode_text(text_buf);
field_tbf__est.encode_text(text_buf);
}

void UlAckNackGprsAdditionsRel99::decode_text(Text_Buf& text_buf)
{
field_ext__pkt__ta__present.decode_text(text_buf);
field_ext__pkt__ta.decode_text(text_buf);
field_tbf__est.decode_text(text_buf);
}

void UlAckNackGprsAdditionsRel99::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 UlAckNackGprsAdditionsRel99::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 UlAckNackGprsAdditionsRel99::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, UlAckNackGprsAdditionsRel99_ext__pkt__ta__present_descr_.raw->forceomit);
  decoded_field_length = field_ext__pkt__ta__present.RAW_decode(UlAckNackGprsAdditionsRel99_ext__pkt__ta__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_ext__pkt__ta__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(1)) {
    field_ext__pkt__ta = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_1_force_omit(1, force_omit, UlAckNackGprsAdditionsRel99_ext__pkt__ta_descr_.raw->forceomit);
  decoded_field_length = field_ext__pkt__ta().RAW_decode(UlAckNackGprsAdditionsRel99_ext__pkt__ta_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 1) {
  field_ext__pkt__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_ext__pkt__ta=OMIT_VALUE;
  RAW_Force_Omit field_2_force_omit(2, force_omit, UlAckNackGprsAdditionsRel99_tbf__est_descr_.raw->forceomit);
  decoded_field_length = field_tbf__est.RAW_decode(UlAckNackGprsAdditionsRel99_tbf__est_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int UlAckNackGprsAdditionsRel99::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, UlAckNackGprsAdditionsRel99_ext__pkt__ta__present_descr_.raw);
  if (field_ext__pkt__ta.ispresent()) {
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, UlAckNackGprsAdditionsRel99_ext__pkt__ta_descr_.raw);
  }
  else myleaf.body.node.nodes[1] = NULL;
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, UlAckNackGprsAdditionsRel99_tbf__est_descr_.raw);
  encoded_length += field_ext__pkt__ta__present.RAW_encode(UlAckNackGprsAdditionsRel99_ext__pkt__ta__present_descr_, *myleaf.body.node.nodes[0]);
  if (field_ext__pkt__ta.ispresent()) {
  encoded_length += field_ext__pkt__ta().RAW_encode(UlAckNackGprsAdditionsRel99_ext__pkt__ta_descr_, *myleaf.body.node.nodes[1]);
  }
  encoded_length += field_tbf__est.RAW_encode(UlAckNackGprsAdditionsRel99_tbf__est_descr_, *myleaf.body.node.nodes[2]);
  if (field_ext__pkt__ta.ispresent() && (field_ext__pkt__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[]={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(UlAckNackGprsAdditionsRel99_ext__pkt__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);
  }
  }
  return myleaf.length = encoded_length;
}

struct UlAckNackGprsAdditionsRel99_template::single_value_struct {
BITSTRING_template field_ext__pkt__ta__present;
BITSTRING_template field_ext__pkt__ta;
BOOLEAN_template field_tbf__est;
};

void UlAckNackGprsAdditionsRel99_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_ext__pkt__ta__present = ANY_VALUE;
single_value->field_ext__pkt__ta = ANY_OR_OMIT;
single_value->field_tbf__est = ANY_VALUE;
}
}
}

void UlAckNackGprsAdditionsRel99_template::copy_value(const UlAckNackGprsAdditionsRel99& other_value)
{
single_value = new single_value_struct;
if (other_value.ext__pkt__ta__present().is_bound()) {
  single_value->field_ext__pkt__ta__present = other_value.ext__pkt__ta__present();
} else {
  single_value->field_ext__pkt__ta__present.clean_up();
}
if (other_value.ext__pkt__ta().is_bound()) {
  if (other_value.ext__pkt__ta().ispresent()) single_value->field_ext__pkt__ta = other_value.ext__pkt__ta()();
  else single_value->field_ext__pkt__ta = OMIT_VALUE;
} else {
  single_value->field_ext__pkt__ta.clean_up();
}
if (other_value.tbf__est().is_bound()) {
  single_value->field_tbf__est = other_value.tbf__est();
} else {
  single_value->field_tbf__est.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void UlAckNackGprsAdditionsRel99_template::copy_template(const UlAckNackGprsAdditionsRel99_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.ext__pkt__ta__present().get_selection()) {
single_value->field_ext__pkt__ta__present = other_value.ext__pkt__ta__present();
} else {
single_value->field_ext__pkt__ta__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext__pkt__ta().get_selection()) {
single_value->field_ext__pkt__ta = other_value.ext__pkt__ta();
} else {
single_value->field_ext__pkt__ta.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tbf__est().get_selection()) {
single_value->field_tbf__est = other_value.tbf__est();
} else {
single_value->field_tbf__est.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 UlAckNackGprsAdditionsRel99_template[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 UlAckNackGprsAdditionsRel99_template(*other_value.implication_.precondition);
implication_.implied_template = new UlAckNackGprsAdditionsRel99_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.UlAckNackGprsAdditionsRel99.");
break;
}
set_selection(other_value);
}

UlAckNackGprsAdditionsRel99_template::UlAckNackGprsAdditionsRel99_template()
{
}

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

UlAckNackGprsAdditionsRel99_template::UlAckNackGprsAdditionsRel99_template(const UlAckNackGprsAdditionsRel99& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean UlAckNackGprsAdditionsRel99_template::match(const UlAckNackGprsAdditionsRel99& 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.ext__pkt__ta__present().is_bound()) return FALSE;
if(!single_value->field_ext__pkt__ta__present.match(other_value.ext__pkt__ta__present(), legacy))return FALSE;
if(!other_value.ext__pkt__ta().is_bound()) return FALSE;
if((other_value.ext__pkt__ta().ispresent() ? !single_value->field_ext__pkt__ta.match((const BITSTRING&)other_value.ext__pkt__ta(), legacy) : !single_value->field_ext__pkt__ta.match_omit(legacy)))return FALSE;
if(!other_value.tbf__est().is_bound()) return FALSE;
if(!single_value->field_tbf__est.match(other_value.tbf__est(), 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.UlAckNackGprsAdditionsRel99.");
}
return FALSE;
}

boolean UlAckNackGprsAdditionsRel99_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_ext__pkt__ta__present.is_bound()
 || (single_value->field_ext__pkt__ta.is_omit() || single_value->field_ext__pkt__ta.is_bound())
 || single_value->field_tbf__est.is_bound();
}

boolean UlAckNackGprsAdditionsRel99_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_ext__pkt__ta__present.is_value()
 && (single_value->field_ext__pkt__ta.is_omit() || single_value->field_ext__pkt__ta.is_value())
 && single_value->field_tbf__est.is_value();
}

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

UlAckNackGprsAdditionsRel99 UlAckNackGprsAdditionsRel99_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.UlAckNackGprsAdditionsRel99.");
UlAckNackGprsAdditionsRel99 ret_val;
if (single_value->field_ext__pkt__ta__present.is_bound()) {
ret_val.ext__pkt__ta__present() = single_value->field_ext__pkt__ta__present.valueof();
}
if (single_value->field_ext__pkt__ta.is_omit()) ret_val.ext__pkt__ta() = OMIT_VALUE;
else if (single_value->field_ext__pkt__ta.is_bound()) {
ret_val.ext__pkt__ta() = single_value->field_ext__pkt__ta.valueof();
}
if (single_value->field_tbf__est.is_bound()) {
ret_val.tbf__est() = single_value->field_tbf__est.valueof();
}
return ret_val;
}

void UlAckNackGprsAdditionsRel99_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.UlAckNackGprsAdditionsRel99.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new UlAckNackGprsAdditionsRel99_template[list_length];
}

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

BITSTRING_template& UlAckNackGprsAdditionsRel99_template::ext__pkt__ta__present()
{
set_specific();
return single_value->field_ext__pkt__ta__present;
}

const BITSTRING_template& UlAckNackGprsAdditionsRel99_template::ext__pkt__ta__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext_pkt_ta_present of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackGprsAdditionsRel99.");
return single_value->field_ext__pkt__ta__present;
}

BITSTRING_template& UlAckNackGprsAdditionsRel99_template::ext__pkt__ta()
{
set_specific();
return single_value->field_ext__pkt__ta;
}

const BITSTRING_template& UlAckNackGprsAdditionsRel99_template::ext__pkt__ta() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext_pkt_ta of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackGprsAdditionsRel99.");
return single_value->field_ext__pkt__ta;
}

BOOLEAN_template& UlAckNackGprsAdditionsRel99_template::tbf__est()
{
set_specific();
return single_value->field_tbf__est;
}

const BOOLEAN_template& UlAckNackGprsAdditionsRel99_template::tbf__est() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tbf_est of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackGprsAdditionsRel99.");
return single_value->field_tbf__est;
}

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

void UlAckNackGprsAdditionsRel99_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ ext_pkt_ta_present := ");
single_value->field_ext__pkt__ta__present.log();
TTCN_Logger::log_event_str(", ext_pkt_ta := ");
single_value->field_ext__pkt__ta.log();
TTCN_Logger::log_event_str(", tbf_est := ");
single_value->field_tbf__est.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 UlAckNackGprsAdditionsRel99_template::log_match(const UlAckNackGprsAdditionsRel99& 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_ext__pkt__ta__present.match(match_value.ext__pkt__ta__present(), legacy)){
TTCN_Logger::log_logmatch_info(".ext_pkt_ta_present");
single_value->field_ext__pkt__ta__present.log_match(match_value.ext__pkt__ta__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.ext__pkt__ta().ispresent()){
if(!single_value->field_ext__pkt__ta.match(match_value.ext__pkt__ta(), legacy)){
TTCN_Logger::log_logmatch_info(".ext_pkt_ta");
single_value->field_ext__pkt__ta.log_match(match_value.ext__pkt__ta(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_ext__pkt__ta.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".ext_pkt_ta := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_ext__pkt__ta.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_tbf__est.match(match_value.tbf__est(), legacy)){
TTCN_Logger::log_logmatch_info(".tbf_est");
single_value->field_tbf__est.log_match(match_value.tbf__est(), 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("{ ext_pkt_ta_present := ");
single_value->field_ext__pkt__ta__present.log_match(match_value.ext__pkt__ta__present(), legacy);
TTCN_Logger::log_event_str(", ext_pkt_ta := ");
if (match_value.ext__pkt__ta().ispresent()) {
single_value->field_ext__pkt__ta.log_match(match_value.ext__pkt__ta(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_ext__pkt__ta.log();
if (single_value->field_ext__pkt__ta.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", tbf_est := ");
single_value->field_tbf__est.log_match(match_value.tbf__est(), 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 UlAckNackGprsAdditionsRel99_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (ext__pkt__ta__present().is_bound()) ext__pkt__ta__present().set_implicit_omit();
if (!ext__pkt__ta().is_bound()) ext__pkt__ta() = OMIT_VALUE;
else ext__pkt__ta().set_implicit_omit();
if (tbf__est().is_bound()) tbf__est().set_implicit_omit();
}

void UlAckNackGprsAdditionsRel99_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_ext__pkt__ta__present.encode_text(text_buf);
single_value->field_ext__pkt__ta.encode_text(text_buf);
single_value->field_tbf__est.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.UlAckNackGprsAdditionsRel99.");
}
}

void UlAckNackGprsAdditionsRel99_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_ext__pkt__ta__present.decode_text(text_buf);
single_value->field_ext__pkt__ta.decode_text(text_buf);
single_value->field_tbf__est.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 UlAckNackGprsAdditionsRel99_template[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.UlAckNackGprsAdditionsRel99.");
}
}

void UlAckNackGprsAdditionsRel99_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: {
    UlAckNackGprsAdditionsRel99_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.UlAckNackGprsAdditionsRel99 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) ext__pkt__ta__present().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext__pkt__ta().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) tbf__est().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(), "ext_pkt_ta_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext__pkt__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(), "ext_pkt_ta")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext__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(), "tbf_est")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tbf__est().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.UlAckNackGprsAdditionsRel99: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    UlAckNackGprsAdditionsRel99_template* precondition = new UlAckNackGprsAdditionsRel99_template;
    precondition->set_param(*param.get_elem(0));
    UlAckNackGprsAdditionsRel99_template* implied_template = new UlAckNackGprsAdditionsRel99_template;
    implied_template->set_param(*param.get_elem(1));
    *this = UlAckNackGprsAdditionsRel99_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.UlAckNackGprsAdditionsRel99");
  }
  is_ifpresent = param.get_ifpresent();
}

void UlAckNackGprsAdditionsRel99_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_ext__pkt__ta__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackGprsAdditionsRel99");
single_value->field_ext__pkt__ta.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackGprsAdditionsRel99");
single_value->field_tbf__est.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackGprsAdditionsRel99");
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.UlAckNackGprsAdditionsRel99");
}

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

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

AckNackDescription::AckNackDescription()
{
}

AckNackDescription::AckNackDescription(const BITSTRING& par_final__ack,
    const INTEGER& par_starting__seq__nr,
    const BITSTRING& par_receive__block__bitmap)
  :   field_final__ack(par_final__ack),
  field_starting__seq__nr(par_starting__seq__nr),
  field_receive__block__bitmap(par_receive__block__bitmap)
{
}

AckNackDescription::AckNackDescription(const AckNackDescription& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.AckNackDescription.");
if (other_value.final__ack().is_bound()) field_final__ack = other_value.final__ack();
else field_final__ack.clean_up();
if (other_value.starting__seq__nr().is_bound()) field_starting__seq__nr = other_value.starting__seq__nr();
else field_starting__seq__nr.clean_up();
if (other_value.receive__block__bitmap().is_bound()) field_receive__block__bitmap = other_value.receive__block__bitmap();
else field_receive__block__bitmap.clean_up();
}

void AckNackDescription::clean_up()
{
field_final__ack.clean_up();
field_starting__seq__nr.clean_up();
field_receive__block__bitmap.clean_up();
}

const TTCN_Typedescriptor_t* AckNackDescription::get_descriptor() const { return &AckNackDescription_descr_; }
AckNackDescription& AckNackDescription::operator=(const AckNackDescription& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.AckNackDescription.");
  if (other_value.final__ack().is_bound()) field_final__ack = other_value.final__ack();
  else field_final__ack.clean_up();
  if (other_value.starting__seq__nr().is_bound()) field_starting__seq__nr = other_value.starting__seq__nr();
  else field_starting__seq__nr.clean_up();
  if (other_value.receive__block__bitmap().is_bound()) field_receive__block__bitmap = other_value.receive__block__bitmap();
  else field_receive__block__bitmap.clean_up();
}
return *this;
}

boolean AckNackDescription::operator==(const AckNackDescription& other_value) const
{
return field_final__ack==other_value.field_final__ack
  && field_starting__seq__nr==other_value.field_starting__seq__nr
  && field_receive__block__bitmap==other_value.field_receive__block__bitmap;
}

boolean AckNackDescription::is_bound() const
{
return (field_final__ack.is_bound())
  || (field_starting__seq__nr.is_bound())
  || (field_receive__block__bitmap.is_bound());
}
boolean AckNackDescription::is_value() const
{
return field_final__ack.is_value()
  && field_starting__seq__nr.is_value()
  && field_receive__block__bitmap.is_value();
}
void AckNackDescription::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ final_ack := ");
field_final__ack.log();
TTCN_Logger::log_event_str(", starting_seq_nr := ");
field_starting__seq__nr.log();
TTCN_Logger::log_event_str(", receive_block_bitmap := ");
field_receive__block__bitmap.log();
TTCN_Logger::log_event_str(" }");
}

void AckNackDescription::set_implicit_omit()
{
if (final__ack().is_bound()) final__ack().set_implicit_omit();
if (starting__seq__nr().is_bound()) starting__seq__nr().set_implicit_omit();
if (receive__block__bitmap().is_bound()) receive__block__bitmap().set_implicit_omit();
}

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

void AckNackDescription::encode_text(Text_Buf& text_buf) const
{
field_final__ack.encode_text(text_buf);
field_starting__seq__nr.encode_text(text_buf);
field_receive__block__bitmap.encode_text(text_buf);
}

void AckNackDescription::decode_text(Text_Buf& text_buf)
{
field_final__ack.decode_text(text_buf);
field_starting__seq__nr.decode_text(text_buf);
field_receive__block__bitmap.decode_text(text_buf);
}

void AckNackDescription::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 AckNackDescription::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 AckNackDescription::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, AckNackDescription_final__ack_descr_.raw->forceomit);
  decoded_field_length = field_final__ack.RAW_decode(AckNackDescription_final__ack_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, AckNackDescription_starting__seq__nr_descr_.raw->forceomit);
  decoded_field_length = field_starting__seq__nr.RAW_decode(AckNackDescription_starting__seq__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());
  RAW_Force_Omit field_2_force_omit(2, force_omit, AckNackDescription_receive__block__bitmap_descr_.raw->forceomit);
  decoded_field_length = field_receive__block__bitmap.RAW_decode(AckNackDescription_receive__block__bitmap_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int AckNackDescription::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, AckNackDescription_final__ack_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, AckNackDescription_starting__seq__nr_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, AckNackDescription_receive__block__bitmap_descr_.raw);
  encoded_length += field_final__ack.RAW_encode(AckNackDescription_final__ack_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_starting__seq__nr.RAW_encode(AckNackDescription_starting__seq__nr_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_receive__block__bitmap.RAW_encode(AckNackDescription_receive__block__bitmap_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct AckNackDescription_template::single_value_struct {
BITSTRING_template field_final__ack;
INTEGER_template field_starting__seq__nr;
BITSTRING_template field_receive__block__bitmap;
};

void AckNackDescription_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_final__ack = ANY_VALUE;
single_value->field_starting__seq__nr = ANY_VALUE;
single_value->field_receive__block__bitmap = ANY_VALUE;
}
}
}

void AckNackDescription_template::copy_value(const AckNackDescription& other_value)
{
single_value = new single_value_struct;
if (other_value.final__ack().is_bound()) {
  single_value->field_final__ack = other_value.final__ack();
} else {
  single_value->field_final__ack.clean_up();
}
if (other_value.starting__seq__nr().is_bound()) {
  single_value->field_starting__seq__nr = other_value.starting__seq__nr();
} else {
  single_value->field_starting__seq__nr.clean_up();
}
if (other_value.receive__block__bitmap().is_bound()) {
  single_value->field_receive__block__bitmap = other_value.receive__block__bitmap();
} else {
  single_value->field_receive__block__bitmap.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void AckNackDescription_template::copy_template(const AckNackDescription_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.final__ack().get_selection()) {
single_value->field_final__ack = other_value.final__ack();
} else {
single_value->field_final__ack.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.starting__seq__nr().get_selection()) {
single_value->field_starting__seq__nr = other_value.starting__seq__nr();
} else {
single_value->field_starting__seq__nr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.receive__block__bitmap().get_selection()) {
single_value->field_receive__block__bitmap = other_value.receive__block__bitmap();
} else {
single_value->field_receive__block__bitmap.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 AckNackDescription_template[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 AckNackDescription_template(*other_value.implication_.precondition);
implication_.implied_template = new AckNackDescription_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.AckNackDescription.");
break;
}
set_selection(other_value);
}

AckNackDescription_template::AckNackDescription_template()
{
}

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

AckNackDescription_template::AckNackDescription_template(const AckNackDescription& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean AckNackDescription_template::match(const AckNackDescription& 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.final__ack().is_bound()) return FALSE;
if(!single_value->field_final__ack.match(other_value.final__ack(), legacy))return FALSE;
if(!other_value.starting__seq__nr().is_bound()) return FALSE;
if(!single_value->field_starting__seq__nr.match(other_value.starting__seq__nr(), legacy))return FALSE;
if(!other_value.receive__block__bitmap().is_bound()) return FALSE;
if(!single_value->field_receive__block__bitmap.match(other_value.receive__block__bitmap(), 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.AckNackDescription.");
}
return FALSE;
}

boolean AckNackDescription_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_final__ack.is_bound()
 || single_value->field_starting__seq__nr.is_bound()
 || single_value->field_receive__block__bitmap.is_bound();
}

boolean AckNackDescription_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_final__ack.is_value()
 && single_value->field_starting__seq__nr.is_value()
 && single_value->field_receive__block__bitmap.is_value();
}

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

AckNackDescription AckNackDescription_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.AckNackDescription.");
AckNackDescription ret_val;
if (single_value->field_final__ack.is_bound()) {
ret_val.final__ack() = single_value->field_final__ack.valueof();
}
if (single_value->field_starting__seq__nr.is_bound()) {
ret_val.starting__seq__nr() = single_value->field_starting__seq__nr.valueof();
}
if (single_value->field_receive__block__bitmap.is_bound()) {
ret_val.receive__block__bitmap() = single_value->field_receive__block__bitmap.valueof();
}
return ret_val;
}

void AckNackDescription_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.AckNackDescription.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new AckNackDescription_template[list_length];
}

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

BITSTRING_template& AckNackDescription_template::final__ack()
{
set_specific();
return single_value->field_final__ack;
}

const BITSTRING_template& AckNackDescription_template::final__ack() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field final_ack of a non-specific template of type @RLCMAC_CSN1_Types.AckNackDescription.");
return single_value->field_final__ack;
}

INTEGER_template& AckNackDescription_template::starting__seq__nr()
{
set_specific();
return single_value->field_starting__seq__nr;
}

const INTEGER_template& AckNackDescription_template::starting__seq__nr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field starting_seq_nr of a non-specific template of type @RLCMAC_CSN1_Types.AckNackDescription.");
return single_value->field_starting__seq__nr;
}

BITSTRING_template& AckNackDescription_template::receive__block__bitmap()
{
set_specific();
return single_value->field_receive__block__bitmap;
}

const BITSTRING_template& AckNackDescription_template::receive__block__bitmap() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field receive_block_bitmap of a non-specific template of type @RLCMAC_CSN1_Types.AckNackDescription.");
return single_value->field_receive__block__bitmap;
}

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

void AckNackDescription_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ final_ack := ");
single_value->field_final__ack.log();
TTCN_Logger::log_event_str(", starting_seq_nr := ");
single_value->field_starting__seq__nr.log();
TTCN_Logger::log_event_str(", receive_block_bitmap := ");
single_value->field_receive__block__bitmap.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 AckNackDescription_template::log_match(const AckNackDescription& 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_final__ack.match(match_value.final__ack(), legacy)){
TTCN_Logger::log_logmatch_info(".final_ack");
single_value->field_final__ack.log_match(match_value.final__ack(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_starting__seq__nr.match(match_value.starting__seq__nr(), legacy)){
TTCN_Logger::log_logmatch_info(".starting_seq_nr");
single_value->field_starting__seq__nr.log_match(match_value.starting__seq__nr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_receive__block__bitmap.match(match_value.receive__block__bitmap(), legacy)){
TTCN_Logger::log_logmatch_info(".receive_block_bitmap");
single_value->field_receive__block__bitmap.log_match(match_value.receive__block__bitmap(), 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("{ final_ack := ");
single_value->field_final__ack.log_match(match_value.final__ack(), legacy);
TTCN_Logger::log_event_str(", starting_seq_nr := ");
single_value->field_starting__seq__nr.log_match(match_value.starting__seq__nr(), legacy);
TTCN_Logger::log_event_str(", receive_block_bitmap := ");
single_value->field_receive__block__bitmap.log_match(match_value.receive__block__bitmap(), 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 AckNackDescription_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (final__ack().is_bound()) final__ack().set_implicit_omit();
if (starting__seq__nr().is_bound()) starting__seq__nr().set_implicit_omit();
if (receive__block__bitmap().is_bound()) receive__block__bitmap().set_implicit_omit();
}

void AckNackDescription_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_final__ack.encode_text(text_buf);
single_value->field_starting__seq__nr.encode_text(text_buf);
single_value->field_receive__block__bitmap.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.AckNackDescription.");
}
}

void AckNackDescription_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_final__ack.decode_text(text_buf);
single_value->field_starting__seq__nr.decode_text(text_buf);
single_value->field_receive__block__bitmap.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 AckNackDescription_template[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.AckNackDescription.");
}
}

void AckNackDescription_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: {
    AckNackDescription_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.AckNackDescription 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) final__ack().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) starting__seq__nr().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) receive__block__bitmap().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(), "final_ack")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          final__ack().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "starting_seq_nr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          starting__seq__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(), "receive_block_bitmap")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          receive__block__bitmap().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.AckNackDescription: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    AckNackDescription_template* precondition = new AckNackDescription_template;
    precondition->set_param(*param.get_elem(0));
    AckNackDescription_template* implied_template = new AckNackDescription_template;
    implied_template->set_param(*param.get_elem(1));
    *this = AckNackDescription_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.AckNackDescription");
  }
  is_ifpresent = param.get_ifpresent();
}

void AckNackDescription_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_final__ack.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.AckNackDescription");
single_value->field_starting__seq__nr.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.AckNackDescription");
single_value->field_receive__block__bitmap.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.AckNackDescription");
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.AckNackDescription");
}

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

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

UlAckNackGprs::UlAckNackGprs()
{
}

UlAckNackGprs::UlAckNackGprs(const ChCodingCommand& par_ch__coding__cmd,
    const AckNackDescription& par_ack__nack__desc,
    const BITSTRING& par_cont__res__tlli__present,
    const OPTIONAL< OCTETSTRING >& par_cont__res__tlli,
    const BITSTRING& par_pkt__ta__present,
    const OPTIONAL< PacketTimingAdvance >& par_pkt__ta,
    const BITSTRING& par_pwr__ctrl__present,
    const OPTIONAL< PowerControlParameters >& par_pwr__ctrl,
    const BITSTRING& par_extension__bits__present,
    const OPTIONAL< ExtensionBits >& par_extension__bits,
    const BITSTRING& par_not__used,
    const BITSTRING& par_rel99__present,
    const OPTIONAL< UlAckNackGprsAdditionsRel99 >& par_rel99)
  :   field_ch__coding__cmd(par_ch__coding__cmd),
  field_ack__nack__desc(par_ack__nack__desc),
  field_cont__res__tlli__present(par_cont__res__tlli__present),
  field_cont__res__tlli(par_cont__res__tlli),
  field_pkt__ta__present(par_pkt__ta__present),
  field_pkt__ta(par_pkt__ta),
  field_pwr__ctrl__present(par_pwr__ctrl__present),
  field_pwr__ctrl(par_pwr__ctrl),
  field_extension__bits__present(par_extension__bits__present),
  field_extension__bits(par_extension__bits),
  field_not__used(par_not__used),
  field_rel99__present(par_rel99__present),
  field_rel99(par_rel99)
{
}

UlAckNackGprs::UlAckNackGprs(const UlAckNackGprs& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.UlAckNackGprs.");
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.ack__nack__desc().is_bound()) field_ack__nack__desc = other_value.ack__nack__desc();
else field_ack__nack__desc.clean_up();
if (other_value.cont__res__tlli__present().is_bound()) field_cont__res__tlli__present = other_value.cont__res__tlli__present();
else field_cont__res__tlli__present.clean_up();
if (other_value.cont__res__tlli().is_bound()) field_cont__res__tlli = other_value.cont__res__tlli();
else field_cont__res__tlli.clean_up();
if (other_value.pkt__ta__present().is_bound()) field_pkt__ta__present = other_value.pkt__ta__present();
else field_pkt__ta__present.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.pwr__ctrl__present().is_bound()) field_pwr__ctrl__present = other_value.pwr__ctrl__present();
else field_pwr__ctrl__present.clean_up();
if (other_value.pwr__ctrl().is_bound()) field_pwr__ctrl = other_value.pwr__ctrl();
else field_pwr__ctrl.clean_up();
if (other_value.extension__bits__present().is_bound()) field_extension__bits__present = other_value.extension__bits__present();
else field_extension__bits__present.clean_up();
if (other_value.extension__bits().is_bound()) field_extension__bits = other_value.extension__bits();
else field_extension__bits.clean_up();
if (other_value.not__used().is_bound()) field_not__used = other_value.not__used();
else field_not__used.clean_up();
if (other_value.rel99__present().is_bound()) field_rel99__present = other_value.rel99__present();
else field_rel99__present.clean_up();
if (other_value.rel99().is_bound()) field_rel99 = other_value.rel99();
else field_rel99.clean_up();
}

void UlAckNackGprs::clean_up()
{
field_ch__coding__cmd.clean_up();
field_ack__nack__desc.clean_up();
field_cont__res__tlli__present.clean_up();
field_cont__res__tlli.clean_up();
field_pkt__ta__present.clean_up();
field_pkt__ta.clean_up();
field_pwr__ctrl__present.clean_up();
field_pwr__ctrl.clean_up();
field_extension__bits__present.clean_up();
field_extension__bits.clean_up();
field_not__used.clean_up();
field_rel99__present.clean_up();
field_rel99.clean_up();
}

const TTCN_Typedescriptor_t* UlAckNackGprs::get_descriptor() const { return &UlAckNackGprs_descr_; }
UlAckNackGprs& UlAckNackGprs::operator=(const UlAckNackGprs& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.UlAckNackGprs.");
  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.ack__nack__desc().is_bound()) field_ack__nack__desc = other_value.ack__nack__desc();
  else field_ack__nack__desc.clean_up();
  if (other_value.cont__res__tlli__present().is_bound()) field_cont__res__tlli__present = other_value.cont__res__tlli__present();
  else field_cont__res__tlli__present.clean_up();
  if (other_value.cont__res__tlli().is_bound()) field_cont__res__tlli = other_value.cont__res__tlli();
  else field_cont__res__tlli.clean_up();
  if (other_value.pkt__ta__present().is_bound()) field_pkt__ta__present = other_value.pkt__ta__present();
  else field_pkt__ta__present.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.pwr__ctrl__present().is_bound()) field_pwr__ctrl__present = other_value.pwr__ctrl__present();
  else field_pwr__ctrl__present.clean_up();
  if (other_value.pwr__ctrl().is_bound()) field_pwr__ctrl = other_value.pwr__ctrl();
  else field_pwr__ctrl.clean_up();
  if (other_value.extension__bits__present().is_bound()) field_extension__bits__present = other_value.extension__bits__present();
  else field_extension__bits__present.clean_up();
  if (other_value.extension__bits().is_bound()) field_extension__bits = other_value.extension__bits();
  else field_extension__bits.clean_up();
  if (other_value.not__used().is_bound()) field_not__used = other_value.not__used();
  else field_not__used.clean_up();
  if (other_value.rel99__present().is_bound()) field_rel99__present = other_value.rel99__present();
  else field_rel99__present.clean_up();
  if (other_value.rel99().is_bound()) field_rel99 = other_value.rel99();
  else field_rel99.clean_up();
}
return *this;
}

boolean UlAckNackGprs::operator==(const UlAckNackGprs& other_value) const
{
return field_ch__coding__cmd==other_value.field_ch__coding__cmd
  && field_ack__nack__desc==other_value.field_ack__nack__desc
  && field_cont__res__tlli__present==other_value.field_cont__res__tlli__present
  && field_cont__res__tlli==other_value.field_cont__res__tlli
  && field_pkt__ta__present==other_value.field_pkt__ta__present
  && field_pkt__ta==other_value.field_pkt__ta
  && field_pwr__ctrl__present==other_value.field_pwr__ctrl__present
  && field_pwr__ctrl==other_value.field_pwr__ctrl
  && field_extension__bits__present==other_value.field_extension__bits__present
  && field_extension__bits==other_value.field_extension__bits
  && field_not__used==other_value.field_not__used
  && field_rel99__present==other_value.field_rel99__present
  && field_rel99==other_value.field_rel99;
}

boolean UlAckNackGprs::is_bound() const
{
return (field_ch__coding__cmd.is_bound())
  || (field_ack__nack__desc.is_bound())
  || (field_cont__res__tlli__present.is_bound())
  || (OPTIONAL_OMIT == field_cont__res__tlli.get_selection() || field_cont__res__tlli.is_bound())
  || (field_pkt__ta__present.is_bound())
  || (OPTIONAL_OMIT == field_pkt__ta.get_selection() || field_pkt__ta.is_bound())
  || (field_pwr__ctrl__present.is_bound())
  || (OPTIONAL_OMIT == field_pwr__ctrl.get_selection() || field_pwr__ctrl.is_bound())
  || (field_extension__bits__present.is_bound())
  || (OPTIONAL_OMIT == field_extension__bits.get_selection() || field_extension__bits.is_bound())
  || (field_not__used.is_bound())
  || (field_rel99__present.is_bound())
  || (OPTIONAL_OMIT == field_rel99.get_selection() || field_rel99.is_bound());
}
boolean UlAckNackGprs::is_value() const
{
return field_ch__coding__cmd.is_value()
  && field_ack__nack__desc.is_value()
  && field_cont__res__tlli__present.is_value()
  && (OPTIONAL_OMIT == field_cont__res__tlli.get_selection() || field_cont__res__tlli.is_value())
  && field_pkt__ta__present.is_value()
  && (OPTIONAL_OMIT == field_pkt__ta.get_selection() || field_pkt__ta.is_value())
  && field_pwr__ctrl__present.is_value()
  && (OPTIONAL_OMIT == field_pwr__ctrl.get_selection() || field_pwr__ctrl.is_value())
  && field_extension__bits__present.is_value()
  && (OPTIONAL_OMIT == field_extension__bits.get_selection() || field_extension__bits.is_value())
  && field_not__used.is_value()
  && field_rel99__present.is_value()
  && (OPTIONAL_OMIT == field_rel99.get_selection() || field_rel99.is_value());
}
int UlAckNackGprs::size_of() const
{
  int ret_val = 8;
  if (field_cont__res__tlli.ispresent()) ret_val++;
  if (field_pkt__ta.ispresent()) ret_val++;
  if (field_pwr__ctrl.ispresent()) ret_val++;
  if (field_extension__bits.ispresent()) ret_val++;
  if (field_rel99.ispresent()) ret_val++;
  return ret_val;
}

void UlAckNackGprs::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(", ack_nack_desc := ");
field_ack__nack__desc.log();
TTCN_Logger::log_event_str(", cont_res_tlli_present := ");
field_cont__res__tlli__present.log();
TTCN_Logger::log_event_str(", cont_res_tlli := ");
field_cont__res__tlli.log();
TTCN_Logger::log_event_str(", pkt_ta_present := ");
field_pkt__ta__present.log();
TTCN_Logger::log_event_str(", pkt_ta := ");
field_pkt__ta.log();
TTCN_Logger::log_event_str(", pwr_ctrl_present := ");
field_pwr__ctrl__present.log();
TTCN_Logger::log_event_str(", pwr_ctrl := ");
field_pwr__ctrl.log();
TTCN_Logger::log_event_str(", extension_bits_present := ");
field_extension__bits__present.log();
TTCN_Logger::log_event_str(", extension_bits := ");
field_extension__bits.log();
TTCN_Logger::log_event_str(", not_used := ");
field_not__used.log();
TTCN_Logger::log_event_str(", rel99_present := ");
field_rel99__present.log();
TTCN_Logger::log_event_str(", rel99 := ");
field_rel99.log();
TTCN_Logger::log_event_str(" }");
}

void UlAckNackGprs::set_implicit_omit()
{
if (ch__coding__cmd().is_bound()) ch__coding__cmd().set_implicit_omit();
if (ack__nack__desc().is_bound()) ack__nack__desc().set_implicit_omit();
if (cont__res__tlli__present().is_bound()) cont__res__tlli__present().set_implicit_omit();
if (!cont__res__tlli().is_bound()) cont__res__tlli() = OMIT_VALUE;
else cont__res__tlli().set_implicit_omit();
if (pkt__ta__present().is_bound()) pkt__ta__present().set_implicit_omit();
if (!pkt__ta().is_bound()) pkt__ta() = OMIT_VALUE;
else pkt__ta().set_implicit_omit();
if (pwr__ctrl__present().is_bound()) pwr__ctrl__present().set_implicit_omit();
if (!pwr__ctrl().is_bound()) pwr__ctrl() = OMIT_VALUE;
else pwr__ctrl().set_implicit_omit();
if (extension__bits__present().is_bound()) extension__bits__present().set_implicit_omit();
if (!extension__bits().is_bound()) extension__bits() = OMIT_VALUE;
else extension__bits().set_implicit_omit();
if (not__used().is_bound()) not__used().set_implicit_omit();
if (rel99__present().is_bound()) rel99__present().set_implicit_omit();
if (!rel99().is_bound()) rel99() = OMIT_VALUE;
else rel99().set_implicit_omit();
}

void UlAckNackGprs::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 (13<param.get_size()) {
      param.error("record value of type @RLCMAC_CSN1_Types.UlAckNackGprs has 13 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) ack__nack__desc().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) cont__res__tlli__present().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) cont__res__tlli().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) pkt__ta__present().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) pkt__ta().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) pwr__ctrl__present().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) pwr__ctrl().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) extension__bits__present().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) extension__bits().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) not__used().set_param(*param.get_elem(10));
    if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) rel99__present().set_param(*param.get_elem(11));
    if (param.get_size()>12 && param.get_elem(12)->get_type()!=Module_Param::MP_NotUsed) rel99().set_param(*param.get_elem(12));
    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(), "ack_nack_desc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ack__nack__desc().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cont_res_tlli_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cont__res__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(), "cont_res_tlli")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cont__res__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(), "pkt_ta_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pkt__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_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(), "pwr_ctrl_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pwr__ctrl__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(), "pwr_ctrl")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pwr__ctrl().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "extension_bits_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          extension__bits__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(), "extension_bits")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          extension__bits().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "not_used")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          not__used().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rel99_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rel99__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(), "rel99")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rel99().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.UlAckNackGprs: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.UlAckNackGprs");
  }
}

void UlAckNackGprs::encode_text(Text_Buf& text_buf) const
{
field_ch__coding__cmd.encode_text(text_buf);
field_ack__nack__desc.encode_text(text_buf);
field_cont__res__tlli__present.encode_text(text_buf);
field_cont__res__tlli.encode_text(text_buf);
field_pkt__ta__present.encode_text(text_buf);
field_pkt__ta.encode_text(text_buf);
field_pwr__ctrl__present.encode_text(text_buf);
field_pwr__ctrl.encode_text(text_buf);
field_extension__bits__present.encode_text(text_buf);
field_extension__bits.encode_text(text_buf);
field_not__used.encode_text(text_buf);
field_rel99__present.encode_text(text_buf);
field_rel99.encode_text(text_buf);
}

void UlAckNackGprs::decode_text(Text_Buf& text_buf)
{
field_ch__coding__cmd.decode_text(text_buf);
field_ack__nack__desc.decode_text(text_buf);
field_cont__res__tlli__present.decode_text(text_buf);
field_cont__res__tlli.decode_text(text_buf);
field_pkt__ta__present.decode_text(text_buf);
field_pkt__ta.decode_text(text_buf);
field_pwr__ctrl__present.decode_text(text_buf);
field_pwr__ctrl.decode_text(text_buf);
field_extension__bits__present.decode_text(text_buf);
field_extension__bits.decode_text(text_buf);
field_not__used.decode_text(text_buf);
field_rel99__present.decode_text(text_buf);
field_rel99.decode_text(text_buf);
}

void UlAckNackGprs::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 UlAckNackGprs::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 UlAckNackGprs::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, UlAckNackGprs_ch__coding__cmd_descr_.raw->forceomit);
  decoded_field_length = field_ch__coding__cmd.RAW_decode(UlAckNackGprs_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, UlAckNackGprs_ack__nack__desc_descr_.raw->forceomit);
  decoded_field_length = field_ack__nack__desc.RAW_decode(UlAckNackGprs_ack__nack__desc_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, UlAckNackGprs_cont__res__tlli__present_descr_.raw->forceomit);
  decoded_field_length = field_cont__res__tlli__present.RAW_decode(UlAckNackGprs_cont__res__tlli__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_cont__res__tlli__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(3)) {
    field_cont__res__tlli = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_3_force_omit(3, force_omit, UlAckNackGprs_cont__res__tlli_descr_.raw->forceomit);
  decoded_field_length = field_cont__res__tlli().RAW_decode(UlAckNackGprs_cont__res__tlli_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 1) {
  field_cont__res__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_cont__res__tlli=OMIT_VALUE;
  RAW_Force_Omit field_4_force_omit(4, force_omit, UlAckNackGprs_pkt__ta__present_descr_.raw->forceomit);
  decoded_field_length = field_pkt__ta__present.RAW_decode(UlAckNackGprs_pkt__ta__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_pkt__ta__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(5)) {
    field_pkt__ta = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_5_force_omit(5, force_omit, UlAckNackGprs_pkt__ta_descr_.raw->forceomit);
  decoded_field_length = field_pkt__ta().RAW_decode(UlAckNackGprs_pkt__ta_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 1) {
  field_pkt__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__ta=OMIT_VALUE;
  RAW_Force_Omit field_6_force_omit(6, force_omit, UlAckNackGprs_pwr__ctrl__present_descr_.raw->forceomit);
  decoded_field_length = field_pwr__ctrl__present.RAW_decode(UlAckNackGprs_pwr__ctrl__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());
  if (limit > 0 && field_pwr__ctrl__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(7)) {
    field_pwr__ctrl = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_7_force_omit(7, force_omit, UlAckNackGprs_pwr__ctrl_descr_.raw->forceomit);
  decoded_field_length = field_pwr__ctrl().RAW_decode(UlAckNackGprs_pwr__ctrl_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_7_force_omit);
  if (decoded_field_length < 1) {
  field_pwr__ctrl = 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_pwr__ctrl=OMIT_VALUE;
  RAW_Force_Omit field_8_force_omit(8, force_omit, UlAckNackGprs_extension__bits__present_descr_.raw->forceomit);
  decoded_field_length = field_extension__bits__present.RAW_decode(UlAckNackGprs_extension__bits__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_extension__bits__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(9)) {
    field_extension__bits = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_9_force_omit(9, force_omit, UlAckNackGprs_extension__bits_descr_.raw->forceomit);
  decoded_field_length = field_extension__bits().RAW_decode(UlAckNackGprs_extension__bits_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_9_force_omit);
  if (decoded_field_length < 1) {
  field_extension__bits = 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_extension__bits=OMIT_VALUE;
  RAW_Force_Omit field_10_force_omit(10, force_omit, UlAckNackGprs_not__used_descr_.raw->forceomit);
  decoded_field_length = field_not__used.RAW_decode(UlAckNackGprs_not__used_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, UlAckNackGprs_rel99__present_descr_.raw->forceomit);
  decoded_field_length = field_rel99__present.RAW_decode(UlAckNackGprs_rel99__present_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());
  if (limit > 0 && field_rel99__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(12)) {
    field_rel99 = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_12_force_omit(12, force_omit, UlAckNackGprs_rel99_descr_.raw->forceomit);
  decoded_field_length = field_rel99().RAW_decode(UlAckNackGprs_rel99_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_12_force_omit);
  if (decoded_field_length < 1) {
  field_rel99 = 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_rel99=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int UlAckNackGprs::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 = 13;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(13);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, UlAckNackGprs_ch__coding__cmd_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, UlAckNackGprs_ack__nack__desc_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, UlAckNackGprs_cont__res__tlli__present_descr_.raw);
  if (field_cont__res__tlli.ispresent()) {
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, UlAckNackGprs_cont__res__tlli_descr_.raw);
  }
  else myleaf.body.node.nodes[3] = NULL;
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, UlAckNackGprs_pkt__ta__present_descr_.raw);
  if (field_pkt__ta.ispresent()) {
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, UlAckNackGprs_pkt__ta_descr_.raw);
  }
  else myleaf.body.node.nodes[5] = NULL;
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, UlAckNackGprs_pwr__ctrl__present_descr_.raw);
  if (field_pwr__ctrl.ispresent()) {
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, UlAckNackGprs_pwr__ctrl_descr_.raw);
  }
  else myleaf.body.node.nodes[7] = NULL;
  myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, UlAckNackGprs_extension__bits__present_descr_.raw);
  if (field_extension__bits.ispresent()) {
  myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, UlAckNackGprs_extension__bits_descr_.raw);
  }
  else myleaf.body.node.nodes[9] = NULL;
  myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 10, UlAckNackGprs_not__used_descr_.raw);
  myleaf.body.node.nodes[11] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 11, UlAckNackGprs_rel99__present_descr_.raw);
  if (field_rel99.ispresent()) {
  myleaf.body.node.nodes[12] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 12, UlAckNackGprs_rel99_descr_.raw);
  }
  else myleaf.body.node.nodes[12] = NULL;
  encoded_length += field_ch__coding__cmd.RAW_encode(UlAckNackGprs_ch__coding__cmd_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ack__nack__desc.RAW_encode(UlAckNackGprs_ack__nack__desc_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_cont__res__tlli__present.RAW_encode(UlAckNackGprs_cont__res__tlli__present_descr_, *myleaf.body.node.nodes[2]);
  if (field_cont__res__tlli.ispresent()) {
  encoded_length += field_cont__res__tlli().RAW_encode(UlAckNackGprs_cont__res__tlli_descr_, *myleaf.body.node.nodes[3]);
  }
  encoded_length += field_pkt__ta__present.RAW_encode(UlAckNackGprs_pkt__ta__present_descr_, *myleaf.body.node.nodes[4]);
  if (field_pkt__ta.ispresent()) {
  encoded_length += field_pkt__ta().RAW_encode(UlAckNackGprs_pkt__ta_descr_, *myleaf.body.node.nodes[5]);
  }
  encoded_length += field_pwr__ctrl__present.RAW_encode(UlAckNackGprs_pwr__ctrl__present_descr_, *myleaf.body.node.nodes[6]);
  if (field_pwr__ctrl.ispresent()) {
  encoded_length += field_pwr__ctrl().RAW_encode(UlAckNackGprs_pwr__ctrl_descr_, *myleaf.body.node.nodes[7]);
  }
  encoded_length += field_extension__bits__present.RAW_encode(UlAckNackGprs_extension__bits__present_descr_, *myleaf.body.node.nodes[8]);
  if (field_extension__bits.ispresent()) {
  encoded_length += field_extension__bits().RAW_encode(UlAckNackGprs_extension__bits_descr_, *myleaf.body.node.nodes[9]);
  }
  encoded_length += field_not__used.RAW_encode(UlAckNackGprs_not__used_descr_, *myleaf.body.node.nodes[10]);
  encoded_length += field_rel99__present.RAW_encode(UlAckNackGprs_rel99__present_descr_, *myleaf.body.node.nodes[11]);
  if (field_rel99.ispresent()) {
  encoded_length += field_rel99().RAW_encode(UlAckNackGprs_rel99_descr_, *myleaf.body.node.nodes[12]);
  }
  if (field_cont__res__tlli.ispresent() && (field_cont__res__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[]={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(UlAckNackGprs_cont__res__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_pkt__ta.ispresent() && (field_pkt__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[]={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(UlAckNackGprs_pkt__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_pwr__ctrl.ispresent() && (field_pwr__ctrl__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[]={6};
  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(UlAckNackGprs_pwr__ctrl__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_extension__bits.ispresent() && (field_extension__bits__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(UlAckNackGprs_extension__bits__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_rel99.ispresent() && (field_rel99__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[]={11};
  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(UlAckNackGprs_rel99__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 UlAckNackGprs_template::single_value_struct {
ChCodingCommand_template field_ch__coding__cmd;
AckNackDescription_template field_ack__nack__desc;
BITSTRING_template field_cont__res__tlli__present;
OCTETSTRING_template field_cont__res__tlli;
BITSTRING_template field_pkt__ta__present;
PacketTimingAdvance_template field_pkt__ta;
BITSTRING_template field_pwr__ctrl__present;
PowerControlParameters_template field_pwr__ctrl;
BITSTRING_template field_extension__bits__present;
ExtensionBits_template field_extension__bits;
BITSTRING_template field_not__used;
BITSTRING_template field_rel99__present;
UlAckNackGprsAdditionsRel99_template field_rel99;
};

void UlAckNackGprs_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_ack__nack__desc = ANY_VALUE;
single_value->field_cont__res__tlli__present = ANY_VALUE;
single_value->field_cont__res__tlli = ANY_OR_OMIT;
single_value->field_pkt__ta__present = ANY_VALUE;
single_value->field_pkt__ta = ANY_OR_OMIT;
single_value->field_pwr__ctrl__present = ANY_VALUE;
single_value->field_pwr__ctrl = ANY_OR_OMIT;
single_value->field_extension__bits__present = ANY_VALUE;
single_value->field_extension__bits = ANY_OR_OMIT;
single_value->field_not__used = ANY_VALUE;
single_value->field_rel99__present = ANY_VALUE;
single_value->field_rel99 = ANY_OR_OMIT;
}
}
}

void UlAckNackGprs_template::copy_value(const UlAckNackGprs& 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.ack__nack__desc().is_bound()) {
  single_value->field_ack__nack__desc = other_value.ack__nack__desc();
} else {
  single_value->field_ack__nack__desc.clean_up();
}
if (other_value.cont__res__tlli__present().is_bound()) {
  single_value->field_cont__res__tlli__present = other_value.cont__res__tlli__present();
} else {
  single_value->field_cont__res__tlli__present.clean_up();
}
if (other_value.cont__res__tlli().is_bound()) {
  if (other_value.cont__res__tlli().ispresent()) single_value->field_cont__res__tlli = other_value.cont__res__tlli()();
  else single_value->field_cont__res__tlli = OMIT_VALUE;
} else {
  single_value->field_cont__res__tlli.clean_up();
}
if (other_value.pkt__ta__present().is_bound()) {
  single_value->field_pkt__ta__present = other_value.pkt__ta__present();
} else {
  single_value->field_pkt__ta__present.clean_up();
}
if (other_value.pkt__ta().is_bound()) {
  if (other_value.pkt__ta().ispresent()) single_value->field_pkt__ta = other_value.pkt__ta()();
  else single_value->field_pkt__ta = OMIT_VALUE;
} else {
  single_value->field_pkt__ta.clean_up();
}
if (other_value.pwr__ctrl__present().is_bound()) {
  single_value->field_pwr__ctrl__present = other_value.pwr__ctrl__present();
} else {
  single_value->field_pwr__ctrl__present.clean_up();
}
if (other_value.pwr__ctrl().is_bound()) {
  if (other_value.pwr__ctrl().ispresent()) single_value->field_pwr__ctrl = other_value.pwr__ctrl()();
  else single_value->field_pwr__ctrl = OMIT_VALUE;
} else {
  single_value->field_pwr__ctrl.clean_up();
}
if (other_value.extension__bits__present().is_bound()) {
  single_value->field_extension__bits__present = other_value.extension__bits__present();
} else {
  single_value->field_extension__bits__present.clean_up();
}
if (other_value.extension__bits().is_bound()) {
  if (other_value.extension__bits().ispresent()) single_value->field_extension__bits = other_value.extension__bits()();
  else single_value->field_extension__bits = OMIT_VALUE;
} else {
  single_value->field_extension__bits.clean_up();
}
if (other_value.not__used().is_bound()) {
  single_value->field_not__used = other_value.not__used();
} else {
  single_value->field_not__used.clean_up();
}
if (other_value.rel99__present().is_bound()) {
  single_value->field_rel99__present = other_value.rel99__present();
} else {
  single_value->field_rel99__present.clean_up();
}
if (other_value.rel99().is_bound()) {
  if (other_value.rel99().ispresent()) single_value->field_rel99 = other_value.rel99()();
  else single_value->field_rel99 = OMIT_VALUE;
} else {
  single_value->field_rel99.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void UlAckNackGprs_template::copy_template(const UlAckNackGprs_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.ack__nack__desc().get_selection()) {
single_value->field_ack__nack__desc = other_value.ack__nack__desc();
} else {
single_value->field_ack__nack__desc.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.cont__res__tlli__present().get_selection()) {
single_value->field_cont__res__tlli__present = other_value.cont__res__tlli__present();
} else {
single_value->field_cont__res__tlli__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.cont__res__tlli().get_selection()) {
single_value->field_cont__res__tlli = other_value.cont__res__tlli();
} else {
single_value->field_cont__res__tlli.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pkt__ta__present().get_selection()) {
single_value->field_pkt__ta__present = other_value.pkt__ta__present();
} else {
single_value->field_pkt__ta__present.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.pwr__ctrl__present().get_selection()) {
single_value->field_pwr__ctrl__present = other_value.pwr__ctrl__present();
} else {
single_value->field_pwr__ctrl__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pwr__ctrl().get_selection()) {
single_value->field_pwr__ctrl = other_value.pwr__ctrl();
} else {
single_value->field_pwr__ctrl.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.extension__bits__present().get_selection()) {
single_value->field_extension__bits__present = other_value.extension__bits__present();
} else {
single_value->field_extension__bits__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.extension__bits().get_selection()) {
single_value->field_extension__bits = other_value.extension__bits();
} else {
single_value->field_extension__bits.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.not__used().get_selection()) {
single_value->field_not__used = other_value.not__used();
} else {
single_value->field_not__used.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rel99__present().get_selection()) {
single_value->field_rel99__present = other_value.rel99__present();
} else {
single_value->field_rel99__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rel99().get_selection()) {
single_value->field_rel99 = other_value.rel99();
} else {
single_value->field_rel99.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 UlAckNackGprs_template[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 UlAckNackGprs_template(*other_value.implication_.precondition);
implication_.implied_template = new UlAckNackGprs_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.UlAckNackGprs.");
break;
}
set_selection(other_value);
}

UlAckNackGprs_template::UlAckNackGprs_template()
{
}

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

UlAckNackGprs_template::UlAckNackGprs_template(const UlAckNackGprs& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean UlAckNackGprs_template::match(const UlAckNackGprs& 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.ack__nack__desc().is_bound()) return FALSE;
if(!single_value->field_ack__nack__desc.match(other_value.ack__nack__desc(), legacy))return FALSE;
if(!other_value.cont__res__tlli__present().is_bound()) return FALSE;
if(!single_value->field_cont__res__tlli__present.match(other_value.cont__res__tlli__present(), legacy))return FALSE;
if(!other_value.cont__res__tlli().is_bound()) return FALSE;
if((other_value.cont__res__tlli().ispresent() ? !single_value->field_cont__res__tlli.match((const OCTETSTRING&)other_value.cont__res__tlli(), legacy) : !single_value->field_cont__res__tlli.match_omit(legacy)))return FALSE;
if(!other_value.pkt__ta__present().is_bound()) return FALSE;
if(!single_value->field_pkt__ta__present.match(other_value.pkt__ta__present(), legacy))return FALSE;
if(!other_value.pkt__ta().is_bound()) return FALSE;
if((other_value.pkt__ta().ispresent() ? !single_value->field_pkt__ta.match((const PacketTimingAdvance&)other_value.pkt__ta(), legacy) : !single_value->field_pkt__ta.match_omit(legacy)))return FALSE;
if(!other_value.pwr__ctrl__present().is_bound()) return FALSE;
if(!single_value->field_pwr__ctrl__present.match(other_value.pwr__ctrl__present(), legacy))return FALSE;
if(!other_value.pwr__ctrl().is_bound()) return FALSE;
if((other_value.pwr__ctrl().ispresent() ? !single_value->field_pwr__ctrl.match((const PowerControlParameters&)other_value.pwr__ctrl(), legacy) : !single_value->field_pwr__ctrl.match_omit(legacy)))return FALSE;
if(!other_value.extension__bits__present().is_bound()) return FALSE;
if(!single_value->field_extension__bits__present.match(other_value.extension__bits__present(), legacy))return FALSE;
if(!other_value.extension__bits().is_bound()) return FALSE;
if((other_value.extension__bits().ispresent() ? !single_value->field_extension__bits.match((const ExtensionBits&)other_value.extension__bits(), legacy) : !single_value->field_extension__bits.match_omit(legacy)))return FALSE;
if(!other_value.not__used().is_bound()) return FALSE;
if(!single_value->field_not__used.match(other_value.not__used(), legacy))return FALSE;
if(!other_value.rel99__present().is_bound()) return FALSE;
if(!single_value->field_rel99__present.match(other_value.rel99__present(), legacy))return FALSE;
if(!other_value.rel99().is_bound()) return FALSE;
if((other_value.rel99().ispresent() ? !single_value->field_rel99.match((const UlAckNackGprsAdditionsRel99&)other_value.rel99(), legacy) : !single_value->field_rel99.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.UlAckNackGprs.");
}
return FALSE;
}

boolean UlAckNackGprs_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_ack__nack__desc.is_bound()
 || single_value->field_cont__res__tlli__present.is_bound()
 || (single_value->field_cont__res__tlli.is_omit() || single_value->field_cont__res__tlli.is_bound())
 || single_value->field_pkt__ta__present.is_bound()
 || (single_value->field_pkt__ta.is_omit() || single_value->field_pkt__ta.is_bound())
 || single_value->field_pwr__ctrl__present.is_bound()
 || (single_value->field_pwr__ctrl.is_omit() || single_value->field_pwr__ctrl.is_bound())
 || single_value->field_extension__bits__present.is_bound()
 || (single_value->field_extension__bits.is_omit() || single_value->field_extension__bits.is_bound())
 || single_value->field_not__used.is_bound()
 || single_value->field_rel99__present.is_bound()
 || (single_value->field_rel99.is_omit() || single_value->field_rel99.is_bound());
}

boolean UlAckNackGprs_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_ack__nack__desc.is_value()
 && single_value->field_cont__res__tlli__present.is_value()
 && (single_value->field_cont__res__tlli.is_omit() || single_value->field_cont__res__tlli.is_value())
 && single_value->field_pkt__ta__present.is_value()
 && (single_value->field_pkt__ta.is_omit() || single_value->field_pkt__ta.is_value())
 && single_value->field_pwr__ctrl__present.is_value()
 && (single_value->field_pwr__ctrl.is_omit() || single_value->field_pwr__ctrl.is_value())
 && single_value->field_extension__bits__present.is_value()
 && (single_value->field_extension__bits.is_omit() || single_value->field_extension__bits.is_value())
 && single_value->field_not__used.is_value()
 && single_value->field_rel99__present.is_value()
 && (single_value->field_rel99.is_omit() || single_value->field_rel99.is_value());
}

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

UlAckNackGprs UlAckNackGprs_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.UlAckNackGprs.");
UlAckNackGprs 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_ack__nack__desc.is_bound()) {
ret_val.ack__nack__desc() = single_value->field_ack__nack__desc.valueof();
}
if (single_value->field_cont__res__tlli__present.is_bound()) {
ret_val.cont__res__tlli__present() = single_value->field_cont__res__tlli__present.valueof();
}
if (single_value->field_cont__res__tlli.is_omit()) ret_val.cont__res__tlli() = OMIT_VALUE;
else if (single_value->field_cont__res__tlli.is_bound()) {
ret_val.cont__res__tlli() = single_value->field_cont__res__tlli.valueof();
}
if (single_value->field_pkt__ta__present.is_bound()) {
ret_val.pkt__ta__present() = single_value->field_pkt__ta__present.valueof();
}
if (single_value->field_pkt__ta.is_omit()) ret_val.pkt__ta() = OMIT_VALUE;
else if (single_value->field_pkt__ta.is_bound()) {
ret_val.pkt__ta() = single_value->field_pkt__ta.valueof();
}
if (single_value->field_pwr__ctrl__present.is_bound()) {
ret_val.pwr__ctrl__present() = single_value->field_pwr__ctrl__present.valueof();
}
if (single_value->field_pwr__ctrl.is_omit()) ret_val.pwr__ctrl() = OMIT_VALUE;
else if (single_value->field_pwr__ctrl.is_bound()) {
ret_val.pwr__ctrl() = single_value->field_pwr__ctrl.valueof();
}
if (single_value->field_extension__bits__present.is_bound()) {
ret_val.extension__bits__present() = single_value->field_extension__bits__present.valueof();
}
if (single_value->field_extension__bits.is_omit()) ret_val.extension__bits() = OMIT_VALUE;
else if (single_value->field_extension__bits.is_bound()) {
ret_val.extension__bits() = single_value->field_extension__bits.valueof();
}
if (single_value->field_not__used.is_bound()) {
ret_val.not__used() = single_value->field_not__used.valueof();
}
if (single_value->field_rel99__present.is_bound()) {
ret_val.rel99__present() = single_value->field_rel99__present.valueof();
}
if (single_value->field_rel99.is_omit()) ret_val.rel99() = OMIT_VALUE;
else if (single_value->field_rel99.is_bound()) {
ret_val.rel99() = single_value->field_rel99.valueof();
}
return ret_val;
}

void UlAckNackGprs_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.UlAckNackGprs.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new UlAckNackGprs_template[list_length];
}

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

ChCodingCommand_template& UlAckNackGprs_template::ch__coding__cmd()
{
set_specific();
return single_value->field_ch__coding__cmd;
}

const ChCodingCommand_template& UlAckNackGprs_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.UlAckNackGprs.");
return single_value->field_ch__coding__cmd;
}

AckNackDescription_template& UlAckNackGprs_template::ack__nack__desc()
{
set_specific();
return single_value->field_ack__nack__desc;
}

const AckNackDescription_template& UlAckNackGprs_template::ack__nack__desc() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ack_nack_desc of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackGprs.");
return single_value->field_ack__nack__desc;
}

BITSTRING_template& UlAckNackGprs_template::cont__res__tlli__present()
{
set_specific();
return single_value->field_cont__res__tlli__present;
}

const BITSTRING_template& UlAckNackGprs_template::cont__res__tlli__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field cont_res_tlli_present of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackGprs.");
return single_value->field_cont__res__tlli__present;
}

OCTETSTRING_template& UlAckNackGprs_template::cont__res__tlli()
{
set_specific();
return single_value->field_cont__res__tlli;
}

const OCTETSTRING_template& UlAckNackGprs_template::cont__res__tlli() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field cont_res_tlli of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackGprs.");
return single_value->field_cont__res__tlli;
}

BITSTRING_template& UlAckNackGprs_template::pkt__ta__present()
{
set_specific();
return single_value->field_pkt__ta__present;
}

const BITSTRING_template& UlAckNackGprs_template::pkt__ta__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pkt_ta_present of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackGprs.");
return single_value->field_pkt__ta__present;
}

PacketTimingAdvance_template& UlAckNackGprs_template::pkt__ta()
{
set_specific();
return single_value->field_pkt__ta;
}

const PacketTimingAdvance_template& UlAckNackGprs_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.UlAckNackGprs.");
return single_value->field_pkt__ta;
}

BITSTRING_template& UlAckNackGprs_template::pwr__ctrl__present()
{
set_specific();
return single_value->field_pwr__ctrl__present;
}

const BITSTRING_template& UlAckNackGprs_template::pwr__ctrl__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pwr_ctrl_present of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackGprs.");
return single_value->field_pwr__ctrl__present;
}

PowerControlParameters_template& UlAckNackGprs_template::pwr__ctrl()
{
set_specific();
return single_value->field_pwr__ctrl;
}

const PowerControlParameters_template& UlAckNackGprs_template::pwr__ctrl() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pwr_ctrl of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackGprs.");
return single_value->field_pwr__ctrl;
}

BITSTRING_template& UlAckNackGprs_template::extension__bits__present()
{
set_specific();
return single_value->field_extension__bits__present;
}

const BITSTRING_template& UlAckNackGprs_template::extension__bits__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field extension_bits_present of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackGprs.");
return single_value->field_extension__bits__present;
}

ExtensionBits_template& UlAckNackGprs_template::extension__bits()
{
set_specific();
return single_value->field_extension__bits;
}

const ExtensionBits_template& UlAckNackGprs_template::extension__bits() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field extension_bits of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackGprs.");
return single_value->field_extension__bits;
}

BITSTRING_template& UlAckNackGprs_template::not__used()
{
set_specific();
return single_value->field_not__used;
}

const BITSTRING_template& UlAckNackGprs_template::not__used() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field not_used of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackGprs.");
return single_value->field_not__used;
}

BITSTRING_template& UlAckNackGprs_template::rel99__present()
{
set_specific();
return single_value->field_rel99__present;
}

const BITSTRING_template& UlAckNackGprs_template::rel99__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rel99_present of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackGprs.");
return single_value->field_rel99__present;
}

UlAckNackGprsAdditionsRel99_template& UlAckNackGprs_template::rel99()
{
set_specific();
return single_value->field_rel99;
}

const UlAckNackGprsAdditionsRel99_template& UlAckNackGprs_template::rel99() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rel99 of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackGprs.");
return single_value->field_rel99;
}

int UlAckNackGprs_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.UlAckNackGprs which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
  {    int ret_val = 8;
      if (single_value->field_cont__res__tlli.is_present()) ret_val++;
      if (single_value->field_pkt__ta.is_present()) ret_val++;
      if (single_value->field_pwr__ctrl.is_present()) ret_val++;
      if (single_value->field_extension__bits.is_present()) ret_val++;
      if (single_value->field_rel99.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.UlAckNackGprs 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.UlAckNackGprs 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.UlAckNackGprs containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.UlAckNackGprs containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.UlAckNackGprs containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.UlAckNackGprs containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.UlAckNackGprs containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.UlAckNackGprs containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @RLCMAC_CSN1_Types.UlAckNackGprs.");
  }
  return 0;
}

void UlAckNackGprs_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(", ack_nack_desc := ");
single_value->field_ack__nack__desc.log();
TTCN_Logger::log_event_str(", cont_res_tlli_present := ");
single_value->field_cont__res__tlli__present.log();
TTCN_Logger::log_event_str(", cont_res_tlli := ");
single_value->field_cont__res__tlli.log();
TTCN_Logger::log_event_str(", pkt_ta_present := ");
single_value->field_pkt__ta__present.log();
TTCN_Logger::log_event_str(", pkt_ta := ");
single_value->field_pkt__ta.log();
TTCN_Logger::log_event_str(", pwr_ctrl_present := ");
single_value->field_pwr__ctrl__present.log();
TTCN_Logger::log_event_str(", pwr_ctrl := ");
single_value->field_pwr__ctrl.log();
TTCN_Logger::log_event_str(", extension_bits_present := ");
single_value->field_extension__bits__present.log();
TTCN_Logger::log_event_str(", extension_bits := ");
single_value->field_extension__bits.log();
TTCN_Logger::log_event_str(", not_used := ");
single_value->field_not__used.log();
TTCN_Logger::log_event_str(", rel99_present := ");
single_value->field_rel99__present.log();
TTCN_Logger::log_event_str(", rel99 := ");
single_value->field_rel99.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 UlAckNackGprs_template::log_match(const UlAckNackGprs& 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_ack__nack__desc.match(match_value.ack__nack__desc(), legacy)){
TTCN_Logger::log_logmatch_info(".ack_nack_desc");
single_value->field_ack__nack__desc.log_match(match_value.ack__nack__desc(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_cont__res__tlli__present.match(match_value.cont__res__tlli__present(), legacy)){
TTCN_Logger::log_logmatch_info(".cont_res_tlli_present");
single_value->field_cont__res__tlli__present.log_match(match_value.cont__res__tlli__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.cont__res__tlli().ispresent()){
if(!single_value->field_cont__res__tlli.match(match_value.cont__res__tlli(), legacy)){
TTCN_Logger::log_logmatch_info(".cont_res_tlli");
single_value->field_cont__res__tlli.log_match(match_value.cont__res__tlli(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_cont__res__tlli.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".cont_res_tlli := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_cont__res__tlli.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_pkt__ta__present.match(match_value.pkt__ta__present(), legacy)){
TTCN_Logger::log_logmatch_info(".pkt_ta_present");
single_value->field_pkt__ta__present.log_match(match_value.pkt__ta__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.pkt__ta().ispresent()){
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);
}
} else {
if (!single_value->field_pkt__ta.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".pkt_ta := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_pkt__ta.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_pwr__ctrl__present.match(match_value.pwr__ctrl__present(), legacy)){
TTCN_Logger::log_logmatch_info(".pwr_ctrl_present");
single_value->field_pwr__ctrl__present.log_match(match_value.pwr__ctrl__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.pwr__ctrl().ispresent()){
if(!single_value->field_pwr__ctrl.match(match_value.pwr__ctrl(), legacy)){
TTCN_Logger::log_logmatch_info(".pwr_ctrl");
single_value->field_pwr__ctrl.log_match(match_value.pwr__ctrl(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_pwr__ctrl.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".pwr_ctrl := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_pwr__ctrl.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_extension__bits__present.match(match_value.extension__bits__present(), legacy)){
TTCN_Logger::log_logmatch_info(".extension_bits_present");
single_value->field_extension__bits__present.log_match(match_value.extension__bits__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.extension__bits().ispresent()){
if(!single_value->field_extension__bits.match(match_value.extension__bits(), legacy)){
TTCN_Logger::log_logmatch_info(".extension_bits");
single_value->field_extension__bits.log_match(match_value.extension__bits(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_extension__bits.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".extension_bits := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_extension__bits.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_not__used.match(match_value.not__used(), legacy)){
TTCN_Logger::log_logmatch_info(".not_used");
single_value->field_not__used.log_match(match_value.not__used(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rel99__present.match(match_value.rel99__present(), legacy)){
TTCN_Logger::log_logmatch_info(".rel99_present");
single_value->field_rel99__present.log_match(match_value.rel99__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.rel99().ispresent()){
if(!single_value->field_rel99.match(match_value.rel99(), legacy)){
TTCN_Logger::log_logmatch_info(".rel99");
single_value->field_rel99.log_match(match_value.rel99(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_rel99.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".rel99 := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_rel99.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(", ack_nack_desc := ");
single_value->field_ack__nack__desc.log_match(match_value.ack__nack__desc(), legacy);
TTCN_Logger::log_event_str(", cont_res_tlli_present := ");
single_value->field_cont__res__tlli__present.log_match(match_value.cont__res__tlli__present(), legacy);
TTCN_Logger::log_event_str(", cont_res_tlli := ");
if (match_value.cont__res__tlli().ispresent()) {
single_value->field_cont__res__tlli.log_match(match_value.cont__res__tlli(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_cont__res__tlli.log();
if (single_value->field_cont__res__tlli.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", pkt_ta_present := ");
single_value->field_pkt__ta__present.log_match(match_value.pkt__ta__present(), legacy);
TTCN_Logger::log_event_str(", pkt_ta := ");
if (match_value.pkt__ta().ispresent()) {
single_value->field_pkt__ta.log_match(match_value.pkt__ta(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_pkt__ta.log();
if (single_value->field_pkt__ta.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", pwr_ctrl_present := ");
single_value->field_pwr__ctrl__present.log_match(match_value.pwr__ctrl__present(), legacy);
TTCN_Logger::log_event_str(", pwr_ctrl := ");
if (match_value.pwr__ctrl().ispresent()) {
single_value->field_pwr__ctrl.log_match(match_value.pwr__ctrl(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_pwr__ctrl.log();
if (single_value->field_pwr__ctrl.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", extension_bits_present := ");
single_value->field_extension__bits__present.log_match(match_value.extension__bits__present(), legacy);
TTCN_Logger::log_event_str(", extension_bits := ");
if (match_value.extension__bits().ispresent()) {
single_value->field_extension__bits.log_match(match_value.extension__bits(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_extension__bits.log();
if (single_value->field_extension__bits.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", not_used := ");
single_value->field_not__used.log_match(match_value.not__used(), legacy);
TTCN_Logger::log_event_str(", rel99_present := ");
single_value->field_rel99__present.log_match(match_value.rel99__present(), legacy);
TTCN_Logger::log_event_str(", rel99 := ");
if (match_value.rel99().ispresent()) {
single_value->field_rel99.log_match(match_value.rel99(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_rel99.log();
if (single_value->field_rel99.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 UlAckNackGprs_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (ch__coding__cmd().is_bound()) ch__coding__cmd().set_implicit_omit();
if (ack__nack__desc().is_bound()) ack__nack__desc().set_implicit_omit();
if (cont__res__tlli__present().is_bound()) cont__res__tlli__present().set_implicit_omit();
if (!cont__res__tlli().is_bound()) cont__res__tlli() = OMIT_VALUE;
else cont__res__tlli().set_implicit_omit();
if (pkt__ta__present().is_bound()) pkt__ta__present().set_implicit_omit();
if (!pkt__ta().is_bound()) pkt__ta() = OMIT_VALUE;
else pkt__ta().set_implicit_omit();
if (pwr__ctrl__present().is_bound()) pwr__ctrl__present().set_implicit_omit();
if (!pwr__ctrl().is_bound()) pwr__ctrl() = OMIT_VALUE;
else pwr__ctrl().set_implicit_omit();
if (extension__bits__present().is_bound()) extension__bits__present().set_implicit_omit();
if (!extension__bits().is_bound()) extension__bits() = OMIT_VALUE;
else extension__bits().set_implicit_omit();
if (not__used().is_bound()) not__used().set_implicit_omit();
if (rel99__present().is_bound()) rel99__present().set_implicit_omit();
if (!rel99().is_bound()) rel99() = OMIT_VALUE;
else rel99().set_implicit_omit();
}

void UlAckNackGprs_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_ack__nack__desc.encode_text(text_buf);
single_value->field_cont__res__tlli__present.encode_text(text_buf);
single_value->field_cont__res__tlli.encode_text(text_buf);
single_value->field_pkt__ta__present.encode_text(text_buf);
single_value->field_pkt__ta.encode_text(text_buf);
single_value->field_pwr__ctrl__present.encode_text(text_buf);
single_value->field_pwr__ctrl.encode_text(text_buf);
single_value->field_extension__bits__present.encode_text(text_buf);
single_value->field_extension__bits.encode_text(text_buf);
single_value->field_not__used.encode_text(text_buf);
single_value->field_rel99__present.encode_text(text_buf);
single_value->field_rel99.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.UlAckNackGprs.");
}
}

void UlAckNackGprs_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_ack__nack__desc.decode_text(text_buf);
single_value->field_cont__res__tlli__present.decode_text(text_buf);
single_value->field_cont__res__tlli.decode_text(text_buf);
single_value->field_pkt__ta__present.decode_text(text_buf);
single_value->field_pkt__ta.decode_text(text_buf);
single_value->field_pwr__ctrl__present.decode_text(text_buf);
single_value->field_pwr__ctrl.decode_text(text_buf);
single_value->field_extension__bits__present.decode_text(text_buf);
single_value->field_extension__bits.decode_text(text_buf);
single_value->field_not__used.decode_text(text_buf);
single_value->field_rel99__present.decode_text(text_buf);
single_value->field_rel99.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 UlAckNackGprs_template[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.UlAckNackGprs.");
}
}

void UlAckNackGprs_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: {
    UlAckNackGprs_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 (13<param.get_size()) {
      param.error("record template of type @RLCMAC_CSN1_Types.UlAckNackGprs has 13 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) ack__nack__desc().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) cont__res__tlli__present().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) cont__res__tlli().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) pkt__ta__present().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) pkt__ta().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) pwr__ctrl__present().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) pwr__ctrl().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) extension__bits__present().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) extension__bits().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) not__used().set_param(*param.get_elem(10));
    if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) rel99__present().set_param(*param.get_elem(11));
    if (param.get_size()>12 && param.get_elem(12)->get_type()!=Module_Param::MP_NotUsed) rel99().set_param(*param.get_elem(12));
    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(), "ack_nack_desc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ack__nack__desc().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cont_res_tlli_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cont__res__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(), "cont_res_tlli")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cont__res__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(), "pkt_ta_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pkt__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_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(), "pwr_ctrl_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pwr__ctrl__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(), "pwr_ctrl")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pwr__ctrl().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "extension_bits_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          extension__bits__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(), "extension_bits")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          extension__bits().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "not_used")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          not__used().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rel99_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rel99__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(), "rel99")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rel99().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.UlAckNackGprs: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    UlAckNackGprs_template* precondition = new UlAckNackGprs_template;
    precondition->set_param(*param.get_elem(0));
    UlAckNackGprs_template* implied_template = new UlAckNackGprs_template;
    implied_template->set_param(*param.get_elem(1));
    *this = UlAckNackGprs_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.UlAckNackGprs");
  }
  is_ifpresent = param.get_ifpresent();
}

void UlAckNackGprs_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.UlAckNackGprs");
single_value->field_ack__nack__desc.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackGprs");
single_value->field_cont__res__tlli__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackGprs");
single_value->field_cont__res__tlli.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackGprs");
single_value->field_pkt__ta__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackGprs");
single_value->field_pkt__ta.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackGprs");
single_value->field_pwr__ctrl__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackGprs");
single_value->field_pwr__ctrl.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackGprs");
single_value->field_extension__bits__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackGprs");
single_value->field_extension__bits.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackGprs");
single_value->field_not__used.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackGprs");
single_value->field_rel99__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackGprs");
single_value->field_rel99.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackGprs");
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.UlAckNackGprs");
}

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

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

UlAckNackEgprs::UlAckNackEgprs()
{
}

UlAckNackEgprs::UlAckNackEgprs(const BITSTRING& par_msg__excape,
    const EgprsChCodingCommand& par_ch__coding__cmd,
    const BITSTRING& par_resegment,
    const BITSTRING& par_preemptive__tx,
    const BITSTRING& par_prr__retrans__req,
    const BITSTRING& par_arac__retrans__req,
    const BITSTRING& par_cont__res__tlli__present,
    const OPTIONAL< OCTETSTRING >& par_cont__res__tlli,
    const BITSTRING& par_tbf__est,
    const BITSTRING& par_pkt__ta__present,
    const OPTIONAL< PacketTimingAdvance >& par_pkt__ta,
    const BITSTRING& par_pkt__ext__ta__present,
    const OPTIONAL< BITSTRING >& par_pkt__ext__ta,
    const BITSTRING& par_pwr__ctrl__present,
    const OPTIONAL< PowerControlParameters >& par_pwr__ctrl)
  :   field_msg__excape(par_msg__excape),
  field_ch__coding__cmd(par_ch__coding__cmd),
  field_resegment(par_resegment),
  field_preemptive__tx(par_preemptive__tx),
  field_prr__retrans__req(par_prr__retrans__req),
  field_arac__retrans__req(par_arac__retrans__req),
  field_cont__res__tlli__present(par_cont__res__tlli__present),
  field_cont__res__tlli(par_cont__res__tlli),
  field_tbf__est(par_tbf__est),
  field_pkt__ta__present(par_pkt__ta__present),
  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_pwr__ctrl__present(par_pwr__ctrl__present),
  field_pwr__ctrl(par_pwr__ctrl)
{
}

UlAckNackEgprs::UlAckNackEgprs(const UlAckNackEgprs& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.UlAckNackEgprs.");
if (other_value.msg__excape().is_bound()) field_msg__excape = other_value.msg__excape();
else field_msg__excape.clean_up();
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.resegment().is_bound()) field_resegment = other_value.resegment();
else field_resegment.clean_up();
if (other_value.preemptive__tx().is_bound()) field_preemptive__tx = other_value.preemptive__tx();
else field_preemptive__tx.clean_up();
if (other_value.prr__retrans__req().is_bound()) field_prr__retrans__req = other_value.prr__retrans__req();
else field_prr__retrans__req.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.cont__res__tlli__present().is_bound()) field_cont__res__tlli__present = other_value.cont__res__tlli__present();
else field_cont__res__tlli__present.clean_up();
if (other_value.cont__res__tlli().is_bound()) field_cont__res__tlli = other_value.cont__res__tlli();
else field_cont__res__tlli.clean_up();
if (other_value.tbf__est().is_bound()) field_tbf__est = other_value.tbf__est();
else field_tbf__est.clean_up();
if (other_value.pkt__ta__present().is_bound()) field_pkt__ta__present = other_value.pkt__ta__present();
else field_pkt__ta__present.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.pwr__ctrl__present().is_bound()) field_pwr__ctrl__present = other_value.pwr__ctrl__present();
else field_pwr__ctrl__present.clean_up();
if (other_value.pwr__ctrl().is_bound()) field_pwr__ctrl = other_value.pwr__ctrl();
else field_pwr__ctrl.clean_up();
}

void UlAckNackEgprs::clean_up()
{
field_msg__excape.clean_up();
field_ch__coding__cmd.clean_up();
field_resegment.clean_up();
field_preemptive__tx.clean_up();
field_prr__retrans__req.clean_up();
field_arac__retrans__req.clean_up();
field_cont__res__tlli__present.clean_up();
field_cont__res__tlli.clean_up();
field_tbf__est.clean_up();
field_pkt__ta__present.clean_up();
field_pkt__ta.clean_up();
field_pkt__ext__ta__present.clean_up();
field_pkt__ext__ta.clean_up();
field_pwr__ctrl__present.clean_up();
field_pwr__ctrl.clean_up();
}

const TTCN_Typedescriptor_t* UlAckNackEgprs::get_descriptor() const { return &UlAckNackEgprs_descr_; }
UlAckNackEgprs& UlAckNackEgprs::operator=(const UlAckNackEgprs& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.UlAckNackEgprs.");
  if (other_value.msg__excape().is_bound()) field_msg__excape = other_value.msg__excape();
  else field_msg__excape.clean_up();
  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.resegment().is_bound()) field_resegment = other_value.resegment();
  else field_resegment.clean_up();
  if (other_value.preemptive__tx().is_bound()) field_preemptive__tx = other_value.preemptive__tx();
  else field_preemptive__tx.clean_up();
  if (other_value.prr__retrans__req().is_bound()) field_prr__retrans__req = other_value.prr__retrans__req();
  else field_prr__retrans__req.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.cont__res__tlli__present().is_bound()) field_cont__res__tlli__present = other_value.cont__res__tlli__present();
  else field_cont__res__tlli__present.clean_up();
  if (other_value.cont__res__tlli().is_bound()) field_cont__res__tlli = other_value.cont__res__tlli();
  else field_cont__res__tlli.clean_up();
  if (other_value.tbf__est().is_bound()) field_tbf__est = other_value.tbf__est();
  else field_tbf__est.clean_up();
  if (other_value.pkt__ta__present().is_bound()) field_pkt__ta__present = other_value.pkt__ta__present();
  else field_pkt__ta__present.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.pwr__ctrl__present().is_bound()) field_pwr__ctrl__present = other_value.pwr__ctrl__present();
  else field_pwr__ctrl__present.clean_up();
  if (other_value.pwr__ctrl().is_bound()) field_pwr__ctrl = other_value.pwr__ctrl();
  else field_pwr__ctrl.clean_up();
}
return *this;
}

boolean UlAckNackEgprs::operator==(const UlAckNackEgprs& other_value) const
{
return field_msg__excape==other_value.field_msg__excape
  && field_ch__coding__cmd==other_value.field_ch__coding__cmd
  && field_resegment==other_value.field_resegment
  && field_preemptive__tx==other_value.field_preemptive__tx
  && field_prr__retrans__req==other_value.field_prr__retrans__req
  && field_arac__retrans__req==other_value.field_arac__retrans__req
  && field_cont__res__tlli__present==other_value.field_cont__res__tlli__present
  && field_cont__res__tlli==other_value.field_cont__res__tlli
  && field_tbf__est==other_value.field_tbf__est
  && field_pkt__ta__present==other_value.field_pkt__ta__present
  && 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_pwr__ctrl__present==other_value.field_pwr__ctrl__present
  && field_pwr__ctrl==other_value.field_pwr__ctrl;
}

boolean UlAckNackEgprs::is_bound() const
{
return (field_msg__excape.is_bound())
  || (field_ch__coding__cmd.is_bound())
  || (field_resegment.is_bound())
  || (field_preemptive__tx.is_bound())
  || (field_prr__retrans__req.is_bound())
  || (field_arac__retrans__req.is_bound())
  || (field_cont__res__tlli__present.is_bound())
  || (OPTIONAL_OMIT == field_cont__res__tlli.get_selection() || field_cont__res__tlli.is_bound())
  || (field_tbf__est.is_bound())
  || (field_pkt__ta__present.is_bound())
  || (OPTIONAL_OMIT == field_pkt__ta.get_selection() || 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_pwr__ctrl__present.is_bound())
  || (OPTIONAL_OMIT == field_pwr__ctrl.get_selection() || field_pwr__ctrl.is_bound());
}
boolean UlAckNackEgprs::is_value() const
{
return field_msg__excape.is_value()
  && field_ch__coding__cmd.is_value()
  && field_resegment.is_value()
  && field_preemptive__tx.is_value()
  && field_prr__retrans__req.is_value()
  && field_arac__retrans__req.is_value()
  && field_cont__res__tlli__present.is_value()
  && (OPTIONAL_OMIT == field_cont__res__tlli.get_selection() || field_cont__res__tlli.is_value())
  && field_tbf__est.is_value()
  && field_pkt__ta__present.is_value()
  && (OPTIONAL_OMIT == field_pkt__ta.get_selection() || 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_pwr__ctrl__present.is_value()
  && (OPTIONAL_OMIT == field_pwr__ctrl.get_selection() || field_pwr__ctrl.is_value());
}
int UlAckNackEgprs::size_of() const
{
  int ret_val = 11;
  if (field_cont__res__tlli.ispresent()) ret_val++;
  if (field_pkt__ta.ispresent()) ret_val++;
  if (field_pkt__ext__ta.ispresent()) ret_val++;
  if (field_pwr__ctrl.ispresent()) ret_val++;
  return ret_val;
}

void UlAckNackEgprs::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ msg_excape := ");
field_msg__excape.log();
TTCN_Logger::log_event_str(", ch_coding_cmd := ");
field_ch__coding__cmd.log();
TTCN_Logger::log_event_str(", resegment := ");
field_resegment.log();
TTCN_Logger::log_event_str(", preemptive_tx := ");
field_preemptive__tx.log();
TTCN_Logger::log_event_str(", prr_retrans_req := ");
field_prr__retrans__req.log();
TTCN_Logger::log_event_str(", arac_retrans_req := ");
field_arac__retrans__req.log();
TTCN_Logger::log_event_str(", cont_res_tlli_present := ");
field_cont__res__tlli__present.log();
TTCN_Logger::log_event_str(", cont_res_tlli := ");
field_cont__res__tlli.log();
TTCN_Logger::log_event_str(", tbf_est := ");
field_tbf__est.log();
TTCN_Logger::log_event_str(", pkt_ta_present := ");
field_pkt__ta__present.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(", pwr_ctrl_present := ");
field_pwr__ctrl__present.log();
TTCN_Logger::log_event_str(", pwr_ctrl := ");
field_pwr__ctrl.log();
TTCN_Logger::log_event_str(" }");
}

void UlAckNackEgprs::set_implicit_omit()
{
if (msg__excape().is_bound()) msg__excape().set_implicit_omit();
if (ch__coding__cmd().is_bound()) ch__coding__cmd().set_implicit_omit();
if (resegment().is_bound()) resegment().set_implicit_omit();
if (preemptive__tx().is_bound()) preemptive__tx().set_implicit_omit();
if (prr__retrans__req().is_bound()) prr__retrans__req().set_implicit_omit();
if (arac__retrans__req().is_bound()) arac__retrans__req().set_implicit_omit();
if (cont__res__tlli__present().is_bound()) cont__res__tlli__present().set_implicit_omit();
if (!cont__res__tlli().is_bound()) cont__res__tlli() = OMIT_VALUE;
else cont__res__tlli().set_implicit_omit();
if (tbf__est().is_bound()) tbf__est().set_implicit_omit();
if (pkt__ta__present().is_bound()) pkt__ta__present().set_implicit_omit();
if (!pkt__ta().is_bound()) pkt__ta() = OMIT_VALUE;
else 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 (pwr__ctrl__present().is_bound()) pwr__ctrl__present().set_implicit_omit();
if (!pwr__ctrl().is_bound()) pwr__ctrl() = OMIT_VALUE;
else pwr__ctrl().set_implicit_omit();
}

void UlAckNackEgprs::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 (15<param.get_size()) {
      param.error("record value of type @RLCMAC_CSN1_Types.UlAckNackEgprs has 15 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) msg__excape().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ch__coding__cmd().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) resegment().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) preemptive__tx().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) prr__retrans__req().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) arac__retrans__req().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) cont__res__tlli__present().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) cont__res__tlli().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) tbf__est().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) pkt__ta__present().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) pkt__ta().set_param(*param.get_elem(10));
    if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) pkt__ext__ta__present().set_param(*param.get_elem(11));
    if (param.get_size()>12 && param.get_elem(12)->get_type()!=Module_Param::MP_NotUsed) pkt__ext__ta().set_param(*param.get_elem(12));
    if (param.get_size()>13 && param.get_elem(13)->get_type()!=Module_Param::MP_NotUsed) pwr__ctrl__present().set_param(*param.get_elem(13));
    if (param.get_size()>14 && param.get_elem(14)->get_type()!=Module_Param::MP_NotUsed) pwr__ctrl().set_param(*param.get_elem(14));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "msg_excape")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          msg__excape().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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(), "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(), "preemptive_tx")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          preemptive__tx().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "prr_retrans_req")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          prr__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(), "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(), "cont_res_tlli_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cont__res__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(), "cont_res_tlli")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cont__res__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(), "tbf_est")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tbf__est().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pkt__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_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(), "pwr_ctrl_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pwr__ctrl__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(), "pwr_ctrl")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pwr__ctrl().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.UlAckNackEgprs: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.UlAckNackEgprs");
  }
}

void UlAckNackEgprs::encode_text(Text_Buf& text_buf) const
{
field_msg__excape.encode_text(text_buf);
field_ch__coding__cmd.encode_text(text_buf);
field_resegment.encode_text(text_buf);
field_preemptive__tx.encode_text(text_buf);
field_prr__retrans__req.encode_text(text_buf);
field_arac__retrans__req.encode_text(text_buf);
field_cont__res__tlli__present.encode_text(text_buf);
field_cont__res__tlli.encode_text(text_buf);
field_tbf__est.encode_text(text_buf);
field_pkt__ta__present.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_pwr__ctrl__present.encode_text(text_buf);
field_pwr__ctrl.encode_text(text_buf);
}

void UlAckNackEgprs::decode_text(Text_Buf& text_buf)
{
field_msg__excape.decode_text(text_buf);
field_ch__coding__cmd.decode_text(text_buf);
field_resegment.decode_text(text_buf);
field_preemptive__tx.decode_text(text_buf);
field_prr__retrans__req.decode_text(text_buf);
field_arac__retrans__req.decode_text(text_buf);
field_cont__res__tlli__present.decode_text(text_buf);
field_cont__res__tlli.decode_text(text_buf);
field_tbf__est.decode_text(text_buf);
field_pkt__ta__present.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_pwr__ctrl__present.decode_text(text_buf);
field_pwr__ctrl.decode_text(text_buf);
}

void UlAckNackEgprs::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 UlAckNackEgprs::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 UlAckNackEgprs::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, UlAckNackEgprs_msg__excape_descr_.raw->forceomit);
  decoded_field_length = field_msg__excape.RAW_decode(UlAckNackEgprs_msg__excape_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, UlAckNackEgprs_ch__coding__cmd_descr_.raw->forceomit);
  decoded_field_length = field_ch__coding__cmd.RAW_decode(UlAckNackEgprs_ch__coding__cmd_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, UlAckNackEgprs_resegment_descr_.raw->forceomit);
  decoded_field_length = field_resegment.RAW_decode(UlAckNackEgprs_resegment_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, UlAckNackEgprs_preemptive__tx_descr_.raw->forceomit);
  decoded_field_length = field_preemptive__tx.RAW_decode(UlAckNackEgprs_preemptive__tx_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, UlAckNackEgprs_prr__retrans__req_descr_.raw->forceomit);
  decoded_field_length = field_prr__retrans__req.RAW_decode(UlAckNackEgprs_prr__retrans__req_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, UlAckNackEgprs_arac__retrans__req_descr_.raw->forceomit);
  decoded_field_length = field_arac__retrans__req.RAW_decode(UlAckNackEgprs_arac__retrans__req_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, UlAckNackEgprs_cont__res__tlli__present_descr_.raw->forceomit);
  decoded_field_length = field_cont__res__tlli__present.RAW_decode(UlAckNackEgprs_cont__res__tlli__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());
  if (limit > 0 && field_cont__res__tlli__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(7)) {
    field_cont__res__tlli = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_7_force_omit(7, force_omit, UlAckNackEgprs_cont__res__tlli_descr_.raw->forceomit);
  decoded_field_length = field_cont__res__tlli().RAW_decode(UlAckNackEgprs_cont__res__tlli_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_7_force_omit);
  if (decoded_field_length < 1) {
  field_cont__res__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_cont__res__tlli=OMIT_VALUE;
  RAW_Force_Omit field_8_force_omit(8, force_omit, UlAckNackEgprs_tbf__est_descr_.raw->forceomit);
  decoded_field_length = field_tbf__est.RAW_decode(UlAckNackEgprs_tbf__est_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, UlAckNackEgprs_pkt__ta__present_descr_.raw->forceomit);
  decoded_field_length = field_pkt__ta__present.RAW_decode(UlAckNackEgprs_pkt__ta__present_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_9_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (limit > 0 && field_pkt__ta__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(10)) {
    field_pkt__ta = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_10_force_omit(10, force_omit, UlAckNackEgprs_pkt__ta_descr_.raw->forceomit);
  decoded_field_length = field_pkt__ta().RAW_decode(UlAckNackEgprs_pkt__ta_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_10_force_omit);
  if (decoded_field_length < 1) {
  field_pkt__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__ta=OMIT_VALUE;
  RAW_Force_Omit field_11_force_omit(11, force_omit, UlAckNackEgprs_pkt__ext__ta__present_descr_.raw->forceomit);
  decoded_field_length = field_pkt__ext__ta__present.RAW_decode(UlAckNackEgprs_pkt__ext__ta__present_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());
  if (limit > 0 && field_pkt__ext__ta__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(12)) {
    field_pkt__ext__ta = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_12_force_omit(12, force_omit, UlAckNackEgprs_pkt__ext__ta_descr_.raw->forceomit);
  decoded_field_length = field_pkt__ext__ta().RAW_decode(UlAckNackEgprs_pkt__ext__ta_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_12_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_13_force_omit(13, force_omit, UlAckNackEgprs_pwr__ctrl__present_descr_.raw->forceomit);
  decoded_field_length = field_pwr__ctrl__present.RAW_decode(UlAckNackEgprs_pwr__ctrl__present_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_13_force_omit);
  if (decoded_field_length < 0) return 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_pwr__ctrl__present ==  bs_0){
  if (force_omit != NULL && (*force_omit)(14)) {
    field_pwr__ctrl = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_14_force_omit(14, force_omit, UlAckNackEgprs_pwr__ctrl_descr_.raw->forceomit);
  decoded_field_length = field_pwr__ctrl().RAW_decode(UlAckNackEgprs_pwr__ctrl_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_14_force_omit);
  if (decoded_field_length < 1) {
  field_pwr__ctrl = 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_pwr__ctrl=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int UlAckNackEgprs::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 = 15;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(15);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, UlAckNackEgprs_msg__excape_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, UlAckNackEgprs_ch__coding__cmd_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, UlAckNackEgprs_resegment_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, UlAckNackEgprs_preemptive__tx_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, UlAckNackEgprs_prr__retrans__req_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, UlAckNackEgprs_arac__retrans__req_descr_.raw);
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, UlAckNackEgprs_cont__res__tlli__present_descr_.raw);
  if (field_cont__res__tlli.ispresent()) {
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, UlAckNackEgprs_cont__res__tlli_descr_.raw);
  }
  else myleaf.body.node.nodes[7] = NULL;
  myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, UlAckNackEgprs_tbf__est_descr_.raw);
  myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, UlAckNackEgprs_pkt__ta__present_descr_.raw);
  if (field_pkt__ta.ispresent()) {
  myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 10, UlAckNackEgprs_pkt__ta_descr_.raw);
  }
  else myleaf.body.node.nodes[10] = NULL;
  myleaf.body.node.nodes[11] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 11, UlAckNackEgprs_pkt__ext__ta__present_descr_.raw);
  if (field_pkt__ext__ta.ispresent()) {
  myleaf.body.node.nodes[12] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 12, UlAckNackEgprs_pkt__ext__ta_descr_.raw);
  }
  else myleaf.body.node.nodes[12] = NULL;
  myleaf.body.node.nodes[13] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 13, UlAckNackEgprs_pwr__ctrl__present_descr_.raw);
  if (field_pwr__ctrl.ispresent()) {
  myleaf.body.node.nodes[14] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 14, UlAckNackEgprs_pwr__ctrl_descr_.raw);
  }
  else myleaf.body.node.nodes[14] = NULL;
  encoded_length += field_msg__excape.RAW_encode(UlAckNackEgprs_msg__excape_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ch__coding__cmd.RAW_encode(UlAckNackEgprs_ch__coding__cmd_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_resegment.RAW_encode(UlAckNackEgprs_resegment_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_preemptive__tx.RAW_encode(UlAckNackEgprs_preemptive__tx_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_prr__retrans__req.RAW_encode(UlAckNackEgprs_prr__retrans__req_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_arac__retrans__req.RAW_encode(UlAckNackEgprs_arac__retrans__req_descr_, *myleaf.body.node.nodes[5]);
  encoded_length += field_cont__res__tlli__present.RAW_encode(UlAckNackEgprs_cont__res__tlli__present_descr_, *myleaf.body.node.nodes[6]);
  if (field_cont__res__tlli.ispresent()) {
  encoded_length += field_cont__res__tlli().RAW_encode(UlAckNackEgprs_cont__res__tlli_descr_, *myleaf.body.node.nodes[7]);
  }
  encoded_length += field_tbf__est.RAW_encode(UlAckNackEgprs_tbf__est_descr_, *myleaf.body.node.nodes[8]);
  encoded_length += field_pkt__ta__present.RAW_encode(UlAckNackEgprs_pkt__ta__present_descr_, *myleaf.body.node.nodes[9]);
  if (field_pkt__ta.ispresent()) {
  encoded_length += field_pkt__ta().RAW_encode(UlAckNackEgprs_pkt__ta_descr_, *myleaf.body.node.nodes[10]);
  }
  encoded_length += field_pkt__ext__ta__present.RAW_encode(UlAckNackEgprs_pkt__ext__ta__present_descr_, *myleaf.body.node.nodes[11]);
  if (field_pkt__ext__ta.ispresent()) {
  encoded_length += field_pkt__ext__ta().RAW_encode(UlAckNackEgprs_pkt__ext__ta_descr_, *myleaf.body.node.nodes[12]);
  }
  encoded_length += field_pwr__ctrl__present.RAW_encode(UlAckNackEgprs_pwr__ctrl__present_descr_, *myleaf.body.node.nodes[13]);
  if (field_pwr__ctrl.ispresent()) {
  encoded_length += field_pwr__ctrl().RAW_encode(UlAckNackEgprs_pwr__ctrl_descr_, *myleaf.body.node.nodes[14]);
  }
  if (field_cont__res__tlli.ispresent() && (field_cont__res__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[]={6};
  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(UlAckNackEgprs_cont__res__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_pkt__ta.ispresent() && (field_pkt__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[]={9};
  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(UlAckNackEgprs_pkt__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_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[]={11};
  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(UlAckNackEgprs_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_pwr__ctrl.ispresent() && (field_pwr__ctrl__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[]={13};
  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(UlAckNackEgprs_pwr__ctrl__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 UlAckNackEgprs_template::single_value_struct {
BITSTRING_template field_msg__excape;
EgprsChCodingCommand_template field_ch__coding__cmd;
BITSTRING_template field_resegment;
BITSTRING_template field_preemptive__tx;
BITSTRING_template field_prr__retrans__req;
BITSTRING_template field_arac__retrans__req;
BITSTRING_template field_cont__res__tlli__present;
OCTETSTRING_template field_cont__res__tlli;
BITSTRING_template field_tbf__est;
BITSTRING_template field_pkt__ta__present;
PacketTimingAdvance_template field_pkt__ta;
BITSTRING_template field_pkt__ext__ta__present;
BITSTRING_template field_pkt__ext__ta;
BITSTRING_template field_pwr__ctrl__present;
PowerControlParameters_template field_pwr__ctrl;
};

void UlAckNackEgprs_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_msg__excape = ANY_VALUE;
single_value->field_ch__coding__cmd = ANY_VALUE;
single_value->field_resegment = ANY_VALUE;
single_value->field_preemptive__tx = ANY_VALUE;
single_value->field_prr__retrans__req = ANY_VALUE;
single_value->field_arac__retrans__req = ANY_VALUE;
single_value->field_cont__res__tlli__present = ANY_VALUE;
single_value->field_cont__res__tlli = ANY_OR_OMIT;
single_value->field_tbf__est = ANY_VALUE;
single_value->field_pkt__ta__present = ANY_VALUE;
single_value->field_pkt__ta = ANY_OR_OMIT;
single_value->field_pkt__ext__ta__present = ANY_VALUE;
single_value->field_pkt__ext__ta = ANY_OR_OMIT;
single_value->field_pwr__ctrl__present = ANY_VALUE;
single_value->field_pwr__ctrl = ANY_OR_OMIT;
}
}
}

void UlAckNackEgprs_template::copy_value(const UlAckNackEgprs& other_value)
{
single_value = new single_value_struct;
if (other_value.msg__excape().is_bound()) {
  single_value->field_msg__excape = other_value.msg__excape();
} else {
  single_value->field_msg__excape.clean_up();
}
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.resegment().is_bound()) {
  single_value->field_resegment = other_value.resegment();
} else {
  single_value->field_resegment.clean_up();
}
if (other_value.preemptive__tx().is_bound()) {
  single_value->field_preemptive__tx = other_value.preemptive__tx();
} else {
  single_value->field_preemptive__tx.clean_up();
}
if (other_value.prr__retrans__req().is_bound()) {
  single_value->field_prr__retrans__req = other_value.prr__retrans__req();
} else {
  single_value->field_prr__retrans__req.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.cont__res__tlli__present().is_bound()) {
  single_value->field_cont__res__tlli__present = other_value.cont__res__tlli__present();
} else {
  single_value->field_cont__res__tlli__present.clean_up();
}
if (other_value.cont__res__tlli().is_bound()) {
  if (other_value.cont__res__tlli().ispresent()) single_value->field_cont__res__tlli = other_value.cont__res__tlli()();
  else single_value->field_cont__res__tlli = OMIT_VALUE;
} else {
  single_value->field_cont__res__tlli.clean_up();
}
if (other_value.tbf__est().is_bound()) {
  single_value->field_tbf__est = other_value.tbf__est();
} else {
  single_value->field_tbf__est.clean_up();
}
if (other_value.pkt__ta__present().is_bound()) {
  single_value->field_pkt__ta__present = other_value.pkt__ta__present();
} else {
  single_value->field_pkt__ta__present.clean_up();
}
if (other_value.pkt__ta().is_bound()) {
  if (other_value.pkt__ta().ispresent()) single_value->field_pkt__ta = other_value.pkt__ta()();
  else single_value->field_pkt__ta = OMIT_VALUE;
} 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.pwr__ctrl__present().is_bound()) {
  single_value->field_pwr__ctrl__present = other_value.pwr__ctrl__present();
} else {
  single_value->field_pwr__ctrl__present.clean_up();
}
if (other_value.pwr__ctrl().is_bound()) {
  if (other_value.pwr__ctrl().ispresent()) single_value->field_pwr__ctrl = other_value.pwr__ctrl()();
  else single_value->field_pwr__ctrl = OMIT_VALUE;
} else {
  single_value->field_pwr__ctrl.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void UlAckNackEgprs_template::copy_template(const UlAckNackEgprs_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.msg__excape().get_selection()) {
single_value->field_msg__excape = other_value.msg__excape();
} else {
single_value->field_msg__excape.clean_up();
}
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.resegment().get_selection()) {
single_value->field_resegment = other_value.resegment();
} else {
single_value->field_resegment.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.preemptive__tx().get_selection()) {
single_value->field_preemptive__tx = other_value.preemptive__tx();
} else {
single_value->field_preemptive__tx.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.prr__retrans__req().get_selection()) {
single_value->field_prr__retrans__req = other_value.prr__retrans__req();
} else {
single_value->field_prr__retrans__req.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.cont__res__tlli__present().get_selection()) {
single_value->field_cont__res__tlli__present = other_value.cont__res__tlli__present();
} else {
single_value->field_cont__res__tlli__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.cont__res__tlli().get_selection()) {
single_value->field_cont__res__tlli = other_value.cont__res__tlli();
} else {
single_value->field_cont__res__tlli.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tbf__est().get_selection()) {
single_value->field_tbf__est = other_value.tbf__est();
} else {
single_value->field_tbf__est.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pkt__ta__present().get_selection()) {
single_value->field_pkt__ta__present = other_value.pkt__ta__present();
} else {
single_value->field_pkt__ta__present.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.pwr__ctrl__present().get_selection()) {
single_value->field_pwr__ctrl__present = other_value.pwr__ctrl__present();
} else {
single_value->field_pwr__ctrl__present.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pwr__ctrl().get_selection()) {
single_value->field_pwr__ctrl = other_value.pwr__ctrl();
} else {
single_value->field_pwr__ctrl.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 UlAckNackEgprs_template[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 UlAckNackEgprs_template(*other_value.implication_.precondition);
implication_.implied_template = new UlAckNackEgprs_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.UlAckNackEgprs.");
break;
}
set_selection(other_value);
}

UlAckNackEgprs_template::UlAckNackEgprs_template()
{
}

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

UlAckNackEgprs_template::UlAckNackEgprs_template(const UlAckNackEgprs& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean UlAckNackEgprs_template::match(const UlAckNackEgprs& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.msg__excape().is_bound()) return FALSE;
if(!single_value->field_msg__excape.match(other_value.msg__excape(), legacy))return FALSE;
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.resegment().is_bound()) return FALSE;
if(!single_value->field_resegment.match(other_value.resegment(), legacy))return FALSE;
if(!other_value.preemptive__tx().is_bound()) return FALSE;
if(!single_value->field_preemptive__tx.match(other_value.preemptive__tx(), legacy))return FALSE;
if(!other_value.prr__retrans__req().is_bound()) return FALSE;
if(!single_value->field_prr__retrans__req.match(other_value.prr__retrans__req(), 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.cont__res__tlli__present().is_bound()) return FALSE;
if(!single_value->field_cont__res__tlli__present.match(other_value.cont__res__tlli__present(), legacy))return FALSE;
if(!other_value.cont__res__tlli().is_bound()) return FALSE;
if((other_value.cont__res__tlli().ispresent() ? !single_value->field_cont__res__tlli.match((const OCTETSTRING&)other_value.cont__res__tlli(), legacy) : !single_value->field_cont__res__tlli.match_omit(legacy)))return FALSE;
if(!other_value.tbf__est().is_bound()) return FALSE;
if(!single_value->field_tbf__est.match(other_value.tbf__est(), legacy))return FALSE;
if(!other_value.pkt__ta__present().is_bound()) return FALSE;
if(!single_value->field_pkt__ta__present.match(other_value.pkt__ta__present(), legacy))return FALSE;
if(!other_value.pkt__ta().is_bound()) return FALSE;
if((other_value.pkt__ta().ispresent() ? !single_value->field_pkt__ta.match((const PacketTimingAdvance&)other_value.pkt__ta(), legacy) : !single_value->field_pkt__ta.match_omit(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.pwr__ctrl__present().is_bound()) return FALSE;
if(!single_value->field_pwr__ctrl__present.match(other_value.pwr__ctrl__present(), legacy))return FALSE;
if(!other_value.pwr__ctrl().is_bound()) return FALSE;
if((other_value.pwr__ctrl().ispresent() ? !single_value->field_pwr__ctrl.match((const PowerControlParameters&)other_value.pwr__ctrl(), legacy) : !single_value->field_pwr__ctrl.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.UlAckNackEgprs.");
}
return FALSE;
}

boolean UlAckNackEgprs_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_msg__excape.is_bound()
 || single_value->field_ch__coding__cmd.is_bound()
 || single_value->field_resegment.is_bound()
 || single_value->field_preemptive__tx.is_bound()
 || single_value->field_prr__retrans__req.is_bound()
 || single_value->field_arac__retrans__req.is_bound()
 || single_value->field_cont__res__tlli__present.is_bound()
 || (single_value->field_cont__res__tlli.is_omit() || single_value->field_cont__res__tlli.is_bound())
 || single_value->field_tbf__est.is_bound()
 || single_value->field_pkt__ta__present.is_bound()
 || (single_value->field_pkt__ta.is_omit() || 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_pwr__ctrl__present.is_bound()
 || (single_value->field_pwr__ctrl.is_omit() || single_value->field_pwr__ctrl.is_bound());
}

boolean UlAckNackEgprs_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_msg__excape.is_value()
 && single_value->field_ch__coding__cmd.is_value()
 && single_value->field_resegment.is_value()
 && single_value->field_preemptive__tx.is_value()
 && single_value->field_prr__retrans__req.is_value()
 && single_value->field_arac__retrans__req.is_value()
 && single_value->field_cont__res__tlli__present.is_value()
 && (single_value->field_cont__res__tlli.is_omit() || single_value->field_cont__res__tlli.is_value())
 && single_value->field_tbf__est.is_value()
 && single_value->field_pkt__ta__present.is_value()
 && (single_value->field_pkt__ta.is_omit() || 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_pwr__ctrl__present.is_value()
 && (single_value->field_pwr__ctrl.is_omit() || single_value->field_pwr__ctrl.is_value());
}

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

UlAckNackEgprs UlAckNackEgprs_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.UlAckNackEgprs.");
UlAckNackEgprs ret_val;
if (single_value->field_msg__excape.is_bound()) {
ret_val.msg__excape() = single_value->field_msg__excape.valueof();
}
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_resegment.is_bound()) {
ret_val.resegment() = single_value->field_resegment.valueof();
}
if (single_value->field_preemptive__tx.is_bound()) {
ret_val.preemptive__tx() = single_value->field_preemptive__tx.valueof();
}
if (single_value->field_prr__retrans__req.is_bound()) {
ret_val.prr__retrans__req() = single_value->field_prr__retrans__req.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_cont__res__tlli__present.is_bound()) {
ret_val.cont__res__tlli__present() = single_value->field_cont__res__tlli__present.valueof();
}
if (single_value->field_cont__res__tlli.is_omit()) ret_val.cont__res__tlli() = OMIT_VALUE;
else if (single_value->field_cont__res__tlli.is_bound()) {
ret_val.cont__res__tlli() = single_value->field_cont__res__tlli.valueof();
}
if (single_value->field_tbf__est.is_bound()) {
ret_val.tbf__est() = single_value->field_tbf__est.valueof();
}
if (single_value->field_pkt__ta__present.is_bound()) {
ret_val.pkt__ta__present() = single_value->field_pkt__ta__present.valueof();
}
if (single_value->field_pkt__ta.is_omit()) ret_val.pkt__ta() = OMIT_VALUE;
else 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_pwr__ctrl__present.is_bound()) {
ret_val.pwr__ctrl__present() = single_value->field_pwr__ctrl__present.valueof();
}
if (single_value->field_pwr__ctrl.is_omit()) ret_val.pwr__ctrl() = OMIT_VALUE;
else if (single_value->field_pwr__ctrl.is_bound()) {
ret_val.pwr__ctrl() = single_value->field_pwr__ctrl.valueof();
}
return ret_val;
}

void UlAckNackEgprs_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.UlAckNackEgprs.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new UlAckNackEgprs_template[list_length];
}

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

BITSTRING_template& UlAckNackEgprs_template::msg__excape()
{
set_specific();
return single_value->field_msg__excape;
}

const BITSTRING_template& UlAckNackEgprs_template::msg__excape() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field msg_excape of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackEgprs.");
return single_value->field_msg__excape;
}

EgprsChCodingCommand_template& UlAckNackEgprs_template::ch__coding__cmd()
{
set_specific();
return single_value->field_ch__coding__cmd;
}

const EgprsChCodingCommand_template& UlAckNackEgprs_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.UlAckNackEgprs.");
return single_value->field_ch__coding__cmd;
}

BITSTRING_template& UlAckNackEgprs_template::resegment()
{
set_specific();
return single_value->field_resegment;
}

const BITSTRING_template& UlAckNackEgprs_template::resegment() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field resegment of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackEgprs.");
return single_value->field_resegment;
}

BITSTRING_template& UlAckNackEgprs_template::preemptive__tx()
{
set_specific();
return single_value->field_preemptive__tx;
}

const BITSTRING_template& UlAckNackEgprs_template::preemptive__tx() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field preemptive_tx of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackEgprs.");
return single_value->field_preemptive__tx;
}

BITSTRING_template& UlAckNackEgprs_template::prr__retrans__req()
{
set_specific();
return single_value->field_prr__retrans__req;
}

const BITSTRING_template& UlAckNackEgprs_template::prr__retrans__req() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field prr_retrans_req of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackEgprs.");
return single_value->field_prr__retrans__req;
}

BITSTRING_template& UlAckNackEgprs_template::arac__retrans__req()
{
set_specific();
return single_value->field_arac__retrans__req;
}

const BITSTRING_template& UlAckNackEgprs_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.UlAckNackEgprs.");
return single_value->field_arac__retrans__req;
}

BITSTRING_template& UlAckNackEgprs_template::cont__res__tlli__present()
{
set_specific();
return single_value->field_cont__res__tlli__present;
}

const BITSTRING_template& UlAckNackEgprs_template::cont__res__tlli__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field cont_res_tlli_present of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackEgprs.");
return single_value->field_cont__res__tlli__present;
}

OCTETSTRING_template& UlAckNackEgprs_template::cont__res__tlli()
{
set_specific();
return single_value->field_cont__res__tlli;
}

const OCTETSTRING_template& UlAckNackEgprs_template::cont__res__tlli() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field cont_res_tlli of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackEgprs.");
return single_value->field_cont__res__tlli;
}

BITSTRING_template& UlAckNackEgprs_template::tbf__est()
{
set_specific();
return single_value->field_tbf__est;
}

const BITSTRING_template& UlAckNackEgprs_template::tbf__est() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tbf_est of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackEgprs.");
return single_value->field_tbf__est;
}

BITSTRING_template& UlAckNackEgprs_template::pkt__ta__present()
{
set_specific();
return single_value->field_pkt__ta__present;
}

const BITSTRING_template& UlAckNackEgprs_template::pkt__ta__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pkt_ta_present of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackEgprs.");
return single_value->field_pkt__ta__present;
}

PacketTimingAdvance_template& UlAckNackEgprs_template::pkt__ta()
{
set_specific();
return single_value->field_pkt__ta;
}

const PacketTimingAdvance_template& UlAckNackEgprs_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.UlAckNackEgprs.");
return single_value->field_pkt__ta;
}

BITSTRING_template& UlAckNackEgprs_template::pkt__ext__ta__present()
{
set_specific();
return single_value->field_pkt__ext__ta__present;
}

const BITSTRING_template& UlAckNackEgprs_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.UlAckNackEgprs.");
return single_value->field_pkt__ext__ta__present;
}

BITSTRING_template& UlAckNackEgprs_template::pkt__ext__ta()
{
set_specific();
return single_value->field_pkt__ext__ta;
}

const BITSTRING_template& UlAckNackEgprs_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.UlAckNackEgprs.");
return single_value->field_pkt__ext__ta;
}

BITSTRING_template& UlAckNackEgprs_template::pwr__ctrl__present()
{
set_specific();
return single_value->field_pwr__ctrl__present;
}

const BITSTRING_template& UlAckNackEgprs_template::pwr__ctrl__present() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pwr_ctrl_present of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackEgprs.");
return single_value->field_pwr__ctrl__present;
}

PowerControlParameters_template& UlAckNackEgprs_template::pwr__ctrl()
{
set_specific();
return single_value->field_pwr__ctrl;
}

const PowerControlParameters_template& UlAckNackEgprs_template::pwr__ctrl() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pwr_ctrl of a non-specific template of type @RLCMAC_CSN1_Types.UlAckNackEgprs.");
return single_value->field_pwr__ctrl;
}

int UlAckNackEgprs_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.UlAckNackEgprs which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
  {    int ret_val = 11;
      if (single_value->field_cont__res__tlli.is_present()) ret_val++;
      if (single_value->field_pkt__ta.is_present()) ret_val++;
      if (single_value->field_pkt__ext__ta.is_present()) ret_val++;
      if (single_value->field_pwr__ctrl.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.UlAckNackEgprs 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.UlAckNackEgprs 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.UlAckNackEgprs containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.UlAckNackEgprs containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.UlAckNackEgprs containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.UlAckNackEgprs containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.UlAckNackEgprs containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @RLCMAC_CSN1_Types.UlAckNackEgprs containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @RLCMAC_CSN1_Types.UlAckNackEgprs.");
  }
  return 0;
}

void UlAckNackEgprs_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ msg_excape := ");
single_value->field_msg__excape.log();
TTCN_Logger::log_event_str(", ch_coding_cmd := ");
single_value->field_ch__coding__cmd.log();
TTCN_Logger::log_event_str(", resegment := ");
single_value->field_resegment.log();
TTCN_Logger::log_event_str(", preemptive_tx := ");
single_value->field_preemptive__tx.log();
TTCN_Logger::log_event_str(", prr_retrans_req := ");
single_value->field_prr__retrans__req.log();
TTCN_Logger::log_event_str(", arac_retrans_req := ");
single_value->field_arac__retrans__req.log();
TTCN_Logger::log_event_str(", cont_res_tlli_present := ");
single_value->field_cont__res__tlli__present.log();
TTCN_Logger::log_event_str(", cont_res_tlli := ");
single_value->field_cont__res__tlli.log();
TTCN_Logger::log_event_str(", tbf_est := ");
single_value->field_tbf__est.log();
TTCN_Logger::log_event_str(", pkt_ta_present := ");
single_value->field_pkt__ta__present.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(", pwr_ctrl_present := ");
single_value->field_pwr__ctrl__present.log();
TTCN_Logger::log_event_str(", pwr_ctrl := ");
single_value->field_pwr__ctrl.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 UlAckNackEgprs_template::log_match(const UlAckNackEgprs& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_msg__excape.match(match_value.msg__excape(), legacy)){
TTCN_Logger::log_logmatch_info(".msg_excape");
single_value->field_msg__excape.log_match(match_value.msg__excape(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
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_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_preemptive__tx.match(match_value.preemptive__tx(), legacy)){
TTCN_Logger::log_logmatch_info(".preemptive_tx");
single_value->field_preemptive__tx.log_match(match_value.preemptive__tx(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_prr__retrans__req.match(match_value.prr__retrans__req(), legacy)){
TTCN_Logger::log_logmatch_info(".prr_retrans_req");
single_value->field_prr__retrans__req.log_match(match_value.prr__retrans__req(), legacy);
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_cont__res__tlli__present.match(match_value.cont__res__tlli__present(), legacy)){
TTCN_Logger::log_logmatch_info(".cont_res_tlli_present");
single_value->field_cont__res__tlli__present.log_match(match_value.cont__res__tlli__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.cont__res__tlli().ispresent()){
if(!single_value->field_cont__res__tlli.match(match_value.cont__res__tlli(), legacy)){
TTCN_Logger::log_logmatch_info(".cont_res_tlli");
single_value->field_cont__res__tlli.log_match(match_value.cont__res__tlli(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_cont__res__tlli.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".cont_res_tlli := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_cont__res__tlli.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_tbf__est.match(match_value.tbf__est(), legacy)){
TTCN_Logger::log_logmatch_info(".tbf_est");
single_value->field_tbf__est.log_match(match_value.tbf__est(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pkt__ta__present.match(match_value.pkt__ta__present(), legacy)){
TTCN_Logger::log_logmatch_info(".pkt_ta_present");
single_value->field_pkt__ta__present.log_match(match_value.pkt__ta__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.pkt__ta().ispresent()){
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);
}
} else {
if (!single_value->field_pkt__ta.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".pkt_ta := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_pkt__ta.log();
TTCN_Logger::log_event_str(" unmatched");
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_pwr__ctrl__present.match(match_value.pwr__ctrl__present(), legacy)){
TTCN_Logger::log_logmatch_info(".pwr_ctrl_present");
single_value->field_pwr__ctrl__present.log_match(match_value.pwr__ctrl__present(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.pwr__ctrl().ispresent()){
if(!single_value->field_pwr__ctrl.match(match_value.pwr__ctrl(), legacy)){
TTCN_Logger::log_logmatch_info(".pwr_ctrl");
single_value->field_pwr__ctrl.log_match(match_value.pwr__ctrl(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_pwr__ctrl.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".pwr_ctrl := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_pwr__ctrl.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("{ msg_excape := ");
single_value->field_msg__excape.log_match(match_value.msg__excape(), legacy);
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(", resegment := ");
single_value->field_resegment.log_match(match_value.resegment(), legacy);
TTCN_Logger::log_event_str(", preemptive_tx := ");
single_value->field_preemptive__tx.log_match(match_value.preemptive__tx(), legacy);
TTCN_Logger::log_event_str(", prr_retrans_req := ");
single_value->field_prr__retrans__req.log_match(match_value.prr__retrans__req(), legacy);
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(", cont_res_tlli_present := ");
single_value->field_cont__res__tlli__present.log_match(match_value.cont__res__tlli__present(), legacy);
TTCN_Logger::log_event_str(", cont_res_tlli := ");
if (match_value.cont__res__tlli().ispresent()) {
single_value->field_cont__res__tlli.log_match(match_value.cont__res__tlli(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_cont__res__tlli.log();
if (single_value->field_cont__res__tlli.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", tbf_est := ");
single_value->field_tbf__est.log_match(match_value.tbf__est(), legacy);
TTCN_Logger::log_event_str(", pkt_ta_present := ");
single_value->field_pkt__ta__present.log_match(match_value.pkt__ta__present(), legacy);
TTCN_Logger::log_event_str(", pkt_ta := ");
if (match_value.pkt__ta().ispresent()) {
single_value->field_pkt__ta.log_match(match_value.pkt__ta(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_pkt__ta.log();
if (single_value->field_pkt__ta.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
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(", pwr_ctrl_present := ");
single_value->field_pwr__ctrl__present.log_match(match_value.pwr__ctrl__present(), legacy);
TTCN_Logger::log_event_str(", pwr_ctrl := ");
if (match_value.pwr__ctrl().ispresent()) {
single_value->field_pwr__ctrl.log_match(match_value.pwr__ctrl(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_pwr__ctrl.log();
if (single_value->field_pwr__ctrl.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 UlAckNackEgprs_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (msg__excape().is_bound()) msg__excape().set_implicit_omit();
if (ch__coding__cmd().is_bound()) ch__coding__cmd().set_implicit_omit();
if (resegment().is_bound()) resegment().set_implicit_omit();
if (preemptive__tx().is_bound()) preemptive__tx().set_implicit_omit();
if (prr__retrans__req().is_bound()) prr__retrans__req().set_implicit_omit();
if (arac__retrans__req().is_bound()) arac__retrans__req().set_implicit_omit();
if (cont__res__tlli__present().is_bound()) cont__res__tlli__present().set_implicit_omit();
if (!cont__res__tlli().is_bound()) cont__res__tlli() = OMIT_VALUE;
else cont__res__tlli().set_implicit_omit();
if (tbf__est().is_bound()) tbf__est().set_implicit_omit();
if (pkt__ta__present().is_bound()) pkt__ta__present().set_implicit_omit();
if (!pkt__ta().is_bound()) pkt__ta() = OMIT_VALUE;
else 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 (pwr__ctrl__present().is_bound()) pwr__ctrl__present().set_implicit_omit();
if (!pwr__ctrl().is_bound()) pwr__ctrl() = OMIT_VALUE;
else pwr__ctrl().set_implicit_omit();
}

void UlAckNackEgprs_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_msg__excape.encode_text(text_buf);
single_value->field_ch__coding__cmd.encode_text(text_buf);
single_value->field_resegment.encode_text(text_buf);
single_value->field_preemptive__tx.encode_text(text_buf);
single_value->field_prr__retrans__req.encode_text(text_buf);
single_value->field_arac__retrans__req.encode_text(text_buf);
single_value->field_cont__res__tlli__present.encode_text(text_buf);
single_value->field_cont__res__tlli.encode_text(text_buf);
single_value->field_tbf__est.encode_text(text_buf);
single_value->field_pkt__ta__present.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_pwr__ctrl__present.encode_text(text_buf);
single_value->field_pwr__ctrl.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.UlAckNackEgprs.");
}
}

void UlAckNackEgprs_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_msg__excape.decode_text(text_buf);
single_value->field_ch__coding__cmd.decode_text(text_buf);
single_value->field_resegment.decode_text(text_buf);
single_value->field_preemptive__tx.decode_text(text_buf);
single_value->field_prr__retrans__req.decode_text(text_buf);
single_value->field_arac__retrans__req.decode_text(text_buf);
single_value->field_cont__res__tlli__present.decode_text(text_buf);
single_value->field_cont__res__tlli.decode_text(text_buf);
single_value->field_tbf__est.decode_text(text_buf);
single_value->field_pkt__ta__present.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_pwr__ctrl__present.decode_text(text_buf);
single_value->field_pwr__ctrl.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 UlAckNackEgprs_template[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.UlAckNackEgprs.");
}
}

void UlAckNackEgprs_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: {
    UlAckNackEgprs_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 (15<param.get_size()) {
      param.error("record template of type @RLCMAC_CSN1_Types.UlAckNackEgprs has 15 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) msg__excape().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ch__coding__cmd().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) resegment().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) preemptive__tx().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) prr__retrans__req().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) arac__retrans__req().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) cont__res__tlli__present().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) cont__res__tlli().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) tbf__est().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) pkt__ta__present().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) pkt__ta().set_param(*param.get_elem(10));
    if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) pkt__ext__ta__present().set_param(*param.get_elem(11));
    if (param.get_size()>12 && param.get_elem(12)->get_type()!=Module_Param::MP_NotUsed) pkt__ext__ta().set_param(*param.get_elem(12));
    if (param.get_size()>13 && param.get_elem(13)->get_type()!=Module_Param::MP_NotUsed) pwr__ctrl__present().set_param(*param.get_elem(13));
    if (param.get_size()>14 && param.get_elem(14)->get_type()!=Module_Param::MP_NotUsed) pwr__ctrl().set_param(*param.get_elem(14));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "msg_excape")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          msg__excape().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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(), "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(), "preemptive_tx")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          preemptive__tx().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "prr_retrans_req")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          prr__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(), "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(), "cont_res_tlli_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cont__res__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(), "cont_res_tlli")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cont__res__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(), "tbf_est")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tbf__est().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pkt__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_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(), "pwr_ctrl_present")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pwr__ctrl__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(), "pwr_ctrl")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pwr__ctrl().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.UlAckNackEgprs: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    UlAckNackEgprs_template* precondition = new UlAckNackEgprs_template;
    precondition->set_param(*param.get_elem(0));
    UlAckNackEgprs_template* implied_template = new UlAckNackEgprs_template;
    implied_template->set_param(*param.get_elem(1));
    *this = UlAckNackEgprs_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.UlAckNackEgprs");
  }
  is_ifpresent = param.get_ifpresent();
}

void UlAckNackEgprs_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_msg__excape.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackEgprs");
single_value->field_ch__coding__cmd.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackEgprs");
single_value->field_resegment.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackEgprs");
single_value->field_preemptive__tx.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackEgprs");
single_value->field_prr__retrans__req.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackEgprs");
single_value->field_arac__retrans__req.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackEgprs");
single_value->field_cont__res__tlli__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackEgprs");
single_value->field_cont__res__tlli.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackEgprs");
single_value->field_tbf__est.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackEgprs");
single_value->field_pkt__ta__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackEgprs");
single_value->field_pkt__ta.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackEgprs");
single_value->field_pkt__ext__ta__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackEgprs");
single_value->field_pkt__ext__ta.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackEgprs");
single_value->field_pwr__ctrl__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackEgprs");
single_value->field_pwr__ctrl.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.UlAckNackEgprs");
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.UlAckNackEgprs");
}

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

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

PacketUlAckNack::PacketUlAckNack()
{
}

PacketUlAckNack::PacketUlAckNack(const PageMode& par_page__mode,
    const BITSTRING& par_msg__excape,
    const INTEGER& par_uplink__tfi,
    const BITSTRING& par_is__egprs,
    const OPTIONAL< UlAckNackGprs >& par_gprs,
    const OPTIONAL< UlAckNackEgprs >& par_egprs)
  :   field_page__mode(par_page__mode),
  field_msg__excape(par_msg__excape),
  field_uplink__tfi(par_uplink__tfi),
  field_is__egprs(par_is__egprs),
  field_gprs(par_gprs),
  field_egprs(par_egprs)
{
}

PacketUlAckNack::PacketUlAckNack(const PacketUlAckNack& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PacketUlAckNack.");
if (other_value.page__mode().is_bound()) field_page__mode = other_value.page__mode();
else field_page__mode.clean_up();
if (other_value.msg__excape().is_bound()) field_msg__excape = other_value.msg__excape();
else field_msg__excape.clean_up();
if (other_value.uplink__tfi().is_bound()) field_uplink__tfi = other_value.uplink__tfi();
else field_uplink__tfi.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 PacketUlAckNack::clean_up()
{
field_page__mode.clean_up();
field_msg__excape.clean_up();
field_uplink__tfi.clean_up();
field_is__egprs.clean_up();
field_gprs.clean_up();
field_egprs.clean_up();
}

const TTCN_Typedescriptor_t* PacketUlAckNack::get_descriptor() const { return &PacketUlAckNack_descr_; }
PacketUlAckNack& PacketUlAckNack::operator=(const PacketUlAckNack& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PacketUlAckNack.");
  if (other_value.page__mode().is_bound()) field_page__mode = other_value.page__mode();
  else field_page__mode.clean_up();
  if (other_value.msg__excape().is_bound()) field_msg__excape = other_value.msg__excape();
  else field_msg__excape.clean_up();
  if (other_value.uplink__tfi().is_bound()) field_uplink__tfi = other_value.uplink__tfi();
  else field_uplink__tfi.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 PacketUlAckNack::operator==(const PacketUlAckNack& other_value) const
{
return field_page__mode==other_value.field_page__mode
  && field_msg__excape==other_value.field_msg__excape
  && field_uplink__tfi==other_value.field_uplink__tfi
  && field_is__egprs==other_value.field_is__egprs
  && field_gprs==other_value.field_gprs
  && field_egprs==other_value.field_egprs;
}

boolean PacketUlAckNack::is_bound() const
{
return (field_page__mode.is_bound())
  || (field_msg__excape.is_bound())
  || (field_uplink__tfi.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 PacketUlAckNack::is_value() const
{
return field_page__mode.is_value()
  && field_msg__excape.is_value()
  && field_uplink__tfi.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 PacketUlAckNack::size_of() const
{
  int ret_val = 4;
  if (field_gprs.ispresent()) ret_val++;
  if (field_egprs.ispresent()) ret_val++;
  return ret_val;
}

void PacketUlAckNack::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(", msg_excape := ");
field_msg__excape.log();
TTCN_Logger::log_event_str(", uplink_tfi := ");
field_uplink__tfi.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 PacketUlAckNack::set_implicit_omit()
{
if (page__mode().is_bound()) page__mode().set_implicit_omit();
if (msg__excape().is_bound()) msg__excape().set_implicit_omit();
if (uplink__tfi().is_bound()) uplink__tfi().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 PacketUlAckNack::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.PacketUlAckNack 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) page__mode().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) msg__excape().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) uplink__tfi().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) is__egprs().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) gprs().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) egprs().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(), "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(), "msg_excape")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          msg__excape().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "uplink_tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          uplink__tfi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "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.PacketUlAckNack: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.PacketUlAckNack");
  }
}

void PacketUlAckNack::encode_text(Text_Buf& text_buf) const
{
field_page__mode.encode_text(text_buf);
field_msg__excape.encode_text(text_buf);
field_uplink__tfi.encode_text(text_buf);
field_is__egprs.encode_text(text_buf);
field_gprs.encode_text(text_buf);
field_egprs.encode_text(text_buf);
}

void PacketUlAckNack::decode_text(Text_Buf& text_buf)
{
field_page__mode.decode_text(text_buf);
field_msg__excape.decode_text(text_buf);
field_uplink__tfi.decode_text(text_buf);
field_is__egprs.decode_text(text_buf);
field_gprs.decode_text(text_buf);
field_egprs.decode_text(text_buf);
}

void PacketUlAckNack::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 PacketUlAckNack::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 PacketUlAckNack::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, PacketUlAckNack_page__mode_descr_.raw->forceomit);
  decoded_field_length = field_page__mode.RAW_decode(PacketUlAckNack_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, PacketUlAckNack_msg__excape_descr_.raw->forceomit);
  decoded_field_length = field_msg__excape.RAW_decode(PacketUlAckNack_msg__excape_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, PacketUlAckNack_uplink__tfi_descr_.raw->forceomit);
  decoded_field_length = field_uplink__tfi.RAW_decode(PacketUlAckNack_uplink__tfi_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_3_force_omit(3, force_omit, PacketUlAckNack_is__egprs_descr_.raw->forceomit);
  decoded_field_length = field_is__egprs.RAW_decode(PacketUlAckNack_is__egprs_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_is__egprs ==  bs_1){
  if (force_omit != NULL && (*force_omit)(4)) {
    field_gprs = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_4_force_omit(4, force_omit, PacketUlAckNack_gprs_descr_.raw->forceomit);
  decoded_field_length = field_gprs().RAW_decode(PacketUlAckNack_gprs_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_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)(5)) {
    field_egprs = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_5_force_omit(5, force_omit, PacketUlAckNack_egprs_descr_.raw->forceomit);
  decoded_field_length = field_egprs().RAW_decode(PacketUlAckNack_egprs_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_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 PacketUlAckNack::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, PacketUlAckNack_page__mode_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PacketUlAckNack_msg__excape_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PacketUlAckNack_uplink__tfi_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, PacketUlAckNack_is__egprs_descr_.raw);
  if (field_gprs.ispresent()) {
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, PacketUlAckNack_gprs_descr_.raw);
  }
  else myleaf.body.node.nodes[4] = NULL;
  if (field_egprs.ispresent()) {
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, PacketUlAckNack_egprs_descr_.raw);
  }
  else myleaf.body.node.nodes[5] = NULL;
  encoded_length += field_page__mode.RAW_encode(PacketUlAckNack_page__mode_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_msg__excape.RAW_encode(PacketUlAckNack_msg__excape_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_uplink__tfi.RAW_encode(PacketUlAckNack_uplink__tfi_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_is__egprs.RAW_encode(PacketUlAckNack_is__egprs_descr_, *myleaf.body.node.nodes[3]);
  if (field_gprs.ispresent()) {
  encoded_length += field_gprs().RAW_encode(PacketUlAckNack_gprs_descr_, *myleaf.body.node.nodes[4]);
  }
  if (field_egprs.ispresent()) {
  encoded_length += field_egprs().RAW_encode(PacketUlAckNack_egprs_descr_, *myleaf.body.node.nodes[5]);
  }
  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[]={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_1.RAW_encode(PacketUlAckNack_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[]={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(PacketUlAckNack_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 PacketUlAckNack_template::single_value_struct {
PageMode_template field_page__mode;
BITSTRING_template field_msg__excape;
INTEGER_template field_uplink__tfi;
BITSTRING_template field_is__egprs;
UlAckNackGprs_template field_gprs;
UlAckNackEgprs_template field_egprs;
};

void PacketUlAckNack_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_msg__excape = ANY_VALUE;
single_value->field_uplink__tfi = ANY_VALUE;
single_value->field_is__egprs = ANY_VALUE;
single_value->field_gprs = ANY_OR_OMIT;
single_value->field_egprs = ANY_OR_OMIT;
}
}
}

void PacketUlAckNack_template::copy_value(const PacketUlAckNack& 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.msg__excape().is_bound()) {
  single_value->field_msg__excape = other_value.msg__excape();
} else {
  single_value->field_msg__excape.clean_up();
}
if (other_value.uplink__tfi().is_bound()) {
  single_value->field_uplink__tfi = other_value.uplink__tfi();
} else {
  single_value->field_uplink__tfi.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 PacketUlAckNack_template::copy_template(const PacketUlAckNack_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.msg__excape().get_selection()) {
single_value->field_msg__excape = other_value.msg__excape();
} else {
single_value->field_msg__excape.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.uplink__tfi().get_selection()) {
single_value->field_uplink__tfi = other_value.uplink__tfi();
} else {
single_value->field_uplink__tfi.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 PacketUlAckNack_template[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 PacketUlAckNack_template(*other_value.implication_.precondition);
implication_.implied_template = new PacketUlAckNack_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.PacketUlAckNack.");
break;
}
set_selection(other_value);
}

PacketUlAckNack_template::PacketUlAckNack_template()
{
}

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

PacketUlAckNack_template::PacketUlAckNack_template(const PacketUlAckNack& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PacketUlAckNack_template::match(const PacketUlAckNack& 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.msg__excape().is_bound()) return FALSE;
if(!single_value->field_msg__excape.match(other_value.msg__excape(), legacy))return FALSE;
if(!other_value.uplink__tfi().is_bound()) return FALSE;
if(!single_value->field_uplink__tfi.match(other_value.uplink__tfi(), 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 UlAckNackGprs&)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 UlAckNackEgprs&)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.PacketUlAckNack.");
}
return FALSE;
}

boolean PacketUlAckNack_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_msg__excape.is_bound()
 || single_value->field_uplink__tfi.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 PacketUlAckNack_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_page__mode.is_value()
 && single_value->field_msg__excape.is_value()
 && single_value->field_uplink__tfi.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 PacketUlAckNack_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;
}

PacketUlAckNack PacketUlAckNack_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.PacketUlAckNack.");
PacketUlAckNack ret_val;
if (single_value->field_page__mode.is_bound()) {
ret_val.page__mode() = single_value->field_page__mode.valueof();
}
if (single_value->field_msg__excape.is_bound()) {
ret_val.msg__excape() = single_value->field_msg__excape.valueof();
}
if (single_value->field_uplink__tfi.is_bound()) {
ret_val.uplink__tfi() = single_value->field_uplink__tfi.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 PacketUlAckNack_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.PacketUlAckNack.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PacketUlAckNack_template[list_length];
}

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

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

const PageMode_template& PacketUlAckNack_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.PacketUlAckNack.");
return single_value->field_page__mode;
}

BITSTRING_template& PacketUlAckNack_template::msg__excape()
{
set_specific();
return single_value->field_msg__excape;
}

const BITSTRING_template& PacketUlAckNack_template::msg__excape() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field msg_excape of a non-specific template of type @RLCMAC_CSN1_Types.PacketUlAckNack.");
return single_value->field_msg__excape;
}

INTEGER_template& PacketUlAckNack_template::uplink__tfi()
{
set_specific();
return single_value->field_uplink__tfi;
}

const INTEGER_template& PacketUlAckNack_template::uplink__tfi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field uplink_tfi of a non-specific template of type @RLCMAC_CSN1_Types.PacketUlAckNack.");
return single_value->field_uplink__tfi;
}

BITSTRING_template& PacketUlAckNack_template::is__egprs()
{
set_specific();
return single_value->field_is__egprs;
}

const BITSTRING_template& PacketUlAckNack_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.PacketUlAckNack.");
return single_value->field_is__egprs;
}

UlAckNackGprs_template& PacketUlAckNack_template::gprs()
{
set_specific();
return single_value->field_gprs;
}

const UlAckNackGprs_template& PacketUlAckNack_template::gprs() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field gprs of a non-specific template of type @RLCMAC_CSN1_Types.PacketUlAckNack.");
return single_value->field_gprs;
}

UlAckNackEgprs_template& PacketUlAckNack_template::egprs()
{
set_specific();
return single_value->field_egprs;
}

const UlAckNackEgprs_template& PacketUlAckNack_template::egprs() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field egprs of a non-specific template of type @RLCMAC_CSN1_Types.PacketUlAckNack.");
return single_value->field_egprs;
}

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

void PacketUlAckNack_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(", msg_excape := ");
single_value->field_msg__excape.log();
TTCN_Logger::log_event_str(", uplink_tfi := ");
single_value->field_uplink__tfi.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 PacketUlAckNack_template::log_match(const PacketUlAckNack& 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_msg__excape.match(match_value.msg__excape(), legacy)){
TTCN_Logger::log_logmatch_info(".msg_excape");
single_value->field_msg__excape.log_match(match_value.msg__excape(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_uplink__tfi.match(match_value.uplink__tfi(), legacy)){
TTCN_Logger::log_logmatch_info(".uplink_tfi");
single_value->field_uplink__tfi.log_match(match_value.uplink__tfi(), 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(", msg_excape := ");
single_value->field_msg__excape.log_match(match_value.msg__excape(), legacy);
TTCN_Logger::log_event_str(", uplink_tfi := ");
single_value->field_uplink__tfi.log_match(match_value.uplink__tfi(), 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 PacketUlAckNack_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (page__mode().is_bound()) page__mode().set_implicit_omit();
if (msg__excape().is_bound()) msg__excape().set_implicit_omit();
if (uplink__tfi().is_bound()) uplink__tfi().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 PacketUlAckNack_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_msg__excape.encode_text(text_buf);
single_value->field_uplink__tfi.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.PacketUlAckNack.");
}
}

void PacketUlAckNack_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_msg__excape.decode_text(text_buf);
single_value->field_uplink__tfi.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 PacketUlAckNack_template[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.PacketUlAckNack.");
}
}

void PacketUlAckNack_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: {
    PacketUlAckNack_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.PacketUlAckNack 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) page__mode().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) msg__excape().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) uplink__tfi().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) is__egprs().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) gprs().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) egprs().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(), "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(), "msg_excape")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          msg__excape().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "uplink_tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          uplink__tfi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "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.PacketUlAckNack: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PacketUlAckNack_template* precondition = new PacketUlAckNack_template;
    precondition->set_param(*param.get_elem(0));
    PacketUlAckNack_template* implied_template = new PacketUlAckNack_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PacketUlAckNack_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.PacketUlAckNack");
  }
  is_ifpresent = param.get_ifpresent();
}

void PacketUlAckNack_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.PacketUlAckNack");
single_value->field_msg__excape.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketUlAckNack");
single_value->field_uplink__tfi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketUlAckNack");
single_value->field_is__egprs.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketUlAckNack");
single_value->field_gprs.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketUlAckNack");
single_value->field_egprs.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketUlAckNack");
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.PacketUlAckNack");
}

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

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

PacketDlDummy::PacketDlDummy()
{
}

PacketDlDummy::PacketDlDummy(const PageMode& par_page__mode,
    const BITSTRING& par_persistence__levels__present,
    const OPTIONAL< PersistenceLevels >& par_persistence__levels)
  :   field_page__mode(par_page__mode),
  field_persistence__levels__present(par_persistence__levels__present),
  field_persistence__levels(par_persistence__levels)
{
}

PacketDlDummy::PacketDlDummy(const PacketDlDummy& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PacketDlDummy.");
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();
}

void PacketDlDummy::clean_up()
{
field_page__mode.clean_up();
field_persistence__levels__present.clean_up();
field_persistence__levels.clean_up();
}

const TTCN_Typedescriptor_t* PacketDlDummy::get_descriptor() const { return &PacketDlDummy_descr_; }
PacketDlDummy& PacketDlDummy::operator=(const PacketDlDummy& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PacketDlDummy.");
  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();
}
return *this;
}

boolean PacketDlDummy::operator==(const PacketDlDummy& 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;
}

boolean PacketDlDummy::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());
}
boolean PacketDlDummy::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());
}
int PacketDlDummy::size_of() const
{
  int ret_val = 2;
  if (field_persistence__levels.ispresent()) ret_val++;
  return ret_val;
}

void PacketDlDummy::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(" }");
}

void PacketDlDummy::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();
}

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

void PacketDlDummy::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);
}

void PacketDlDummy::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);
}

void PacketDlDummy::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 PacketDlDummy::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 PacketDlDummy::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, PacketDlDummy_page__mode_descr_.raw->forceomit);
  decoded_field_length = field_page__mode.RAW_decode(PacketDlDummy_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, PacketDlDummy_persistence__levels__present_descr_.raw->forceomit);
  decoded_field_length = field_persistence__levels__present.RAW_decode(PacketDlDummy_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, PacketDlDummy_persistence__levels_descr_.raw->forceomit);
  decoded_field_length = field_persistence__levels().RAW_decode(PacketDlDummy_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;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int PacketDlDummy::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, PacketDlDummy_page__mode_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PacketDlDummy_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, PacketDlDummy_persistence__levels_descr_.raw);
  }
  else myleaf.body.node.nodes[2] = NULL;
  encoded_length += field_page__mode.RAW_encode(PacketDlDummy_page__mode_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_persistence__levels__present.RAW_encode(PacketDlDummy_persistence__levels__present_descr_, *myleaf.body.node.nodes[1]);
  if (field_persistence__levels.ispresent()) {
  encoded_length += field_persistence__levels().RAW_encode(PacketDlDummy_persistence__levels_descr_, *myleaf.body.node.nodes[2]);
  }
  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(PacketDlDummy_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);
  }
  }
  return myleaf.length = encoded_length;
}

struct PacketDlDummy_template::single_value_struct {
PageMode_template field_page__mode;
BITSTRING_template field_persistence__levels__present;
PersistenceLevels_template field_persistence__levels;
};

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

void PacketDlDummy_template::copy_value(const PacketDlDummy& 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();
}
set_selection(SPECIFIC_VALUE);
}

void PacketDlDummy_template::copy_template(const PacketDlDummy_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();
}
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 PacketDlDummy_template[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 PacketDlDummy_template(*other_value.implication_.precondition);
implication_.implied_template = new PacketDlDummy_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.PacketDlDummy.");
break;
}
set_selection(other_value);
}

PacketDlDummy_template::PacketDlDummy_template()
{
}

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

PacketDlDummy_template::PacketDlDummy_template(const PacketDlDummy& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

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

boolean PacketDlDummy_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());
}

boolean PacketDlDummy_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());
}

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

PacketDlDummy PacketDlDummy_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.PacketDlDummy.");
PacketDlDummy 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();
}
return ret_val;
}

void PacketDlDummy_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.PacketDlDummy.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PacketDlDummy_template[list_length];
}

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

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

const PageMode_template& PacketDlDummy_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.PacketDlDummy.");
return single_value->field_page__mode;
}

BITSTRING_template& PacketDlDummy_template::persistence__levels__present()
{
set_specific();
return single_value->field_persistence__levels__present;
}

const BITSTRING_template& PacketDlDummy_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.PacketDlDummy.");
return single_value->field_persistence__levels__present;
}

PersistenceLevels_template& PacketDlDummy_template::persistence__levels()
{
set_specific();
return single_value->field_persistence__levels;
}

const PersistenceLevels_template& PacketDlDummy_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.PacketDlDummy.");
return single_value->field_persistence__levels;
}

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

void PacketDlDummy_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(" }");
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 PacketDlDummy_template::log_match(const PacketDlDummy& 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);
}
}
}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(" }");
} 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 PacketDlDummy_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();
}

void PacketDlDummy_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);
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.PacketDlDummy.");
}
}

void PacketDlDummy_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);
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 PacketDlDummy_template[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.PacketDlDummy.");
}
}

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

void PacketDlDummy_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.PacketDlDummy");
single_value->field_persistence__levels__present.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketDlDummy");
single_value->field_persistence__levels.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketDlDummy");
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.PacketDlDummy");
}

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

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

GlobalPwrCtrlParams::GlobalPwrCtrlParams()
{
}

GlobalPwrCtrlParams::GlobalPwrCtrlParams(const INTEGER& par_alpha,
    const INTEGER& par_t__avg__v,
    const INTEGER& par_t__avg__t,
    const INTEGER& par_pb,
    const BITSTRING& par_pc__meas__chan,
    const BITSTRING& par_spare,
    const INTEGER& par_n__avg__i)
  :   field_alpha(par_alpha),
  field_t__avg__v(par_t__avg__v),
  field_t__avg__t(par_t__avg__t),
  field_pb(par_pb),
  field_pc__meas__chan(par_pc__meas__chan),
  field_spare(par_spare),
  field_n__avg__i(par_n__avg__i)
{
}

GlobalPwrCtrlParams::GlobalPwrCtrlParams(const GlobalPwrCtrlParams& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.GlobalPwrCtrlParams.");
if (other_value.alpha().is_bound()) field_alpha = other_value.alpha();
else field_alpha.clean_up();
if (other_value.t__avg__v().is_bound()) field_t__avg__v = other_value.t__avg__v();
else field_t__avg__v.clean_up();
if (other_value.t__avg__t().is_bound()) field_t__avg__t = other_value.t__avg__t();
else field_t__avg__t.clean_up();
if (other_value.pb().is_bound()) field_pb = other_value.pb();
else field_pb.clean_up();
if (other_value.pc__meas__chan().is_bound()) field_pc__meas__chan = other_value.pc__meas__chan();
else field_pc__meas__chan.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.n__avg__i().is_bound()) field_n__avg__i = other_value.n__avg__i();
else field_n__avg__i.clean_up();
}

void GlobalPwrCtrlParams::clean_up()
{
field_alpha.clean_up();
field_t__avg__v.clean_up();
field_t__avg__t.clean_up();
field_pb.clean_up();
field_pc__meas__chan.clean_up();
field_spare.clean_up();
field_n__avg__i.clean_up();
}

const TTCN_Typedescriptor_t* GlobalPwrCtrlParams::get_descriptor() const { return &GlobalPwrCtrlParams_descr_; }
GlobalPwrCtrlParams& GlobalPwrCtrlParams::operator=(const GlobalPwrCtrlParams& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.GlobalPwrCtrlParams.");
  if (other_value.alpha().is_bound()) field_alpha = other_value.alpha();
  else field_alpha.clean_up();
  if (other_value.t__avg__v().is_bound()) field_t__avg__v = other_value.t__avg__v();
  else field_t__avg__v.clean_up();
  if (other_value.t__avg__t().is_bound()) field_t__avg__t = other_value.t__avg__t();
  else field_t__avg__t.clean_up();
  if (other_value.pb().is_bound()) field_pb = other_value.pb();
  else field_pb.clean_up();
  if (other_value.pc__meas__chan().is_bound()) field_pc__meas__chan = other_value.pc__meas__chan();
  else field_pc__meas__chan.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.n__avg__i().is_bound()) field_n__avg__i = other_value.n__avg__i();
  else field_n__avg__i.clean_up();
}
return *this;
}

boolean GlobalPwrCtrlParams::operator==(const GlobalPwrCtrlParams& other_value) const
{
return field_alpha==other_value.field_alpha
  && field_t__avg__v==other_value.field_t__avg__v
  && field_t__avg__t==other_value.field_t__avg__t
  && field_pb==other_value.field_pb
  && field_pc__meas__chan==other_value.field_pc__meas__chan
  && field_spare==other_value.field_spare
  && field_n__avg__i==other_value.field_n__avg__i;
}

boolean GlobalPwrCtrlParams::is_bound() const
{
return (field_alpha.is_bound())
  || (field_t__avg__v.is_bound())
  || (field_t__avg__t.is_bound())
  || (field_pb.is_bound())
  || (field_pc__meas__chan.is_bound())
  || (field_spare.is_bound())
  || (field_n__avg__i.is_bound());
}
boolean GlobalPwrCtrlParams::is_value() const
{
return field_alpha.is_value()
  && field_t__avg__v.is_value()
  && field_t__avg__t.is_value()
  && field_pb.is_value()
  && field_pc__meas__chan.is_value()
  && field_spare.is_value()
  && field_n__avg__i.is_value();
}
void GlobalPwrCtrlParams::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(", t_avg_v := ");
field_t__avg__v.log();
TTCN_Logger::log_event_str(", t_avg_t := ");
field_t__avg__t.log();
TTCN_Logger::log_event_str(", pb := ");
field_pb.log();
TTCN_Logger::log_event_str(", pc_meas_chan := ");
field_pc__meas__chan.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(", n_avg_i := ");
field_n__avg__i.log();
TTCN_Logger::log_event_str(" }");
}

void GlobalPwrCtrlParams::set_implicit_omit()
{
if (alpha().is_bound()) alpha().set_implicit_omit();
if (t__avg__v().is_bound()) t__avg__v().set_implicit_omit();
if (t__avg__t().is_bound()) t__avg__t().set_implicit_omit();
if (pb().is_bound()) pb().set_implicit_omit();
if (pc__meas__chan().is_bound()) pc__meas__chan().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (n__avg__i().is_bound()) n__avg__i().set_implicit_omit();
}

void GlobalPwrCtrlParams::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.GlobalPwrCtrlParams 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) alpha().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) t__avg__v().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) t__avg__t().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) pb().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) pc__meas__chan().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) n__avg__i().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(), "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(), "t_avg_v")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          t__avg__v().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "t_avg_t")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          t__avg__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(), "pb")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pb().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pc_meas_chan")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pc__meas__chan().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "n_avg_i")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          n__avg__i().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.GlobalPwrCtrlParams: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.GlobalPwrCtrlParams");
  }
}

void GlobalPwrCtrlParams::encode_text(Text_Buf& text_buf) const
{
field_alpha.encode_text(text_buf);
field_t__avg__v.encode_text(text_buf);
field_t__avg__t.encode_text(text_buf);
field_pb.encode_text(text_buf);
field_pc__meas__chan.encode_text(text_buf);
field_spare.encode_text(text_buf);
field_n__avg__i.encode_text(text_buf);
}

void GlobalPwrCtrlParams::decode_text(Text_Buf& text_buf)
{
field_alpha.decode_text(text_buf);
field_t__avg__v.decode_text(text_buf);
field_t__avg__t.decode_text(text_buf);
field_pb.decode_text(text_buf);
field_pc__meas__chan.decode_text(text_buf);
field_spare.decode_text(text_buf);
field_n__avg__i.decode_text(text_buf);
}

void GlobalPwrCtrlParams::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 GlobalPwrCtrlParams::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 GlobalPwrCtrlParams::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, GlobalPwrCtrlParams_alpha_descr_.raw->forceomit);
  decoded_field_length = field_alpha.RAW_decode(GlobalPwrCtrlParams_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, GlobalPwrCtrlParams_t__avg__v_descr_.raw->forceomit);
  decoded_field_length = field_t__avg__v.RAW_decode(GlobalPwrCtrlParams_t__avg__v_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, GlobalPwrCtrlParams_t__avg__t_descr_.raw->forceomit);
  decoded_field_length = field_t__avg__t.RAW_decode(GlobalPwrCtrlParams_t__avg__t_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_3_force_omit(3, force_omit, GlobalPwrCtrlParams_pb_descr_.raw->forceomit);
  decoded_field_length = field_pb.RAW_decode(GlobalPwrCtrlParams_pb_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, GlobalPwrCtrlParams_pc__meas__chan_descr_.raw->forceomit);
  decoded_field_length = field_pc__meas__chan.RAW_decode(GlobalPwrCtrlParams_pc__meas__chan_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, GlobalPwrCtrlParams_spare_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(GlobalPwrCtrlParams_spare_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, GlobalPwrCtrlParams_n__avg__i_descr_.raw->forceomit);
  decoded_field_length = field_n__avg__i.RAW_decode(GlobalPwrCtrlParams_n__avg__i_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 GlobalPwrCtrlParams::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, GlobalPwrCtrlParams_alpha_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, GlobalPwrCtrlParams_t__avg__v_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, GlobalPwrCtrlParams_t__avg__t_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, GlobalPwrCtrlParams_pb_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, GlobalPwrCtrlParams_pc__meas__chan_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, GlobalPwrCtrlParams_spare_descr_.raw);
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, GlobalPwrCtrlParams_n__avg__i_descr_.raw);
  encoded_length += field_alpha.RAW_encode(GlobalPwrCtrlParams_alpha_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_t__avg__v.RAW_encode(GlobalPwrCtrlParams_t__avg__v_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_t__avg__t.RAW_encode(GlobalPwrCtrlParams_t__avg__t_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_pb.RAW_encode(GlobalPwrCtrlParams_pb_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_pc__meas__chan.RAW_encode(GlobalPwrCtrlParams_pc__meas__chan_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_spare.RAW_encode(GlobalPwrCtrlParams_spare_descr_, *myleaf.body.node.nodes[5]);
  encoded_length += field_n__avg__i.RAW_encode(GlobalPwrCtrlParams_n__avg__i_descr_, *myleaf.body.node.nodes[6]);
  return myleaf.length = encoded_length;
}

struct GlobalPwrCtrlParams_template::single_value_struct {
INTEGER_template field_alpha;
INTEGER_template field_t__avg__v;
INTEGER_template field_t__avg__t;
INTEGER_template field_pb;
BITSTRING_template field_pc__meas__chan;
BITSTRING_template field_spare;
INTEGER_template field_n__avg__i;
};

void GlobalPwrCtrlParams_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_t__avg__v = ANY_VALUE;
single_value->field_t__avg__t = ANY_VALUE;
single_value->field_pb = ANY_VALUE;
single_value->field_pc__meas__chan = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
single_value->field_n__avg__i = ANY_VALUE;
}
}
}

void GlobalPwrCtrlParams_template::copy_value(const GlobalPwrCtrlParams& 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.t__avg__v().is_bound()) {
  single_value->field_t__avg__v = other_value.t__avg__v();
} else {
  single_value->field_t__avg__v.clean_up();
}
if (other_value.t__avg__t().is_bound()) {
  single_value->field_t__avg__t = other_value.t__avg__t();
} else {
  single_value->field_t__avg__t.clean_up();
}
if (other_value.pb().is_bound()) {
  single_value->field_pb = other_value.pb();
} else {
  single_value->field_pb.clean_up();
}
if (other_value.pc__meas__chan().is_bound()) {
  single_value->field_pc__meas__chan = other_value.pc__meas__chan();
} else {
  single_value->field_pc__meas__chan.clean_up();
}
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
if (other_value.n__avg__i().is_bound()) {
  single_value->field_n__avg__i = other_value.n__avg__i();
} else {
  single_value->field_n__avg__i.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void GlobalPwrCtrlParams_template::copy_template(const GlobalPwrCtrlParams_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.t__avg__v().get_selection()) {
single_value->field_t__avg__v = other_value.t__avg__v();
} else {
single_value->field_t__avg__v.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.t__avg__t().get_selection()) {
single_value->field_t__avg__t = other_value.t__avg__t();
} else {
single_value->field_t__avg__t.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pb().get_selection()) {
single_value->field_pb = other_value.pb();
} else {
single_value->field_pb.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pc__meas__chan().get_selection()) {
single_value->field_pc__meas__chan = other_value.pc__meas__chan();
} else {
single_value->field_pc__meas__chan.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.n__avg__i().get_selection()) {
single_value->field_n__avg__i = other_value.n__avg__i();
} else {
single_value->field_n__avg__i.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 GlobalPwrCtrlParams_template[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 GlobalPwrCtrlParams_template(*other_value.implication_.precondition);
implication_.implied_template = new GlobalPwrCtrlParams_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.GlobalPwrCtrlParams.");
break;
}
set_selection(other_value);
}

GlobalPwrCtrlParams_template::GlobalPwrCtrlParams_template()
{
}

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

GlobalPwrCtrlParams_template::GlobalPwrCtrlParams_template(const GlobalPwrCtrlParams& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean GlobalPwrCtrlParams_template::match(const GlobalPwrCtrlParams& 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.t__avg__v().is_bound()) return FALSE;
if(!single_value->field_t__avg__v.match(other_value.t__avg__v(), legacy))return FALSE;
if(!other_value.t__avg__t().is_bound()) return FALSE;
if(!single_value->field_t__avg__t.match(other_value.t__avg__t(), legacy))return FALSE;
if(!other_value.pb().is_bound()) return FALSE;
if(!single_value->field_pb.match(other_value.pb(), legacy))return FALSE;
if(!other_value.pc__meas__chan().is_bound()) return FALSE;
if(!single_value->field_pc__meas__chan.match(other_value.pc__meas__chan(), legacy))return FALSE;
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
if(!other_value.n__avg__i().is_bound()) return FALSE;
if(!single_value->field_n__avg__i.match(other_value.n__avg__i(), 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.GlobalPwrCtrlParams.");
}
return FALSE;
}

boolean GlobalPwrCtrlParams_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_t__avg__v.is_bound()
 || single_value->field_t__avg__t.is_bound()
 || single_value->field_pb.is_bound()
 || single_value->field_pc__meas__chan.is_bound()
 || single_value->field_spare.is_bound()
 || single_value->field_n__avg__i.is_bound();
}

boolean GlobalPwrCtrlParams_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_alpha.is_value()
 && single_value->field_t__avg__v.is_value()
 && single_value->field_t__avg__t.is_value()
 && single_value->field_pb.is_value()
 && single_value->field_pc__meas__chan.is_value()
 && single_value->field_spare.is_value()
 && single_value->field_n__avg__i.is_value();
}

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

GlobalPwrCtrlParams GlobalPwrCtrlParams_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.GlobalPwrCtrlParams.");
GlobalPwrCtrlParams ret_val;
if (single_value->field_alpha.is_bound()) {
ret_val.alpha() = single_value->field_alpha.valueof();
}
if (single_value->field_t__avg__v.is_bound()) {
ret_val.t__avg__v() = single_value->field_t__avg__v.valueof();
}
if (single_value->field_t__avg__t.is_bound()) {
ret_val.t__avg__t() = single_value->field_t__avg__t.valueof();
}
if (single_value->field_pb.is_bound()) {
ret_val.pb() = single_value->field_pb.valueof();
}
if (single_value->field_pc__meas__chan.is_bound()) {
ret_val.pc__meas__chan() = single_value->field_pc__meas__chan.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_n__avg__i.is_bound()) {
ret_val.n__avg__i() = single_value->field_n__avg__i.valueof();
}
return ret_val;
}

void GlobalPwrCtrlParams_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.GlobalPwrCtrlParams.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new GlobalPwrCtrlParams_template[list_length];
}

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

INTEGER_template& GlobalPwrCtrlParams_template::alpha()
{
set_specific();
return single_value->field_alpha;
}

const INTEGER_template& GlobalPwrCtrlParams_template::alpha() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field alpha of a non-specific template of type @RLCMAC_CSN1_Types.GlobalPwrCtrlParams.");
return single_value->field_alpha;
}

INTEGER_template& GlobalPwrCtrlParams_template::t__avg__v()
{
set_specific();
return single_value->field_t__avg__v;
}

const INTEGER_template& GlobalPwrCtrlParams_template::t__avg__v() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field t_avg_v of a non-specific template of type @RLCMAC_CSN1_Types.GlobalPwrCtrlParams.");
return single_value->field_t__avg__v;
}

INTEGER_template& GlobalPwrCtrlParams_template::t__avg__t()
{
set_specific();
return single_value->field_t__avg__t;
}

const INTEGER_template& GlobalPwrCtrlParams_template::t__avg__t() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field t_avg_t of a non-specific template of type @RLCMAC_CSN1_Types.GlobalPwrCtrlParams.");
return single_value->field_t__avg__t;
}

INTEGER_template& GlobalPwrCtrlParams_template::pb()
{
set_specific();
return single_value->field_pb;
}

const INTEGER_template& GlobalPwrCtrlParams_template::pb() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pb of a non-specific template of type @RLCMAC_CSN1_Types.GlobalPwrCtrlParams.");
return single_value->field_pb;
}

BITSTRING_template& GlobalPwrCtrlParams_template::pc__meas__chan()
{
set_specific();
return single_value->field_pc__meas__chan;
}

const BITSTRING_template& GlobalPwrCtrlParams_template::pc__meas__chan() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pc_meas_chan of a non-specific template of type @RLCMAC_CSN1_Types.GlobalPwrCtrlParams.");
return single_value->field_pc__meas__chan;
}

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

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

INTEGER_template& GlobalPwrCtrlParams_template::n__avg__i()
{
set_specific();
return single_value->field_n__avg__i;
}

const INTEGER_template& GlobalPwrCtrlParams_template::n__avg__i() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field n_avg_i of a non-specific template of type @RLCMAC_CSN1_Types.GlobalPwrCtrlParams.");
return single_value->field_n__avg__i;
}

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

void GlobalPwrCtrlParams_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(", t_avg_v := ");
single_value->field_t__avg__v.log();
TTCN_Logger::log_event_str(", t_avg_t := ");
single_value->field_t__avg__t.log();
TTCN_Logger::log_event_str(", pb := ");
single_value->field_pb.log();
TTCN_Logger::log_event_str(", pc_meas_chan := ");
single_value->field_pc__meas__chan.log();
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(", n_avg_i := ");
single_value->field_n__avg__i.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 GlobalPwrCtrlParams_template::log_match(const GlobalPwrCtrlParams& 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_t__avg__v.match(match_value.t__avg__v(), legacy)){
TTCN_Logger::log_logmatch_info(".t_avg_v");
single_value->field_t__avg__v.log_match(match_value.t__avg__v(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_t__avg__t.match(match_value.t__avg__t(), legacy)){
TTCN_Logger::log_logmatch_info(".t_avg_t");
single_value->field_t__avg__t.log_match(match_value.t__avg__t(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pb.match(match_value.pb(), legacy)){
TTCN_Logger::log_logmatch_info(".pb");
single_value->field_pb.log_match(match_value.pb(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pc__meas__chan.match(match_value.pc__meas__chan(), legacy)){
TTCN_Logger::log_logmatch_info(".pc_meas_chan");
single_value->field_pc__meas__chan.log_match(match_value.pc__meas__chan(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_n__avg__i.match(match_value.n__avg__i(), legacy)){
TTCN_Logger::log_logmatch_info(".n_avg_i");
single_value->field_n__avg__i.log_match(match_value.n__avg__i(), 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(", t_avg_v := ");
single_value->field_t__avg__v.log_match(match_value.t__avg__v(), legacy);
TTCN_Logger::log_event_str(", t_avg_t := ");
single_value->field_t__avg__t.log_match(match_value.t__avg__t(), legacy);
TTCN_Logger::log_event_str(", pb := ");
single_value->field_pb.log_match(match_value.pb(), legacy);
TTCN_Logger::log_event_str(", pc_meas_chan := ");
single_value->field_pc__meas__chan.log_match(match_value.pc__meas__chan(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(", n_avg_i := ");
single_value->field_n__avg__i.log_match(match_value.n__avg__i(), 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 GlobalPwrCtrlParams_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (alpha().is_bound()) alpha().set_implicit_omit();
if (t__avg__v().is_bound()) t__avg__v().set_implicit_omit();
if (t__avg__t().is_bound()) t__avg__t().set_implicit_omit();
if (pb().is_bound()) pb().set_implicit_omit();
if (pc__meas__chan().is_bound()) pc__meas__chan().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (n__avg__i().is_bound()) n__avg__i().set_implicit_omit();
}

void GlobalPwrCtrlParams_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_t__avg__v.encode_text(text_buf);
single_value->field_t__avg__t.encode_text(text_buf);
single_value->field_pb.encode_text(text_buf);
single_value->field_pc__meas__chan.encode_text(text_buf);
single_value->field_spare.encode_text(text_buf);
single_value->field_n__avg__i.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.GlobalPwrCtrlParams.");
}
}

void GlobalPwrCtrlParams_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_t__avg__v.decode_text(text_buf);
single_value->field_t__avg__t.decode_text(text_buf);
single_value->field_pb.decode_text(text_buf);
single_value->field_pc__meas__chan.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
single_value->field_n__avg__i.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 GlobalPwrCtrlParams_template[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.GlobalPwrCtrlParams.");
}
}

void GlobalPwrCtrlParams_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: {
    GlobalPwrCtrlParams_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.GlobalPwrCtrlParams 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) alpha().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) t__avg__v().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) t__avg__t().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) pb().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) pc__meas__chan().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) n__avg__i().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(), "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(), "t_avg_v")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          t__avg__v().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "t_avg_t")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          t__avg__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(), "pb")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pb().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pc_meas_chan")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pc__meas__chan().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "n_avg_i")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          n__avg__i().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.GlobalPwrCtrlParams: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    GlobalPwrCtrlParams_template* precondition = new GlobalPwrCtrlParams_template;
    precondition->set_param(*param.get_elem(0));
    GlobalPwrCtrlParams_template* implied_template = new GlobalPwrCtrlParams_template;
    implied_template->set_param(*param.get_elem(1));
    *this = GlobalPwrCtrlParams_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.GlobalPwrCtrlParams");
  }
  is_ifpresent = param.get_ifpresent();
}

void GlobalPwrCtrlParams_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.GlobalPwrCtrlParams");
single_value->field_t__avg__v.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.GlobalPwrCtrlParams");
single_value->field_t__avg__t.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.GlobalPwrCtrlParams");
single_value->field_pb.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.GlobalPwrCtrlParams");
single_value->field_pc__meas__chan.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.GlobalPwrCtrlParams");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.GlobalPwrCtrlParams");
single_value->field_n__avg__i.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.GlobalPwrCtrlParams");
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.GlobalPwrCtrlParams");
}

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

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

TimingAdvanceIdxTN::TimingAdvanceIdxTN()
{
}

TimingAdvanceIdxTN::TimingAdvanceIdxTN(const INTEGER& par_ta__idx,
    const INTEGER& par_ts__num)
  :   field_ta__idx(par_ta__idx),
  field_ts__num(par_ts__num)
{
}

TimingAdvanceIdxTN::TimingAdvanceIdxTN(const TimingAdvanceIdxTN& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.TimingAdvanceIdxTN.");
if (other_value.ta__idx().is_bound()) field_ta__idx = other_value.ta__idx();
else field_ta__idx.clean_up();
if (other_value.ts__num().is_bound()) field_ts__num = other_value.ts__num();
else field_ts__num.clean_up();
}

void TimingAdvanceIdxTN::clean_up()
{
field_ta__idx.clean_up();
field_ts__num.clean_up();
}

const TTCN_Typedescriptor_t* TimingAdvanceIdxTN::get_descriptor() const { return &TimingAdvanceIdxTN_descr_; }
TimingAdvanceIdxTN& TimingAdvanceIdxTN::operator=(const TimingAdvanceIdxTN& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.TimingAdvanceIdxTN.");
  if (other_value.ta__idx().is_bound()) field_ta__idx = other_value.ta__idx();
  else field_ta__idx.clean_up();
  if (other_value.ts__num().is_bound()) field_ts__num = other_value.ts__num();
  else field_ts__num.clean_up();
}
return *this;
}

boolean TimingAdvanceIdxTN::operator==(const TimingAdvanceIdxTN& other_value) const
{
return field_ta__idx==other_value.field_ta__idx
  && field_ts__num==other_value.field_ts__num;
}

boolean TimingAdvanceIdxTN::is_bound() const
{
return (field_ta__idx.is_bound())
  || (field_ts__num.is_bound());
}
boolean TimingAdvanceIdxTN::is_value() const
{
return field_ta__idx.is_value()
  && field_ts__num.is_value();
}
void TimingAdvanceIdxTN::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ ta_idx := ");
field_ta__idx.log();
TTCN_Logger::log_event_str(", ts_num := ");
field_ts__num.log();
TTCN_Logger::log_event_str(" }");
}

void TimingAdvanceIdxTN::set_implicit_omit()
{
if (ta__idx().is_bound()) ta__idx().set_implicit_omit();
if (ts__num().is_bound()) ts__num().set_implicit_omit();
}

void TimingAdvanceIdxTN::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.TimingAdvanceIdxTN has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) ta__idx().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ts__num().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ta_idx")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ta__idx().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ts_num")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ts__num().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.TimingAdvanceIdxTN: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.TimingAdvanceIdxTN");
  }
}

void TimingAdvanceIdxTN::encode_text(Text_Buf& text_buf) const
{
field_ta__idx.encode_text(text_buf);
field_ts__num.encode_text(text_buf);
}

void TimingAdvanceIdxTN::decode_text(Text_Buf& text_buf)
{
field_ta__idx.decode_text(text_buf);
field_ts__num.decode_text(text_buf);
}

void TimingAdvanceIdxTN::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 TimingAdvanceIdxTN::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 TimingAdvanceIdxTN::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, TimingAdvanceIdxTN_ta__idx_descr_.raw->forceomit);
  decoded_field_length = field_ta__idx.RAW_decode(TimingAdvanceIdxTN_ta__idx_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, TimingAdvanceIdxTN_ts__num_descr_.raw->forceomit);
  decoded_field_length = field_ts__num.RAW_decode(TimingAdvanceIdxTN_ts__num_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 TimingAdvanceIdxTN::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, TimingAdvanceIdxTN_ta__idx_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, TimingAdvanceIdxTN_ts__num_descr_.raw);
  encoded_length += field_ta__idx.RAW_encode(TimingAdvanceIdxTN_ta__idx_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ts__num.RAW_encode(TimingAdvanceIdxTN_ts__num_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct TimingAdvanceIdxTN_template::single_value_struct {
INTEGER_template field_ta__idx;
INTEGER_template field_ts__num;
};

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

void TimingAdvanceIdxTN_template::copy_value(const TimingAdvanceIdxTN& other_value)
{
single_value = new single_value_struct;
if (other_value.ta__idx().is_bound()) {
  single_value->field_ta__idx = other_value.ta__idx();
} else {
  single_value->field_ta__idx.clean_up();
}
if (other_value.ts__num().is_bound()) {
  single_value->field_ts__num = other_value.ts__num();
} else {
  single_value->field_ts__num.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void TimingAdvanceIdxTN_template::copy_template(const TimingAdvanceIdxTN_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.ta__idx().get_selection()) {
single_value->field_ta__idx = other_value.ta__idx();
} else {
single_value->field_ta__idx.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ts__num().get_selection()) {
single_value->field_ts__num = other_value.ts__num();
} else {
single_value->field_ts__num.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 TimingAdvanceIdxTN_template[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 TimingAdvanceIdxTN_template(*other_value.implication_.precondition);
implication_.implied_template = new TimingAdvanceIdxTN_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.TimingAdvanceIdxTN.");
break;
}
set_selection(other_value);
}

TimingAdvanceIdxTN_template::TimingAdvanceIdxTN_template()
{
}

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

TimingAdvanceIdxTN_template::TimingAdvanceIdxTN_template(const TimingAdvanceIdxTN& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean TimingAdvanceIdxTN_template::match(const TimingAdvanceIdxTN& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.ta__idx().is_bound()) return FALSE;
if(!single_value->field_ta__idx.match(other_value.ta__idx(), legacy))return FALSE;
if(!other_value.ts__num().is_bound()) return FALSE;
if(!single_value->field_ts__num.match(other_value.ts__num(), 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.TimingAdvanceIdxTN.");
}
return FALSE;
}

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

boolean TimingAdvanceIdxTN_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_ta__idx.is_value()
 && single_value->field_ts__num.is_value();
}

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

TimingAdvanceIdxTN TimingAdvanceIdxTN_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.TimingAdvanceIdxTN.");
TimingAdvanceIdxTN ret_val;
if (single_value->field_ta__idx.is_bound()) {
ret_val.ta__idx() = single_value->field_ta__idx.valueof();
}
if (single_value->field_ts__num.is_bound()) {
ret_val.ts__num() = single_value->field_ts__num.valueof();
}
return ret_val;
}

void TimingAdvanceIdxTN_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.TimingAdvanceIdxTN.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new TimingAdvanceIdxTN_template[list_length];
}

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

INTEGER_template& TimingAdvanceIdxTN_template::ta__idx()
{
set_specific();
return single_value->field_ta__idx;
}

const INTEGER_template& TimingAdvanceIdxTN_template::ta__idx() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ta_idx of a non-specific template of type @RLCMAC_CSN1_Types.TimingAdvanceIdxTN.");
return single_value->field_ta__idx;
}

INTEGER_template& TimingAdvanceIdxTN_template::ts__num()
{
set_specific();
return single_value->field_ts__num;
}

const INTEGER_template& TimingAdvanceIdxTN_template::ts__num() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ts_num of a non-specific template of type @RLCMAC_CSN1_Types.TimingAdvanceIdxTN.");
return single_value->field_ts__num;
}

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

void TimingAdvanceIdxTN_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ ta_idx := ");
single_value->field_ta__idx.log();
TTCN_Logger::log_event_str(", ts_num := ");
single_value->field_ts__num.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 TimingAdvanceIdxTN_template::log_match(const TimingAdvanceIdxTN& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_ta__idx.match(match_value.ta__idx(), legacy)){
TTCN_Logger::log_logmatch_info(".ta_idx");
single_value->field_ta__idx.log_match(match_value.ta__idx(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ts__num.match(match_value.ts__num(), legacy)){
TTCN_Logger::log_logmatch_info(".ts_num");
single_value->field_ts__num.log_match(match_value.ts__num(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ ta_idx := ");
single_value->field_ta__idx.log_match(match_value.ta__idx(), legacy);
TTCN_Logger::log_event_str(", ts_num := ");
single_value->field_ts__num.log_match(match_value.ts__num(), 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 TimingAdvanceIdxTN_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (ta__idx().is_bound()) ta__idx().set_implicit_omit();
if (ts__num().is_bound()) ts__num().set_implicit_omit();
}

void TimingAdvanceIdxTN_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_ta__idx.encode_text(text_buf);
single_value->field_ts__num.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.TimingAdvanceIdxTN.");
}
}

void TimingAdvanceIdxTN_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_ta__idx.decode_text(text_buf);
single_value->field_ts__num.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 TimingAdvanceIdxTN_template[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.TimingAdvanceIdxTN.");
}
}

void TimingAdvanceIdxTN_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: {
    TimingAdvanceIdxTN_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.TimingAdvanceIdxTN has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) ta__idx().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ts__num().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ta_idx")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ta__idx().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ts_num")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ts__num().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.TimingAdvanceIdxTN: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    TimingAdvanceIdxTN_template* precondition = new TimingAdvanceIdxTN_template;
    precondition->set_param(*param.get_elem(0));
    TimingAdvanceIdxTN_template* implied_template = new TimingAdvanceIdxTN_template;
    implied_template->set_param(*param.get_elem(1));
    *this = TimingAdvanceIdxTN_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.TimingAdvanceIdxTN");
  }
  is_ifpresent = param.get_ifpresent();
}

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

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

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

GlobalPacketTA::GlobalPacketTA()
{
}

GlobalPacketTA::GlobalPacketTA(const BITSTRING& par_ta__val__presence,
    const OPTIONAL< INTEGER >& par_ta__val,
    const BITSTRING& par_ul__presence,
    const OPTIONAL< TimingAdvanceIdxTN >& par_ul,
    const BITSTRING& par_dl__presence,
    const OPTIONAL< TimingAdvanceIdxTN >& par_dl)
  :   field_ta__val__presence(par_ta__val__presence),
  field_ta__val(par_ta__val),
  field_ul__presence(par_ul__presence),
  field_ul(par_ul),
  field_dl__presence(par_dl__presence),
  field_dl(par_dl)
{
}

GlobalPacketTA::GlobalPacketTA(const GlobalPacketTA& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.GlobalPacketTA.");
if (other_value.ta__val__presence().is_bound()) field_ta__val__presence = other_value.ta__val__presence();
else field_ta__val__presence.clean_up();
if (other_value.ta__val().is_bound()) field_ta__val = other_value.ta__val();
else field_ta__val.clean_up();
if (other_value.ul__presence().is_bound()) field_ul__presence = other_value.ul__presence();
else field_ul__presence.clean_up();
if (other_value.ul().is_bound()) field_ul = other_value.ul();
else field_ul.clean_up();
if (other_value.dl__presence().is_bound()) field_dl__presence = other_value.dl__presence();
else field_dl__presence.clean_up();
if (other_value.dl().is_bound()) field_dl = other_value.dl();
else field_dl.clean_up();
}

void GlobalPacketTA::clean_up()
{
field_ta__val__presence.clean_up();
field_ta__val.clean_up();
field_ul__presence.clean_up();
field_ul.clean_up();
field_dl__presence.clean_up();
field_dl.clean_up();
}

const TTCN_Typedescriptor_t* GlobalPacketTA::get_descriptor() const { return &GlobalPacketTA_descr_; }
GlobalPacketTA& GlobalPacketTA::operator=(const GlobalPacketTA& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.GlobalPacketTA.");
  if (other_value.ta__val__presence().is_bound()) field_ta__val__presence = other_value.ta__val__presence();
  else field_ta__val__presence.clean_up();
  if (other_value.ta__val().is_bound()) field_ta__val = other_value.ta__val();
  else field_ta__val.clean_up();
  if (other_value.ul__presence().is_bound()) field_ul__presence = other_value.ul__presence();
  else field_ul__presence.clean_up();
  if (other_value.ul().is_bound()) field_ul = other_value.ul();
  else field_ul.clean_up();
  if (other_value.dl__presence().is_bound()) field_dl__presence = other_value.dl__presence();
  else field_dl__presence.clean_up();
  if (other_value.dl().is_bound()) field_dl = other_value.dl();
  else field_dl.clean_up();
}
return *this;
}

boolean GlobalPacketTA::operator==(const GlobalPacketTA& other_value) const
{
return field_ta__val__presence==other_value.field_ta__val__presence
  && field_ta__val==other_value.field_ta__val
  && field_ul__presence==other_value.field_ul__presence
  && field_ul==other_value.field_ul
  && field_dl__presence==other_value.field_dl__presence
  && field_dl==other_value.field_dl;
}

boolean GlobalPacketTA::is_bound() const
{
return (field_ta__val__presence.is_bound())
  || (OPTIONAL_OMIT == field_ta__val.get_selection() || field_ta__val.is_bound())
  || (field_ul__presence.is_bound())
  || (OPTIONAL_OMIT == field_ul.get_selection() || field_ul.is_bound())
  || (field_dl__presence.is_bound())
  || (OPTIONAL_OMIT == field_dl.get_selection() || field_dl.is_bound());
}
boolean GlobalPacketTA::is_value() const
{
return field_ta__val__presence.is_value()
  && (OPTIONAL_OMIT == field_ta__val.get_selection() || field_ta__val.is_value())
  && field_ul__presence.is_value()
  && (OPTIONAL_OMIT == field_ul.get_selection() || field_ul.is_value())
  && field_dl__presence.is_value()
  && (OPTIONAL_OMIT == field_dl.get_selection() || field_dl.is_value());
}
int GlobalPacketTA::size_of() const
{
  int ret_val = 3;
  if (field_ta__val.ispresent()) ret_val++;
  if (field_ul.ispresent()) ret_val++;
  if (field_dl.ispresent()) ret_val++;
  return ret_val;
}

void GlobalPacketTA::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ ta_val_presence := ");
field_ta__val__presence.log();
TTCN_Logger::log_event_str(", ta_val := ");
field_ta__val.log();
TTCN_Logger::log_event_str(", ul_presence := ");
field_ul__presence.log();
TTCN_Logger::log_event_str(", ul := ");
field_ul.log();
TTCN_Logger::log_event_str(", dl_presence := ");
field_dl__presence.log();
TTCN_Logger::log_event_str(", dl := ");
field_dl.log();
TTCN_Logger::log_event_str(" }");
}

void GlobalPacketTA::set_implicit_omit()
{
if (ta__val__presence().is_bound()) ta__val__presence().set_implicit_omit();
if (!ta__val().is_bound()) ta__val() = OMIT_VALUE;
else ta__val().set_implicit_omit();
if (ul__presence().is_bound()) ul__presence().set_implicit_omit();
if (!ul().is_bound()) ul() = OMIT_VALUE;
else ul().set_implicit_omit();
if (dl__presence().is_bound()) dl__presence().set_implicit_omit();
if (!dl().is_bound()) dl() = OMIT_VALUE;
else dl().set_implicit_omit();
}

void GlobalPacketTA::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.GlobalPacketTA 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) ta__val__presence().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ta__val().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ul__presence().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) ul().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) dl__presence().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) dl().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(), "ta_val_presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ta__val__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(), "ta_val")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ta__val().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ul_presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ul__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(), "ul")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ul().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "dl_presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          dl__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(), "dl")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          dl().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.GlobalPacketTA: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.GlobalPacketTA");
  }
}

void GlobalPacketTA::encode_text(Text_Buf& text_buf) const
{
field_ta__val__presence.encode_text(text_buf);
field_ta__val.encode_text(text_buf);
field_ul__presence.encode_text(text_buf);
field_ul.encode_text(text_buf);
field_dl__presence.encode_text(text_buf);
field_dl.encode_text(text_buf);
}

void GlobalPacketTA::decode_text(Text_Buf& text_buf)
{
field_ta__val__presence.decode_text(text_buf);
field_ta__val.decode_text(text_buf);
field_ul__presence.decode_text(text_buf);
field_ul.decode_text(text_buf);
field_dl__presence.decode_text(text_buf);
field_dl.decode_text(text_buf);
}

void GlobalPacketTA::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 GlobalPacketTA::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 GlobalPacketTA::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, GlobalPacketTA_ta__val__presence_descr_.raw->forceomit);
  decoded_field_length = field_ta__val__presence.RAW_decode(GlobalPacketTA_ta__val__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_ta__val__presence ==  bs_0){
  if (force_omit != NULL && (*force_omit)(1)) {
    field_ta__val = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_1_force_omit(1, force_omit, GlobalPacketTA_ta__val_descr_.raw->forceomit);
  decoded_field_length = field_ta__val().RAW_decode(GlobalPacketTA_ta__val_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 1) {
  field_ta__val = 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_ta__val=OMIT_VALUE;
  RAW_Force_Omit field_2_force_omit(2, force_omit, GlobalPacketTA_ul__presence_descr_.raw->forceomit);
  decoded_field_length = field_ul__presence.RAW_decode(GlobalPacketTA_ul__presence_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_ul__presence ==  bs_0){
  if (force_omit != NULL && (*force_omit)(3)) {
    field_ul = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_3_force_omit(3, force_omit, GlobalPacketTA_ul_descr_.raw->forceomit);
  decoded_field_length = field_ul().RAW_decode(GlobalPacketTA_ul_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 1) {
  field_ul = 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=OMIT_VALUE;
  RAW_Force_Omit field_4_force_omit(4, force_omit, GlobalPacketTA_dl__presence_descr_.raw->forceomit);
  decoded_field_length = field_dl__presence.RAW_decode(GlobalPacketTA_dl__presence_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_dl__presence ==  bs_0){
  if (force_omit != NULL && (*force_omit)(5)) {
    field_dl = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_5_force_omit(5, force_omit, GlobalPacketTA_dl_descr_.raw->forceomit);
  decoded_field_length = field_dl().RAW_decode(GlobalPacketTA_dl_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 1) {
  field_dl = 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_dl=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int GlobalPacketTA::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, GlobalPacketTA_ta__val__presence_descr_.raw);
  if (field_ta__val.ispresent()) {
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, GlobalPacketTA_ta__val_descr_.raw);
  }
  else myleaf.body.node.nodes[1] = NULL;
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, GlobalPacketTA_ul__presence_descr_.raw);
  if (field_ul.ispresent()) {
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, GlobalPacketTA_ul_descr_.raw);
  }
  else myleaf.body.node.nodes[3] = NULL;
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, GlobalPacketTA_dl__presence_descr_.raw);
  if (field_dl.ispresent()) {
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, GlobalPacketTA_dl_descr_.raw);
  }
  else myleaf.body.node.nodes[5] = NULL;
  encoded_length += field_ta__val__presence.RAW_encode(GlobalPacketTA_ta__val__presence_descr_, *myleaf.body.node.nodes[0]);
  if (field_ta__val.ispresent()) {
  encoded_length += field_ta__val().RAW_encode(GlobalPacketTA_ta__val_descr_, *myleaf.body.node.nodes[1]);
  }
  encoded_length += field_ul__presence.RAW_encode(GlobalPacketTA_ul__presence_descr_, *myleaf.body.node.nodes[2]);
  if (field_ul.ispresent()) {
  encoded_length += field_ul().RAW_encode(GlobalPacketTA_ul_descr_, *myleaf.body.node.nodes[3]);
  }
  encoded_length += field_dl__presence.RAW_encode(GlobalPacketTA_dl__presence_descr_, *myleaf.body.node.nodes[4]);
  if (field_dl.ispresent()) {
  encoded_length += field_dl().RAW_encode(GlobalPacketTA_dl_descr_, *myleaf.body.node.nodes[5]);
  }
  if (field_ta__val.ispresent() && (field_ta__val__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(GlobalPacketTA_ta__val__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_ul.ispresent() && (field_ul__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[]={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(GlobalPacketTA_ul__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_dl.ispresent() && (field_dl__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[]={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(GlobalPacketTA_dl__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 GlobalPacketTA_template::single_value_struct {
BITSTRING_template field_ta__val__presence;
INTEGER_template field_ta__val;
BITSTRING_template field_ul__presence;
TimingAdvanceIdxTN_template field_ul;
BITSTRING_template field_dl__presence;
TimingAdvanceIdxTN_template field_dl;
};

void GlobalPacketTA_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_ta__val__presence = ANY_VALUE;
single_value->field_ta__val = ANY_OR_OMIT;
single_value->field_ul__presence = ANY_VALUE;
single_value->field_ul = ANY_OR_OMIT;
single_value->field_dl__presence = ANY_VALUE;
single_value->field_dl = ANY_OR_OMIT;
}
}
}

void GlobalPacketTA_template::copy_value(const GlobalPacketTA& other_value)
{
single_value = new single_value_struct;
if (other_value.ta__val__presence().is_bound()) {
  single_value->field_ta__val__presence = other_value.ta__val__presence();
} else {
  single_value->field_ta__val__presence.clean_up();
}
if (other_value.ta__val().is_bound()) {
  if (other_value.ta__val().ispresent()) single_value->field_ta__val = other_value.ta__val()();
  else single_value->field_ta__val = OMIT_VALUE;
} else {
  single_value->field_ta__val.clean_up();
}
if (other_value.ul__presence().is_bound()) {
  single_value->field_ul__presence = other_value.ul__presence();
} else {
  single_value->field_ul__presence.clean_up();
}
if (other_value.ul().is_bound()) {
  if (other_value.ul().ispresent()) single_value->field_ul = other_value.ul()();
  else single_value->field_ul = OMIT_VALUE;
} else {
  single_value->field_ul.clean_up();
}
if (other_value.dl__presence().is_bound()) {
  single_value->field_dl__presence = other_value.dl__presence();
} else {
  single_value->field_dl__presence.clean_up();
}
if (other_value.dl().is_bound()) {
  if (other_value.dl().ispresent()) single_value->field_dl = other_value.dl()();
  else single_value->field_dl = OMIT_VALUE;
} else {
  single_value->field_dl.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void GlobalPacketTA_template::copy_template(const GlobalPacketTA_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.ta__val__presence().get_selection()) {
single_value->field_ta__val__presence = other_value.ta__val__presence();
} else {
single_value->field_ta__val__presence.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ta__val().get_selection()) {
single_value->field_ta__val = other_value.ta__val();
} else {
single_value->field_ta__val.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ul__presence().get_selection()) {
single_value->field_ul__presence = other_value.ul__presence();
} else {
single_value->field_ul__presence.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ul().get_selection()) {
single_value->field_ul = other_value.ul();
} else {
single_value->field_ul.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.dl__presence().get_selection()) {
single_value->field_dl__presence = other_value.dl__presence();
} else {
single_value->field_dl__presence.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.dl().get_selection()) {
single_value->field_dl = other_value.dl();
} else {
single_value->field_dl.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 GlobalPacketTA_template[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 GlobalPacketTA_template(*other_value.implication_.precondition);
implication_.implied_template = new GlobalPacketTA_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.GlobalPacketTA.");
break;
}
set_selection(other_value);
}

GlobalPacketTA_template::GlobalPacketTA_template()
{
}

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

GlobalPacketTA_template::GlobalPacketTA_template(const GlobalPacketTA& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean GlobalPacketTA_template::match(const GlobalPacketTA& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.ta__val__presence().is_bound()) return FALSE;
if(!single_value->field_ta__val__presence.match(other_value.ta__val__presence(), legacy))return FALSE;
if(!other_value.ta__val().is_bound()) return FALSE;
if((other_value.ta__val().ispresent() ? !single_value->field_ta__val.match((const INTEGER&)other_value.ta__val(), legacy) : !single_value->field_ta__val.match_omit(legacy)))return FALSE;
if(!other_value.ul__presence().is_bound()) return FALSE;
if(!single_value->field_ul__presence.match(other_value.ul__presence(), legacy))return FALSE;
if(!other_value.ul().is_bound()) return FALSE;
if((other_value.ul().ispresent() ? !single_value->field_ul.match((const TimingAdvanceIdxTN&)other_value.ul(), legacy) : !single_value->field_ul.match_omit(legacy)))return FALSE;
if(!other_value.dl__presence().is_bound()) return FALSE;
if(!single_value->field_dl__presence.match(other_value.dl__presence(), legacy))return FALSE;
if(!other_value.dl().is_bound()) return FALSE;
if((other_value.dl().ispresent() ? !single_value->field_dl.match((const TimingAdvanceIdxTN&)other_value.dl(), legacy) : !single_value->field_dl.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.GlobalPacketTA.");
}
return FALSE;
}

boolean GlobalPacketTA_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_ta__val__presence.is_bound()
 || (single_value->field_ta__val.is_omit() || single_value->field_ta__val.is_bound())
 || single_value->field_ul__presence.is_bound()
 || (single_value->field_ul.is_omit() || single_value->field_ul.is_bound())
 || single_value->field_dl__presence.is_bound()
 || (single_value->field_dl.is_omit() || single_value->field_dl.is_bound());
}

boolean GlobalPacketTA_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_ta__val__presence.is_value()
 && (single_value->field_ta__val.is_omit() || single_value->field_ta__val.is_value())
 && single_value->field_ul__presence.is_value()
 && (single_value->field_ul.is_omit() || single_value->field_ul.is_value())
 && single_value->field_dl__presence.is_value()
 && (single_value->field_dl.is_omit() || single_value->field_dl.is_value());
}

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

GlobalPacketTA GlobalPacketTA_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.GlobalPacketTA.");
GlobalPacketTA ret_val;
if (single_value->field_ta__val__presence.is_bound()) {
ret_val.ta__val__presence() = single_value->field_ta__val__presence.valueof();
}
if (single_value->field_ta__val.is_omit()) ret_val.ta__val() = OMIT_VALUE;
else if (single_value->field_ta__val.is_bound()) {
ret_val.ta__val() = single_value->field_ta__val.valueof();
}
if (single_value->field_ul__presence.is_bound()) {
ret_val.ul__presence() = single_value->field_ul__presence.valueof();
}
if (single_value->field_ul.is_omit()) ret_val.ul() = OMIT_VALUE;
else if (single_value->field_ul.is_bound()) {
ret_val.ul() = single_value->field_ul.valueof();
}
if (single_value->field_dl__presence.is_bound()) {
ret_val.dl__presence() = single_value->field_dl__presence.valueof();
}
if (single_value->field_dl.is_omit()) ret_val.dl() = OMIT_VALUE;
else if (single_value->field_dl.is_bound()) {
ret_val.dl() = single_value->field_dl.valueof();
}
return ret_val;
}

void GlobalPacketTA_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.GlobalPacketTA.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new GlobalPacketTA_template[list_length];
}

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

BITSTRING_template& GlobalPacketTA_template::ta__val__presence()
{
set_specific();
return single_value->field_ta__val__presence;
}

const BITSTRING_template& GlobalPacketTA_template::ta__val__presence() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ta_val_presence of a non-specific template of type @RLCMAC_CSN1_Types.GlobalPacketTA.");
return single_value->field_ta__val__presence;
}

INTEGER_template& GlobalPacketTA_template::ta__val()
{
set_specific();
return single_value->field_ta__val;
}

const INTEGER_template& GlobalPacketTA_template::ta__val() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ta_val of a non-specific template of type @RLCMAC_CSN1_Types.GlobalPacketTA.");
return single_value->field_ta__val;
}

BITSTRING_template& GlobalPacketTA_template::ul__presence()
{
set_specific();
return single_value->field_ul__presence;
}

const BITSTRING_template& GlobalPacketTA_template::ul__presence() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ul_presence of a non-specific template of type @RLCMAC_CSN1_Types.GlobalPacketTA.");
return single_value->field_ul__presence;
}

TimingAdvanceIdxTN_template& GlobalPacketTA_template::ul()
{
set_specific();
return single_value->field_ul;
}

const TimingAdvanceIdxTN_template& GlobalPacketTA_template::ul() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ul of a non-specific template of type @RLCMAC_CSN1_Types.GlobalPacketTA.");
return single_value->field_ul;
}

BITSTRING_template& GlobalPacketTA_template::dl__presence()
{
set_specific();
return single_value->field_dl__presence;
}

const BITSTRING_template& GlobalPacketTA_template::dl__presence() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field dl_presence of a non-specific template of type @RLCMAC_CSN1_Types.GlobalPacketTA.");
return single_value->field_dl__presence;
}

TimingAdvanceIdxTN_template& GlobalPacketTA_template::dl()
{
set_specific();
return single_value->field_dl;
}

const TimingAdvanceIdxTN_template& GlobalPacketTA_template::dl() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field dl of a non-specific template of type @RLCMAC_CSN1_Types.GlobalPacketTA.");
return single_value->field_dl;
}

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

void GlobalPacketTA_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ ta_val_presence := ");
single_value->field_ta__val__presence.log();
TTCN_Logger::log_event_str(", ta_val := ");
single_value->field_ta__val.log();
TTCN_Logger::log_event_str(", ul_presence := ");
single_value->field_ul__presence.log();
TTCN_Logger::log_event_str(", ul := ");
single_value->field_ul.log();
TTCN_Logger::log_event_str(", dl_presence := ");
single_value->field_dl__presence.log();
TTCN_Logger::log_event_str(", dl := ");
single_value->field_dl.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 GlobalPacketTA_template::log_match(const GlobalPacketTA& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_ta__val__presence.match(match_value.ta__val__presence(), legacy)){
TTCN_Logger::log_logmatch_info(".ta_val_presence");
single_value->field_ta__val__presence.log_match(match_value.ta__val__presence(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.ta__val().ispresent()){
if(!single_value->field_ta__val.match(match_value.ta__val(), legacy)){
TTCN_Logger::log_logmatch_info(".ta_val");
single_value->field_ta__val.log_match(match_value.ta__val(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_ta__val.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".ta_val := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_ta__val.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_ul__presence.match(match_value.ul__presence(), legacy)){
TTCN_Logger::log_logmatch_info(".ul_presence");
single_value->field_ul__presence.log_match(match_value.ul__presence(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.ul().ispresent()){
if(!single_value->field_ul.match(match_value.ul(), legacy)){
TTCN_Logger::log_logmatch_info(".ul");
single_value->field_ul.log_match(match_value.ul(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_ul.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".ul := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_ul.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_dl__presence.match(match_value.dl__presence(), legacy)){
TTCN_Logger::log_logmatch_info(".dl_presence");
single_value->field_dl__presence.log_match(match_value.dl__presence(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.dl().ispresent()){
if(!single_value->field_dl.match(match_value.dl(), legacy)){
TTCN_Logger::log_logmatch_info(".dl");
single_value->field_dl.log_match(match_value.dl(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_dl.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".dl := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_dl.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("{ ta_val_presence := ");
single_value->field_ta__val__presence.log_match(match_value.ta__val__presence(), legacy);
TTCN_Logger::log_event_str(", ta_val := ");
if (match_value.ta__val().ispresent()) {
single_value->field_ta__val.log_match(match_value.ta__val(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_ta__val.log();
if (single_value->field_ta__val.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", ul_presence := ");
single_value->field_ul__presence.log_match(match_value.ul__presence(), legacy);
TTCN_Logger::log_event_str(", ul := ");
if (match_value.ul().ispresent()) {
single_value->field_ul.log_match(match_value.ul(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_ul.log();
if (single_value->field_ul.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", dl_presence := ");
single_value->field_dl__presence.log_match(match_value.dl__presence(), legacy);
TTCN_Logger::log_event_str(", dl := ");
if (match_value.dl().ispresent()) {
single_value->field_dl.log_match(match_value.dl(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_dl.log();
if (single_value->field_dl.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 GlobalPacketTA_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (ta__val__presence().is_bound()) ta__val__presence().set_implicit_omit();
if (!ta__val().is_bound()) ta__val() = OMIT_VALUE;
else ta__val().set_implicit_omit();
if (ul__presence().is_bound()) ul__presence().set_implicit_omit();
if (!ul().is_bound()) ul() = OMIT_VALUE;
else ul().set_implicit_omit();
if (dl__presence().is_bound()) dl__presence().set_implicit_omit();
if (!dl().is_bound()) dl() = OMIT_VALUE;
else dl().set_implicit_omit();
}

void GlobalPacketTA_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_ta__val__presence.encode_text(text_buf);
single_value->field_ta__val.encode_text(text_buf);
single_value->field_ul__presence.encode_text(text_buf);
single_value->field_ul.encode_text(text_buf);
single_value->field_dl__presence.encode_text(text_buf);
single_value->field_dl.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.GlobalPacketTA.");
}
}

void GlobalPacketTA_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_ta__val__presence.decode_text(text_buf);
single_value->field_ta__val.decode_text(text_buf);
single_value->field_ul__presence.decode_text(text_buf);
single_value->field_ul.decode_text(text_buf);
single_value->field_dl__presence.decode_text(text_buf);
single_value->field_dl.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 GlobalPacketTA_template[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.GlobalPacketTA.");
}
}

void GlobalPacketTA_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: {
    GlobalPacketTA_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.GlobalPacketTA 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) ta__val__presence().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ta__val().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ul__presence().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) ul().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) dl__presence().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) dl().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(), "ta_val_presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ta__val__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(), "ta_val")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ta__val().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ul_presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ul__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(), "ul")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ul().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "dl_presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          dl__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(), "dl")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          dl().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.GlobalPacketTA: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    GlobalPacketTA_template* precondition = new GlobalPacketTA_template;
    precondition->set_param(*param.get_elem(0));
    GlobalPacketTA_template* implied_template = new GlobalPacketTA_template;
    implied_template->set_param(*param.get_elem(1));
    *this = GlobalPacketTA_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.GlobalPacketTA");
  }
  is_ifpresent = param.get_ifpresent();
}

void GlobalPacketTA_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_ta__val__presence.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.GlobalPacketTA");
single_value->field_ta__val.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.GlobalPacketTA");
single_value->field_ul__presence.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.GlobalPacketTA");
single_value->field_ul.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.GlobalPacketTA");
single_value->field_dl__presence.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.GlobalPacketTA");
single_value->field_dl.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.GlobalPacketTA");
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.GlobalPacketTA");
}

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

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

PacketPwrControlTAMsg::PacketPwrControlTAMsg()
{
}

PacketPwrControlTAMsg::PacketPwrControlTAMsg(const BITSTRING& par_g__pwr__ctrl__presence,
    const OPTIONAL< GlobalPwrCtrlParams >& par_g__pwr__ctrl,
    const BITSTRING& par_split,
    const OPTIONAL< BITSTRING >& par_split__desc,
    const OPTIONAL< GlobalPacketTA >& par_g__pkt__ta,
    const OPTIONAL< PowerControlParameters >& par_pwr__ctrl)
  :   field_g__pwr__ctrl__presence(par_g__pwr__ctrl__presence),
  field_g__pwr__ctrl(par_g__pwr__ctrl),
  field_split(par_split),
  field_split__desc(par_split__desc),
  field_g__pkt__ta(par_g__pkt__ta),
  field_pwr__ctrl(par_pwr__ctrl)
{
}

PacketPwrControlTAMsg::PacketPwrControlTAMsg(const PacketPwrControlTAMsg& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PacketPwrControlTAMsg.");
if (other_value.g__pwr__ctrl__presence().is_bound()) field_g__pwr__ctrl__presence = other_value.g__pwr__ctrl__presence();
else field_g__pwr__ctrl__presence.clean_up();
if (other_value.g__pwr__ctrl().is_bound()) field_g__pwr__ctrl = other_value.g__pwr__ctrl();
else field_g__pwr__ctrl.clean_up();
if (other_value.split().is_bound()) field_split = other_value.split();
else field_split.clean_up();
if (other_value.split__desc().is_bound()) field_split__desc = other_value.split__desc();
else field_split__desc.clean_up();
if (other_value.g__pkt__ta().is_bound()) field_g__pkt__ta = other_value.g__pkt__ta();
else field_g__pkt__ta.clean_up();
if (other_value.pwr__ctrl().is_bound()) field_pwr__ctrl = other_value.pwr__ctrl();
else field_pwr__ctrl.clean_up();
}

void PacketPwrControlTAMsg::clean_up()
{
field_g__pwr__ctrl__presence.clean_up();
field_g__pwr__ctrl.clean_up();
field_split.clean_up();
field_split__desc.clean_up();
field_g__pkt__ta.clean_up();
field_pwr__ctrl.clean_up();
}

const TTCN_Typedescriptor_t* PacketPwrControlTAMsg::get_descriptor() const { return &PacketPwrControlTAMsg_descr_; }
PacketPwrControlTAMsg& PacketPwrControlTAMsg::operator=(const PacketPwrControlTAMsg& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PacketPwrControlTAMsg.");
  if (other_value.g__pwr__ctrl__presence().is_bound()) field_g__pwr__ctrl__presence = other_value.g__pwr__ctrl__presence();
  else field_g__pwr__ctrl__presence.clean_up();
  if (other_value.g__pwr__ctrl().is_bound()) field_g__pwr__ctrl = other_value.g__pwr__ctrl();
  else field_g__pwr__ctrl.clean_up();
  if (other_value.split().is_bound()) field_split = other_value.split();
  else field_split.clean_up();
  if (other_value.split__desc().is_bound()) field_split__desc = other_value.split__desc();
  else field_split__desc.clean_up();
  if (other_value.g__pkt__ta().is_bound()) field_g__pkt__ta = other_value.g__pkt__ta();
  else field_g__pkt__ta.clean_up();
  if (other_value.pwr__ctrl().is_bound()) field_pwr__ctrl = other_value.pwr__ctrl();
  else field_pwr__ctrl.clean_up();
}
return *this;
}

boolean PacketPwrControlTAMsg::operator==(const PacketPwrControlTAMsg& other_value) const
{
return field_g__pwr__ctrl__presence==other_value.field_g__pwr__ctrl__presence
  && field_g__pwr__ctrl==other_value.field_g__pwr__ctrl
  && field_split==other_value.field_split
  && field_split__desc==other_value.field_split__desc
  && field_g__pkt__ta==other_value.field_g__pkt__ta
  && field_pwr__ctrl==other_value.field_pwr__ctrl;
}

boolean PacketPwrControlTAMsg::is_bound() const
{
return (field_g__pwr__ctrl__presence.is_bound())
  || (OPTIONAL_OMIT == field_g__pwr__ctrl.get_selection() || field_g__pwr__ctrl.is_bound())
  || (field_split.is_bound())
  || (OPTIONAL_OMIT == field_split__desc.get_selection() || field_split__desc.is_bound())
  || (OPTIONAL_OMIT == field_g__pkt__ta.get_selection() || field_g__pkt__ta.is_bound())
  || (OPTIONAL_OMIT == field_pwr__ctrl.get_selection() || field_pwr__ctrl.is_bound());
}
boolean PacketPwrControlTAMsg::is_value() const
{
return field_g__pwr__ctrl__presence.is_value()
  && (OPTIONAL_OMIT == field_g__pwr__ctrl.get_selection() || field_g__pwr__ctrl.is_value())
  && field_split.is_value()
  && (OPTIONAL_OMIT == field_split__desc.get_selection() || field_split__desc.is_value())
  && (OPTIONAL_OMIT == field_g__pkt__ta.get_selection() || field_g__pkt__ta.is_value())
  && (OPTIONAL_OMIT == field_pwr__ctrl.get_selection() || field_pwr__ctrl.is_value());
}
int PacketPwrControlTAMsg::size_of() const
{
  int ret_val = 2;
  if (field_g__pwr__ctrl.ispresent()) ret_val++;
  if (field_split__desc.ispresent()) ret_val++;
  if (field_g__pkt__ta.ispresent()) ret_val++;
  if (field_pwr__ctrl.ispresent()) ret_val++;
  return ret_val;
}

void PacketPwrControlTAMsg::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ g_pwr_ctrl_presence := ");
field_g__pwr__ctrl__presence.log();
TTCN_Logger::log_event_str(", g_pwr_ctrl := ");
field_g__pwr__ctrl.log();
TTCN_Logger::log_event_str(", split := ");
field_split.log();
TTCN_Logger::log_event_str(", split_desc := ");
field_split__desc.log();
TTCN_Logger::log_event_str(", g_pkt_ta := ");
field_g__pkt__ta.log();
TTCN_Logger::log_event_str(", pwr_ctrl := ");
field_pwr__ctrl.log();
TTCN_Logger::log_event_str(" }");
}

void PacketPwrControlTAMsg::set_implicit_omit()
{
if (g__pwr__ctrl__presence().is_bound()) g__pwr__ctrl__presence().set_implicit_omit();
if (!g__pwr__ctrl().is_bound()) g__pwr__ctrl() = OMIT_VALUE;
else g__pwr__ctrl().set_implicit_omit();
if (split().is_bound()) split().set_implicit_omit();
if (!split__desc().is_bound()) split__desc() = OMIT_VALUE;
else split__desc().set_implicit_omit();
if (!g__pkt__ta().is_bound()) g__pkt__ta() = OMIT_VALUE;
else g__pkt__ta().set_implicit_omit();
if (!pwr__ctrl().is_bound()) pwr__ctrl() = OMIT_VALUE;
else pwr__ctrl().set_implicit_omit();
}

void PacketPwrControlTAMsg::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.PacketPwrControlTAMsg 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) g__pwr__ctrl__presence().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) g__pwr__ctrl().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) split().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) split__desc().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) g__pkt__ta().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) pwr__ctrl().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(), "g_pwr_ctrl_presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          g__pwr__ctrl__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(), "g_pwr_ctrl")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          g__pwr__ctrl().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "split")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          split().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "split_desc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          split__desc().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "g_pkt_ta")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          g__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(), "pwr_ctrl")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pwr__ctrl().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.PacketPwrControlTAMsg: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.PacketPwrControlTAMsg");
  }
}

void PacketPwrControlTAMsg::encode_text(Text_Buf& text_buf) const
{
field_g__pwr__ctrl__presence.encode_text(text_buf);
field_g__pwr__ctrl.encode_text(text_buf);
field_split.encode_text(text_buf);
field_split__desc.encode_text(text_buf);
field_g__pkt__ta.encode_text(text_buf);
field_pwr__ctrl.encode_text(text_buf);
}

void PacketPwrControlTAMsg::decode_text(Text_Buf& text_buf)
{
field_g__pwr__ctrl__presence.decode_text(text_buf);
field_g__pwr__ctrl.decode_text(text_buf);
field_split.decode_text(text_buf);
field_split__desc.decode_text(text_buf);
field_g__pkt__ta.decode_text(text_buf);
field_pwr__ctrl.decode_text(text_buf);
}

void PacketPwrControlTAMsg::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 PacketPwrControlTAMsg::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 PacketPwrControlTAMsg::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, PacketPwrControlTAMsg_g__pwr__ctrl__presence_descr_.raw->forceomit);
  decoded_field_length = field_g__pwr__ctrl__presence.RAW_decode(PacketPwrControlTAMsg_g__pwr__ctrl__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_g__pwr__ctrl__presence ==  bs_0){
  if (force_omit != NULL && (*force_omit)(1)) {
    field_g__pwr__ctrl = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_1_force_omit(1, force_omit, PacketPwrControlTAMsg_g__pwr__ctrl_descr_.raw->forceomit);
  decoded_field_length = field_g__pwr__ctrl().RAW_decode(PacketPwrControlTAMsg_g__pwr__ctrl_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 1) {
  field_g__pwr__ctrl = 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_g__pwr__ctrl=OMIT_VALUE;
  RAW_Force_Omit field_2_force_omit(2, force_omit, PacketPwrControlTAMsg_split_descr_.raw->forceomit);
  decoded_field_length = field_split.RAW_decode(PacketPwrControlTAMsg_split_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_split ==  bs_0){
  if (force_omit != NULL && (*force_omit)(3)) {
    field_split__desc = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_3_force_omit(3, force_omit, PacketPwrControlTAMsg_split__desc_descr_.raw->forceomit);
  decoded_field_length = field_split__desc().RAW_decode(PacketPwrControlTAMsg_split__desc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 1) {
  field_split__desc = 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_split__desc=OMIT_VALUE;
  if (limit > 0 && (field_split ==  bs_1 || field_split__desc ==  bs_1)){
  if (force_omit != NULL && (*force_omit)(4)) {
    field_g__pkt__ta = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_4_force_omit(4, force_omit, PacketPwrControlTAMsg_g__pkt__ta_descr_.raw->forceomit);
  decoded_field_length = field_g__pkt__ta().RAW_decode(PacketPwrControlTAMsg_g__pkt__ta_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit);
  if (decoded_field_length < 1) {
  field_g__pkt__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_g__pkt__ta=OMIT_VALUE;
  if (limit > 0 && (field_split ==  bs_1 || field_split__desc ==  bs_0)){
  if (force_omit != NULL && (*force_omit)(5)) {
    field_pwr__ctrl = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_5_force_omit(5, force_omit, PacketPwrControlTAMsg_pwr__ctrl_descr_.raw->forceomit);
  decoded_field_length = field_pwr__ctrl().RAW_decode(PacketPwrControlTAMsg_pwr__ctrl_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 1) {
  field_pwr__ctrl = 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_pwr__ctrl=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int PacketPwrControlTAMsg::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, PacketPwrControlTAMsg_g__pwr__ctrl__presence_descr_.raw);
  if (field_g__pwr__ctrl.ispresent()) {
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PacketPwrControlTAMsg_g__pwr__ctrl_descr_.raw);
  }
  else myleaf.body.node.nodes[1] = NULL;
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PacketPwrControlTAMsg_split_descr_.raw);
  if (field_split__desc.ispresent()) {
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, PacketPwrControlTAMsg_split__desc_descr_.raw);
  }
  else myleaf.body.node.nodes[3] = NULL;
  if (field_g__pkt__ta.ispresent()) {
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, PacketPwrControlTAMsg_g__pkt__ta_descr_.raw);
  }
  else myleaf.body.node.nodes[4] = NULL;
  if (field_pwr__ctrl.ispresent()) {
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, PacketPwrControlTAMsg_pwr__ctrl_descr_.raw);
  }
  else myleaf.body.node.nodes[5] = NULL;
  encoded_length += field_g__pwr__ctrl__presence.RAW_encode(PacketPwrControlTAMsg_g__pwr__ctrl__presence_descr_, *myleaf.body.node.nodes[0]);
  if (field_g__pwr__ctrl.ispresent()) {
  encoded_length += field_g__pwr__ctrl().RAW_encode(PacketPwrControlTAMsg_g__pwr__ctrl_descr_, *myleaf.body.node.nodes[1]);
  }
  encoded_length += field_split.RAW_encode(PacketPwrControlTAMsg_split_descr_, *myleaf.body.node.nodes[2]);
  if (field_split__desc.ispresent()) {
  encoded_length += field_split__desc().RAW_encode(PacketPwrControlTAMsg_split__desc_descr_, *myleaf.body.node.nodes[3]);
  }
  if (field_g__pkt__ta.ispresent()) {
  encoded_length += field_g__pkt__ta().RAW_encode(PacketPwrControlTAMsg_g__pkt__ta_descr_, *myleaf.body.node.nodes[4]);
  }
  if (field_pwr__ctrl.ispresent()) {
  encoded_length += field_pwr__ctrl().RAW_encode(PacketPwrControlTAMsg_pwr__ctrl_descr_, *myleaf.body.node.nodes[5]);
  }
  if (field_g__pwr__ctrl.ispresent() && (field_g__pwr__ctrl__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(PacketPwrControlTAMsg_g__pwr__ctrl__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_split__desc.ispresent() && (field_split !=  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(PacketPwrControlTAMsg_split_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_g__pkt__ta.ispresent() && (field_split !=  bs_1 && field_split__desc !=  bs_1)) {
  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_1.RAW_encode(PacketPwrControlTAMsg_split_descr_,*temp_leaf);
  } else  {
  RAW_enc_tr_pos pr_pos1;
  pr_pos1.level=myleaf.curr_pos.level+1;
  int new_pos1[]={3};
  pr_pos1.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos1);
  temp_leaf = myleaf.get_node(pr_pos1);
  if(temp_leaf != NULL){
   bs_1.RAW_encode(PacketPwrControlTAMsg_split__desc_descr_,*temp_leaf);
  } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  }
  free_tree_pos(pr_pos1.pos);
  }
  free_tree_pos(pr_pos0.pos);
  }
  }
  if (field_pwr__ctrl.ispresent() && (field_split !=  bs_1 && field_split__desc !=  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_1.RAW_encode(PacketPwrControlTAMsg_split_descr_,*temp_leaf);
  } else  {
  RAW_enc_tr_pos pr_pos1;
  pr_pos1.level=myleaf.curr_pos.level+1;
  int new_pos1[]={3};
  pr_pos1.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos1);
  temp_leaf = myleaf.get_node(pr_pos1);
  if(temp_leaf != NULL){
   bs_0.RAW_encode(PacketPwrControlTAMsg_split__desc_descr_,*temp_leaf);
  } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  }
  free_tree_pos(pr_pos1.pos);
  }
  free_tree_pos(pr_pos0.pos);
  }
  }
  return myleaf.length = encoded_length;
}

struct PacketPwrControlTAMsg_template::single_value_struct {
BITSTRING_template field_g__pwr__ctrl__presence;
GlobalPwrCtrlParams_template field_g__pwr__ctrl;
BITSTRING_template field_split;
BITSTRING_template field_split__desc;
GlobalPacketTA_template field_g__pkt__ta;
PowerControlParameters_template field_pwr__ctrl;
};

void PacketPwrControlTAMsg_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_g__pwr__ctrl__presence = ANY_VALUE;
single_value->field_g__pwr__ctrl = ANY_OR_OMIT;
single_value->field_split = ANY_VALUE;
single_value->field_split__desc = ANY_OR_OMIT;
single_value->field_g__pkt__ta = ANY_OR_OMIT;
single_value->field_pwr__ctrl = ANY_OR_OMIT;
}
}
}

void PacketPwrControlTAMsg_template::copy_value(const PacketPwrControlTAMsg& other_value)
{
single_value = new single_value_struct;
if (other_value.g__pwr__ctrl__presence().is_bound()) {
  single_value->field_g__pwr__ctrl__presence = other_value.g__pwr__ctrl__presence();
} else {
  single_value->field_g__pwr__ctrl__presence.clean_up();
}
if (other_value.g__pwr__ctrl().is_bound()) {
  if (other_value.g__pwr__ctrl().ispresent()) single_value->field_g__pwr__ctrl = other_value.g__pwr__ctrl()();
  else single_value->field_g__pwr__ctrl = OMIT_VALUE;
} else {
  single_value->field_g__pwr__ctrl.clean_up();
}
if (other_value.split().is_bound()) {
  single_value->field_split = other_value.split();
} else {
  single_value->field_split.clean_up();
}
if (other_value.split__desc().is_bound()) {
  if (other_value.split__desc().ispresent()) single_value->field_split__desc = other_value.split__desc()();
  else single_value->field_split__desc = OMIT_VALUE;
} else {
  single_value->field_split__desc.clean_up();
}
if (other_value.g__pkt__ta().is_bound()) {
  if (other_value.g__pkt__ta().ispresent()) single_value->field_g__pkt__ta = other_value.g__pkt__ta()();
  else single_value->field_g__pkt__ta = OMIT_VALUE;
} else {
  single_value->field_g__pkt__ta.clean_up();
}
if (other_value.pwr__ctrl().is_bound()) {
  if (other_value.pwr__ctrl().ispresent()) single_value->field_pwr__ctrl = other_value.pwr__ctrl()();
  else single_value->field_pwr__ctrl = OMIT_VALUE;
} else {
  single_value->field_pwr__ctrl.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PacketPwrControlTAMsg_template::copy_template(const PacketPwrControlTAMsg_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.g__pwr__ctrl__presence().get_selection()) {
single_value->field_g__pwr__ctrl__presence = other_value.g__pwr__ctrl__presence();
} else {
single_value->field_g__pwr__ctrl__presence.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.g__pwr__ctrl().get_selection()) {
single_value->field_g__pwr__ctrl = other_value.g__pwr__ctrl();
} else {
single_value->field_g__pwr__ctrl.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.split().get_selection()) {
single_value->field_split = other_value.split();
} else {
single_value->field_split.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.split__desc().get_selection()) {
single_value->field_split__desc = other_value.split__desc();
} else {
single_value->field_split__desc.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.g__pkt__ta().get_selection()) {
single_value->field_g__pkt__ta = other_value.g__pkt__ta();
} else {
single_value->field_g__pkt__ta.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pwr__ctrl().get_selection()) {
single_value->field_pwr__ctrl = other_value.pwr__ctrl();
} else {
single_value->field_pwr__ctrl.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 PacketPwrControlTAMsg_template[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 PacketPwrControlTAMsg_template(*other_value.implication_.precondition);
implication_.implied_template = new PacketPwrControlTAMsg_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.PacketPwrControlTAMsg.");
break;
}
set_selection(other_value);
}

PacketPwrControlTAMsg_template::PacketPwrControlTAMsg_template()
{
}

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

PacketPwrControlTAMsg_template::PacketPwrControlTAMsg_template(const PacketPwrControlTAMsg& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PacketPwrControlTAMsg_template::match(const PacketPwrControlTAMsg& 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.g__pwr__ctrl__presence().is_bound()) return FALSE;
if(!single_value->field_g__pwr__ctrl__presence.match(other_value.g__pwr__ctrl__presence(), legacy))return FALSE;
if(!other_value.g__pwr__ctrl().is_bound()) return FALSE;
if((other_value.g__pwr__ctrl().ispresent() ? !single_value->field_g__pwr__ctrl.match((const GlobalPwrCtrlParams&)other_value.g__pwr__ctrl(), legacy) : !single_value->field_g__pwr__ctrl.match_omit(legacy)))return FALSE;
if(!other_value.split().is_bound()) return FALSE;
if(!single_value->field_split.match(other_value.split(), legacy))return FALSE;
if(!other_value.split__desc().is_bound()) return FALSE;
if((other_value.split__desc().ispresent() ? !single_value->field_split__desc.match((const BITSTRING&)other_value.split__desc(), legacy) : !single_value->field_split__desc.match_omit(legacy)))return FALSE;
if(!other_value.g__pkt__ta().is_bound()) return FALSE;
if((other_value.g__pkt__ta().ispresent() ? !single_value->field_g__pkt__ta.match((const GlobalPacketTA&)other_value.g__pkt__ta(), legacy) : !single_value->field_g__pkt__ta.match_omit(legacy)))return FALSE;
if(!other_value.pwr__ctrl().is_bound()) return FALSE;
if((other_value.pwr__ctrl().ispresent() ? !single_value->field_pwr__ctrl.match((const PowerControlParameters&)other_value.pwr__ctrl(), legacy) : !single_value->field_pwr__ctrl.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.PacketPwrControlTAMsg.");
}
return FALSE;
}

boolean PacketPwrControlTAMsg_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_g__pwr__ctrl__presence.is_bound()
 || (single_value->field_g__pwr__ctrl.is_omit() || single_value->field_g__pwr__ctrl.is_bound())
 || single_value->field_split.is_bound()
 || (single_value->field_split__desc.is_omit() || single_value->field_split__desc.is_bound())
 || (single_value->field_g__pkt__ta.is_omit() || single_value->field_g__pkt__ta.is_bound())
 || (single_value->field_pwr__ctrl.is_omit() || single_value->field_pwr__ctrl.is_bound());
}

boolean PacketPwrControlTAMsg_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_g__pwr__ctrl__presence.is_value()
 && (single_value->field_g__pwr__ctrl.is_omit() || single_value->field_g__pwr__ctrl.is_value())
 && single_value->field_split.is_value()
 && (single_value->field_split__desc.is_omit() || single_value->field_split__desc.is_value())
 && (single_value->field_g__pkt__ta.is_omit() || single_value->field_g__pkt__ta.is_value())
 && (single_value->field_pwr__ctrl.is_omit() || single_value->field_pwr__ctrl.is_value());
}

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

PacketPwrControlTAMsg PacketPwrControlTAMsg_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.PacketPwrControlTAMsg.");
PacketPwrControlTAMsg ret_val;
if (single_value->field_g__pwr__ctrl__presence.is_bound()) {
ret_val.g__pwr__ctrl__presence() = single_value->field_g__pwr__ctrl__presence.valueof();
}
if (single_value->field_g__pwr__ctrl.is_omit()) ret_val.g__pwr__ctrl() = OMIT_VALUE;
else if (single_value->field_g__pwr__ctrl.is_bound()) {
ret_val.g__pwr__ctrl() = single_value->field_g__pwr__ctrl.valueof();
}
if (single_value->field_split.is_bound()) {
ret_val.split() = single_value->field_split.valueof();
}
if (single_value->field_split__desc.is_omit()) ret_val.split__desc() = OMIT_VALUE;
else if (single_value->field_split__desc.is_bound()) {
ret_val.split__desc() = single_value->field_split__desc.valueof();
}
if (single_value->field_g__pkt__ta.is_omit()) ret_val.g__pkt__ta() = OMIT_VALUE;
else if (single_value->field_g__pkt__ta.is_bound()) {
ret_val.g__pkt__ta() = single_value->field_g__pkt__ta.valueof();
}
if (single_value->field_pwr__ctrl.is_omit()) ret_val.pwr__ctrl() = OMIT_VALUE;
else if (single_value->field_pwr__ctrl.is_bound()) {
ret_val.pwr__ctrl() = single_value->field_pwr__ctrl.valueof();
}
return ret_val;
}

void PacketPwrControlTAMsg_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.PacketPwrControlTAMsg.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PacketPwrControlTAMsg_template[list_length];
}

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

BITSTRING_template& PacketPwrControlTAMsg_template::g__pwr__ctrl__presence()
{
set_specific();
return single_value->field_g__pwr__ctrl__presence;
}

const BITSTRING_template& PacketPwrControlTAMsg_template::g__pwr__ctrl__presence() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field g_pwr_ctrl_presence of a non-specific template of type @RLCMAC_CSN1_Types.PacketPwrControlTAMsg.");
return single_value->field_g__pwr__ctrl__presence;
}

GlobalPwrCtrlParams_template& PacketPwrControlTAMsg_template::g__pwr__ctrl()
{
set_specific();
return single_value->field_g__pwr__ctrl;
}

const GlobalPwrCtrlParams_template& PacketPwrControlTAMsg_template::g__pwr__ctrl() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field g_pwr_ctrl of a non-specific template of type @RLCMAC_CSN1_Types.PacketPwrControlTAMsg.");
return single_value->field_g__pwr__ctrl;
}

BITSTRING_template& PacketPwrControlTAMsg_template::split()
{
set_specific();
return single_value->field_split;
}

const BITSTRING_template& PacketPwrControlTAMsg_template::split() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field split of a non-specific template of type @RLCMAC_CSN1_Types.PacketPwrControlTAMsg.");
return single_value->field_split;
}

BITSTRING_template& PacketPwrControlTAMsg_template::split__desc()
{
set_specific();
return single_value->field_split__desc;
}

const BITSTRING_template& PacketPwrControlTAMsg_template::split__desc() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field split_desc of a non-specific template of type @RLCMAC_CSN1_Types.PacketPwrControlTAMsg.");
return single_value->field_split__desc;
}

GlobalPacketTA_template& PacketPwrControlTAMsg_template::g__pkt__ta()
{
set_specific();
return single_value->field_g__pkt__ta;
}

const GlobalPacketTA_template& PacketPwrControlTAMsg_template::g__pkt__ta() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field g_pkt_ta of a non-specific template of type @RLCMAC_CSN1_Types.PacketPwrControlTAMsg.");
return single_value->field_g__pkt__ta;
}

PowerControlParameters_template& PacketPwrControlTAMsg_template::pwr__ctrl()
{
set_specific();
return single_value->field_pwr__ctrl;
}

const PowerControlParameters_template& PacketPwrControlTAMsg_template::pwr__ctrl() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pwr_ctrl of a non-specific template of type @RLCMAC_CSN1_Types.PacketPwrControlTAMsg.");
return single_value->field_pwr__ctrl;
}

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

void PacketPwrControlTAMsg_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ g_pwr_ctrl_presence := ");
single_value->field_g__pwr__ctrl__presence.log();
TTCN_Logger::log_event_str(", g_pwr_ctrl := ");
single_value->field_g__pwr__ctrl.log();
TTCN_Logger::log_event_str(", split := ");
single_value->field_split.log();
TTCN_Logger::log_event_str(", split_desc := ");
single_value->field_split__desc.log();
TTCN_Logger::log_event_str(", g_pkt_ta := ");
single_value->field_g__pkt__ta.log();
TTCN_Logger::log_event_str(", pwr_ctrl := ");
single_value->field_pwr__ctrl.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 PacketPwrControlTAMsg_template::log_match(const PacketPwrControlTAMsg& 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_g__pwr__ctrl__presence.match(match_value.g__pwr__ctrl__presence(), legacy)){
TTCN_Logger::log_logmatch_info(".g_pwr_ctrl_presence");
single_value->field_g__pwr__ctrl__presence.log_match(match_value.g__pwr__ctrl__presence(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.g__pwr__ctrl().ispresent()){
if(!single_value->field_g__pwr__ctrl.match(match_value.g__pwr__ctrl(), legacy)){
TTCN_Logger::log_logmatch_info(".g_pwr_ctrl");
single_value->field_g__pwr__ctrl.log_match(match_value.g__pwr__ctrl(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_g__pwr__ctrl.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".g_pwr_ctrl := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_g__pwr__ctrl.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_split.match(match_value.split(), legacy)){
TTCN_Logger::log_logmatch_info(".split");
single_value->field_split.log_match(match_value.split(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.split__desc().ispresent()){
if(!single_value->field_split__desc.match(match_value.split__desc(), legacy)){
TTCN_Logger::log_logmatch_info(".split_desc");
single_value->field_split__desc.log_match(match_value.split__desc(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_split__desc.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".split_desc := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_split__desc.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.g__pkt__ta().ispresent()){
if(!single_value->field_g__pkt__ta.match(match_value.g__pkt__ta(), legacy)){
TTCN_Logger::log_logmatch_info(".g_pkt_ta");
single_value->field_g__pkt__ta.log_match(match_value.g__pkt__ta(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_g__pkt__ta.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".g_pkt_ta := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_g__pkt__ta.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.pwr__ctrl().ispresent()){
if(!single_value->field_pwr__ctrl.match(match_value.pwr__ctrl(), legacy)){
TTCN_Logger::log_logmatch_info(".pwr_ctrl");
single_value->field_pwr__ctrl.log_match(match_value.pwr__ctrl(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_pwr__ctrl.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".pwr_ctrl := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_pwr__ctrl.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("{ g_pwr_ctrl_presence := ");
single_value->field_g__pwr__ctrl__presence.log_match(match_value.g__pwr__ctrl__presence(), legacy);
TTCN_Logger::log_event_str(", g_pwr_ctrl := ");
if (match_value.g__pwr__ctrl().ispresent()) {
single_value->field_g__pwr__ctrl.log_match(match_value.g__pwr__ctrl(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_g__pwr__ctrl.log();
if (single_value->field_g__pwr__ctrl.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", split := ");
single_value->field_split.log_match(match_value.split(), legacy);
TTCN_Logger::log_event_str(", split_desc := ");
if (match_value.split__desc().ispresent()) {
single_value->field_split__desc.log_match(match_value.split__desc(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_split__desc.log();
if (single_value->field_split__desc.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", g_pkt_ta := ");
if (match_value.g__pkt__ta().ispresent()) {
single_value->field_g__pkt__ta.log_match(match_value.g__pkt__ta(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_g__pkt__ta.log();
if (single_value->field_g__pkt__ta.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", pwr_ctrl := ");
if (match_value.pwr__ctrl().ispresent()) {
single_value->field_pwr__ctrl.log_match(match_value.pwr__ctrl(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_pwr__ctrl.log();
if (single_value->field_pwr__ctrl.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 PacketPwrControlTAMsg_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (g__pwr__ctrl__presence().is_bound()) g__pwr__ctrl__presence().set_implicit_omit();
if (!g__pwr__ctrl().is_bound()) g__pwr__ctrl() = OMIT_VALUE;
else g__pwr__ctrl().set_implicit_omit();
if (split().is_bound()) split().set_implicit_omit();
if (!split__desc().is_bound()) split__desc() = OMIT_VALUE;
else split__desc().set_implicit_omit();
if (!g__pkt__ta().is_bound()) g__pkt__ta() = OMIT_VALUE;
else g__pkt__ta().set_implicit_omit();
if (!pwr__ctrl().is_bound()) pwr__ctrl() = OMIT_VALUE;
else pwr__ctrl().set_implicit_omit();
}

void PacketPwrControlTAMsg_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_g__pwr__ctrl__presence.encode_text(text_buf);
single_value->field_g__pwr__ctrl.encode_text(text_buf);
single_value->field_split.encode_text(text_buf);
single_value->field_split__desc.encode_text(text_buf);
single_value->field_g__pkt__ta.encode_text(text_buf);
single_value->field_pwr__ctrl.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.PacketPwrControlTAMsg.");
}
}

void PacketPwrControlTAMsg_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_g__pwr__ctrl__presence.decode_text(text_buf);
single_value->field_g__pwr__ctrl.decode_text(text_buf);
single_value->field_split.decode_text(text_buf);
single_value->field_split__desc.decode_text(text_buf);
single_value->field_g__pkt__ta.decode_text(text_buf);
single_value->field_pwr__ctrl.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 PacketPwrControlTAMsg_template[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.PacketPwrControlTAMsg.");
}
}

void PacketPwrControlTAMsg_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: {
    PacketPwrControlTAMsg_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.PacketPwrControlTAMsg 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) g__pwr__ctrl__presence().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) g__pwr__ctrl().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) split().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) split__desc().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) g__pkt__ta().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) pwr__ctrl().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(), "g_pwr_ctrl_presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          g__pwr__ctrl__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(), "g_pwr_ctrl")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          g__pwr__ctrl().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "split")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          split().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "split_desc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          split__desc().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "g_pkt_ta")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          g__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(), "pwr_ctrl")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pwr__ctrl().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.PacketPwrControlTAMsg: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PacketPwrControlTAMsg_template* precondition = new PacketPwrControlTAMsg_template;
    precondition->set_param(*param.get_elem(0));
    PacketPwrControlTAMsg_template* implied_template = new PacketPwrControlTAMsg_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PacketPwrControlTAMsg_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.PacketPwrControlTAMsg");
  }
  is_ifpresent = param.get_ifpresent();
}

void PacketPwrControlTAMsg_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_g__pwr__ctrl__presence.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketPwrControlTAMsg");
single_value->field_g__pwr__ctrl.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketPwrControlTAMsg");
single_value->field_split.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketPwrControlTAMsg");
single_value->field_split__desc.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketPwrControlTAMsg");
single_value->field_g__pkt__ta.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketPwrControlTAMsg");
single_value->field_pwr__ctrl.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketPwrControlTAMsg");
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.PacketPwrControlTAMsg");
}

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

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

PacketPwrControlTA::PacketPwrControlTA()
{
}

PacketPwrControlTA::PacketPwrControlTA(const PageMode& par_page__mode,
    const NullGlobalTfi& par_global__tfi,
    const BITSTRING& par_msg__escape,
    const OPTIONAL< PacketPwrControlTAMsg >& par_msg)
  :   field_page__mode(par_page__mode),
  field_global__tfi(par_global__tfi),
  field_msg__escape(par_msg__escape),
  field_msg(par_msg)
{
}

PacketPwrControlTA::PacketPwrControlTA(const PacketPwrControlTA& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PacketPwrControlTA.");
if (other_value.page__mode().is_bound()) field_page__mode = other_value.page__mode();
else field_page__mode.clean_up();
if (other_value.global__tfi().is_bound()) field_global__tfi = other_value.global__tfi();
else field_global__tfi.clean_up();
if (other_value.msg__escape().is_bound()) field_msg__escape = other_value.msg__escape();
else field_msg__escape.clean_up();
if (other_value.msg().is_bound()) field_msg = other_value.msg();
else field_msg.clean_up();
}

void PacketPwrControlTA::clean_up()
{
field_page__mode.clean_up();
field_global__tfi.clean_up();
field_msg__escape.clean_up();
field_msg.clean_up();
}

const TTCN_Typedescriptor_t* PacketPwrControlTA::get_descriptor() const { return &PacketPwrControlTA_descr_; }
PacketPwrControlTA& PacketPwrControlTA::operator=(const PacketPwrControlTA& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PacketPwrControlTA.");
  if (other_value.page__mode().is_bound()) field_page__mode = other_value.page__mode();
  else field_page__mode.clean_up();
  if (other_value.global__tfi().is_bound()) field_global__tfi = other_value.global__tfi();
  else field_global__tfi.clean_up();
  if (other_value.msg__escape().is_bound()) field_msg__escape = other_value.msg__escape();
  else field_msg__escape.clean_up();
  if (other_value.msg().is_bound()) field_msg = other_value.msg();
  else field_msg.clean_up();
}
return *this;
}

boolean PacketPwrControlTA::operator==(const PacketPwrControlTA& other_value) const
{
return field_page__mode==other_value.field_page__mode
  && field_global__tfi==other_value.field_global__tfi
  && field_msg__escape==other_value.field_msg__escape
  && field_msg==other_value.field_msg;
}

boolean PacketPwrControlTA::is_bound() const
{
return (field_page__mode.is_bound())
  || (field_global__tfi.is_bound())
  || (field_msg__escape.is_bound())
  || (OPTIONAL_OMIT == field_msg.get_selection() || field_msg.is_bound());
}
boolean PacketPwrControlTA::is_value() const
{
return field_page__mode.is_value()
  && field_global__tfi.is_value()
  && field_msg__escape.is_value()
  && (OPTIONAL_OMIT == field_msg.get_selection() || field_msg.is_value());
}
int PacketPwrControlTA::size_of() const
{
  int ret_val = 3;
  if (field_msg.ispresent()) ret_val++;
  return ret_val;
}

void PacketPwrControlTA::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(", global_tfi := ");
field_global__tfi.log();
TTCN_Logger::log_event_str(", msg_escape := ");
field_msg__escape.log();
TTCN_Logger::log_event_str(", msg := ");
field_msg.log();
TTCN_Logger::log_event_str(" }");
}

void PacketPwrControlTA::set_implicit_omit()
{
if (page__mode().is_bound()) page__mode().set_implicit_omit();
if (global__tfi().is_bound()) global__tfi().set_implicit_omit();
if (msg__escape().is_bound()) msg__escape().set_implicit_omit();
if (!msg().is_bound()) msg() = OMIT_VALUE;
else msg().set_implicit_omit();
}

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

void PacketPwrControlTA::encode_text(Text_Buf& text_buf) const
{
field_page__mode.encode_text(text_buf);
field_global__tfi.encode_text(text_buf);
field_msg__escape.encode_text(text_buf);
field_msg.encode_text(text_buf);
}

void PacketPwrControlTA::decode_text(Text_Buf& text_buf)
{
field_page__mode.decode_text(text_buf);
field_global__tfi.decode_text(text_buf);
field_msg__escape.decode_text(text_buf);
field_msg.decode_text(text_buf);
}

void PacketPwrControlTA::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 PacketPwrControlTA::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 PacketPwrControlTA::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, PacketPwrControlTA_page__mode_descr_.raw->forceomit);
  decoded_field_length = field_page__mode.RAW_decode(PacketPwrControlTA_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, PacketPwrControlTA_global__tfi_descr_.raw->forceomit);
  decoded_field_length = field_global__tfi.RAW_decode(PacketPwrControlTA_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());
  RAW_Force_Omit field_2_force_omit(2, force_omit, PacketPwrControlTA_msg__escape_descr_.raw->forceomit);
  decoded_field_length = field_msg__escape.RAW_decode(PacketPwrControlTA_msg__escape_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_msg__escape ==  bs_1){
  if (force_omit != NULL && (*force_omit)(3)) {
    field_msg = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_3_force_omit(3, force_omit, PacketPwrControlTA_msg_descr_.raw->forceomit);
  decoded_field_length = field_msg().RAW_decode(PacketPwrControlTA_msg_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 1) {
  field_msg = 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_msg=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int PacketPwrControlTA::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, PacketPwrControlTA_page__mode_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PacketPwrControlTA_global__tfi_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PacketPwrControlTA_msg__escape_descr_.raw);
  if (field_msg.ispresent()) {
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, PacketPwrControlTA_msg_descr_.raw);
  }
  else myleaf.body.node.nodes[3] = NULL;
  encoded_length += field_page__mode.RAW_encode(PacketPwrControlTA_page__mode_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_global__tfi.RAW_encode(PacketPwrControlTA_global__tfi_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_msg__escape.RAW_encode(PacketPwrControlTA_msg__escape_descr_, *myleaf.body.node.nodes[2]);
  if (field_msg.ispresent()) {
  encoded_length += field_msg().RAW_encode(PacketPwrControlTA_msg_descr_, *myleaf.body.node.nodes[3]);
  }
  if (field_msg.ispresent() && (field_msg__escape !=  bs_1)) {
  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_1.RAW_encode(PacketPwrControlTA_msg__escape_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 PacketPwrControlTA_template::single_value_struct {
PageMode_template field_page__mode;
NullGlobalTfi_template field_global__tfi;
BITSTRING_template field_msg__escape;
PacketPwrControlTAMsg_template field_msg;
};

void PacketPwrControlTA_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_global__tfi = ANY_VALUE;
single_value->field_msg__escape = ANY_VALUE;
single_value->field_msg = ANY_OR_OMIT;
}
}
}

void PacketPwrControlTA_template::copy_value(const PacketPwrControlTA& 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.global__tfi().is_bound()) {
  single_value->field_global__tfi = other_value.global__tfi();
} else {
  single_value->field_global__tfi.clean_up();
}
if (other_value.msg__escape().is_bound()) {
  single_value->field_msg__escape = other_value.msg__escape();
} else {
  single_value->field_msg__escape.clean_up();
}
if (other_value.msg().is_bound()) {
  if (other_value.msg().ispresent()) single_value->field_msg = other_value.msg()();
  else single_value->field_msg = OMIT_VALUE;
} else {
  single_value->field_msg.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PacketPwrControlTA_template::copy_template(const PacketPwrControlTA_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.global__tfi().get_selection()) {
single_value->field_global__tfi = other_value.global__tfi();
} else {
single_value->field_global__tfi.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.msg__escape().get_selection()) {
single_value->field_msg__escape = other_value.msg__escape();
} else {
single_value->field_msg__escape.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.msg().get_selection()) {
single_value->field_msg = other_value.msg();
} else {
single_value->field_msg.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 PacketPwrControlTA_template[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 PacketPwrControlTA_template(*other_value.implication_.precondition);
implication_.implied_template = new PacketPwrControlTA_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.PacketPwrControlTA.");
break;
}
set_selection(other_value);
}

PacketPwrControlTA_template::PacketPwrControlTA_template()
{
}

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

PacketPwrControlTA_template::PacketPwrControlTA_template(const PacketPwrControlTA& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PacketPwrControlTA_template::match(const PacketPwrControlTA& 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.global__tfi().is_bound()) return FALSE;
if(!single_value->field_global__tfi.match(other_value.global__tfi(), legacy))return FALSE;
if(!other_value.msg__escape().is_bound()) return FALSE;
if(!single_value->field_msg__escape.match(other_value.msg__escape(), legacy))return FALSE;
if(!other_value.msg().is_bound()) return FALSE;
if((other_value.msg().ispresent() ? !single_value->field_msg.match((const PacketPwrControlTAMsg&)other_value.msg(), legacy) : !single_value->field_msg.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.PacketPwrControlTA.");
}
return FALSE;
}

boolean PacketPwrControlTA_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_global__tfi.is_bound()
 || single_value->field_msg__escape.is_bound()
 || (single_value->field_msg.is_omit() || single_value->field_msg.is_bound());
}

boolean PacketPwrControlTA_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_page__mode.is_value()
 && single_value->field_global__tfi.is_value()
 && single_value->field_msg__escape.is_value()
 && (single_value->field_msg.is_omit() || single_value->field_msg.is_value());
}

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

PacketPwrControlTA PacketPwrControlTA_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.PacketPwrControlTA.");
PacketPwrControlTA ret_val;
if (single_value->field_page__mode.is_bound()) {
ret_val.page__mode() = single_value->field_page__mode.valueof();
}
if (single_value->field_global__tfi.is_bound()) {
ret_val.global__tfi() = single_value->field_global__tfi.valueof();
}
if (single_value->field_msg__escape.is_bound()) {
ret_val.msg__escape() = single_value->field_msg__escape.valueof();
}
if (single_value->field_msg.is_omit()) ret_val.msg() = OMIT_VALUE;
else if (single_value->field_msg.is_bound()) {
ret_val.msg() = single_value->field_msg.valueof();
}
return ret_val;
}

void PacketPwrControlTA_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.PacketPwrControlTA.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PacketPwrControlTA_template[list_length];
}

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

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

const PageMode_template& PacketPwrControlTA_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.PacketPwrControlTA.");
return single_value->field_page__mode;
}

NullGlobalTfi_template& PacketPwrControlTA_template::global__tfi()
{
set_specific();
return single_value->field_global__tfi;
}

const NullGlobalTfi_template& PacketPwrControlTA_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.PacketPwrControlTA.");
return single_value->field_global__tfi;
}

BITSTRING_template& PacketPwrControlTA_template::msg__escape()
{
set_specific();
return single_value->field_msg__escape;
}

const BITSTRING_template& PacketPwrControlTA_template::msg__escape() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field msg_escape of a non-specific template of type @RLCMAC_CSN1_Types.PacketPwrControlTA.");
return single_value->field_msg__escape;
}

PacketPwrControlTAMsg_template& PacketPwrControlTA_template::msg()
{
set_specific();
return single_value->field_msg;
}

const PacketPwrControlTAMsg_template& PacketPwrControlTA_template::msg() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field msg of a non-specific template of type @RLCMAC_CSN1_Types.PacketPwrControlTA.");
return single_value->field_msg;
}

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

void PacketPwrControlTA_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(", global_tfi := ");
single_value->field_global__tfi.log();
TTCN_Logger::log_event_str(", msg_escape := ");
single_value->field_msg__escape.log();
TTCN_Logger::log_event_str(", msg := ");
single_value->field_msg.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 PacketPwrControlTA_template::log_match(const PacketPwrControlTA& 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_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);
}
if(!single_value->field_msg__escape.match(match_value.msg__escape(), legacy)){
TTCN_Logger::log_logmatch_info(".msg_escape");
single_value->field_msg__escape.log_match(match_value.msg__escape(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.msg().ispresent()){
if(!single_value->field_msg.match(match_value.msg(), legacy)){
TTCN_Logger::log_logmatch_info(".msg");
single_value->field_msg.log_match(match_value.msg(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_msg.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".msg := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_msg.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(", global_tfi := ");
single_value->field_global__tfi.log_match(match_value.global__tfi(), legacy);
TTCN_Logger::log_event_str(", msg_escape := ");
single_value->field_msg__escape.log_match(match_value.msg__escape(), legacy);
TTCN_Logger::log_event_str(", msg := ");
if (match_value.msg().ispresent()) {
single_value->field_msg.log_match(match_value.msg(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_msg.log();
if (single_value->field_msg.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 PacketPwrControlTA_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (page__mode().is_bound()) page__mode().set_implicit_omit();
if (global__tfi().is_bound()) global__tfi().set_implicit_omit();
if (msg__escape().is_bound()) msg__escape().set_implicit_omit();
if (!msg().is_bound()) msg() = OMIT_VALUE;
else msg().set_implicit_omit();
}

void PacketPwrControlTA_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_global__tfi.encode_text(text_buf);
single_value->field_msg__escape.encode_text(text_buf);
single_value->field_msg.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.PacketPwrControlTA.");
}
}

void PacketPwrControlTA_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_global__tfi.decode_text(text_buf);
single_value->field_msg__escape.decode_text(text_buf);
single_value->field_msg.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 PacketPwrControlTA_template[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.PacketPwrControlTA.");
}
}

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

void PacketPwrControlTA_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.PacketPwrControlTA");
single_value->field_global__tfi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketPwrControlTA");
single_value->field_msg__escape.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketPwrControlTA");
single_value->field_msg.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketPwrControlTA");
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.PacketPwrControlTA");
}

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

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

PacketCellChangeContinue::PacketCellChangeContinue()
{
}

PacketCellChangeContinue::PacketCellChangeContinue(const PageMode& par_page__mode,
    const BITSTRING& par_zero,
    const GlobalTfi& par_gtfi,
    const BITSTRING& par_arfcn__bsic__presence,
    const OPTIONAL< INTEGER >& par_arfcn,
    const OPTIONAL< INTEGER >& par_bsic,
    const OPTIONAL< INTEGER >& par_container__id)
  :   field_page__mode(par_page__mode),
  field_zero(par_zero),
  field_gtfi(par_gtfi),
  field_arfcn__bsic__presence(par_arfcn__bsic__presence),
  field_arfcn(par_arfcn),
  field_bsic(par_bsic),
  field_container__id(par_container__id)
{
}

PacketCellChangeContinue::PacketCellChangeContinue(const PacketCellChangeContinue& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PacketCellChangeContinue.");
if (other_value.page__mode().is_bound()) field_page__mode = other_value.page__mode();
else field_page__mode.clean_up();
if (other_value.zero().is_bound()) field_zero = other_value.zero();
else field_zero.clean_up();
if (other_value.gtfi().is_bound()) field_gtfi = other_value.gtfi();
else field_gtfi.clean_up();
if (other_value.arfcn__bsic__presence().is_bound()) field_arfcn__bsic__presence = other_value.arfcn__bsic__presence();
else field_arfcn__bsic__presence.clean_up();
if (other_value.arfcn().is_bound()) field_arfcn = other_value.arfcn();
else field_arfcn.clean_up();
if (other_value.bsic().is_bound()) field_bsic = other_value.bsic();
else field_bsic.clean_up();
if (other_value.container__id().is_bound()) field_container__id = other_value.container__id();
else field_container__id.clean_up();
}

void PacketCellChangeContinue::clean_up()
{
field_page__mode.clean_up();
field_zero.clean_up();
field_gtfi.clean_up();
field_arfcn__bsic__presence.clean_up();
field_arfcn.clean_up();
field_bsic.clean_up();
field_container__id.clean_up();
}

const TTCN_Typedescriptor_t* PacketCellChangeContinue::get_descriptor() const { return &PacketCellChangeContinue_descr_; }
PacketCellChangeContinue& PacketCellChangeContinue::operator=(const PacketCellChangeContinue& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PacketCellChangeContinue.");
  if (other_value.page__mode().is_bound()) field_page__mode = other_value.page__mode();
  else field_page__mode.clean_up();
  if (other_value.zero().is_bound()) field_zero = other_value.zero();
  else field_zero.clean_up();
  if (other_value.gtfi().is_bound()) field_gtfi = other_value.gtfi();
  else field_gtfi.clean_up();
  if (other_value.arfcn__bsic__presence().is_bound()) field_arfcn__bsic__presence = other_value.arfcn__bsic__presence();
  else field_arfcn__bsic__presence.clean_up();
  if (other_value.arfcn().is_bound()) field_arfcn = other_value.arfcn();
  else field_arfcn.clean_up();
  if (other_value.bsic().is_bound()) field_bsic = other_value.bsic();
  else field_bsic.clean_up();
  if (other_value.container__id().is_bound()) field_container__id = other_value.container__id();
  else field_container__id.clean_up();
}
return *this;
}

boolean PacketCellChangeContinue::operator==(const PacketCellChangeContinue& other_value) const
{
return field_page__mode==other_value.field_page__mode
  && field_zero==other_value.field_zero
  && field_gtfi==other_value.field_gtfi
  && field_arfcn__bsic__presence==other_value.field_arfcn__bsic__presence
  && field_arfcn==other_value.field_arfcn
  && field_bsic==other_value.field_bsic
  && field_container__id==other_value.field_container__id;
}

boolean PacketCellChangeContinue::is_bound() const
{
return (field_page__mode.is_bound())
  || (field_zero.is_bound())
  || (field_gtfi.is_bound())
  || (field_arfcn__bsic__presence.is_bound())
  || (OPTIONAL_OMIT == field_arfcn.get_selection() || field_arfcn.is_bound())
  || (OPTIONAL_OMIT == field_bsic.get_selection() || field_bsic.is_bound())
  || (OPTIONAL_OMIT == field_container__id.get_selection() || field_container__id.is_bound());
}
boolean PacketCellChangeContinue::is_value() const
{
return field_page__mode.is_value()
  && field_zero.is_value()
  && field_gtfi.is_value()
  && field_arfcn__bsic__presence.is_value()
  && (OPTIONAL_OMIT == field_arfcn.get_selection() || field_arfcn.is_value())
  && (OPTIONAL_OMIT == field_bsic.get_selection() || field_bsic.is_value())
  && (OPTIONAL_OMIT == field_container__id.get_selection() || field_container__id.is_value());
}
int PacketCellChangeContinue::size_of() const
{
  int ret_val = 4;
  if (field_arfcn.ispresent()) ret_val++;
  if (field_bsic.ispresent()) ret_val++;
  if (field_container__id.ispresent()) ret_val++;
  return ret_val;
}

void PacketCellChangeContinue::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(", zero := ");
field_zero.log();
TTCN_Logger::log_event_str(", gtfi := ");
field_gtfi.log();
TTCN_Logger::log_event_str(", arfcn_bsic_presence := ");
field_arfcn__bsic__presence.log();
TTCN_Logger::log_event_str(", arfcn := ");
field_arfcn.log();
TTCN_Logger::log_event_str(", bsic := ");
field_bsic.log();
TTCN_Logger::log_event_str(", container_id := ");
field_container__id.log();
TTCN_Logger::log_event_str(" }");
}

void PacketCellChangeContinue::set_implicit_omit()
{
if (page__mode().is_bound()) page__mode().set_implicit_omit();
if (zero().is_bound()) zero().set_implicit_omit();
if (gtfi().is_bound()) gtfi().set_implicit_omit();
if (arfcn__bsic__presence().is_bound()) arfcn__bsic__presence().set_implicit_omit();
if (!arfcn().is_bound()) arfcn() = OMIT_VALUE;
else arfcn().set_implicit_omit();
if (!bsic().is_bound()) bsic() = OMIT_VALUE;
else bsic().set_implicit_omit();
if (!container__id().is_bound()) container__id() = OMIT_VALUE;
else container__id().set_implicit_omit();
}

void PacketCellChangeContinue::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.PacketCellChangeContinue 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) zero().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) gtfi().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) arfcn__bsic__presence().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) arfcn().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) bsic().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) container__id().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(), "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++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gtfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gtfi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "arfcn_bsic_presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          arfcn__bsic__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(), "arfcn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          arfcn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "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(), "container_id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          container__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.PacketCellChangeContinue: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.PacketCellChangeContinue");
  }
}

void PacketCellChangeContinue::encode_text(Text_Buf& text_buf) const
{
field_page__mode.encode_text(text_buf);
field_zero.encode_text(text_buf);
field_gtfi.encode_text(text_buf);
field_arfcn__bsic__presence.encode_text(text_buf);
field_arfcn.encode_text(text_buf);
field_bsic.encode_text(text_buf);
field_container__id.encode_text(text_buf);
}

void PacketCellChangeContinue::decode_text(Text_Buf& text_buf)
{
field_page__mode.decode_text(text_buf);
field_zero.decode_text(text_buf);
field_gtfi.decode_text(text_buf);
field_arfcn__bsic__presence.decode_text(text_buf);
field_arfcn.decode_text(text_buf);
field_bsic.decode_text(text_buf);
field_container__id.decode_text(text_buf);
}

void PacketCellChangeContinue::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 PacketCellChangeContinue::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 PacketCellChangeContinue::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, PacketCellChangeContinue_page__mode_descr_.raw->forceomit);
  decoded_field_length = field_page__mode.RAW_decode(PacketCellChangeContinue_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, PacketCellChangeContinue_zero_descr_.raw->forceomit);
  decoded_field_length = field_zero.RAW_decode(PacketCellChangeContinue_zero_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, PacketCellChangeContinue_gtfi_descr_.raw->forceomit);
  decoded_field_length = field_gtfi.RAW_decode(PacketCellChangeContinue_gtfi_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, PacketCellChangeContinue_arfcn__bsic__presence_descr_.raw->forceomit);
  decoded_field_length = field_arfcn__bsic__presence.RAW_decode(PacketCellChangeContinue_arfcn__bsic__presence_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_arfcn__bsic__presence ==  bs_0){
  if (force_omit != NULL && (*force_omit)(4)) {
    field_arfcn = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_4_force_omit(4, force_omit, PacketCellChangeContinue_arfcn_descr_.raw->forceomit);
  decoded_field_length = field_arfcn().RAW_decode(PacketCellChangeContinue_arfcn_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit);
  if (decoded_field_length < 1) {
  field_arfcn = 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_arfcn=OMIT_VALUE;
  if (limit > 0 && field_arfcn__bsic__presence ==  bs_0){
  if (force_omit != NULL && (*force_omit)(5)) {
    field_bsic = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_5_force_omit(5, force_omit, PacketCellChangeContinue_bsic_descr_.raw->forceomit);
  decoded_field_length = field_bsic().RAW_decode(PacketCellChangeContinue_bsic_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 1) {
  field_bsic = 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_bsic=OMIT_VALUE;
  if (limit > 0 && field_arfcn__bsic__presence ==  bs_0){
  if (force_omit != NULL && (*force_omit)(6)) {
    field_container__id = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_6_force_omit(6, force_omit, PacketCellChangeContinue_container__id_descr_.raw->forceomit);
  decoded_field_length = field_container__id().RAW_decode(PacketCellChangeContinue_container__id_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_6_force_omit);
  if (decoded_field_length < 1) {
  field_container__id = 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_container__id=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int PacketCellChangeContinue::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, PacketCellChangeContinue_page__mode_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PacketCellChangeContinue_zero_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PacketCellChangeContinue_gtfi_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, PacketCellChangeContinue_arfcn__bsic__presence_descr_.raw);
  if (field_arfcn.ispresent()) {
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, PacketCellChangeContinue_arfcn_descr_.raw);
  }
  else myleaf.body.node.nodes[4] = NULL;
  if (field_bsic.ispresent()) {
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, PacketCellChangeContinue_bsic_descr_.raw);
  }
  else myleaf.body.node.nodes[5] = NULL;
  if (field_container__id.ispresent()) {
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, PacketCellChangeContinue_container__id_descr_.raw);
  }
  else myleaf.body.node.nodes[6] = NULL;
  encoded_length += field_page__mode.RAW_encode(PacketCellChangeContinue_page__mode_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_zero.RAW_encode(PacketCellChangeContinue_zero_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_gtfi.RAW_encode(PacketCellChangeContinue_gtfi_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_arfcn__bsic__presence.RAW_encode(PacketCellChangeContinue_arfcn__bsic__presence_descr_, *myleaf.body.node.nodes[3]);
  if (field_arfcn.ispresent()) {
  encoded_length += field_arfcn().RAW_encode(PacketCellChangeContinue_arfcn_descr_, *myleaf.body.node.nodes[4]);
  }
  if (field_bsic.ispresent()) {
  encoded_length += field_bsic().RAW_encode(PacketCellChangeContinue_bsic_descr_, *myleaf.body.node.nodes[5]);
  }
  if (field_container__id.ispresent()) {
  encoded_length += field_container__id().RAW_encode(PacketCellChangeContinue_container__id_descr_, *myleaf.body.node.nodes[6]);
  }
  if (field_arfcn.ispresent() && (field_arfcn__bsic__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[]={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(PacketCellChangeContinue_arfcn__bsic__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_bsic.ispresent() && (field_arfcn__bsic__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[]={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(PacketCellChangeContinue_arfcn__bsic__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_container__id.ispresent() && (field_arfcn__bsic__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[]={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(PacketCellChangeContinue_arfcn__bsic__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 PacketCellChangeContinue_template::single_value_struct {
PageMode_template field_page__mode;
BITSTRING_template field_zero;
GlobalTfi_template field_gtfi;
BITSTRING_template field_arfcn__bsic__presence;
INTEGER_template field_arfcn;
INTEGER_template field_bsic;
INTEGER_template field_container__id;
};

void PacketCellChangeContinue_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_zero = ANY_VALUE;
single_value->field_gtfi = ANY_VALUE;
single_value->field_arfcn__bsic__presence = ANY_VALUE;
single_value->field_arfcn = ANY_OR_OMIT;
single_value->field_bsic = ANY_OR_OMIT;
single_value->field_container__id = ANY_OR_OMIT;
}
}
}

void PacketCellChangeContinue_template::copy_value(const PacketCellChangeContinue& 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.zero().is_bound()) {
  single_value->field_zero = other_value.zero();
} else {
  single_value->field_zero.clean_up();
}
if (other_value.gtfi().is_bound()) {
  single_value->field_gtfi = other_value.gtfi();
} else {
  single_value->field_gtfi.clean_up();
}
if (other_value.arfcn__bsic__presence().is_bound()) {
  single_value->field_arfcn__bsic__presence = other_value.arfcn__bsic__presence();
} else {
  single_value->field_arfcn__bsic__presence.clean_up();
}
if (other_value.arfcn().is_bound()) {
  if (other_value.arfcn().ispresent()) single_value->field_arfcn = other_value.arfcn()();
  else single_value->field_arfcn = OMIT_VALUE;
} else {
  single_value->field_arfcn.clean_up();
}
if (other_value.bsic().is_bound()) {
  if (other_value.bsic().ispresent()) single_value->field_bsic = other_value.bsic()();
  else single_value->field_bsic = OMIT_VALUE;
} else {
  single_value->field_bsic.clean_up();
}
if (other_value.container__id().is_bound()) {
  if (other_value.container__id().ispresent()) single_value->field_container__id = other_value.container__id()();
  else single_value->field_container__id = OMIT_VALUE;
} else {
  single_value->field_container__id.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PacketCellChangeContinue_template::copy_template(const PacketCellChangeContinue_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.zero().get_selection()) {
single_value->field_zero = other_value.zero();
} else {
single_value->field_zero.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.gtfi().get_selection()) {
single_value->field_gtfi = other_value.gtfi();
} else {
single_value->field_gtfi.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.arfcn__bsic__presence().get_selection()) {
single_value->field_arfcn__bsic__presence = other_value.arfcn__bsic__presence();
} else {
single_value->field_arfcn__bsic__presence.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.arfcn().get_selection()) {
single_value->field_arfcn = other_value.arfcn();
} else {
single_value->field_arfcn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.bsic().get_selection()) {
single_value->field_bsic = other_value.bsic();
} else {
single_value->field_bsic.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.container__id().get_selection()) {
single_value->field_container__id = other_value.container__id();
} else {
single_value->field_container__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 PacketCellChangeContinue_template[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 PacketCellChangeContinue_template(*other_value.implication_.precondition);
implication_.implied_template = new PacketCellChangeContinue_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.PacketCellChangeContinue.");
break;
}
set_selection(other_value);
}

PacketCellChangeContinue_template::PacketCellChangeContinue_template()
{
}

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

PacketCellChangeContinue_template::PacketCellChangeContinue_template(const PacketCellChangeContinue& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PacketCellChangeContinue_template::match(const PacketCellChangeContinue& 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.zero().is_bound()) return FALSE;
if(!single_value->field_zero.match(other_value.zero(), legacy))return FALSE;
if(!other_value.gtfi().is_bound()) return FALSE;
if(!single_value->field_gtfi.match(other_value.gtfi(), legacy))return FALSE;
if(!other_value.arfcn__bsic__presence().is_bound()) return FALSE;
if(!single_value->field_arfcn__bsic__presence.match(other_value.arfcn__bsic__presence(), legacy))return FALSE;
if(!other_value.arfcn().is_bound()) return FALSE;
if((other_value.arfcn().ispresent() ? !single_value->field_arfcn.match((const INTEGER&)other_value.arfcn(), legacy) : !single_value->field_arfcn.match_omit(legacy)))return FALSE;
if(!other_value.bsic().is_bound()) return FALSE;
if((other_value.bsic().ispresent() ? !single_value->field_bsic.match((const INTEGER&)other_value.bsic(), legacy) : !single_value->field_bsic.match_omit(legacy)))return FALSE;
if(!other_value.container__id().is_bound()) return FALSE;
if((other_value.container__id().ispresent() ? !single_value->field_container__id.match((const INTEGER&)other_value.container__id(), legacy) : !single_value->field_container__id.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.PacketCellChangeContinue.");
}
return FALSE;
}

boolean PacketCellChangeContinue_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_zero.is_bound()
 || single_value->field_gtfi.is_bound()
 || single_value->field_arfcn__bsic__presence.is_bound()
 || (single_value->field_arfcn.is_omit() || single_value->field_arfcn.is_bound())
 || (single_value->field_bsic.is_omit() || single_value->field_bsic.is_bound())
 || (single_value->field_container__id.is_omit() || single_value->field_container__id.is_bound());
}

boolean PacketCellChangeContinue_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_page__mode.is_value()
 && single_value->field_zero.is_value()
 && single_value->field_gtfi.is_value()
 && single_value->field_arfcn__bsic__presence.is_value()
 && (single_value->field_arfcn.is_omit() || single_value->field_arfcn.is_value())
 && (single_value->field_bsic.is_omit() || single_value->field_bsic.is_value())
 && (single_value->field_container__id.is_omit() || single_value->field_container__id.is_value());
}

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

PacketCellChangeContinue PacketCellChangeContinue_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.PacketCellChangeContinue.");
PacketCellChangeContinue ret_val;
if (single_value->field_page__mode.is_bound()) {
ret_val.page__mode() = single_value->field_page__mode.valueof();
}
if (single_value->field_zero.is_bound()) {
ret_val.zero() = single_value->field_zero.valueof();
}
if (single_value->field_gtfi.is_bound()) {
ret_val.gtfi() = single_value->field_gtfi.valueof();
}
if (single_value->field_arfcn__bsic__presence.is_bound()) {
ret_val.arfcn__bsic__presence() = single_value->field_arfcn__bsic__presence.valueof();
}
if (single_value->field_arfcn.is_omit()) ret_val.arfcn() = OMIT_VALUE;
else if (single_value->field_arfcn.is_bound()) {
ret_val.arfcn() = single_value->field_arfcn.valueof();
}
if (single_value->field_bsic.is_omit()) ret_val.bsic() = OMIT_VALUE;
else if (single_value->field_bsic.is_bound()) {
ret_val.bsic() = single_value->field_bsic.valueof();
}
if (single_value->field_container__id.is_omit()) ret_val.container__id() = OMIT_VALUE;
else if (single_value->field_container__id.is_bound()) {
ret_val.container__id() = single_value->field_container__id.valueof();
}
return ret_val;
}

void PacketCellChangeContinue_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.PacketCellChangeContinue.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PacketCellChangeContinue_template[list_length];
}

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

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

const PageMode_template& PacketCellChangeContinue_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.PacketCellChangeContinue.");
return single_value->field_page__mode;
}

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

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

GlobalTfi_template& PacketCellChangeContinue_template::gtfi()
{
set_specific();
return single_value->field_gtfi;
}

const GlobalTfi_template& PacketCellChangeContinue_template::gtfi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field gtfi of a non-specific template of type @RLCMAC_CSN1_Types.PacketCellChangeContinue.");
return single_value->field_gtfi;
}

BITSTRING_template& PacketCellChangeContinue_template::arfcn__bsic__presence()
{
set_specific();
return single_value->field_arfcn__bsic__presence;
}

const BITSTRING_template& PacketCellChangeContinue_template::arfcn__bsic__presence() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field arfcn_bsic_presence of a non-specific template of type @RLCMAC_CSN1_Types.PacketCellChangeContinue.");
return single_value->field_arfcn__bsic__presence;
}

INTEGER_template& PacketCellChangeContinue_template::arfcn()
{
set_specific();
return single_value->field_arfcn;
}

const INTEGER_template& PacketCellChangeContinue_template::arfcn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field arfcn of a non-specific template of type @RLCMAC_CSN1_Types.PacketCellChangeContinue.");
return single_value->field_arfcn;
}

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

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

INTEGER_template& PacketCellChangeContinue_template::container__id()
{
set_specific();
return single_value->field_container__id;
}

const INTEGER_template& PacketCellChangeContinue_template::container__id() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field container_id of a non-specific template of type @RLCMAC_CSN1_Types.PacketCellChangeContinue.");
return single_value->field_container__id;
}

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

void PacketCellChangeContinue_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(", zero := ");
single_value->field_zero.log();
TTCN_Logger::log_event_str(", gtfi := ");
single_value->field_gtfi.log();
TTCN_Logger::log_event_str(", arfcn_bsic_presence := ");
single_value->field_arfcn__bsic__presence.log();
TTCN_Logger::log_event_str(", arfcn := ");
single_value->field_arfcn.log();
TTCN_Logger::log_event_str(", bsic := ");
single_value->field_bsic.log();
TTCN_Logger::log_event_str(", container_id := ");
single_value->field_container__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 PacketCellChangeContinue_template::log_match(const PacketCellChangeContinue& 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_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);
}
if(!single_value->field_gtfi.match(match_value.gtfi(), legacy)){
TTCN_Logger::log_logmatch_info(".gtfi");
single_value->field_gtfi.log_match(match_value.gtfi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_arfcn__bsic__presence.match(match_value.arfcn__bsic__presence(), legacy)){
TTCN_Logger::log_logmatch_info(".arfcn_bsic_presence");
single_value->field_arfcn__bsic__presence.log_match(match_value.arfcn__bsic__presence(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.arfcn().ispresent()){
if(!single_value->field_arfcn.match(match_value.arfcn(), legacy)){
TTCN_Logger::log_logmatch_info(".arfcn");
single_value->field_arfcn.log_match(match_value.arfcn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_arfcn.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".arfcn := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_arfcn.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.bsic().ispresent()){
if(!single_value->field_bsic.match(match_value.bsic(), legacy)){
TTCN_Logger::log_logmatch_info(".bsic");
single_value->field_bsic.log_match(match_value.bsic(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_bsic.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".bsic := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_bsic.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.container__id().ispresent()){
if(!single_value->field_container__id.match(match_value.container__id(), legacy)){
TTCN_Logger::log_logmatch_info(".container_id");
single_value->field_container__id.log_match(match_value.container__id(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_container__id.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".container_id := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_container__id.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(", zero := ");
single_value->field_zero.log_match(match_value.zero(), legacy);
TTCN_Logger::log_event_str(", gtfi := ");
single_value->field_gtfi.log_match(match_value.gtfi(), legacy);
TTCN_Logger::log_event_str(", arfcn_bsic_presence := ");
single_value->field_arfcn__bsic__presence.log_match(match_value.arfcn__bsic__presence(), legacy);
TTCN_Logger::log_event_str(", arfcn := ");
if (match_value.arfcn().ispresent()) {
single_value->field_arfcn.log_match(match_value.arfcn(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_arfcn.log();
if (single_value->field_arfcn.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", bsic := ");
if (match_value.bsic().ispresent()) {
single_value->field_bsic.log_match(match_value.bsic(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_bsic.log();
if (single_value->field_bsic.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", container_id := ");
if (match_value.container__id().ispresent()) {
single_value->field_container__id.log_match(match_value.container__id(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_container__id.log();
if (single_value->field_container__id.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 PacketCellChangeContinue_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (page__mode().is_bound()) page__mode().set_implicit_omit();
if (zero().is_bound()) zero().set_implicit_omit();
if (gtfi().is_bound()) gtfi().set_implicit_omit();
if (arfcn__bsic__presence().is_bound()) arfcn__bsic__presence().set_implicit_omit();
if (!arfcn().is_bound()) arfcn() = OMIT_VALUE;
else arfcn().set_implicit_omit();
if (!bsic().is_bound()) bsic() = OMIT_VALUE;
else bsic().set_implicit_omit();
if (!container__id().is_bound()) container__id() = OMIT_VALUE;
else container__id().set_implicit_omit();
}

void PacketCellChangeContinue_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_zero.encode_text(text_buf);
single_value->field_gtfi.encode_text(text_buf);
single_value->field_arfcn__bsic__presence.encode_text(text_buf);
single_value->field_arfcn.encode_text(text_buf);
single_value->field_bsic.encode_text(text_buf);
single_value->field_container__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.PacketCellChangeContinue.");
}
}

void PacketCellChangeContinue_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_zero.decode_text(text_buf);
single_value->field_gtfi.decode_text(text_buf);
single_value->field_arfcn__bsic__presence.decode_text(text_buf);
single_value->field_arfcn.decode_text(text_buf);
single_value->field_bsic.decode_text(text_buf);
single_value->field_container__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 PacketCellChangeContinue_template[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.PacketCellChangeContinue.");
}
}

void PacketCellChangeContinue_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: {
    PacketCellChangeContinue_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.PacketCellChangeContinue 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) zero().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) gtfi().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) arfcn__bsic__presence().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) arfcn().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) bsic().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) container__id().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(), "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++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gtfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gtfi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "arfcn_bsic_presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          arfcn__bsic__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(), "arfcn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          arfcn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "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(), "container_id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          container__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.PacketCellChangeContinue: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PacketCellChangeContinue_template* precondition = new PacketCellChangeContinue_template;
    precondition->set_param(*param.get_elem(0));
    PacketCellChangeContinue_template* implied_template = new PacketCellChangeContinue_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PacketCellChangeContinue_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.PacketCellChangeContinue");
  }
  is_ifpresent = param.get_ifpresent();
}

void PacketCellChangeContinue_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.PacketCellChangeContinue");
single_value->field_zero.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketCellChangeContinue");
single_value->field_gtfi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketCellChangeContinue");
single_value->field_arfcn__bsic__presence.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketCellChangeContinue");
single_value->field_arfcn.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketCellChangeContinue");
single_value->field_bsic.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketCellChangeContinue");
single_value->field_container__id.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketCellChangeContinue");
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.PacketCellChangeContinue");
}

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

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

PacketNeighbourCellDataContainer::PacketNeighbourCellDataContainer()
{
}

PacketNeighbourCellDataContainer::PacketNeighbourCellDataContainer(const BITSTRING& par_pd,
    const INTEGER& par_cd__length,
    const OCTETSTRING& par_container__data)
  :   field_pd(par_pd),
  field_cd__length(par_cd__length),
  field_container__data(par_container__data)
{
}

PacketNeighbourCellDataContainer::PacketNeighbourCellDataContainer(const PacketNeighbourCellDataContainer& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PacketNeighbourCellDataContainer.");
if (other_value.pd().is_bound()) field_pd = other_value.pd();
else field_pd.clean_up();
if (other_value.cd__length().is_bound()) field_cd__length = other_value.cd__length();
else field_cd__length.clean_up();
if (other_value.container__data().is_bound()) field_container__data = other_value.container__data();
else field_container__data.clean_up();
}

void PacketNeighbourCellDataContainer::clean_up()
{
field_pd.clean_up();
field_cd__length.clean_up();
field_container__data.clean_up();
}

const TTCN_Typedescriptor_t* PacketNeighbourCellDataContainer::get_descriptor() const { return &PacketNeighbourCellDataContainer_descr_; }
PacketNeighbourCellDataContainer& PacketNeighbourCellDataContainer::operator=(const PacketNeighbourCellDataContainer& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PacketNeighbourCellDataContainer.");
  if (other_value.pd().is_bound()) field_pd = other_value.pd();
  else field_pd.clean_up();
  if (other_value.cd__length().is_bound()) field_cd__length = other_value.cd__length();
  else field_cd__length.clean_up();
  if (other_value.container__data().is_bound()) field_container__data = other_value.container__data();
  else field_container__data.clean_up();
}
return *this;
}

boolean PacketNeighbourCellDataContainer::operator==(const PacketNeighbourCellDataContainer& other_value) const
{
return field_pd==other_value.field_pd
  && field_cd__length==other_value.field_cd__length
  && field_container__data==other_value.field_container__data;
}

boolean PacketNeighbourCellDataContainer::is_bound() const
{
return (field_pd.is_bound())
  || (field_cd__length.is_bound())
  || (field_container__data.is_bound());
}
boolean PacketNeighbourCellDataContainer::is_value() const
{
return field_pd.is_value()
  && field_cd__length.is_value()
  && field_container__data.is_value();
}
void PacketNeighbourCellDataContainer::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ pd := ");
field_pd.log();
TTCN_Logger::log_event_str(", cd_length := ");
field_cd__length.log();
TTCN_Logger::log_event_str(", container_data := ");
field_container__data.log();
TTCN_Logger::log_event_str(" }");
}

void PacketNeighbourCellDataContainer::set_implicit_omit()
{
if (pd().is_bound()) pd().set_implicit_omit();
if (cd__length().is_bound()) cd__length().set_implicit_omit();
if (container__data().is_bound()) container__data().set_implicit_omit();
}

void PacketNeighbourCellDataContainer::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.PacketNeighbourCellDataContainer 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) pd().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) cd__length().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) container__data().set_param(*param.get_elem(2));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pd")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pd().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cd_length")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cd__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(), "container_data")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          container__data().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @RLCMAC_CSN1_Types.PacketNeighbourCellDataContainer: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.PacketNeighbourCellDataContainer");
  }
}

void PacketNeighbourCellDataContainer::encode_text(Text_Buf& text_buf) const
{
field_pd.encode_text(text_buf);
field_cd__length.encode_text(text_buf);
field_container__data.encode_text(text_buf);
}

void PacketNeighbourCellDataContainer::decode_text(Text_Buf& text_buf)
{
field_pd.decode_text(text_buf);
field_cd__length.decode_text(text_buf);
field_container__data.decode_text(text_buf);
}

void PacketNeighbourCellDataContainer::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 PacketNeighbourCellDataContainer::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 PacketNeighbourCellDataContainer::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, PacketNeighbourCellDataContainer_pd_descr_.raw->forceomit);
  decoded_field_length = field_pd.RAW_decode(PacketNeighbourCellDataContainer_pd_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, PacketNeighbourCellDataContainer_cd__length_descr_.raw->forceomit);
  decoded_field_length = field_cd__length.RAW_decode(PacketNeighbourCellDataContainer_cd__length_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  INTEGER tmp1 = field_cd__length.convert_to_Integer(PacketNeighbourCellDataContainer_cd__length_descr_);
  field_cd__length = tmp1;
  value_of_length_field1 += tmp1.get_long_long_val() * 8;
  RAW_Force_Omit field_2_force_omit(2, force_omit, PacketNeighbourCellDataContainer_container__data_descr_.raw->forceomit);
  decoded_field_length = field_container__data.RAW_decode(PacketNeighbourCellDataContainer_container__data_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field1 -= decoded_field_length;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int PacketNeighbourCellDataContainer::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, PacketNeighbourCellDataContainer_pd_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PacketNeighbourCellDataContainer_cd__length_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PacketNeighbourCellDataContainer_container__data_descr_.raw);
  encoded_length += field_pd.RAW_encode(PacketNeighbourCellDataContainer_pd_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += 5;
  myleaf.body.node.nodes[1]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[1]->coding_descr = &PacketNeighbourCellDataContainer_cd__length_descr_;
  myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[1]->length = 5;
  myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level;
  myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos;
  encoded_length += field_container__data.RAW_encode(PacketNeighbourCellDataContainer_container__data_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct PacketNeighbourCellDataContainer_template::single_value_struct {
BITSTRING_template field_pd;
INTEGER_template field_cd__length;
OCTETSTRING_template field_container__data;
};

void PacketNeighbourCellDataContainer_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_pd = ANY_VALUE;
single_value->field_cd__length = ANY_VALUE;
single_value->field_container__data = ANY_VALUE;
}
}
}

void PacketNeighbourCellDataContainer_template::copy_value(const PacketNeighbourCellDataContainer& other_value)
{
single_value = new single_value_struct;
if (other_value.pd().is_bound()) {
  single_value->field_pd = other_value.pd();
} else {
  single_value->field_pd.clean_up();
}
if (other_value.cd__length().is_bound()) {
  single_value->field_cd__length = other_value.cd__length();
} else {
  single_value->field_cd__length.clean_up();
}
if (other_value.container__data().is_bound()) {
  single_value->field_container__data = other_value.container__data();
} else {
  single_value->field_container__data.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PacketNeighbourCellDataContainer_template::copy_template(const PacketNeighbourCellDataContainer_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.pd().get_selection()) {
single_value->field_pd = other_value.pd();
} else {
single_value->field_pd.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.cd__length().get_selection()) {
single_value->field_cd__length = other_value.cd__length();
} else {
single_value->field_cd__length.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.container__data().get_selection()) {
single_value->field_container__data = other_value.container__data();
} else {
single_value->field_container__data.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new PacketNeighbourCellDataContainer_template[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 PacketNeighbourCellDataContainer_template(*other_value.implication_.precondition);
implication_.implied_template = new PacketNeighbourCellDataContainer_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.PacketNeighbourCellDataContainer.");
break;
}
set_selection(other_value);
}

PacketNeighbourCellDataContainer_template::PacketNeighbourCellDataContainer_template()
{
}

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

PacketNeighbourCellDataContainer_template::PacketNeighbourCellDataContainer_template(const PacketNeighbourCellDataContainer& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

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

boolean PacketNeighbourCellDataContainer_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_pd.is_bound()
 || single_value->field_cd__length.is_bound()
 || single_value->field_container__data.is_bound();
}

boolean PacketNeighbourCellDataContainer_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_pd.is_value()
 && single_value->field_cd__length.is_value()
 && single_value->field_container__data.is_value();
}

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

PacketNeighbourCellDataContainer PacketNeighbourCellDataContainer_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.PacketNeighbourCellDataContainer.");
PacketNeighbourCellDataContainer ret_val;
if (single_value->field_pd.is_bound()) {
ret_val.pd() = single_value->field_pd.valueof();
}
if (single_value->field_cd__length.is_bound()) {
ret_val.cd__length() = single_value->field_cd__length.valueof();
}
if (single_value->field_container__data.is_bound()) {
ret_val.container__data() = single_value->field_container__data.valueof();
}
return ret_val;
}

void PacketNeighbourCellDataContainer_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.PacketNeighbourCellDataContainer.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PacketNeighbourCellDataContainer_template[list_length];
}

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

BITSTRING_template& PacketNeighbourCellDataContainer_template::pd()
{
set_specific();
return single_value->field_pd;
}

const BITSTRING_template& PacketNeighbourCellDataContainer_template::pd() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pd of a non-specific template of type @RLCMAC_CSN1_Types.PacketNeighbourCellDataContainer.");
return single_value->field_pd;
}

INTEGER_template& PacketNeighbourCellDataContainer_template::cd__length()
{
set_specific();
return single_value->field_cd__length;
}

const INTEGER_template& PacketNeighbourCellDataContainer_template::cd__length() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field cd_length of a non-specific template of type @RLCMAC_CSN1_Types.PacketNeighbourCellDataContainer.");
return single_value->field_cd__length;
}

OCTETSTRING_template& PacketNeighbourCellDataContainer_template::container__data()
{
set_specific();
return single_value->field_container__data;
}

const OCTETSTRING_template& PacketNeighbourCellDataContainer_template::container__data() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field container_data of a non-specific template of type @RLCMAC_CSN1_Types.PacketNeighbourCellDataContainer.");
return single_value->field_container__data;
}

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

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

void PacketNeighbourCellDataContainer_template::log_match(const PacketNeighbourCellDataContainer& 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_pd.match(match_value.pd(), legacy)){
TTCN_Logger::log_logmatch_info(".pd");
single_value->field_pd.log_match(match_value.pd(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_cd__length.match(match_value.cd__length(), legacy)){
TTCN_Logger::log_logmatch_info(".cd_length");
single_value->field_cd__length.log_match(match_value.cd__length(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_container__data.match(match_value.container__data(), legacy)){
TTCN_Logger::log_logmatch_info(".container_data");
single_value->field_container__data.log_match(match_value.container__data(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ pd := ");
single_value->field_pd.log_match(match_value.pd(), legacy);
TTCN_Logger::log_event_str(", cd_length := ");
single_value->field_cd__length.log_match(match_value.cd__length(), legacy);
TTCN_Logger::log_event_str(", container_data := ");
single_value->field_container__data.log_match(match_value.container__data(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void PacketNeighbourCellDataContainer_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (pd().is_bound()) pd().set_implicit_omit();
if (cd__length().is_bound()) cd__length().set_implicit_omit();
if (container__data().is_bound()) container__data().set_implicit_omit();
}

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

void PacketNeighbourCellDataContainer_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_pd.decode_text(text_buf);
single_value->field_cd__length.decode_text(text_buf);
single_value->field_container__data.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new PacketNeighbourCellDataContainer_template[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.PacketNeighbourCellDataContainer.");
}
}

void PacketNeighbourCellDataContainer_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: {
    PacketNeighbourCellDataContainer_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.PacketNeighbourCellDataContainer 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) pd().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) cd__length().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) container__data().set_param(*param.get_elem(2));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pd")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pd().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cd_length")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cd__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(), "container_data")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          container__data().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @RLCMAC_CSN1_Types.PacketNeighbourCellDataContainer: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PacketNeighbourCellDataContainer_template* precondition = new PacketNeighbourCellDataContainer_template;
    precondition->set_param(*param.get_elem(0));
    PacketNeighbourCellDataContainer_template* implied_template = new PacketNeighbourCellDataContainer_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PacketNeighbourCellDataContainer_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.PacketNeighbourCellDataContainer");
  }
  is_ifpresent = param.get_ifpresent();
}

void PacketNeighbourCellDataContainer_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_pd.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketNeighbourCellDataContainer");
single_value->field_cd__length.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketNeighbourCellDataContainer");
single_value->field_container__data.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketNeighbourCellDataContainer");
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.PacketNeighbourCellDataContainer");
}

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

boolean PacketNeighbourCellDataContainer_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 PacketNeighbourCellDataContainer PacketNeighbourCellDataContainerList::UNBOUND_ELEM;
PacketNeighbourCellDataContainerList::PacketNeighbourCellDataContainerList()
{
val_ptr = NULL;
}

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

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

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

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

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

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

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

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

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

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

const PacketNeighbourCellDataContainer& PacketNeighbourCellDataContainerList::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @RLCMAC_CSN1_Types.PacketNeighbourCellDataContainerList.");
if (index_value < 0) TTCN_error("Accessing an element of type @RLCMAC_CSN1_Types.PacketNeighbourCellDataContainerList 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.PacketNeighbourCellDataContainerList: 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 PacketNeighbourCellDataContainer& PacketNeighbourCellDataContainerList::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @RLCMAC_CSN1_Types.PacketNeighbourCellDataContainerList.");
return (*this)[(int)index_value];
}

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

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

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

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

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

PacketNeighbourCellDataContainerList PacketNeighbourCellDataContainerList::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.PacketNeighbourCellDataContainerList.");
check_substr_arguments(val_ptr->n_elements, index, returncount, "@RLCMAC_CSN1_Types.PacketNeighbourCellDataContainerList","element");
PacketNeighbourCellDataContainerList 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 PacketNeighbourCellDataContainer(*val_ptr->value_elements[i+index]);
}
}
return ret_val;
}

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

PacketNeighbourCellDataContainerList PacketNeighbourCellDataContainerList::replace(int index, int len, const PacketNeighbourCellDataContainerList_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 PacketNeighbourCellDataContainerList::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.PacketNeighbourCellDataContainerList.");
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 = (PacketNeighbourCellDataContainer**)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 PacketNeighbourCellDataContainer(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (PacketNeighbourCellDataContainer**)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.PacketNeighbourCellDataContainerList: %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 = (PacketNeighbourCellDataContainer**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}

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

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

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

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

void PacketNeighbourCellDataContainerList_template::copy_template(const PacketNeighbourCellDataContainerList_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 = (PacketNeighbourCellDataContainer_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 PacketNeighbourCellDataContainer_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new PacketNeighbourCellDataContainer_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 PacketNeighbourCellDataContainerList_template[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 PacketNeighbourCellDataContainerList_template(*other_value.implication_.precondition);
implication_.implied_template = new PacketNeighbourCellDataContainerList_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.PacketNeighbourCellDataContainerList.");
break;
}
set_selection(other_value);
}

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

PacketNeighbourCellDataContainerList_template::PacketNeighbourCellDataContainerList_template()
{
}

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

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

PacketNeighbourCellDataContainerList_template::PacketNeighbourCellDataContainerList_template(const PacketNeighbourCellDataContainerList& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

const PacketNeighbourCellDataContainer_template& PacketNeighbourCellDataContainerList_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @RLCMAC_CSN1_Types.PacketNeighbourCellDataContainerList 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.PacketNeighbourCellDataContainerList.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @RLCMAC_CSN1_Types.PacketNeighbourCellDataContainerList: 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 PacketNeighbourCellDataContainer_template& PacketNeighbourCellDataContainerList_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.PacketNeighbourCellDataContainerList.");
return (*this)[(int)index_value];
}

void PacketNeighbourCellDataContainerList_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.PacketNeighbourCellDataContainerList.");
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 = (PacketNeighbourCellDataContainer_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 PacketNeighbourCellDataContainer_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 PacketNeighbourCellDataContainer_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 = (PacketNeighbourCellDataContainer_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}

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

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

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

PacketNeighbourCellDataContainerList PacketNeighbourCellDataContainerList_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.PacketNeighbourCellDataContainerList.");
PacketNeighbourCellDataContainerList 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;
}

PacketNeighbourCellDataContainerList PacketNeighbourCellDataContainerList_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);
}

PacketNeighbourCellDataContainerList PacketNeighbourCellDataContainerList_template::replace(int index, int len, const PacketNeighbourCellDataContainerList_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());
}

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

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

void PacketNeighbourCellDataContainerList_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 PacketNeighbourCellDataContainerList_template::log_match(const PacketNeighbourCellDataContainerList& 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 PacketNeighbourCellDataContainerList_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.PacketNeighbourCellDataContainerList.");
}
}

void PacketNeighbourCellDataContainerList_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.PacketNeighbourCellDataContainerList.");
single_value.value_elements = (PacketNeighbourCellDataContainer_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 PacketNeighbourCellDataContainer_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 PacketNeighbourCellDataContainerList_template[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.PacketNeighbourCellDataContainerList.");
}
}

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

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

void PacketNeighbourCellDataContainerList_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.PacketNeighbourCellDataContainerList");
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.PacketNeighbourCellDataContainerList");
}

boolean PacketNeighbourCellDataContainerList_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);
}
}
PacketNeighbourCellData::PacketNeighbourCellData()
{
}

PacketNeighbourCellData::PacketNeighbourCellData(const PageMode& par_page__mode,
    const BITSTRING& par_zero,
    const GlobalTfi& par_gtfi,
    const INTEGER& par_container__id,
    const BITSTRING& par_spare,
    const INTEGER& par_container__index,
    const BITSTRING& par_arfcn__bsic__presence,
    const OPTIONAL< INTEGER >& par_arfcn,
    const OPTIONAL< INTEGER >& par_bsic,
    const PacketNeighbourCellDataContainerList& par_container__list)
  :   field_page__mode(par_page__mode),
  field_zero(par_zero),
  field_gtfi(par_gtfi),
  field_container__id(par_container__id),
  field_spare(par_spare),
  field_container__index(par_container__index),
  field_arfcn__bsic__presence(par_arfcn__bsic__presence),
  field_arfcn(par_arfcn),
  field_bsic(par_bsic),
  field_container__list(par_container__list)
{
}

PacketNeighbourCellData::PacketNeighbourCellData(const PacketNeighbourCellData& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PacketNeighbourCellData.");
if (other_value.page__mode().is_bound()) field_page__mode = other_value.page__mode();
else field_page__mode.clean_up();
if (other_value.zero().is_bound()) field_zero = other_value.zero();
else field_zero.clean_up();
if (other_value.gtfi().is_bound()) field_gtfi = other_value.gtfi();
else field_gtfi.clean_up();
if (other_value.container__id().is_bound()) field_container__id = other_value.container__id();
else field_container__id.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.container__index().is_bound()) field_container__index = other_value.container__index();
else field_container__index.clean_up();
if (other_value.arfcn__bsic__presence().is_bound()) field_arfcn__bsic__presence = other_value.arfcn__bsic__presence();
else field_arfcn__bsic__presence.clean_up();
if (other_value.arfcn().is_bound()) field_arfcn = other_value.arfcn();
else field_arfcn.clean_up();
if (other_value.bsic().is_bound()) field_bsic = other_value.bsic();
else field_bsic.clean_up();
if (other_value.container__list().is_bound()) field_container__list = other_value.container__list();
else field_container__list.clean_up();
}

void PacketNeighbourCellData::clean_up()
{
field_page__mode.clean_up();
field_zero.clean_up();
field_gtfi.clean_up();
field_container__id.clean_up();
field_spare.clean_up();
field_container__index.clean_up();
field_arfcn__bsic__presence.clean_up();
field_arfcn.clean_up();
field_bsic.clean_up();
field_container__list.clean_up();
}

const TTCN_Typedescriptor_t* PacketNeighbourCellData::get_descriptor() const { return &PacketNeighbourCellData_descr_; }
PacketNeighbourCellData& PacketNeighbourCellData::operator=(const PacketNeighbourCellData& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PacketNeighbourCellData.");
  if (other_value.page__mode().is_bound()) field_page__mode = other_value.page__mode();
  else field_page__mode.clean_up();
  if (other_value.zero().is_bound()) field_zero = other_value.zero();
  else field_zero.clean_up();
  if (other_value.gtfi().is_bound()) field_gtfi = other_value.gtfi();
  else field_gtfi.clean_up();
  if (other_value.container__id().is_bound()) field_container__id = other_value.container__id();
  else field_container__id.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.container__index().is_bound()) field_container__index = other_value.container__index();
  else field_container__index.clean_up();
  if (other_value.arfcn__bsic__presence().is_bound()) field_arfcn__bsic__presence = other_value.arfcn__bsic__presence();
  else field_arfcn__bsic__presence.clean_up();
  if (other_value.arfcn().is_bound()) field_arfcn = other_value.arfcn();
  else field_arfcn.clean_up();
  if (other_value.bsic().is_bound()) field_bsic = other_value.bsic();
  else field_bsic.clean_up();
  if (other_value.container__list().is_bound()) field_container__list = other_value.container__list();
  else field_container__list.clean_up();
}
return *this;
}

boolean PacketNeighbourCellData::operator==(const PacketNeighbourCellData& other_value) const
{
return field_page__mode==other_value.field_page__mode
  && field_zero==other_value.field_zero
  && field_gtfi==other_value.field_gtfi
  && field_container__id==other_value.field_container__id
  && field_spare==other_value.field_spare
  && field_container__index==other_value.field_container__index
  && field_arfcn__bsic__presence==other_value.field_arfcn__bsic__presence
  && field_arfcn==other_value.field_arfcn
  && field_bsic==other_value.field_bsic
  && field_container__list==other_value.field_container__list;
}

boolean PacketNeighbourCellData::is_bound() const
{
return (field_page__mode.is_bound())
  || (field_zero.is_bound())
  || (field_gtfi.is_bound())
  || (field_container__id.is_bound())
  || (field_spare.is_bound())
  || (field_container__index.is_bound())
  || (field_arfcn__bsic__presence.is_bound())
  || (OPTIONAL_OMIT == field_arfcn.get_selection() || field_arfcn.is_bound())
  || (OPTIONAL_OMIT == field_bsic.get_selection() || field_bsic.is_bound())
  || (field_container__list.is_bound());
}
boolean PacketNeighbourCellData::is_value() const
{
return field_page__mode.is_value()
  && field_zero.is_value()
  && field_gtfi.is_value()
  && field_container__id.is_value()
  && field_spare.is_value()
  && field_container__index.is_value()
  && field_arfcn__bsic__presence.is_value()
  && (OPTIONAL_OMIT == field_arfcn.get_selection() || field_arfcn.is_value())
  && (OPTIONAL_OMIT == field_bsic.get_selection() || field_bsic.is_value())
  && field_container__list.is_value();
}
int PacketNeighbourCellData::size_of() const
{
  int ret_val = 8;
  if (field_arfcn.ispresent()) ret_val++;
  if (field_bsic.ispresent()) ret_val++;
  return ret_val;
}

void PacketNeighbourCellData::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(", zero := ");
field_zero.log();
TTCN_Logger::log_event_str(", gtfi := ");
field_gtfi.log();
TTCN_Logger::log_event_str(", container_id := ");
field_container__id.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(", container_index := ");
field_container__index.log();
TTCN_Logger::log_event_str(", arfcn_bsic_presence := ");
field_arfcn__bsic__presence.log();
TTCN_Logger::log_event_str(", arfcn := ");
field_arfcn.log();
TTCN_Logger::log_event_str(", bsic := ");
field_bsic.log();
TTCN_Logger::log_event_str(", container_list := ");
field_container__list.log();
TTCN_Logger::log_event_str(" }");
}

void PacketNeighbourCellData::set_implicit_omit()
{
if (page__mode().is_bound()) page__mode().set_implicit_omit();
if (zero().is_bound()) zero().set_implicit_omit();
if (gtfi().is_bound()) gtfi().set_implicit_omit();
if (container__id().is_bound()) container__id().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (container__index().is_bound()) container__index().set_implicit_omit();
if (arfcn__bsic__presence().is_bound()) arfcn__bsic__presence().set_implicit_omit();
if (!arfcn().is_bound()) arfcn() = OMIT_VALUE;
else arfcn().set_implicit_omit();
if (!bsic().is_bound()) bsic() = OMIT_VALUE;
else bsic().set_implicit_omit();
if (container__list().is_bound()) container__list().set_implicit_omit();
}

void PacketNeighbourCellData::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.PacketNeighbourCellData 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) page__mode().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) zero().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) gtfi().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) container__id().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) container__index().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) arfcn__bsic__presence().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) arfcn().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) bsic().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) container__list().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(), "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(), "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++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gtfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gtfi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "container_id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          container__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(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "container_index")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          container__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(), "arfcn_bsic_presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          arfcn__bsic__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(), "arfcn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          arfcn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "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(), "container_list")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          container__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.PacketNeighbourCellData: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.PacketNeighbourCellData");
  }
}

void PacketNeighbourCellData::encode_text(Text_Buf& text_buf) const
{
field_page__mode.encode_text(text_buf);
field_zero.encode_text(text_buf);
field_gtfi.encode_text(text_buf);
field_container__id.encode_text(text_buf);
field_spare.encode_text(text_buf);
field_container__index.encode_text(text_buf);
field_arfcn__bsic__presence.encode_text(text_buf);
field_arfcn.encode_text(text_buf);
field_bsic.encode_text(text_buf);
field_container__list.encode_text(text_buf);
}

void PacketNeighbourCellData::decode_text(Text_Buf& text_buf)
{
field_page__mode.decode_text(text_buf);
field_zero.decode_text(text_buf);
field_gtfi.decode_text(text_buf);
field_container__id.decode_text(text_buf);
field_spare.decode_text(text_buf);
field_container__index.decode_text(text_buf);
field_arfcn__bsic__presence.decode_text(text_buf);
field_arfcn.decode_text(text_buf);
field_bsic.decode_text(text_buf);
field_container__list.decode_text(text_buf);
}

void PacketNeighbourCellData::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 PacketNeighbourCellData::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 PacketNeighbourCellData::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, PacketNeighbourCellData_page__mode_descr_.raw->forceomit);
  decoded_field_length = field_page__mode.RAW_decode(PacketNeighbourCellData_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, PacketNeighbourCellData_zero_descr_.raw->forceomit);
  decoded_field_length = field_zero.RAW_decode(PacketNeighbourCellData_zero_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, PacketNeighbourCellData_gtfi_descr_.raw->forceomit);
  decoded_field_length = field_gtfi.RAW_decode(PacketNeighbourCellData_gtfi_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, PacketNeighbourCellData_container__id_descr_.raw->forceomit);
  decoded_field_length = field_container__id.RAW_decode(PacketNeighbourCellData_container__id_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, PacketNeighbourCellData_spare_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(PacketNeighbourCellData_spare_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_4_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_5_force_omit(5, force_omit, PacketNeighbourCellData_container__index_descr_.raw->forceomit);
  decoded_field_length = field_container__index.RAW_decode(PacketNeighbourCellData_container__index_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, PacketNeighbourCellData_arfcn__bsic__presence_descr_.raw->forceomit);
  decoded_field_length = field_arfcn__bsic__presence.RAW_decode(PacketNeighbourCellData_arfcn__bsic__presence_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());
  if (limit > 0 && field_arfcn__bsic__presence ==  bs_0){
  if (force_omit != NULL && (*force_omit)(7)) {
    field_arfcn = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_7_force_omit(7, force_omit, PacketNeighbourCellData_arfcn_descr_.raw->forceomit);
  decoded_field_length = field_arfcn().RAW_decode(PacketNeighbourCellData_arfcn_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_7_force_omit);
  if (decoded_field_length < 1) {
  field_arfcn = 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_arfcn=OMIT_VALUE;
  if (limit > 0 && field_arfcn__bsic__presence ==  bs_0){
  if (force_omit != NULL && (*force_omit)(8)) {
    field_bsic = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_8_force_omit(8, force_omit, PacketNeighbourCellData_bsic_descr_.raw->forceomit);
  decoded_field_length = field_bsic().RAW_decode(PacketNeighbourCellData_bsic_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_8_force_omit);
  if (decoded_field_length < 1) {
  field_bsic = 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_bsic=OMIT_VALUE;
  RAW_Force_Omit field_9_force_omit(9, force_omit, PacketNeighbourCellData_container__list_descr_.raw->forceomit);
  decoded_field_length = field_container__list.RAW_decode(PacketNeighbourCellData_container__list_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 PacketNeighbourCellData::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, PacketNeighbourCellData_page__mode_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PacketNeighbourCellData_zero_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PacketNeighbourCellData_gtfi_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, PacketNeighbourCellData_container__id_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, PacketNeighbourCellData_spare_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, PacketNeighbourCellData_container__index_descr_.raw);
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, PacketNeighbourCellData_arfcn__bsic__presence_descr_.raw);
  if (field_arfcn.ispresent()) {
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, PacketNeighbourCellData_arfcn_descr_.raw);
  }
  else myleaf.body.node.nodes[7] = NULL;
  if (field_bsic.ispresent()) {
  myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, PacketNeighbourCellData_bsic_descr_.raw);
  }
  else myleaf.body.node.nodes[8] = NULL;
  myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, PacketNeighbourCellData_container__list_descr_.raw);
  encoded_length += field_page__mode.RAW_encode(PacketNeighbourCellData_page__mode_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_zero.RAW_encode(PacketNeighbourCellData_zero_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_gtfi.RAW_encode(PacketNeighbourCellData_gtfi_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_container__id.RAW_encode(PacketNeighbourCellData_container__id_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_spare.RAW_encode(PacketNeighbourCellData_spare_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_container__index.RAW_encode(PacketNeighbourCellData_container__index_descr_, *myleaf.body.node.nodes[5]);
  encoded_length += field_arfcn__bsic__presence.RAW_encode(PacketNeighbourCellData_arfcn__bsic__presence_descr_, *myleaf.body.node.nodes[6]);
  if (field_arfcn.ispresent()) {
  encoded_length += field_arfcn().RAW_encode(PacketNeighbourCellData_arfcn_descr_, *myleaf.body.node.nodes[7]);
  }
  if (field_bsic.ispresent()) {
  encoded_length += field_bsic().RAW_encode(PacketNeighbourCellData_bsic_descr_, *myleaf.body.node.nodes[8]);
  }
  encoded_length += field_container__list.RAW_encode(PacketNeighbourCellData_container__list_descr_, *myleaf.body.node.nodes[9]);
  if (field_arfcn.ispresent() && (field_arfcn__bsic__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[]={6};
  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(PacketNeighbourCellData_arfcn__bsic__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_bsic.ispresent() && (field_arfcn__bsic__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[]={6};
  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(PacketNeighbourCellData_arfcn__bsic__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 PacketNeighbourCellData_template::single_value_struct {
PageMode_template field_page__mode;
BITSTRING_template field_zero;
GlobalTfi_template field_gtfi;
INTEGER_template field_container__id;
BITSTRING_template field_spare;
INTEGER_template field_container__index;
BITSTRING_template field_arfcn__bsic__presence;
INTEGER_template field_arfcn;
INTEGER_template field_bsic;
PacketNeighbourCellDataContainerList_template field_container__list;
};

void PacketNeighbourCellData_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_zero = ANY_VALUE;
single_value->field_gtfi = ANY_VALUE;
single_value->field_container__id = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
single_value->field_container__index = ANY_VALUE;
single_value->field_arfcn__bsic__presence = ANY_VALUE;
single_value->field_arfcn = ANY_OR_OMIT;
single_value->field_bsic = ANY_OR_OMIT;
single_value->field_container__list = ANY_VALUE;
}
}
}

void PacketNeighbourCellData_template::copy_value(const PacketNeighbourCellData& 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.zero().is_bound()) {
  single_value->field_zero = other_value.zero();
} else {
  single_value->field_zero.clean_up();
}
if (other_value.gtfi().is_bound()) {
  single_value->field_gtfi = other_value.gtfi();
} else {
  single_value->field_gtfi.clean_up();
}
if (other_value.container__id().is_bound()) {
  single_value->field_container__id = other_value.container__id();
} else {
  single_value->field_container__id.clean_up();
}
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
if (other_value.container__index().is_bound()) {
  single_value->field_container__index = other_value.container__index();
} else {
  single_value->field_container__index.clean_up();
}
if (other_value.arfcn__bsic__presence().is_bound()) {
  single_value->field_arfcn__bsic__presence = other_value.arfcn__bsic__presence();
} else {
  single_value->field_arfcn__bsic__presence.clean_up();
}
if (other_value.arfcn().is_bound()) {
  if (other_value.arfcn().ispresent()) single_value->field_arfcn = other_value.arfcn()();
  else single_value->field_arfcn = OMIT_VALUE;
} else {
  single_value->field_arfcn.clean_up();
}
if (other_value.bsic().is_bound()) {
  if (other_value.bsic().ispresent()) single_value->field_bsic = other_value.bsic()();
  else single_value->field_bsic = OMIT_VALUE;
} else {
  single_value->field_bsic.clean_up();
}
if (other_value.container__list().is_bound()) {
  single_value->field_container__list = other_value.container__list();
} else {
  single_value->field_container__list.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PacketNeighbourCellData_template::copy_template(const PacketNeighbourCellData_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.zero().get_selection()) {
single_value->field_zero = other_value.zero();
} else {
single_value->field_zero.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.gtfi().get_selection()) {
single_value->field_gtfi = other_value.gtfi();
} else {
single_value->field_gtfi.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.container__id().get_selection()) {
single_value->field_container__id = other_value.container__id();
} else {
single_value->field_container__id.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.container__index().get_selection()) {
single_value->field_container__index = other_value.container__index();
} else {
single_value->field_container__index.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.arfcn__bsic__presence().get_selection()) {
single_value->field_arfcn__bsic__presence = other_value.arfcn__bsic__presence();
} else {
single_value->field_arfcn__bsic__presence.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.arfcn().get_selection()) {
single_value->field_arfcn = other_value.arfcn();
} else {
single_value->field_arfcn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.bsic().get_selection()) {
single_value->field_bsic = other_value.bsic();
} else {
single_value->field_bsic.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.container__list().get_selection()) {
single_value->field_container__list = other_value.container__list();
} else {
single_value->field_container__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 PacketNeighbourCellData_template[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 PacketNeighbourCellData_template(*other_value.implication_.precondition);
implication_.implied_template = new PacketNeighbourCellData_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.PacketNeighbourCellData.");
break;
}
set_selection(other_value);
}

PacketNeighbourCellData_template::PacketNeighbourCellData_template()
{
}

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

PacketNeighbourCellData_template::PacketNeighbourCellData_template(const PacketNeighbourCellData& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PacketNeighbourCellData_template::match(const PacketNeighbourCellData& 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.zero().is_bound()) return FALSE;
if(!single_value->field_zero.match(other_value.zero(), legacy))return FALSE;
if(!other_value.gtfi().is_bound()) return FALSE;
if(!single_value->field_gtfi.match(other_value.gtfi(), legacy))return FALSE;
if(!other_value.container__id().is_bound()) return FALSE;
if(!single_value->field_container__id.match(other_value.container__id(), legacy))return FALSE;
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
if(!other_value.container__index().is_bound()) return FALSE;
if(!single_value->field_container__index.match(other_value.container__index(), legacy))return FALSE;
if(!other_value.arfcn__bsic__presence().is_bound()) return FALSE;
if(!single_value->field_arfcn__bsic__presence.match(other_value.arfcn__bsic__presence(), legacy))return FALSE;
if(!other_value.arfcn().is_bound()) return FALSE;
if((other_value.arfcn().ispresent() ? !single_value->field_arfcn.match((const INTEGER&)other_value.arfcn(), legacy) : !single_value->field_arfcn.match_omit(legacy)))return FALSE;
if(!other_value.bsic().is_bound()) return FALSE;
if((other_value.bsic().ispresent() ? !single_value->field_bsic.match((const INTEGER&)other_value.bsic(), legacy) : !single_value->field_bsic.match_omit(legacy)))return FALSE;
if(!other_value.container__list().is_bound()) return FALSE;
if(!single_value->field_container__list.match(other_value.container__list(), 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.PacketNeighbourCellData.");
}
return FALSE;
}

boolean PacketNeighbourCellData_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_zero.is_bound()
 || single_value->field_gtfi.is_bound()
 || single_value->field_container__id.is_bound()
 || single_value->field_spare.is_bound()
 || single_value->field_container__index.is_bound()
 || single_value->field_arfcn__bsic__presence.is_bound()
 || (single_value->field_arfcn.is_omit() || single_value->field_arfcn.is_bound())
 || (single_value->field_bsic.is_omit() || single_value->field_bsic.is_bound())
 || single_value->field_container__list.is_bound();
}

boolean PacketNeighbourCellData_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_page__mode.is_value()
 && single_value->field_zero.is_value()
 && single_value->field_gtfi.is_value()
 && single_value->field_container__id.is_value()
 && single_value->field_spare.is_value()
 && single_value->field_container__index.is_value()
 && single_value->field_arfcn__bsic__presence.is_value()
 && (single_value->field_arfcn.is_omit() || single_value->field_arfcn.is_value())
 && (single_value->field_bsic.is_omit() || single_value->field_bsic.is_value())
 && single_value->field_container__list.is_value();
}

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

PacketNeighbourCellData PacketNeighbourCellData_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.PacketNeighbourCellData.");
PacketNeighbourCellData ret_val;
if (single_value->field_page__mode.is_bound()) {
ret_val.page__mode() = single_value->field_page__mode.valueof();
}
if (single_value->field_zero.is_bound()) {
ret_val.zero() = single_value->field_zero.valueof();
}
if (single_value->field_gtfi.is_bound()) {
ret_val.gtfi() = single_value->field_gtfi.valueof();
}
if (single_value->field_container__id.is_bound()) {
ret_val.container__id() = single_value->field_container__id.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_container__index.is_bound()) {
ret_val.container__index() = single_value->field_container__index.valueof();
}
if (single_value->field_arfcn__bsic__presence.is_bound()) {
ret_val.arfcn__bsic__presence() = single_value->field_arfcn__bsic__presence.valueof();
}
if (single_value->field_arfcn.is_omit()) ret_val.arfcn() = OMIT_VALUE;
else if (single_value->field_arfcn.is_bound()) {
ret_val.arfcn() = single_value->field_arfcn.valueof();
}
if (single_value->field_bsic.is_omit()) ret_val.bsic() = OMIT_VALUE;
else if (single_value->field_bsic.is_bound()) {
ret_val.bsic() = single_value->field_bsic.valueof();
}
if (single_value->field_container__list.is_bound()) {
ret_val.container__list() = single_value->field_container__list.valueof();
}
return ret_val;
}

void PacketNeighbourCellData_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.PacketNeighbourCellData.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PacketNeighbourCellData_template[list_length];
}

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

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

const PageMode_template& PacketNeighbourCellData_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.PacketNeighbourCellData.");
return single_value->field_page__mode;
}

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

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

GlobalTfi_template& PacketNeighbourCellData_template::gtfi()
{
set_specific();
return single_value->field_gtfi;
}

const GlobalTfi_template& PacketNeighbourCellData_template::gtfi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field gtfi of a non-specific template of type @RLCMAC_CSN1_Types.PacketNeighbourCellData.");
return single_value->field_gtfi;
}

INTEGER_template& PacketNeighbourCellData_template::container__id()
{
set_specific();
return single_value->field_container__id;
}

const INTEGER_template& PacketNeighbourCellData_template::container__id() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field container_id of a non-specific template of type @RLCMAC_CSN1_Types.PacketNeighbourCellData.");
return single_value->field_container__id;
}

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

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

INTEGER_template& PacketNeighbourCellData_template::container__index()
{
set_specific();
return single_value->field_container__index;
}

const INTEGER_template& PacketNeighbourCellData_template::container__index() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field container_index of a non-specific template of type @RLCMAC_CSN1_Types.PacketNeighbourCellData.");
return single_value->field_container__index;
}

BITSTRING_template& PacketNeighbourCellData_template::arfcn__bsic__presence()
{
set_specific();
return single_value->field_arfcn__bsic__presence;
}

const BITSTRING_template& PacketNeighbourCellData_template::arfcn__bsic__presence() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field arfcn_bsic_presence of a non-specific template of type @RLCMAC_CSN1_Types.PacketNeighbourCellData.");
return single_value->field_arfcn__bsic__presence;
}

INTEGER_template& PacketNeighbourCellData_template::arfcn()
{
set_specific();
return single_value->field_arfcn;
}

const INTEGER_template& PacketNeighbourCellData_template::arfcn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field arfcn of a non-specific template of type @RLCMAC_CSN1_Types.PacketNeighbourCellData.");
return single_value->field_arfcn;
}

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

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

PacketNeighbourCellDataContainerList_template& PacketNeighbourCellData_template::container__list()
{
set_specific();
return single_value->field_container__list;
}

const PacketNeighbourCellDataContainerList_template& PacketNeighbourCellData_template::container__list() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field container_list of a non-specific template of type @RLCMAC_CSN1_Types.PacketNeighbourCellData.");
return single_value->field_container__list;
}

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

void PacketNeighbourCellData_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(", zero := ");
single_value->field_zero.log();
TTCN_Logger::log_event_str(", gtfi := ");
single_value->field_gtfi.log();
TTCN_Logger::log_event_str(", container_id := ");
single_value->field_container__id.log();
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(", container_index := ");
single_value->field_container__index.log();
TTCN_Logger::log_event_str(", arfcn_bsic_presence := ");
single_value->field_arfcn__bsic__presence.log();
TTCN_Logger::log_event_str(", arfcn := ");
single_value->field_arfcn.log();
TTCN_Logger::log_event_str(", bsic := ");
single_value->field_bsic.log();
TTCN_Logger::log_event_str(", container_list := ");
single_value->field_container__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 PacketNeighbourCellData_template::log_match(const PacketNeighbourCellData& 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_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);
}
if(!single_value->field_gtfi.match(match_value.gtfi(), legacy)){
TTCN_Logger::log_logmatch_info(".gtfi");
single_value->field_gtfi.log_match(match_value.gtfi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_container__id.match(match_value.container__id(), legacy)){
TTCN_Logger::log_logmatch_info(".container_id");
single_value->field_container__id.log_match(match_value.container__id(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_container__index.match(match_value.container__index(), legacy)){
TTCN_Logger::log_logmatch_info(".container_index");
single_value->field_container__index.log_match(match_value.container__index(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_arfcn__bsic__presence.match(match_value.arfcn__bsic__presence(), legacy)){
TTCN_Logger::log_logmatch_info(".arfcn_bsic_presence");
single_value->field_arfcn__bsic__presence.log_match(match_value.arfcn__bsic__presence(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.arfcn().ispresent()){
if(!single_value->field_arfcn.match(match_value.arfcn(), legacy)){
TTCN_Logger::log_logmatch_info(".arfcn");
single_value->field_arfcn.log_match(match_value.arfcn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_arfcn.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".arfcn := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_arfcn.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.bsic().ispresent()){
if(!single_value->field_bsic.match(match_value.bsic(), legacy)){
TTCN_Logger::log_logmatch_info(".bsic");
single_value->field_bsic.log_match(match_value.bsic(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_bsic.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".bsic := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_bsic.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_container__list.match(match_value.container__list(), legacy)){
TTCN_Logger::log_logmatch_info(".container_list");
single_value->field_container__list.log_match(match_value.container__list(), 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(", zero := ");
single_value->field_zero.log_match(match_value.zero(), legacy);
TTCN_Logger::log_event_str(", gtfi := ");
single_value->field_gtfi.log_match(match_value.gtfi(), legacy);
TTCN_Logger::log_event_str(", container_id := ");
single_value->field_container__id.log_match(match_value.container__id(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(", container_index := ");
single_value->field_container__index.log_match(match_value.container__index(), legacy);
TTCN_Logger::log_event_str(", arfcn_bsic_presence := ");
single_value->field_arfcn__bsic__presence.log_match(match_value.arfcn__bsic__presence(), legacy);
TTCN_Logger::log_event_str(", arfcn := ");
if (match_value.arfcn().ispresent()) {
single_value->field_arfcn.log_match(match_value.arfcn(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_arfcn.log();
if (single_value->field_arfcn.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", bsic := ");
if (match_value.bsic().ispresent()) {
single_value->field_bsic.log_match(match_value.bsic(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_bsic.log();
if (single_value->field_bsic.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", container_list := ");
single_value->field_container__list.log_match(match_value.container__list(), 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 PacketNeighbourCellData_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (page__mode().is_bound()) page__mode().set_implicit_omit();
if (zero().is_bound()) zero().set_implicit_omit();
if (gtfi().is_bound()) gtfi().set_implicit_omit();
if (container__id().is_bound()) container__id().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (container__index().is_bound()) container__index().set_implicit_omit();
if (arfcn__bsic__presence().is_bound()) arfcn__bsic__presence().set_implicit_omit();
if (!arfcn().is_bound()) arfcn() = OMIT_VALUE;
else arfcn().set_implicit_omit();
if (!bsic().is_bound()) bsic() = OMIT_VALUE;
else bsic().set_implicit_omit();
if (container__list().is_bound()) container__list().set_implicit_omit();
}

void PacketNeighbourCellData_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_zero.encode_text(text_buf);
single_value->field_gtfi.encode_text(text_buf);
single_value->field_container__id.encode_text(text_buf);
single_value->field_spare.encode_text(text_buf);
single_value->field_container__index.encode_text(text_buf);
single_value->field_arfcn__bsic__presence.encode_text(text_buf);
single_value->field_arfcn.encode_text(text_buf);
single_value->field_bsic.encode_text(text_buf);
single_value->field_container__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.PacketNeighbourCellData.");
}
}

void PacketNeighbourCellData_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_zero.decode_text(text_buf);
single_value->field_gtfi.decode_text(text_buf);
single_value->field_container__id.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
single_value->field_container__index.decode_text(text_buf);
single_value->field_arfcn__bsic__presence.decode_text(text_buf);
single_value->field_arfcn.decode_text(text_buf);
single_value->field_bsic.decode_text(text_buf);
single_value->field_container__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 PacketNeighbourCellData_template[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.PacketNeighbourCellData.");
}
}

void PacketNeighbourCellData_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: {
    PacketNeighbourCellData_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.PacketNeighbourCellData 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) page__mode().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) zero().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) gtfi().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) container__id().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) container__index().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) arfcn__bsic__presence().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) arfcn().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) bsic().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) container__list().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(), "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(), "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++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gtfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gtfi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "container_id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          container__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(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "container_index")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          container__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(), "arfcn_bsic_presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          arfcn__bsic__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(), "arfcn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          arfcn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "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(), "container_list")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          container__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.PacketNeighbourCellData: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PacketNeighbourCellData_template* precondition = new PacketNeighbourCellData_template;
    precondition->set_param(*param.get_elem(0));
    PacketNeighbourCellData_template* implied_template = new PacketNeighbourCellData_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PacketNeighbourCellData_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.PacketNeighbourCellData");
  }
  is_ifpresent = param.get_ifpresent();
}

void PacketNeighbourCellData_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.PacketNeighbourCellData");
single_value->field_zero.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketNeighbourCellData");
single_value->field_gtfi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketNeighbourCellData");
single_value->field_container__id.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketNeighbourCellData");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketNeighbourCellData");
single_value->field_container__index.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketNeighbourCellData");
single_value->field_arfcn__bsic__presence.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketNeighbourCellData");
single_value->field_arfcn.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketNeighbourCellData");
single_value->field_bsic.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketNeighbourCellData");
single_value->field_container__list.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketNeighbourCellData");
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.PacketNeighbourCellData");
}

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

boolean PacketNeighbourCellData_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 RlcmacDlCtrlUnion::copy_value(const RlcmacDlCtrlUnion& other_value)
{
switch (other_value.union_selection) {
case ALT_access__reject:
field_access__reject = new PacketAccessReject(*other_value.field_access__reject);
break;
case ALT_dl__assignment:
field_dl__assignment = new PacketDlAssignment(*other_value.field_dl__assignment);
break;
case ALT_meas__order:
field_meas__order = new PacketMeasOrder(*other_value.field_meas__order);
break;
case ALT_ul__assignment:
field_ul__assignment = new PacketUlAssignment(*other_value.field_ul__assignment);
break;
case ALT_paging:
field_paging = new PacketPagingReq(*other_value.field_paging);
break;
case ALT_ul__ack__nack:
field_ul__ack__nack = new PacketUlAckNack(*other_value.field_ul__ack__nack);
break;
case ALT_dl__dummy:
field_dl__dummy = new PacketDlDummy(*other_value.field_dl__dummy);
break;
case ALT_pwr__ta:
field_pwr__ta = new PacketPwrControlTA(*other_value.field_pwr__ta);
break;
case ALT_cell__chg__continue:
field_cell__chg__continue = new PacketCellChangeContinue(*other_value.field_cell__chg__continue);
break;
case ALT_neighbour__cell__data:
field_neighbour__cell__data = new PacketNeighbourCellData(*other_value.field_neighbour__cell__data);
break;
case ALT_other:
field_other = new OCTETSTRING(*other_value.field_other);
break;
default:
TTCN_error("Assignment of an unbound union value of type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
}
union_selection = other_value.union_selection;
}

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

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

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

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

boolean RlcmacDlCtrlUnion::operator==(const RlcmacDlCtrlUnion& 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.RlcmacDlCtrlUnion.");
if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
if (union_selection != other_value.union_selection) return FALSE;
switch (union_selection) {
case ALT_access__reject:
return *field_access__reject == *other_value.field_access__reject;
case ALT_dl__assignment:
return *field_dl__assignment == *other_value.field_dl__assignment;
case ALT_meas__order:
return *field_meas__order == *other_value.field_meas__order;
case ALT_ul__assignment:
return *field_ul__assignment == *other_value.field_ul__assignment;
case ALT_paging:
return *field_paging == *other_value.field_paging;
case ALT_ul__ack__nack:
return *field_ul__ack__nack == *other_value.field_ul__ack__nack;
case ALT_dl__dummy:
return *field_dl__dummy == *other_value.field_dl__dummy;
case ALT_pwr__ta:
return *field_pwr__ta == *other_value.field_pwr__ta;
case ALT_cell__chg__continue:
return *field_cell__chg__continue == *other_value.field_cell__chg__continue;
case ALT_neighbour__cell__data:
return *field_neighbour__cell__data == *other_value.field_neighbour__cell__data;
case ALT_other:
return *field_other == *other_value.field_other;
default:
return FALSE;
}
}

PacketAccessReject& RlcmacDlCtrlUnion::access__reject()
{
if (union_selection != ALT_access__reject) {
clean_up();
field_access__reject = new PacketAccessReject;
union_selection = ALT_access__reject;
}
return *field_access__reject;
}

const PacketAccessReject& RlcmacDlCtrlUnion::access__reject() const
{
if (union_selection != ALT_access__reject) TTCN_error("Using non-selected field access_reject in a value of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *field_access__reject;
}

PacketDlAssignment& RlcmacDlCtrlUnion::dl__assignment()
{
if (union_selection != ALT_dl__assignment) {
clean_up();
field_dl__assignment = new PacketDlAssignment;
union_selection = ALT_dl__assignment;
}
return *field_dl__assignment;
}

const PacketDlAssignment& RlcmacDlCtrlUnion::dl__assignment() const
{
if (union_selection != ALT_dl__assignment) TTCN_error("Using non-selected field dl_assignment in a value of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *field_dl__assignment;
}

PacketMeasOrder& RlcmacDlCtrlUnion::meas__order()
{
if (union_selection != ALT_meas__order) {
clean_up();
field_meas__order = new PacketMeasOrder;
union_selection = ALT_meas__order;
}
return *field_meas__order;
}

const PacketMeasOrder& RlcmacDlCtrlUnion::meas__order() const
{
if (union_selection != ALT_meas__order) TTCN_error("Using non-selected field meas_order in a value of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *field_meas__order;
}

PacketUlAssignment& RlcmacDlCtrlUnion::ul__assignment()
{
if (union_selection != ALT_ul__assignment) {
clean_up();
field_ul__assignment = new PacketUlAssignment;
union_selection = ALT_ul__assignment;
}
return *field_ul__assignment;
}

const PacketUlAssignment& RlcmacDlCtrlUnion::ul__assignment() const
{
if (union_selection != ALT_ul__assignment) TTCN_error("Using non-selected field ul_assignment in a value of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *field_ul__assignment;
}

PacketPagingReq& RlcmacDlCtrlUnion::paging()
{
if (union_selection != ALT_paging) {
clean_up();
field_paging = new PacketPagingReq;
union_selection = ALT_paging;
}
return *field_paging;
}

const PacketPagingReq& RlcmacDlCtrlUnion::paging() const
{
if (union_selection != ALT_paging) TTCN_error("Using non-selected field paging in a value of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *field_paging;
}

PacketUlAckNack& RlcmacDlCtrlUnion::ul__ack__nack()
{
if (union_selection != ALT_ul__ack__nack) {
clean_up();
field_ul__ack__nack = new PacketUlAckNack;
union_selection = ALT_ul__ack__nack;
}
return *field_ul__ack__nack;
}

const PacketUlAckNack& RlcmacDlCtrlUnion::ul__ack__nack() const
{
if (union_selection != ALT_ul__ack__nack) TTCN_error("Using non-selected field ul_ack_nack in a value of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *field_ul__ack__nack;
}

PacketDlDummy& RlcmacDlCtrlUnion::dl__dummy()
{
if (union_selection != ALT_dl__dummy) {
clean_up();
field_dl__dummy = new PacketDlDummy;
union_selection = ALT_dl__dummy;
}
return *field_dl__dummy;
}

const PacketDlDummy& RlcmacDlCtrlUnion::dl__dummy() const
{
if (union_selection != ALT_dl__dummy) TTCN_error("Using non-selected field dl_dummy in a value of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *field_dl__dummy;
}

PacketPwrControlTA& RlcmacDlCtrlUnion::pwr__ta()
{
if (union_selection != ALT_pwr__ta) {
clean_up();
field_pwr__ta = new PacketPwrControlTA;
union_selection = ALT_pwr__ta;
}
return *field_pwr__ta;
}

const PacketPwrControlTA& RlcmacDlCtrlUnion::pwr__ta() const
{
if (union_selection != ALT_pwr__ta) TTCN_error("Using non-selected field pwr_ta in a value of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *field_pwr__ta;
}

PacketCellChangeContinue& RlcmacDlCtrlUnion::cell__chg__continue()
{
if (union_selection != ALT_cell__chg__continue) {
clean_up();
field_cell__chg__continue = new PacketCellChangeContinue;
union_selection = ALT_cell__chg__continue;
}
return *field_cell__chg__continue;
}

const PacketCellChangeContinue& RlcmacDlCtrlUnion::cell__chg__continue() const
{
if (union_selection != ALT_cell__chg__continue) TTCN_error("Using non-selected field cell_chg_continue in a value of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *field_cell__chg__continue;
}

PacketNeighbourCellData& RlcmacDlCtrlUnion::neighbour__cell__data()
{
if (union_selection != ALT_neighbour__cell__data) {
clean_up();
field_neighbour__cell__data = new PacketNeighbourCellData;
union_selection = ALT_neighbour__cell__data;
}
return *field_neighbour__cell__data;
}

const PacketNeighbourCellData& RlcmacDlCtrlUnion::neighbour__cell__data() const
{
if (union_selection != ALT_neighbour__cell__data) TTCN_error("Using non-selected field neighbour_cell_data in a value of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *field_neighbour__cell__data;
}

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

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

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

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

boolean RlcmacDlCtrlUnion::is_value() const
{
switch (union_selection) {
case UNBOUND_VALUE: return FALSE;
case ALT_access__reject: return field_access__reject->is_value();
case ALT_dl__assignment: return field_dl__assignment->is_value();
case ALT_meas__order: return field_meas__order->is_value();
case ALT_ul__assignment: return field_ul__assignment->is_value();
case ALT_paging: return field_paging->is_value();
case ALT_ul__ack__nack: return field_ul__ack__nack->is_value();
case ALT_dl__dummy: return field_dl__dummy->is_value();
case ALT_pwr__ta: return field_pwr__ta->is_value();
case ALT_cell__chg__continue: return field_cell__chg__continue->is_value();
case ALT_neighbour__cell__data: return field_neighbour__cell__data->is_value();
case ALT_other: return field_other->is_value();
default: TTCN_error("Invalid selection in union is_bound");}
}

void RlcmacDlCtrlUnion::clean_up()
{
switch (union_selection) {
case ALT_access__reject:
  delete field_access__reject;
  break;
case ALT_dl__assignment:
  delete field_dl__assignment;
  break;
case ALT_meas__order:
  delete field_meas__order;
  break;
case ALT_ul__assignment:
  delete field_ul__assignment;
  break;
case ALT_paging:
  delete field_paging;
  break;
case ALT_ul__ack__nack:
  delete field_ul__ack__nack;
  break;
case ALT_dl__dummy:
  delete field_dl__dummy;
  break;
case ALT_pwr__ta:
  delete field_pwr__ta;
  break;
case ALT_cell__chg__continue:
  delete field_cell__chg__continue;
  break;
case ALT_neighbour__cell__data:
  delete field_neighbour__cell__data;
  break;
case ALT_other:
  delete field_other;
  break;
default:
  break;
}
union_selection = UNBOUND_VALUE;
}

void RlcmacDlCtrlUnion::log() const
{
switch (union_selection) {
case ALT_access__reject:
TTCN_Logger::log_event_str("{ access_reject := ");
field_access__reject->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_dl__assignment:
TTCN_Logger::log_event_str("{ dl_assignment := ");
field_dl__assignment->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_meas__order:
TTCN_Logger::log_event_str("{ meas_order := ");
field_meas__order->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_ul__assignment:
TTCN_Logger::log_event_str("{ ul_assignment := ");
field_ul__assignment->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_paging:
TTCN_Logger::log_event_str("{ paging := ");
field_paging->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_ul__ack__nack:
TTCN_Logger::log_event_str("{ ul_ack_nack := ");
field_ul__ack__nack->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_dl__dummy:
TTCN_Logger::log_event_str("{ dl_dummy := ");
field_dl__dummy->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_pwr__ta:
TTCN_Logger::log_event_str("{ pwr_ta := ");
field_pwr__ta->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_cell__chg__continue:
TTCN_Logger::log_event_str("{ cell_chg_continue := ");
field_cell__chg__continue->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_neighbour__cell__data:
TTCN_Logger::log_event_str("{ neighbour_cell_data := ");
field_neighbour__cell__data->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_other:
TTCN_Logger::log_event_str("{ other := ");
field_other->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_unbound();
}
}

void RlcmacDlCtrlUnion::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, "access_reject")) {
    access__reject().set_param(*mp_last);
    if (!access__reject().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "dl_assignment")) {
    dl__assignment().set_param(*mp_last);
    if (!dl__assignment().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "meas_order")) {
    meas__order().set_param(*mp_last);
    if (!meas__order().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "ul_assignment")) {
    ul__assignment().set_param(*mp_last);
    if (!ul__assignment().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "paging")) {
    paging().set_param(*mp_last);
    if (!paging().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "ul_ack_nack")) {
    ul__ack__nack().set_param(*mp_last);
    if (!ul__ack__nack().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "dl_dummy")) {
    dl__dummy().set_param(*mp_last);
    if (!dl__dummy().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "pwr_ta")) {
    pwr__ta().set_param(*mp_last);
    if (!pwr__ta().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "cell_chg_continue")) {
    cell__chg__continue().set_param(*mp_last);
    if (!cell__chg__continue().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "neighbour_cell_data")) {
    neighbour__cell__data().set_param(*mp_last);
    if (!neighbour__cell__data().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "other")) {
    other().set_param(*mp_last);
    if (!other().is_bound()) clean_up();
    return;
  }
  mp_last->error("Field %s does not exist in type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.", last_name);
}

void RlcmacDlCtrlUnion::set_implicit_omit()
{
switch (union_selection) {
case ALT_access__reject:
field_access__reject->set_implicit_omit(); break;
case ALT_dl__assignment:
field_dl__assignment->set_implicit_omit(); break;
case ALT_meas__order:
field_meas__order->set_implicit_omit(); break;
case ALT_ul__assignment:
field_ul__assignment->set_implicit_omit(); break;
case ALT_paging:
field_paging->set_implicit_omit(); break;
case ALT_ul__ack__nack:
field_ul__ack__nack->set_implicit_omit(); break;
case ALT_dl__dummy:
field_dl__dummy->set_implicit_omit(); break;
case ALT_pwr__ta:
field_pwr__ta->set_implicit_omit(); break;
case ALT_cell__chg__continue:
field_cell__chg__continue->set_implicit_omit(); break;
case ALT_neighbour__cell__data:
field_neighbour__cell__data->set_implicit_omit(); break;
case ALT_other:
field_other->set_implicit_omit(); break;
default: break;
}
}

void RlcmacDlCtrlUnion::encode_text(Text_Buf& text_buf) const
{
text_buf.push_int(union_selection);
switch (union_selection) {
case ALT_access__reject:
field_access__reject->encode_text(text_buf);
break;
case ALT_dl__assignment:
field_dl__assignment->encode_text(text_buf);
break;
case ALT_meas__order:
field_meas__order->encode_text(text_buf);
break;
case ALT_ul__assignment:
field_ul__assignment->encode_text(text_buf);
break;
case ALT_paging:
field_paging->encode_text(text_buf);
break;
case ALT_ul__ack__nack:
field_ul__ack__nack->encode_text(text_buf);
break;
case ALT_dl__dummy:
field_dl__dummy->encode_text(text_buf);
break;
case ALT_pwr__ta:
field_pwr__ta->encode_text(text_buf);
break;
case ALT_cell__chg__continue:
field_cell__chg__continue->encode_text(text_buf);
break;
case ALT_neighbour__cell__data:
field_neighbour__cell__data->encode_text(text_buf);
break;
case ALT_other:
field_other->encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an unbound value of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
}
}

void RlcmacDlCtrlUnion::decode_text(Text_Buf& text_buf)
{
switch ((union_selection_type)text_buf.pull_int().get_val()) {
case ALT_access__reject:
access__reject().decode_text(text_buf);
break;
case ALT_dl__assignment:
dl__assignment().decode_text(text_buf);
break;
case ALT_meas__order:
meas__order().decode_text(text_buf);
break;
case ALT_ul__assignment:
ul__assignment().decode_text(text_buf);
break;
case ALT_paging:
paging().decode_text(text_buf);
break;
case ALT_ul__ack__nack:
ul__ack__nack().decode_text(text_buf);
break;
case ALT_dl__dummy:
dl__dummy().decode_text(text_buf);
break;
case ALT_pwr__ta:
pwr__ta().decode_text(text_buf);
break;
case ALT_cell__chg__continue:
cell__chg__continue().decode_text(text_buf);
break;
case ALT_neighbour__cell__data:
neighbour__cell__data().decode_text(text_buf);
break;
case ALT_other:
other().decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
}
}

void RlcmacDlCtrlUnion::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 RlcmacDlCtrlUnion::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 RlcmacDlCtrlUnion::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, RlcmacDlCtrlUnion_access__reject_descr_.raw->forceomit);
      decoded_length = access__reject().RAW_decode(RlcmacDlCtrlUnion_access__reject_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, RlcmacDlCtrlUnion_dl__assignment_descr_.raw->forceomit);
      decoded_length = dl__assignment().RAW_decode(RlcmacDlCtrlUnion_dl__assignment_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, RlcmacDlCtrlUnion_meas__order_descr_.raw->forceomit);
      decoded_length = meas__order().RAW_decode(RlcmacDlCtrlUnion_meas__order_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 3: {
      RAW_Force_Omit field_force_omit(3, force_omit, RlcmacDlCtrlUnion_ul__assignment_descr_.raw->forceomit);
      decoded_length = ul__assignment().RAW_decode(RlcmacDlCtrlUnion_ul__assignment_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 4: {
      RAW_Force_Omit field_force_omit(4, force_omit, RlcmacDlCtrlUnion_paging_descr_.raw->forceomit);
      decoded_length = paging().RAW_decode(RlcmacDlCtrlUnion_paging_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 5: {
      RAW_Force_Omit field_force_omit(5, force_omit, RlcmacDlCtrlUnion_ul__ack__nack_descr_.raw->forceomit);
      decoded_length = ul__ack__nack().RAW_decode(RlcmacDlCtrlUnion_ul__ack__nack_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 6: {
      RAW_Force_Omit field_force_omit(6, force_omit, RlcmacDlCtrlUnion_dl__dummy_descr_.raw->forceomit);
      decoded_length = dl__dummy().RAW_decode(RlcmacDlCtrlUnion_dl__dummy_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 7: {
      RAW_Force_Omit field_force_omit(7, force_omit, RlcmacDlCtrlUnion_pwr__ta_descr_.raw->forceomit);
      decoded_length = pwr__ta().RAW_decode(RlcmacDlCtrlUnion_pwr__ta_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 8: {
      RAW_Force_Omit field_force_omit(8, force_omit, RlcmacDlCtrlUnion_cell__chg__continue_descr_.raw->forceomit);
      decoded_length = cell__chg__continue().RAW_decode(RlcmacDlCtrlUnion_cell__chg__continue_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 9: {
      RAW_Force_Omit field_force_omit(9, force_omit, RlcmacDlCtrlUnion_neighbour__cell__data_descr_.raw->forceomit);
      decoded_length = neighbour__cell__data().RAW_decode(RlcmacDlCtrlUnion_neighbour__cell__data_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    case 10: {
      RAW_Force_Omit field_force_omit(10, force_omit, RlcmacDlCtrlUnion_other_descr_.raw->forceomit);
      decoded_length = other().RAW_decode(RlcmacDlCtrlUnion_other_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    default: break;
    }
    return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
  } else {
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_0_force_omit(0, force_omit, RlcmacDlCtrlUnion_access__reject_descr_.raw->forceomit);
      decoded_length = access__reject().RAW_decode(RlcmacDlCtrlUnion_access__reject_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_0_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_1_force_omit(1, force_omit, RlcmacDlCtrlUnion_dl__assignment_descr_.raw->forceomit);
      decoded_length = dl__assignment().RAW_decode(RlcmacDlCtrlUnion_dl__assignment_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_1_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_2_force_omit(2, force_omit, RlcmacDlCtrlUnion_meas__order_descr_.raw->forceomit);
      decoded_length = meas__order().RAW_decode(RlcmacDlCtrlUnion_meas__order_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_2_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_3_force_omit(3, force_omit, RlcmacDlCtrlUnion_ul__assignment_descr_.raw->forceomit);
      decoded_length = ul__assignment().RAW_decode(RlcmacDlCtrlUnion_ul__assignment_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_3_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_4_force_omit(4, force_omit, RlcmacDlCtrlUnion_paging_descr_.raw->forceomit);
      decoded_length = paging().RAW_decode(RlcmacDlCtrlUnion_paging_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_4_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_5_force_omit(5, force_omit, RlcmacDlCtrlUnion_ul__ack__nack_descr_.raw->forceomit);
      decoded_length = ul__ack__nack().RAW_decode(RlcmacDlCtrlUnion_ul__ack__nack_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_5_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_6_force_omit(6, force_omit, RlcmacDlCtrlUnion_dl__dummy_descr_.raw->forceomit);
      decoded_length = dl__dummy().RAW_decode(RlcmacDlCtrlUnion_dl__dummy_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_6_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_7_force_omit(7, force_omit, RlcmacDlCtrlUnion_pwr__ta_descr_.raw->forceomit);
      decoded_length = pwr__ta().RAW_decode(RlcmacDlCtrlUnion_pwr__ta_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_7_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_8_force_omit(8, force_omit, RlcmacDlCtrlUnion_cell__chg__continue_descr_.raw->forceomit);
      decoded_length = cell__chg__continue().RAW_decode(RlcmacDlCtrlUnion_cell__chg__continue_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_8_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_9_force_omit(9, force_omit, RlcmacDlCtrlUnion_neighbour__cell__data_descr_.raw->forceomit);
      decoded_length = neighbour__cell__data().RAW_decode(RlcmacDlCtrlUnion_neighbour__cell__data_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_9_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_10_force_omit(10, force_omit, RlcmacDlCtrlUnion_other_descr_.raw->forceomit);
      decoded_length = other().RAW_decode(RlcmacDlCtrlUnion_other_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_10_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
 }
 clean_up();
 return -1;
}

int RlcmacDlCtrlUnion::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const
{
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 11;  myleaf.body.node.nodes = init_nodes_of_enc_tree(11);
  memset(myleaf.body.node.nodes, 0, 11 * sizeof(RAW_enc_tree *));
  switch (union_selection) {
  case ALT_access__reject:
    myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, RlcmacDlCtrlUnion_access__reject_descr_.raw);
    encoded_length = field_access__reject->RAW_encode(RlcmacDlCtrlUnion_access__reject_descr_, *myleaf.body.node.nodes[0]);
    myleaf.body.node.nodes[0]->coding_descr = &RlcmacDlCtrlUnion_access__reject_descr_;
    break;
  case ALT_dl__assignment:
    myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, RlcmacDlCtrlUnion_dl__assignment_descr_.raw);
    encoded_length = field_dl__assignment->RAW_encode(RlcmacDlCtrlUnion_dl__assignment_descr_, *myleaf.body.node.nodes[1]);
    myleaf.body.node.nodes[1]->coding_descr = &RlcmacDlCtrlUnion_dl__assignment_descr_;
    break;
  case ALT_meas__order:
    myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 2, RlcmacDlCtrlUnion_meas__order_descr_.raw);
    encoded_length = field_meas__order->RAW_encode(RlcmacDlCtrlUnion_meas__order_descr_, *myleaf.body.node.nodes[2]);
    myleaf.body.node.nodes[2]->coding_descr = &RlcmacDlCtrlUnion_meas__order_descr_;
    break;
  case ALT_ul__assignment:
    myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 3, RlcmacDlCtrlUnion_ul__assignment_descr_.raw);
    encoded_length = field_ul__assignment->RAW_encode(RlcmacDlCtrlUnion_ul__assignment_descr_, *myleaf.body.node.nodes[3]);
    myleaf.body.node.nodes[3]->coding_descr = &RlcmacDlCtrlUnion_ul__assignment_descr_;
    break;
  case ALT_paging:
    myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 4, RlcmacDlCtrlUnion_paging_descr_.raw);
    encoded_length = field_paging->RAW_encode(RlcmacDlCtrlUnion_paging_descr_, *myleaf.body.node.nodes[4]);
    myleaf.body.node.nodes[4]->coding_descr = &RlcmacDlCtrlUnion_paging_descr_;
    break;
  case ALT_ul__ack__nack:
    myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 5, RlcmacDlCtrlUnion_ul__ack__nack_descr_.raw);
    encoded_length = field_ul__ack__nack->RAW_encode(RlcmacDlCtrlUnion_ul__ack__nack_descr_, *myleaf.body.node.nodes[5]);
    myleaf.body.node.nodes[5]->coding_descr = &RlcmacDlCtrlUnion_ul__ack__nack_descr_;
    break;
  case ALT_dl__dummy:
    myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 6, RlcmacDlCtrlUnion_dl__dummy_descr_.raw);
    encoded_length = field_dl__dummy->RAW_encode(RlcmacDlCtrlUnion_dl__dummy_descr_, *myleaf.body.node.nodes[6]);
    myleaf.body.node.nodes[6]->coding_descr = &RlcmacDlCtrlUnion_dl__dummy_descr_;
    break;
  case ALT_pwr__ta:
    myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 7, RlcmacDlCtrlUnion_pwr__ta_descr_.raw);
    encoded_length = field_pwr__ta->RAW_encode(RlcmacDlCtrlUnion_pwr__ta_descr_, *myleaf.body.node.nodes[7]);
    myleaf.body.node.nodes[7]->coding_descr = &RlcmacDlCtrlUnion_pwr__ta_descr_;
    break;
  case ALT_cell__chg__continue:
    myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 8, RlcmacDlCtrlUnion_cell__chg__continue_descr_.raw);
    encoded_length = field_cell__chg__continue->RAW_encode(RlcmacDlCtrlUnion_cell__chg__continue_descr_, *myleaf.body.node.nodes[8]);
    myleaf.body.node.nodes[8]->coding_descr = &RlcmacDlCtrlUnion_cell__chg__continue_descr_;
    break;
  case ALT_neighbour__cell__data:
    myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 9, RlcmacDlCtrlUnion_neighbour__cell__data_descr_.raw);
    encoded_length = field_neighbour__cell__data->RAW_encode(RlcmacDlCtrlUnion_neighbour__cell__data_descr_, *myleaf.body.node.nodes[9]);
    myleaf.body.node.nodes[9]->coding_descr = &RlcmacDlCtrlUnion_neighbour__cell__data_descr_;
    break;
  case ALT_other:
    myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 10, RlcmacDlCtrlUnion_other_descr_.raw);
    encoded_length = field_other->RAW_encode(RlcmacDlCtrlUnion_other_descr_, *myleaf.body.node.nodes[10]);
    myleaf.body.node.nodes[10]->coding_descr = &RlcmacDlCtrlUnion_other_descr_;
    break;
  default:
    TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  }
  return encoded_length;
}

void RlcmacDlCtrlUnion_template::copy_value(const RlcmacDlCtrlUnion& other_value)
{
single_value.union_selection = other_value.get_selection();
switch (single_value.union_selection) {
case RlcmacDlCtrlUnion::ALT_access__reject:
single_value.field_access__reject = new PacketAccessReject_template(other_value.access__reject());
break;
case RlcmacDlCtrlUnion::ALT_dl__assignment:
single_value.field_dl__assignment = new PacketDlAssignment_template(other_value.dl__assignment());
break;
case RlcmacDlCtrlUnion::ALT_meas__order:
single_value.field_meas__order = new PacketMeasOrder_template(other_value.meas__order());
break;
case RlcmacDlCtrlUnion::ALT_ul__assignment:
single_value.field_ul__assignment = new PacketUlAssignment_template(other_value.ul__assignment());
break;
case RlcmacDlCtrlUnion::ALT_paging:
single_value.field_paging = new PacketPagingReq_template(other_value.paging());
break;
case RlcmacDlCtrlUnion::ALT_ul__ack__nack:
single_value.field_ul__ack__nack = new PacketUlAckNack_template(other_value.ul__ack__nack());
break;
case RlcmacDlCtrlUnion::ALT_dl__dummy:
single_value.field_dl__dummy = new PacketDlDummy_template(other_value.dl__dummy());
break;
case RlcmacDlCtrlUnion::ALT_pwr__ta:
single_value.field_pwr__ta = new PacketPwrControlTA_template(other_value.pwr__ta());
break;
case RlcmacDlCtrlUnion::ALT_cell__chg__continue:
single_value.field_cell__chg__continue = new PacketCellChangeContinue_template(other_value.cell__chg__continue());
break;
case RlcmacDlCtrlUnion::ALT_neighbour__cell__data:
single_value.field_neighbour__cell__data = new PacketNeighbourCellData_template(other_value.neighbour__cell__data());
break;
case RlcmacDlCtrlUnion::ALT_other:
single_value.field_other = new OCTETSTRING_template(other_value.other());
break;
default:
TTCN_error("Initializing a template with an unbound value of type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
}
set_selection(SPECIFIC_VALUE);
}

void RlcmacDlCtrlUnion_template::copy_template(const RlcmacDlCtrlUnion_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 RlcmacDlCtrlUnion::ALT_access__reject:
single_value.field_access__reject = new PacketAccessReject_template(*other_value.single_value.field_access__reject);
break;
case RlcmacDlCtrlUnion::ALT_dl__assignment:
single_value.field_dl__assignment = new PacketDlAssignment_template(*other_value.single_value.field_dl__assignment);
break;
case RlcmacDlCtrlUnion::ALT_meas__order:
single_value.field_meas__order = new PacketMeasOrder_template(*other_value.single_value.field_meas__order);
break;
case RlcmacDlCtrlUnion::ALT_ul__assignment:
single_value.field_ul__assignment = new PacketUlAssignment_template(*other_value.single_value.field_ul__assignment);
break;
case RlcmacDlCtrlUnion::ALT_paging:
single_value.field_paging = new PacketPagingReq_template(*other_value.single_value.field_paging);
break;
case RlcmacDlCtrlUnion::ALT_ul__ack__nack:
single_value.field_ul__ack__nack = new PacketUlAckNack_template(*other_value.single_value.field_ul__ack__nack);
break;
case RlcmacDlCtrlUnion::ALT_dl__dummy:
single_value.field_dl__dummy = new PacketDlDummy_template(*other_value.single_value.field_dl__dummy);
break;
case RlcmacDlCtrlUnion::ALT_pwr__ta:
single_value.field_pwr__ta = new PacketPwrControlTA_template(*other_value.single_value.field_pwr__ta);
break;
case RlcmacDlCtrlUnion::ALT_cell__chg__continue:
single_value.field_cell__chg__continue = new PacketCellChangeContinue_template(*other_value.single_value.field_cell__chg__continue);
break;
case RlcmacDlCtrlUnion::ALT_neighbour__cell__data:
single_value.field_neighbour__cell__data = new PacketNeighbourCellData_template(*other_value.single_value.field_neighbour__cell__data);
break;
case RlcmacDlCtrlUnion::ALT_other:
single_value.field_other = new OCTETSTRING_template(*other_value.single_value.field_other);
break;
default:
TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
}
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 RlcmacDlCtrlUnion_template[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 RlcmacDlCtrlUnion_template(*other_value.implication_.precondition);
implication_.implied_template = new RlcmacDlCtrlUnion_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.RlcmacDlCtrlUnion.");
}
set_selection(other_value);
}

RlcmacDlCtrlUnion_template::RlcmacDlCtrlUnion_template()
{
}

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

RlcmacDlCtrlUnion_template::RlcmacDlCtrlUnion_template(const RlcmacDlCtrlUnion& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

void RlcmacDlCtrlUnion_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case RlcmacDlCtrlUnion::ALT_access__reject:
delete single_value.field_access__reject;
break;
case RlcmacDlCtrlUnion::ALT_dl__assignment:
delete single_value.field_dl__assignment;
break;
case RlcmacDlCtrlUnion::ALT_meas__order:
delete single_value.field_meas__order;
break;
case RlcmacDlCtrlUnion::ALT_ul__assignment:
delete single_value.field_ul__assignment;
break;
case RlcmacDlCtrlUnion::ALT_paging:
delete single_value.field_paging;
break;
case RlcmacDlCtrlUnion::ALT_ul__ack__nack:
delete single_value.field_ul__ack__nack;
break;
case RlcmacDlCtrlUnion::ALT_dl__dummy:
delete single_value.field_dl__dummy;
break;
case RlcmacDlCtrlUnion::ALT_pwr__ta:
delete single_value.field_pwr__ta;
break;
case RlcmacDlCtrlUnion::ALT_cell__chg__continue:
delete single_value.field_cell__chg__continue;
break;
case RlcmacDlCtrlUnion::ALT_neighbour__cell__data:
delete single_value.field_neighbour__cell__data;
break;
case RlcmacDlCtrlUnion::ALT_other:
delete single_value.field_other;
default:
break;
}
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

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

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

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

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

boolean RlcmacDlCtrlUnion_template::match(const RlcmacDlCtrlUnion& 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:
{
RlcmacDlCtrlUnion::union_selection_type value_selection = other_value.get_selection();
if (value_selection == RlcmacDlCtrlUnion::UNBOUND_VALUE) return FALSE;
if (value_selection != single_value.union_selection) return FALSE;
switch (value_selection) {
case RlcmacDlCtrlUnion::ALT_access__reject:
return single_value.field_access__reject->match(other_value.access__reject(), legacy);
case RlcmacDlCtrlUnion::ALT_dl__assignment:
return single_value.field_dl__assignment->match(other_value.dl__assignment(), legacy);
case RlcmacDlCtrlUnion::ALT_meas__order:
return single_value.field_meas__order->match(other_value.meas__order(), legacy);
case RlcmacDlCtrlUnion::ALT_ul__assignment:
return single_value.field_ul__assignment->match(other_value.ul__assignment(), legacy);
case RlcmacDlCtrlUnion::ALT_paging:
return single_value.field_paging->match(other_value.paging(), legacy);
case RlcmacDlCtrlUnion::ALT_ul__ack__nack:
return single_value.field_ul__ack__nack->match(other_value.ul__ack__nack(), legacy);
case RlcmacDlCtrlUnion::ALT_dl__dummy:
return single_value.field_dl__dummy->match(other_value.dl__dummy(), legacy);
case RlcmacDlCtrlUnion::ALT_pwr__ta:
return single_value.field_pwr__ta->match(other_value.pwr__ta(), legacy);
case RlcmacDlCtrlUnion::ALT_cell__chg__continue:
return single_value.field_cell__chg__continue->match(other_value.cell__chg__continue(), legacy);
case RlcmacDlCtrlUnion::ALT_neighbour__cell__data:
return single_value.field_neighbour__cell__data->match(other_value.neighbour__cell__data(), legacy);
case RlcmacDlCtrlUnion::ALT_other:
return single_value.field_other->match(other_value.other(), legacy);
default:
TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
}
}
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.RlcmacDlCtrlUnion.");
}
return FALSE;
}

boolean RlcmacDlCtrlUnion_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
switch (single_value.union_selection) {
case RlcmacDlCtrlUnion::ALT_access__reject:
return single_value.field_access__reject->is_value();
case RlcmacDlCtrlUnion::ALT_dl__assignment:
return single_value.field_dl__assignment->is_value();
case RlcmacDlCtrlUnion::ALT_meas__order:
return single_value.field_meas__order->is_value();
case RlcmacDlCtrlUnion::ALT_ul__assignment:
return single_value.field_ul__assignment->is_value();
case RlcmacDlCtrlUnion::ALT_paging:
return single_value.field_paging->is_value();
case RlcmacDlCtrlUnion::ALT_ul__ack__nack:
return single_value.field_ul__ack__nack->is_value();
case RlcmacDlCtrlUnion::ALT_dl__dummy:
return single_value.field_dl__dummy->is_value();
case RlcmacDlCtrlUnion::ALT_pwr__ta:
return single_value.field_pwr__ta->is_value();
case RlcmacDlCtrlUnion::ALT_cell__chg__continue:
return single_value.field_cell__chg__continue->is_value();
case RlcmacDlCtrlUnion::ALT_neighbour__cell__data:
return single_value.field_neighbour__cell__data->is_value();
case RlcmacDlCtrlUnion::ALT_other:
return single_value.field_other->is_value();
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
}
}

RlcmacDlCtrlUnion RlcmacDlCtrlUnion_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.RlcmacDlCtrlUnion.");
RlcmacDlCtrlUnion ret_val;
switch (single_value.union_selection) {
case RlcmacDlCtrlUnion::ALT_access__reject:
ret_val.access__reject() = single_value.field_access__reject->valueof();
break;
case RlcmacDlCtrlUnion::ALT_dl__assignment:
ret_val.dl__assignment() = single_value.field_dl__assignment->valueof();
break;
case RlcmacDlCtrlUnion::ALT_meas__order:
ret_val.meas__order() = single_value.field_meas__order->valueof();
break;
case RlcmacDlCtrlUnion::ALT_ul__assignment:
ret_val.ul__assignment() = single_value.field_ul__assignment->valueof();
break;
case RlcmacDlCtrlUnion::ALT_paging:
ret_val.paging() = single_value.field_paging->valueof();
break;
case RlcmacDlCtrlUnion::ALT_ul__ack__nack:
ret_val.ul__ack__nack() = single_value.field_ul__ack__nack->valueof();
break;
case RlcmacDlCtrlUnion::ALT_dl__dummy:
ret_val.dl__dummy() = single_value.field_dl__dummy->valueof();
break;
case RlcmacDlCtrlUnion::ALT_pwr__ta:
ret_val.pwr__ta() = single_value.field_pwr__ta->valueof();
break;
case RlcmacDlCtrlUnion::ALT_cell__chg__continue:
ret_val.cell__chg__continue() = single_value.field_cell__chg__continue->valueof();
break;
case RlcmacDlCtrlUnion::ALT_neighbour__cell__data:
ret_val.neighbour__cell__data() = single_value.field_neighbour__cell__data->valueof();
break;
case RlcmacDlCtrlUnion::ALT_other:
ret_val.other() = single_value.field_other->valueof();
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
}
return ret_val;
}

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

PacketAccessReject_template& RlcmacDlCtrlUnion_template::access__reject()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RlcmacDlCtrlUnion::ALT_access__reject) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_access__reject = new PacketAccessReject_template(ANY_VALUE);
else single_value.field_access__reject = new PacketAccessReject_template;
single_value.union_selection = RlcmacDlCtrlUnion::ALT_access__reject;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_access__reject;
}

const PacketAccessReject_template& RlcmacDlCtrlUnion_template::access__reject() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field access_reject in a non-specific template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
if (single_value.union_selection != RlcmacDlCtrlUnion::ALT_access__reject) TTCN_error("Accessing non-selected field access_reject in a template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *single_value.field_access__reject;
}

PacketDlAssignment_template& RlcmacDlCtrlUnion_template::dl__assignment()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RlcmacDlCtrlUnion::ALT_dl__assignment) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_dl__assignment = new PacketDlAssignment_template(ANY_VALUE);
else single_value.field_dl__assignment = new PacketDlAssignment_template;
single_value.union_selection = RlcmacDlCtrlUnion::ALT_dl__assignment;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_dl__assignment;
}

const PacketDlAssignment_template& RlcmacDlCtrlUnion_template::dl__assignment() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field dl_assignment in a non-specific template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
if (single_value.union_selection != RlcmacDlCtrlUnion::ALT_dl__assignment) TTCN_error("Accessing non-selected field dl_assignment in a template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *single_value.field_dl__assignment;
}

PacketMeasOrder_template& RlcmacDlCtrlUnion_template::meas__order()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RlcmacDlCtrlUnion::ALT_meas__order) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_meas__order = new PacketMeasOrder_template(ANY_VALUE);
else single_value.field_meas__order = new PacketMeasOrder_template;
single_value.union_selection = RlcmacDlCtrlUnion::ALT_meas__order;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_meas__order;
}

const PacketMeasOrder_template& RlcmacDlCtrlUnion_template::meas__order() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field meas_order in a non-specific template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
if (single_value.union_selection != RlcmacDlCtrlUnion::ALT_meas__order) TTCN_error("Accessing non-selected field meas_order in a template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *single_value.field_meas__order;
}

PacketUlAssignment_template& RlcmacDlCtrlUnion_template::ul__assignment()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RlcmacDlCtrlUnion::ALT_ul__assignment) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_ul__assignment = new PacketUlAssignment_template(ANY_VALUE);
else single_value.field_ul__assignment = new PacketUlAssignment_template;
single_value.union_selection = RlcmacDlCtrlUnion::ALT_ul__assignment;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_ul__assignment;
}

const PacketUlAssignment_template& RlcmacDlCtrlUnion_template::ul__assignment() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ul_assignment in a non-specific template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
if (single_value.union_selection != RlcmacDlCtrlUnion::ALT_ul__assignment) TTCN_error("Accessing non-selected field ul_assignment in a template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *single_value.field_ul__assignment;
}

PacketPagingReq_template& RlcmacDlCtrlUnion_template::paging()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RlcmacDlCtrlUnion::ALT_paging) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_paging = new PacketPagingReq_template(ANY_VALUE);
else single_value.field_paging = new PacketPagingReq_template;
single_value.union_selection = RlcmacDlCtrlUnion::ALT_paging;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_paging;
}

const PacketPagingReq_template& RlcmacDlCtrlUnion_template::paging() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field paging in a non-specific template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
if (single_value.union_selection != RlcmacDlCtrlUnion::ALT_paging) TTCN_error("Accessing non-selected field paging in a template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *single_value.field_paging;
}

PacketUlAckNack_template& RlcmacDlCtrlUnion_template::ul__ack__nack()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RlcmacDlCtrlUnion::ALT_ul__ack__nack) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_ul__ack__nack = new PacketUlAckNack_template(ANY_VALUE);
else single_value.field_ul__ack__nack = new PacketUlAckNack_template;
single_value.union_selection = RlcmacDlCtrlUnion::ALT_ul__ack__nack;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_ul__ack__nack;
}

const PacketUlAckNack_template& RlcmacDlCtrlUnion_template::ul__ack__nack() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ul_ack_nack in a non-specific template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
if (single_value.union_selection != RlcmacDlCtrlUnion::ALT_ul__ack__nack) TTCN_error("Accessing non-selected field ul_ack_nack in a template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *single_value.field_ul__ack__nack;
}

PacketDlDummy_template& RlcmacDlCtrlUnion_template::dl__dummy()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RlcmacDlCtrlUnion::ALT_dl__dummy) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_dl__dummy = new PacketDlDummy_template(ANY_VALUE);
else single_value.field_dl__dummy = new PacketDlDummy_template;
single_value.union_selection = RlcmacDlCtrlUnion::ALT_dl__dummy;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_dl__dummy;
}

const PacketDlDummy_template& RlcmacDlCtrlUnion_template::dl__dummy() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field dl_dummy in a non-specific template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
if (single_value.union_selection != RlcmacDlCtrlUnion::ALT_dl__dummy) TTCN_error("Accessing non-selected field dl_dummy in a template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *single_value.field_dl__dummy;
}

PacketPwrControlTA_template& RlcmacDlCtrlUnion_template::pwr__ta()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RlcmacDlCtrlUnion::ALT_pwr__ta) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pwr__ta = new PacketPwrControlTA_template(ANY_VALUE);
else single_value.field_pwr__ta = new PacketPwrControlTA_template;
single_value.union_selection = RlcmacDlCtrlUnion::ALT_pwr__ta;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_pwr__ta;
}

const PacketPwrControlTA_template& RlcmacDlCtrlUnion_template::pwr__ta() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pwr_ta in a non-specific template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
if (single_value.union_selection != RlcmacDlCtrlUnion::ALT_pwr__ta) TTCN_error("Accessing non-selected field pwr_ta in a template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *single_value.field_pwr__ta;
}

PacketCellChangeContinue_template& RlcmacDlCtrlUnion_template::cell__chg__continue()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RlcmacDlCtrlUnion::ALT_cell__chg__continue) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_cell__chg__continue = new PacketCellChangeContinue_template(ANY_VALUE);
else single_value.field_cell__chg__continue = new PacketCellChangeContinue_template;
single_value.union_selection = RlcmacDlCtrlUnion::ALT_cell__chg__continue;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_cell__chg__continue;
}

const PacketCellChangeContinue_template& RlcmacDlCtrlUnion_template::cell__chg__continue() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cell_chg_continue in a non-specific template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
if (single_value.union_selection != RlcmacDlCtrlUnion::ALT_cell__chg__continue) TTCN_error("Accessing non-selected field cell_chg_continue in a template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *single_value.field_cell__chg__continue;
}

PacketNeighbourCellData_template& RlcmacDlCtrlUnion_template::neighbour__cell__data()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RlcmacDlCtrlUnion::ALT_neighbour__cell__data) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_neighbour__cell__data = new PacketNeighbourCellData_template(ANY_VALUE);
else single_value.field_neighbour__cell__data = new PacketNeighbourCellData_template;
single_value.union_selection = RlcmacDlCtrlUnion::ALT_neighbour__cell__data;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_neighbour__cell__data;
}

const PacketNeighbourCellData_template& RlcmacDlCtrlUnion_template::neighbour__cell__data() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field neighbour_cell_data in a non-specific template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
if (single_value.union_selection != RlcmacDlCtrlUnion::ALT_neighbour__cell__data) TTCN_error("Accessing non-selected field neighbour_cell_data in a template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
return *single_value.field_neighbour__cell__data;
}

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

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

boolean RlcmacDlCtrlUnion_template::ischosen(RlcmacDlCtrlUnion::union_selection_type checked_selection) const
{
if (checked_selection == RlcmacDlCtrlUnion::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.union_selection == RlcmacDlCtrlUnion::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.RlcmacDlCtrlUnion.");
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.RlcmacDlCtrlUnion 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 RlcmacDlCtrlUnion_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case RlcmacDlCtrlUnion::ALT_access__reject:
TTCN_Logger::log_event_str("{ access_reject := ");
single_value.field_access__reject->log();
TTCN_Logger::log_event_str(" }");
break;
case RlcmacDlCtrlUnion::ALT_dl__assignment:
TTCN_Logger::log_event_str("{ dl_assignment := ");
single_value.field_dl__assignment->log();
TTCN_Logger::log_event_str(" }");
break;
case RlcmacDlCtrlUnion::ALT_meas__order:
TTCN_Logger::log_event_str("{ meas_order := ");
single_value.field_meas__order->log();
TTCN_Logger::log_event_str(" }");
break;
case RlcmacDlCtrlUnion::ALT_ul__assignment:
TTCN_Logger::log_event_str("{ ul_assignment := ");
single_value.field_ul__assignment->log();
TTCN_Logger::log_event_str(" }");
break;
case RlcmacDlCtrlUnion::ALT_paging:
TTCN_Logger::log_event_str("{ paging := ");
single_value.field_paging->log();
TTCN_Logger::log_event_str(" }");
break;
case RlcmacDlCtrlUnion::ALT_ul__ack__nack:
TTCN_Logger::log_event_str("{ ul_ack_nack := ");
single_value.field_ul__ack__nack->log();
TTCN_Logger::log_event_str(" }");
break;
case RlcmacDlCtrlUnion::ALT_dl__dummy:
TTCN_Logger::log_event_str("{ dl_dummy := ");
single_value.field_dl__dummy->log();
TTCN_Logger::log_event_str(" }");
break;
case RlcmacDlCtrlUnion::ALT_pwr__ta:
TTCN_Logger::log_event_str("{ pwr_ta := ");
single_value.field_pwr__ta->log();
TTCN_Logger::log_event_str(" }");
break;
case RlcmacDlCtrlUnion::ALT_cell__chg__continue:
TTCN_Logger::log_event_str("{ cell_chg_continue := ");
single_value.field_cell__chg__continue->log();
TTCN_Logger::log_event_str(" }");
break;
case RlcmacDlCtrlUnion::ALT_neighbour__cell__data:
TTCN_Logger::log_event_str("{ neighbour_cell_data := ");
single_value.field_neighbour__cell__data->log();
TTCN_Logger::log_event_str(" }");
break;
case RlcmacDlCtrlUnion::ALT_other:
TTCN_Logger::log_event_str("{ other := ");
single_value.field_other->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_str("<invalid selector>");
}
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void RlcmacDlCtrlUnion_template::log_match(const RlcmacDlCtrlUnion& 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 RlcmacDlCtrlUnion::ALT_access__reject:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".access_reject");
single_value.field_access__reject->log_match(match_value.access__reject(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ access_reject := ");
single_value.field_access__reject->log_match(match_value.access__reject(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case RlcmacDlCtrlUnion::ALT_dl__assignment:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".dl_assignment");
single_value.field_dl__assignment->log_match(match_value.dl__assignment(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ dl_assignment := ");
single_value.field_dl__assignment->log_match(match_value.dl__assignment(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case RlcmacDlCtrlUnion::ALT_meas__order:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".meas_order");
single_value.field_meas__order->log_match(match_value.meas__order(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ meas_order := ");
single_value.field_meas__order->log_match(match_value.meas__order(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case RlcmacDlCtrlUnion::ALT_ul__assignment:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".ul_assignment");
single_value.field_ul__assignment->log_match(match_value.ul__assignment(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ ul_assignment := ");
single_value.field_ul__assignment->log_match(match_value.ul__assignment(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case RlcmacDlCtrlUnion::ALT_paging:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".paging");
single_value.field_paging->log_match(match_value.paging(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ paging := ");
single_value.field_paging->log_match(match_value.paging(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case RlcmacDlCtrlUnion::ALT_ul__ack__nack:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".ul_ack_nack");
single_value.field_ul__ack__nack->log_match(match_value.ul__ack__nack(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ ul_ack_nack := ");
single_value.field_ul__ack__nack->log_match(match_value.ul__ack__nack(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case RlcmacDlCtrlUnion::ALT_dl__dummy:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".dl_dummy");
single_value.field_dl__dummy->log_match(match_value.dl__dummy(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ dl_dummy := ");
single_value.field_dl__dummy->log_match(match_value.dl__dummy(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case RlcmacDlCtrlUnion::ALT_pwr__ta:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".pwr_ta");
single_value.field_pwr__ta->log_match(match_value.pwr__ta(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ pwr_ta := ");
single_value.field_pwr__ta->log_match(match_value.pwr__ta(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case RlcmacDlCtrlUnion::ALT_cell__chg__continue:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".cell_chg_continue");
single_value.field_cell__chg__continue->log_match(match_value.cell__chg__continue(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ cell_chg_continue := ");
single_value.field_cell__chg__continue->log_match(match_value.cell__chg__continue(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case RlcmacDlCtrlUnion::ALT_neighbour__cell__data:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".neighbour_cell_data");
single_value.field_neighbour__cell__data->log_match(match_value.neighbour__cell__data(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ neighbour_cell_data := ");
single_value.field_neighbour__cell__data->log_match(match_value.neighbour__cell__data(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case RlcmacDlCtrlUnion::ALT_other:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".other");
single_value.field_other->log_match(match_value.other(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ other := ");
single_value.field_other->log_match(match_value.other(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
default:
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str("<invalid selector>");
}
} else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void RlcmacDlCtrlUnion_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
switch (single_value.union_selection) {
case RlcmacDlCtrlUnion::ALT_access__reject:
single_value.field_access__reject->set_implicit_omit(); break;
case RlcmacDlCtrlUnion::ALT_dl__assignment:
single_value.field_dl__assignment->set_implicit_omit(); break;
case RlcmacDlCtrlUnion::ALT_meas__order:
single_value.field_meas__order->set_implicit_omit(); break;
case RlcmacDlCtrlUnion::ALT_ul__assignment:
single_value.field_ul__assignment->set_implicit_omit(); break;
case RlcmacDlCtrlUnion::ALT_paging:
single_value.field_paging->set_implicit_omit(); break;
case RlcmacDlCtrlUnion::ALT_ul__ack__nack:
single_value.field_ul__ack__nack->set_implicit_omit(); break;
case RlcmacDlCtrlUnion::ALT_dl__dummy:
single_value.field_dl__dummy->set_implicit_omit(); break;
case RlcmacDlCtrlUnion::ALT_pwr__ta:
single_value.field_pwr__ta->set_implicit_omit(); break;
case RlcmacDlCtrlUnion::ALT_cell__chg__continue:
single_value.field_cell__chg__continue->set_implicit_omit(); break;
case RlcmacDlCtrlUnion::ALT_neighbour__cell__data:
single_value.field_neighbour__cell__data->set_implicit_omit(); break;
case RlcmacDlCtrlUnion::ALT_other:
single_value.field_other->set_implicit_omit(); break;
default: break;
}
}

void RlcmacDlCtrlUnion_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 RlcmacDlCtrlUnion::ALT_access__reject:
single_value.field_access__reject->encode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_dl__assignment:
single_value.field_dl__assignment->encode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_meas__order:
single_value.field_meas__order->encode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_ul__assignment:
single_value.field_ul__assignment->encode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_paging:
single_value.field_paging->encode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_ul__ack__nack:
single_value.field_ul__ack__nack->encode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_dl__dummy:
single_value.field_dl__dummy->encode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_pwr__ta:
single_value.field_pwr__ta->encode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_cell__chg__continue:
single_value.field_cell__chg__continue->encode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_neighbour__cell__data:
single_value.field_neighbour__cell__data->encode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_other:
single_value.field_other->encode_text(text_buf);
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
}
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.RlcmacDlCtrlUnion.");
}
}

void RlcmacDlCtrlUnion_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
{
single_value.union_selection = RlcmacDlCtrlUnion::UNBOUND_VALUE;
RlcmacDlCtrlUnion::union_selection_type new_selection = (RlcmacDlCtrlUnion::union_selection_type)text_buf.pull_int().get_val();
switch (new_selection) {
case RlcmacDlCtrlUnion::ALT_access__reject:
single_value.field_access__reject = new PacketAccessReject_template;
single_value.field_access__reject->decode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_dl__assignment:
single_value.field_dl__assignment = new PacketDlAssignment_template;
single_value.field_dl__assignment->decode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_meas__order:
single_value.field_meas__order = new PacketMeasOrder_template;
single_value.field_meas__order->decode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_ul__assignment:
single_value.field_ul__assignment = new PacketUlAssignment_template;
single_value.field_ul__assignment->decode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_paging:
single_value.field_paging = new PacketPagingReq_template;
single_value.field_paging->decode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_ul__ack__nack:
single_value.field_ul__ack__nack = new PacketUlAckNack_template;
single_value.field_ul__ack__nack->decode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_dl__dummy:
single_value.field_dl__dummy = new PacketDlDummy_template;
single_value.field_dl__dummy->decode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_pwr__ta:
single_value.field_pwr__ta = new PacketPwrControlTA_template;
single_value.field_pwr__ta->decode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_cell__chg__continue:
single_value.field_cell__chg__continue = new PacketCellChangeContinue_template;
single_value.field_cell__chg__continue->decode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_neighbour__cell__data:
single_value.field_neighbour__cell__data = new PacketNeighbourCellData_template;
single_value.field_neighbour__cell__data->decode_text(text_buf);
break;
case RlcmacDlCtrlUnion::ALT_other:
single_value.field_other = new OCTETSTRING_template;
single_value.field_other->decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.");
}
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 RlcmacDlCtrlUnion_template[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.RlcmacDlCtrlUnion.");
}
}

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

boolean RlcmacDlCtrlUnion_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 RlcmacDlCtrlUnion_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.RlcmacDlCtrlUnion'");
    }
    if (strcmp("access_reject", param_field) == 0) {
      access__reject().set_param(param);
      return;
    } else if (strcmp("dl_assignment", param_field) == 0) {
      dl__assignment().set_param(param);
      return;
    } else if (strcmp("meas_order", param_field) == 0) {
      meas__order().set_param(param);
      return;
    } else if (strcmp("ul_assignment", param_field) == 0) {
      ul__assignment().set_param(param);
      return;
    } else if (strcmp("paging", param_field) == 0) {
      paging().set_param(param);
      return;
    } else if (strcmp("ul_ack_nack", param_field) == 0) {
      ul__ack__nack().set_param(param);
      return;
    } else if (strcmp("dl_dummy", param_field) == 0) {
      dl__dummy().set_param(param);
      return;
    } else if (strcmp("pwr_ta", param_field) == 0) {
      pwr__ta().set_param(param);
      return;
    } else if (strcmp("cell_chg_continue", param_field) == 0) {
      cell__chg__continue().set_param(param);
      return;
    } else if (strcmp("neighbour_cell_data", param_field) == 0) {
      neighbour__cell__data().set_param(param);
      return;
    } else if (strcmp("other", param_field) == 0) {
      other().set_param(param);
      return;
    } else param.error("Field `%s' not found in union template type `@RLCMAC_CSN1_Types.RlcmacDlCtrlUnion'", 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: {
    RlcmacDlCtrlUnion_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.RlcmacDlCtrlUnion");
    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, "access_reject")) {
      access__reject().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "dl_assignment")) {
      dl__assignment().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "meas_order")) {
      meas__order().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "ul_assignment")) {
      ul__assignment().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "paging")) {
      paging().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "ul_ack_nack")) {
      ul__ack__nack().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "dl_dummy")) {
      dl__dummy().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "pwr_ta")) {
      pwr__ta().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "cell_chg_continue")) {
      cell__chg__continue().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "neighbour_cell_data")) {
      neighbour__cell__data().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "other")) {
      other().set_param(*mp_last);
      break;
    }
    mp_last->error("Field %s does not exist in type @RLCMAC_CSN1_Types.RlcmacDlCtrlUnion.", last_name);
  } break;
  case Module_Param::MP_Implication_Template: {
    RlcmacDlCtrlUnion_template* precondition = new RlcmacDlCtrlUnion_template;
    precondition->set_param(*m_p->get_elem(0));
    RlcmacDlCtrlUnion_template* implied_template = new RlcmacDlCtrlUnion_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = RlcmacDlCtrlUnion_template(precondition, implied_template);
  } break;
  default:
    param.type_error("union template", "@RLCMAC_CSN1_Types.RlcmacDlCtrlUnion");
  }
  is_ifpresent = param.get_ifpresent();
}

void RlcmacDlCtrlUnion_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 RlcmacDlCtrlUnion::ALT_access__reject:
single_value.field_access__reject->check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.RlcmacDlCtrlUnion");
return;
case RlcmacDlCtrlUnion::ALT_dl__assignment:
single_value.field_dl__assignment->check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.RlcmacDlCtrlUnion");
return;
case RlcmacDlCtrlUnion::ALT_meas__order:
single_value.field_meas__order->check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.RlcmacDlCtrlUnion");
return;
case RlcmacDlCtrlUnion::ALT_ul__assignment:
single_value.field_ul__assignment->check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.RlcmacDlCtrlUnion");
return;
case RlcmacDlCtrlUnion::ALT_paging:
single_value.field_paging->check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.RlcmacDlCtrlUnion");
return;
case RlcmacDlCtrlUnion::ALT_ul__ack__nack:
single_value.field_ul__ack__nack->check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.RlcmacDlCtrlUnion");
return;
case RlcmacDlCtrlUnion::ALT_dl__dummy:
single_value.field_dl__dummy->check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.RlcmacDlCtrlUnion");
return;
case RlcmacDlCtrlUnion::ALT_pwr__ta:
single_value.field_pwr__ta->check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.RlcmacDlCtrlUnion");
return;
case RlcmacDlCtrlUnion::ALT_cell__chg__continue:
single_value.field_cell__chg__continue->check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.RlcmacDlCtrlUnion");
return;
case RlcmacDlCtrlUnion::ALT_neighbour__cell__data:
single_value.field_neighbour__cell__data->check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.RlcmacDlCtrlUnion");
return;
case RlcmacDlCtrlUnion::ALT_other:
single_value.field_other->check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.RlcmacDlCtrlUnion");
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.RlcmacDlCtrlUnion.");
}
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.RlcmacDlCtrlUnion");
}

void PacketAccessRejectID::copy_value(const PacketAccessRejectID& other_value)
{
switch (other_value.union_selection) {
case ALT_tlli:
field_tlli = new OCTETSTRING(*other_value.field_tlli);
break;
case ALT_id__sub:
field_id__sub = new PacketAccessRejectIDSub(*other_value.field_id__sub);
break;
default:
TTCN_error("Assignment of an unbound union value of type @RLCMAC_CSN1_Types.PacketAccessRejectID.");
}
union_selection = other_value.union_selection;
}

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

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

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

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

boolean PacketAccessRejectID::operator==(const PacketAccessRejectID& 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.PacketAccessRejectID.");
if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @RLCMAC_CSN1_Types.PacketAccessRejectID.");
if (union_selection != other_value.union_selection) return FALSE;
switch (union_selection) {
case ALT_tlli:
return *field_tlli == *other_value.field_tlli;
case ALT_id__sub:
return *field_id__sub == *other_value.field_id__sub;
default:
return FALSE;
}
}

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

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

PacketAccessRejectIDSub& PacketAccessRejectID::id__sub()
{
if (union_selection != ALT_id__sub) {
clean_up();
field_id__sub = new PacketAccessRejectIDSub;
union_selection = ALT_id__sub;
}
return *field_id__sub;
}

const PacketAccessRejectIDSub& PacketAccessRejectID::id__sub() const
{
if (union_selection != ALT_id__sub) TTCN_error("Using non-selected field id_sub in a value of union type @RLCMAC_CSN1_Types.PacketAccessRejectID.");
return *field_id__sub;
}

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

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

boolean PacketAccessRejectID::is_value() const
{
switch (union_selection) {
case UNBOUND_VALUE: return FALSE;
case ALT_tlli: return field_tlli->is_value();
case ALT_id__sub: return field_id__sub->is_value();
default: TTCN_error("Invalid selection in union is_bound");}
}

void PacketAccessRejectID::clean_up()
{
switch (union_selection) {
case ALT_tlli:
  delete field_tlli;
  break;
case ALT_id__sub:
  delete field_id__sub;
  break;
default:
  break;
}
union_selection = UNBOUND_VALUE;
}

void PacketAccessRejectID::log() const
{
switch (union_selection) {
case ALT_tlli:
TTCN_Logger::log_event_str("{ tlli := ");
field_tlli->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_id__sub:
TTCN_Logger::log_event_str("{ id_sub := ");
field_id__sub->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_unbound();
}
}

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

void PacketAccessRejectID::set_implicit_omit()
{
switch (union_selection) {
case ALT_tlli:
field_tlli->set_implicit_omit(); break;
case ALT_id__sub:
field_id__sub->set_implicit_omit(); break;
default: break;
}
}

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

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

void PacketAccessRejectID::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 PacketAccessRejectID::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 PacketAccessRejectID::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, PacketAccessRejectID_tlli_descr_.raw->forceomit);
      decoded_length = tlli().RAW_decode(PacketAccessRejectID_tlli_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, PacketAccessRejectID_id__sub_descr_.raw->forceomit);
      decoded_length = id__sub().RAW_decode(PacketAccessRejectID_id__sub_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit);
      break; }
    default: break;
    }
    return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
  } else {
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_0_force_omit(0, force_omit, PacketAccessRejectID_tlli_descr_.raw->forceomit);
      decoded_length = tlli().RAW_decode(PacketAccessRejectID_tlli_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_0_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
      p_buf.set_pos_bit(starting_pos);
      RAW_Force_Omit field_1_force_omit(1, force_omit, PacketAccessRejectID_id__sub_descr_.raw->forceomit);
      decoded_length = id__sub().RAW_decode(PacketAccessRejectID_id__sub_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_1_force_omit);
      if (decoded_length >= 0) {
         return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength;
       }
 }
 clean_up();
 return -1;
}

int PacketAccessRejectID::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const
{
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 2;  myleaf.body.node.nodes = init_nodes_of_enc_tree(2);
  memset(myleaf.body.node.nodes, 0, 2 * sizeof(RAW_enc_tree *));
  switch (union_selection) {
  case ALT_tlli:
    myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, PacketAccessRejectID_tlli_descr_.raw);
    encoded_length = field_tlli->RAW_encode(PacketAccessRejectID_tlli_descr_, *myleaf.body.node.nodes[0]);
    myleaf.body.node.nodes[0]->coding_descr = &PacketAccessRejectID_tlli_descr_;
    break;
  case ALT_id__sub:
    myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, PacketAccessRejectID_id__sub_descr_.raw);
    encoded_length = field_id__sub->RAW_encode(PacketAccessRejectID_id__sub_descr_, *myleaf.body.node.nodes[1]);
    myleaf.body.node.nodes[1]->coding_descr = &PacketAccessRejectID_id__sub_descr_;
    break;
  default:
    TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  }
  return encoded_length;
}

void PacketAccessRejectID_template::copy_value(const PacketAccessRejectID& other_value)
{
single_value.union_selection = other_value.get_selection();
switch (single_value.union_selection) {
case PacketAccessRejectID::ALT_tlli:
single_value.field_tlli = new OCTETSTRING_template(other_value.tlli());
break;
case PacketAccessRejectID::ALT_id__sub:
single_value.field_id__sub = new PacketAccessRejectIDSub_template(other_value.id__sub());
break;
default:
TTCN_error("Initializing a template with an unbound value of type @RLCMAC_CSN1_Types.PacketAccessRejectID.");
}
set_selection(SPECIFIC_VALUE);
}

void PacketAccessRejectID_template::copy_template(const PacketAccessRejectID_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 PacketAccessRejectID::ALT_tlli:
single_value.field_tlli = new OCTETSTRING_template(*other_value.single_value.field_tlli);
break;
case PacketAccessRejectID::ALT_id__sub:
single_value.field_id__sub = new PacketAccessRejectIDSub_template(*other_value.single_value.field_id__sub);
break;
default:
TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @RLCMAC_CSN1_Types.PacketAccessRejectID.");
}
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 PacketAccessRejectID_template[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 PacketAccessRejectID_template(*other_value.implication_.precondition);
implication_.implied_template = new PacketAccessRejectID_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.PacketAccessRejectID.");
}
set_selection(other_value);
}

PacketAccessRejectID_template::PacketAccessRejectID_template()
{
}

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

PacketAccessRejectID_template::PacketAccessRejectID_template(const PacketAccessRejectID& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

void PacketAccessRejectID_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case PacketAccessRejectID::ALT_tlli:
delete single_value.field_tlli;
break;
case PacketAccessRejectID::ALT_id__sub:
delete single_value.field_id__sub;
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;
}

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

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

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

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

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

boolean PacketAccessRejectID_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
switch (single_value.union_selection) {
case PacketAccessRejectID::ALT_tlli:
return single_value.field_tlli->is_value();
case PacketAccessRejectID::ALT_id__sub:
return single_value.field_id__sub->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.PacketAccessRejectID.");
}
}

PacketAccessRejectID PacketAccessRejectID_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.PacketAccessRejectID.");
PacketAccessRejectID ret_val;
switch (single_value.union_selection) {
case PacketAccessRejectID::ALT_tlli:
ret_val.tlli() = single_value.field_tlli->valueof();
break;
case PacketAccessRejectID::ALT_id__sub:
ret_val.id__sub() = single_value.field_id__sub->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.PacketAccessRejectID.");
}
return ret_val;
}

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

OCTETSTRING_template& PacketAccessRejectID_template::tlli()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PacketAccessRejectID::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 OCTETSTRING_template(ANY_VALUE);
else single_value.field_tlli = new OCTETSTRING_template;
single_value.union_selection = PacketAccessRejectID::ALT_tlli;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_tlli;
}

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

PacketAccessRejectIDSub_template& PacketAccessRejectID_template::id__sub()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PacketAccessRejectID::ALT_id__sub) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_id__sub = new PacketAccessRejectIDSub_template(ANY_VALUE);
else single_value.field_id__sub = new PacketAccessRejectIDSub_template;
single_value.union_selection = PacketAccessRejectID::ALT_id__sub;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_id__sub;
}

const PacketAccessRejectIDSub_template& PacketAccessRejectID_template::id__sub() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field id_sub in a non-specific template of union type @RLCMAC_CSN1_Types.PacketAccessRejectID.");
if (single_value.union_selection != PacketAccessRejectID::ALT_id__sub) TTCN_error("Accessing non-selected field id_sub in a template of union type @RLCMAC_CSN1_Types.PacketAccessRejectID.");
return *single_value.field_id__sub;
}

boolean PacketAccessRejectID_template::ischosen(PacketAccessRejectID::union_selection_type checked_selection) const
{
if (checked_selection == PacketAccessRejectID::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @RLCMAC_CSN1_Types.PacketAccessRejectID.");
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.union_selection == PacketAccessRejectID::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.PacketAccessRejectID.");
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.PacketAccessRejectID 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 PacketAccessRejectID_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case PacketAccessRejectID::ALT_tlli:
TTCN_Logger::log_event_str("{ tlli := ");
single_value.field_tlli->log();
TTCN_Logger::log_event_str(" }");
break;
case PacketAccessRejectID::ALT_id__sub:
TTCN_Logger::log_event_str("{ id_sub := ");
single_value.field_id__sub->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 PacketAccessRejectID_template::log_match(const PacketAccessRejectID& 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 PacketAccessRejectID::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 PacketAccessRejectID::ALT_id__sub:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".id_sub");
single_value.field_id__sub->log_match(match_value.id__sub(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ id_sub := ");
single_value.field_id__sub->log_match(match_value.id__sub(), 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 PacketAccessRejectID_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
switch (single_value.union_selection) {
case PacketAccessRejectID::ALT_tlli:
single_value.field_tlli->set_implicit_omit(); break;
case PacketAccessRejectID::ALT_id__sub:
single_value.field_id__sub->set_implicit_omit(); break;
default: break;
}
}

void PacketAccessRejectID_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 PacketAccessRejectID::ALT_tlli:
single_value.field_tlli->encode_text(text_buf);
break;
case PacketAccessRejectID::ALT_id__sub:
single_value.field_id__sub->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.PacketAccessRejectID.");
}
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.PacketAccessRejectID.");
}
}

void PacketAccessRejectID_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
{
single_value.union_selection = PacketAccessRejectID::UNBOUND_VALUE;
PacketAccessRejectID::union_selection_type new_selection = (PacketAccessRejectID::union_selection_type)text_buf.pull_int().get_val();
switch (new_selection) {
case PacketAccessRejectID::ALT_tlli:
single_value.field_tlli = new OCTETSTRING_template;
single_value.field_tlli->decode_text(text_buf);
break;
case PacketAccessRejectID::ALT_id__sub:
single_value.field_id__sub = new PacketAccessRejectIDSub_template;
single_value.field_id__sub->decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @RLCMAC_CSN1_Types.PacketAccessRejectID.");
}
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 PacketAccessRejectID_template[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.PacketAccessRejectID.");
}
}

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

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

void PacketAccessRejectID_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 PacketAccessRejectID::ALT_tlli:
single_value.field_tlli->check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketAccessRejectID");
return;
case PacketAccessRejectID::ALT_id__sub:
single_value.field_id__sub->check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketAccessRejectID");
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.PacketAccessRejectID.");
}
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.PacketAccessRejectID");
}

PacketAccessRejectIDSub::PacketAccessRejectIDSub()
{
}

PacketAccessRejectIDSub::PacketAccessRejectIDSub(const BITSTRING& par_id__type,
    const OPTIONAL< PacketRequestReference >& par_req__ref,
    const OPTIONAL< GlobalTfi >& par_gtfi)
  :   field_id__type(par_id__type),
  field_req__ref(par_req__ref),
  field_gtfi(par_gtfi)
{
}

PacketAccessRejectIDSub::PacketAccessRejectIDSub(const PacketAccessRejectIDSub& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PacketAccessRejectIDSub.");
if (other_value.id__type().is_bound()) field_id__type = other_value.id__type();
else field_id__type.clean_up();
if (other_value.req__ref().is_bound()) field_req__ref = other_value.req__ref();
else field_req__ref.clean_up();
if (other_value.gtfi().is_bound()) field_gtfi = other_value.gtfi();
else field_gtfi.clean_up();
}

void PacketAccessRejectIDSub::clean_up()
{
field_id__type.clean_up();
field_req__ref.clean_up();
field_gtfi.clean_up();
}

const TTCN_Typedescriptor_t* PacketAccessRejectIDSub::get_descriptor() const { return &PacketAccessRejectIDSub_descr_; }
PacketAccessRejectIDSub& PacketAccessRejectIDSub::operator=(const PacketAccessRejectIDSub& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PacketAccessRejectIDSub.");
  if (other_value.id__type().is_bound()) field_id__type = other_value.id__type();
  else field_id__type.clean_up();
  if (other_value.req__ref().is_bound()) field_req__ref = other_value.req__ref();
  else field_req__ref.clean_up();
  if (other_value.gtfi().is_bound()) field_gtfi = other_value.gtfi();
  else field_gtfi.clean_up();
}
return *this;
}

boolean PacketAccessRejectIDSub::operator==(const PacketAccessRejectIDSub& other_value) const
{
return field_id__type==other_value.field_id__type
  && field_req__ref==other_value.field_req__ref
  && field_gtfi==other_value.field_gtfi;
}

boolean PacketAccessRejectIDSub::is_bound() const
{
return (field_id__type.is_bound())
  || (OPTIONAL_OMIT == field_req__ref.get_selection() || field_req__ref.is_bound())
  || (OPTIONAL_OMIT == field_gtfi.get_selection() || field_gtfi.is_bound());
}
boolean PacketAccessRejectIDSub::is_value() const
{
return field_id__type.is_value()
  && (OPTIONAL_OMIT == field_req__ref.get_selection() || field_req__ref.is_value())
  && (OPTIONAL_OMIT == field_gtfi.get_selection() || field_gtfi.is_value());
}
int PacketAccessRejectIDSub::size_of() const
{
  int ret_val = 1;
  if (field_req__ref.ispresent()) ret_val++;
  if (field_gtfi.ispresent()) ret_val++;
  return ret_val;
}

void PacketAccessRejectIDSub::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ id_type := ");
field_id__type.log();
TTCN_Logger::log_event_str(", req_ref := ");
field_req__ref.log();
TTCN_Logger::log_event_str(", gtfi := ");
field_gtfi.log();
TTCN_Logger::log_event_str(" }");
}

void PacketAccessRejectIDSub::set_implicit_omit()
{
if (id__type().is_bound()) id__type().set_implicit_omit();
if (!req__ref().is_bound()) req__ref() = OMIT_VALUE;
else req__ref().set_implicit_omit();
if (!gtfi().is_bound()) gtfi() = OMIT_VALUE;
else gtfi().set_implicit_omit();
}

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

void PacketAccessRejectIDSub::encode_text(Text_Buf& text_buf) const
{
field_id__type.encode_text(text_buf);
field_req__ref.encode_text(text_buf);
field_gtfi.encode_text(text_buf);
}

void PacketAccessRejectIDSub::decode_text(Text_Buf& text_buf)
{
field_id__type.decode_text(text_buf);
field_req__ref.decode_text(text_buf);
field_gtfi.decode_text(text_buf);
}

void PacketAccessRejectIDSub::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 PacketAccessRejectIDSub::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 PacketAccessRejectIDSub::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, PacketAccessRejectIDSub_id__type_descr_.raw->forceomit);
  decoded_field_length = field_id__type.RAW_decode(PacketAccessRejectIDSub_id__type_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (limit > 0 && field_id__type ==  bs_1){
  if (force_omit != NULL && (*force_omit)(1)) {
    field_req__ref = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_1_force_omit(1, force_omit, PacketAccessRejectIDSub_req__ref_descr_.raw->forceomit);
  decoded_field_length = field_req__ref().RAW_decode(PacketAccessRejectIDSub_req__ref_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 1) {
  field_req__ref = 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_req__ref=OMIT_VALUE;
  if (limit > 0 && field_id__type ==  bs_0){
  if (force_omit != NULL && (*force_omit)(2)) {
    field_gtfi = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_2_force_omit(2, force_omit, PacketAccessRejectIDSub_gtfi_descr_.raw->forceomit);
  decoded_field_length = field_gtfi().RAW_decode(PacketAccessRejectIDSub_gtfi_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit);
  if (decoded_field_length < 1) {
  field_gtfi = 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_gtfi=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int PacketAccessRejectIDSub::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, PacketAccessRejectIDSub_id__type_descr_.raw);
  if (field_req__ref.ispresent()) {
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PacketAccessRejectIDSub_req__ref_descr_.raw);
  }
  else myleaf.body.node.nodes[1] = NULL;
  if (field_gtfi.ispresent()) {
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PacketAccessRejectIDSub_gtfi_descr_.raw);
  }
  else myleaf.body.node.nodes[2] = NULL;
  encoded_length += field_id__type.RAW_encode(PacketAccessRejectIDSub_id__type_descr_, *myleaf.body.node.nodes[0]);
  if (field_req__ref.ispresent()) {
  encoded_length += field_req__ref().RAW_encode(PacketAccessRejectIDSub_req__ref_descr_, *myleaf.body.node.nodes[1]);
  }
  if (field_gtfi.ispresent()) {
  encoded_length += field_gtfi().RAW_encode(PacketAccessRejectIDSub_gtfi_descr_, *myleaf.body.node.nodes[2]);
  }
  if (field_req__ref.ispresent() && (field_id__type !=  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(PacketAccessRejectIDSub_id__type_descr_,*temp_leaf);
  } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  }
  free_tree_pos(pr_pos0.pos);
  }
  }
  if (field_gtfi.ispresent() && (field_id__type !=  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(PacketAccessRejectIDSub_id__type_descr_,*temp_leaf);
  } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  }
  free_tree_pos(pr_pos0.pos);
  }
  }
  return myleaf.length = encoded_length;
}

struct PacketAccessRejectIDSub_template::single_value_struct {
BITSTRING_template field_id__type;
PacketRequestReference_template field_req__ref;
GlobalTfi_template field_gtfi;
};

void PacketAccessRejectIDSub_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_id__type = ANY_VALUE;
single_value->field_req__ref = ANY_OR_OMIT;
single_value->field_gtfi = ANY_OR_OMIT;
}
}
}

void PacketAccessRejectIDSub_template::copy_value(const PacketAccessRejectIDSub& other_value)
{
single_value = new single_value_struct;
if (other_value.id__type().is_bound()) {
  single_value->field_id__type = other_value.id__type();
} else {
  single_value->field_id__type.clean_up();
}
if (other_value.req__ref().is_bound()) {
  if (other_value.req__ref().ispresent()) single_value->field_req__ref = other_value.req__ref()();
  else single_value->field_req__ref = OMIT_VALUE;
} else {
  single_value->field_req__ref.clean_up();
}
if (other_value.gtfi().is_bound()) {
  if (other_value.gtfi().ispresent()) single_value->field_gtfi = other_value.gtfi()();
  else single_value->field_gtfi = OMIT_VALUE;
} else {
  single_value->field_gtfi.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PacketAccessRejectIDSub_template::copy_template(const PacketAccessRejectIDSub_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.id__type().get_selection()) {
single_value->field_id__type = other_value.id__type();
} else {
single_value->field_id__type.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.req__ref().get_selection()) {
single_value->field_req__ref = other_value.req__ref();
} else {
single_value->field_req__ref.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.gtfi().get_selection()) {
single_value->field_gtfi = other_value.gtfi();
} else {
single_value->field_gtfi.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 PacketAccessRejectIDSub_template[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 PacketAccessRejectIDSub_template(*other_value.implication_.precondition);
implication_.implied_template = new PacketAccessRejectIDSub_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.PacketAccessRejectIDSub.");
break;
}
set_selection(other_value);
}

PacketAccessRejectIDSub_template::PacketAccessRejectIDSub_template()
{
}

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

PacketAccessRejectIDSub_template::PacketAccessRejectIDSub_template(const PacketAccessRejectIDSub& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PacketAccessRejectIDSub_template::match(const PacketAccessRejectIDSub& 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.id__type().is_bound()) return FALSE;
if(!single_value->field_id__type.match(other_value.id__type(), legacy))return FALSE;
if(!other_value.req__ref().is_bound()) return FALSE;
if((other_value.req__ref().ispresent() ? !single_value->field_req__ref.match((const PacketRequestReference&)other_value.req__ref(), legacy) : !single_value->field_req__ref.match_omit(legacy)))return FALSE;
if(!other_value.gtfi().is_bound()) return FALSE;
if((other_value.gtfi().ispresent() ? !single_value->field_gtfi.match((const GlobalTfi&)other_value.gtfi(), legacy) : !single_value->field_gtfi.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.PacketAccessRejectIDSub.");
}
return FALSE;
}

boolean PacketAccessRejectIDSub_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_id__type.is_bound()
 || (single_value->field_req__ref.is_omit() || single_value->field_req__ref.is_bound())
 || (single_value->field_gtfi.is_omit() || single_value->field_gtfi.is_bound());
}

boolean PacketAccessRejectIDSub_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_id__type.is_value()
 && (single_value->field_req__ref.is_omit() || single_value->field_req__ref.is_value())
 && (single_value->field_gtfi.is_omit() || single_value->field_gtfi.is_value());
}

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

PacketAccessRejectIDSub PacketAccessRejectIDSub_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.PacketAccessRejectIDSub.");
PacketAccessRejectIDSub ret_val;
if (single_value->field_id__type.is_bound()) {
ret_val.id__type() = single_value->field_id__type.valueof();
}
if (single_value->field_req__ref.is_omit()) ret_val.req__ref() = OMIT_VALUE;
else if (single_value->field_req__ref.is_bound()) {
ret_val.req__ref() = single_value->field_req__ref.valueof();
}
if (single_value->field_gtfi.is_omit()) ret_val.gtfi() = OMIT_VALUE;
else if (single_value->field_gtfi.is_bound()) {
ret_val.gtfi() = single_value->field_gtfi.valueof();
}
return ret_val;
}

void PacketAccessRejectIDSub_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.PacketAccessRejectIDSub.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PacketAccessRejectIDSub_template[list_length];
}

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

BITSTRING_template& PacketAccessRejectIDSub_template::id__type()
{
set_specific();
return single_value->field_id__type;
}

const BITSTRING_template& PacketAccessRejectIDSub_template::id__type() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field id_type of a non-specific template of type @RLCMAC_CSN1_Types.PacketAccessRejectIDSub.");
return single_value->field_id__type;
}

PacketRequestReference_template& PacketAccessRejectIDSub_template::req__ref()
{
set_specific();
return single_value->field_req__ref;
}

const PacketRequestReference_template& PacketAccessRejectIDSub_template::req__ref() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field req_ref of a non-specific template of type @RLCMAC_CSN1_Types.PacketAccessRejectIDSub.");
return single_value->field_req__ref;
}

GlobalTfi_template& PacketAccessRejectIDSub_template::gtfi()
{
set_specific();
return single_value->field_gtfi;
}

const GlobalTfi_template& PacketAccessRejectIDSub_template::gtfi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field gtfi of a non-specific template of type @RLCMAC_CSN1_Types.PacketAccessRejectIDSub.");
return single_value->field_gtfi;
}

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

void PacketAccessRejectIDSub_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ id_type := ");
single_value->field_id__type.log();
TTCN_Logger::log_event_str(", req_ref := ");
single_value->field_req__ref.log();
TTCN_Logger::log_event_str(", gtfi := ");
single_value->field_gtfi.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 PacketAccessRejectIDSub_template::log_match(const PacketAccessRejectIDSub& 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_id__type.match(match_value.id__type(), legacy)){
TTCN_Logger::log_logmatch_info(".id_type");
single_value->field_id__type.log_match(match_value.id__type(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.req__ref().ispresent()){
if(!single_value->field_req__ref.match(match_value.req__ref(), legacy)){
TTCN_Logger::log_logmatch_info(".req_ref");
single_value->field_req__ref.log_match(match_value.req__ref(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_req__ref.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".req_ref := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_req__ref.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.gtfi().ispresent()){
if(!single_value->field_gtfi.match(match_value.gtfi(), legacy)){
TTCN_Logger::log_logmatch_info(".gtfi");
single_value->field_gtfi.log_match(match_value.gtfi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_gtfi.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".gtfi := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_gtfi.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("{ id_type := ");
single_value->field_id__type.log_match(match_value.id__type(), legacy);
TTCN_Logger::log_event_str(", req_ref := ");
if (match_value.req__ref().ispresent()) {
single_value->field_req__ref.log_match(match_value.req__ref(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_req__ref.log();
if (single_value->field_req__ref.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", gtfi := ");
if (match_value.gtfi().ispresent()) {
single_value->field_gtfi.log_match(match_value.gtfi(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_gtfi.log();
if (single_value->field_gtfi.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 PacketAccessRejectIDSub_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (id__type().is_bound()) id__type().set_implicit_omit();
if (!req__ref().is_bound()) req__ref() = OMIT_VALUE;
else req__ref().set_implicit_omit();
if (!gtfi().is_bound()) gtfi() = OMIT_VALUE;
else gtfi().set_implicit_omit();
}

void PacketAccessRejectIDSub_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_id__type.encode_text(text_buf);
single_value->field_req__ref.encode_text(text_buf);
single_value->field_gtfi.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.PacketAccessRejectIDSub.");
}
}

void PacketAccessRejectIDSub_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_id__type.decode_text(text_buf);
single_value->field_req__ref.decode_text(text_buf);
single_value->field_gtfi.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 PacketAccessRejectIDSub_template[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.PacketAccessRejectIDSub.");
}
}

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

void PacketAccessRejectIDSub_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_id__type.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketAccessRejectIDSub");
single_value->field_req__ref.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketAccessRejectIDSub");
single_value->field_gtfi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketAccessRejectIDSub");
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.PacketAccessRejectIDSub");
}

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

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

PacketAccessRejectStruct::PacketAccessRejectStruct()
{
}

PacketAccessRejectStruct::PacketAccessRejectStruct(const BITSTRING& par_id__type,
    const PacketAccessRejectID& par_id,
    const BITSTRING& par_wait__ind__presence,
    const OPTIONAL< INTEGER >& par_wait__ind,
    const OPTIONAL< BITSTRING >& par_wait__ind__size)
  :   field_id__type(par_id__type),
  field_id(par_id),
  field_wait__ind__presence(par_wait__ind__presence),
  field_wait__ind(par_wait__ind),
  field_wait__ind__size(par_wait__ind__size)
{
}

PacketAccessRejectStruct::PacketAccessRejectStruct(const PacketAccessRejectStruct& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PacketAccessRejectStruct.");
if (other_value.id__type().is_bound()) field_id__type = other_value.id__type();
else field_id__type.clean_up();
if (other_value.id().is_bound()) field_id = other_value.id();
else field_id.clean_up();
if (other_value.wait__ind__presence().is_bound()) field_wait__ind__presence = other_value.wait__ind__presence();
else field_wait__ind__presence.clean_up();
if (other_value.wait__ind().is_bound()) field_wait__ind = other_value.wait__ind();
else field_wait__ind.clean_up();
if (other_value.wait__ind__size().is_bound()) field_wait__ind__size = other_value.wait__ind__size();
else field_wait__ind__size.clean_up();
}

void PacketAccessRejectStruct::clean_up()
{
field_id__type.clean_up();
field_id.clean_up();
field_wait__ind__presence.clean_up();
field_wait__ind.clean_up();
field_wait__ind__size.clean_up();
}

const TTCN_Typedescriptor_t* PacketAccessRejectStruct::get_descriptor() const { return &PacketAccessRejectStruct_descr_; }
PacketAccessRejectStruct& PacketAccessRejectStruct::operator=(const PacketAccessRejectStruct& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PacketAccessRejectStruct.");
  if (other_value.id__type().is_bound()) field_id__type = other_value.id__type();
  else field_id__type.clean_up();
  if (other_value.id().is_bound()) field_id = other_value.id();
  else field_id.clean_up();
  if (other_value.wait__ind__presence().is_bound()) field_wait__ind__presence = other_value.wait__ind__presence();
  else field_wait__ind__presence.clean_up();
  if (other_value.wait__ind().is_bound()) field_wait__ind = other_value.wait__ind();
  else field_wait__ind.clean_up();
  if (other_value.wait__ind__size().is_bound()) field_wait__ind__size = other_value.wait__ind__size();
  else field_wait__ind__size.clean_up();
}
return *this;
}

boolean PacketAccessRejectStruct::operator==(const PacketAccessRejectStruct& other_value) const
{
return field_id__type==other_value.field_id__type
  && field_id==other_value.field_id
  && field_wait__ind__presence==other_value.field_wait__ind__presence
  && field_wait__ind==other_value.field_wait__ind
  && field_wait__ind__size==other_value.field_wait__ind__size;
}

boolean PacketAccessRejectStruct::is_bound() const
{
return (field_id__type.is_bound())
  || (field_id.is_bound())
  || (field_wait__ind__presence.is_bound())
  || (OPTIONAL_OMIT == field_wait__ind.get_selection() || field_wait__ind.is_bound())
  || (OPTIONAL_OMIT == field_wait__ind__size.get_selection() || field_wait__ind__size.is_bound());
}
boolean PacketAccessRejectStruct::is_value() const
{
return field_id__type.is_value()
  && field_id.is_value()
  && field_wait__ind__presence.is_value()
  && (OPTIONAL_OMIT == field_wait__ind.get_selection() || field_wait__ind.is_value())
  && (OPTIONAL_OMIT == field_wait__ind__size.get_selection() || field_wait__ind__size.is_value());
}
int PacketAccessRejectStruct::size_of() const
{
  int ret_val = 3;
  if (field_wait__ind.ispresent()) ret_val++;
  if (field_wait__ind__size.ispresent()) ret_val++;
  return ret_val;
}

void PacketAccessRejectStruct::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ id_type := ");
field_id__type.log();
TTCN_Logger::log_event_str(", id := ");
field_id.log();
TTCN_Logger::log_event_str(", wait_ind_presence := ");
field_wait__ind__presence.log();
TTCN_Logger::log_event_str(", wait_ind := ");
field_wait__ind.log();
TTCN_Logger::log_event_str(", wait_ind_size := ");
field_wait__ind__size.log();
TTCN_Logger::log_event_str(" }");
}

void PacketAccessRejectStruct::set_implicit_omit()
{
if (id__type().is_bound()) id__type().set_implicit_omit();
if (id().is_bound()) id().set_implicit_omit();
if (wait__ind__presence().is_bound()) wait__ind__presence().set_implicit_omit();
if (!wait__ind().is_bound()) wait__ind() = OMIT_VALUE;
else wait__ind().set_implicit_omit();
if (!wait__ind__size().is_bound()) wait__ind__size() = OMIT_VALUE;
else wait__ind__size().set_implicit_omit();
}

void PacketAccessRejectStruct::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.PacketAccessRejectStruct 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) id__type().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) id().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) wait__ind__presence().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) wait__ind().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) wait__ind__size().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(), "id_type")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          id__type().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          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(), "wait_ind_presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          wait__ind__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(), "wait_ind")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          wait__ind().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "wait_ind_size")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          wait__ind__size().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.PacketAccessRejectStruct: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.PacketAccessRejectStruct");
  }
}

void PacketAccessRejectStruct::encode_text(Text_Buf& text_buf) const
{
field_id__type.encode_text(text_buf);
field_id.encode_text(text_buf);
field_wait__ind__presence.encode_text(text_buf);
field_wait__ind.encode_text(text_buf);
field_wait__ind__size.encode_text(text_buf);
}

void PacketAccessRejectStruct::decode_text(Text_Buf& text_buf)
{
field_id__type.decode_text(text_buf);
field_id.decode_text(text_buf);
field_wait__ind__presence.decode_text(text_buf);
field_wait__ind.decode_text(text_buf);
field_wait__ind__size.decode_text(text_buf);
}

void PacketAccessRejectStruct::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 PacketAccessRejectStruct::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 PacketAccessRejectStruct::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  int selected_field = -1;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, PacketAccessRejectStruct_id__type_descr_.raw->forceomit);
  decoded_field_length = field_id__type.RAW_decode(PacketAccessRejectStruct_id__type_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_id__type ==  bs_1) selected_field = 0;
  else if (field_id__type ==  bs_0) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_1_force_omit(1, force_omit, PacketAccessRejectStruct_id_descr_.raw->forceomit);
  decoded_field_length = field_id.RAW_decode(PacketAccessRejectStruct_id_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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, PacketAccessRejectStruct_wait__ind__presence_descr_.raw->forceomit);
  decoded_field_length = field_wait__ind__presence.RAW_decode(PacketAccessRejectStruct_wait__ind__presence_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_wait__ind__presence ==  bs_0){
  if (force_omit != NULL && (*force_omit)(3)) {
    field_wait__ind = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_3_force_omit(3, force_omit, PacketAccessRejectStruct_wait__ind_descr_.raw->forceomit);
  decoded_field_length = field_wait__ind().RAW_decode(PacketAccessRejectStruct_wait__ind_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 1) {
  field_wait__ind = 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_wait__ind=OMIT_VALUE;
  if (limit > 0 && field_wait__ind__presence ==  bs_0){
  if (force_omit != NULL && (*force_omit)(4)) {
    field_wait__ind__size = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_4_force_omit(4, force_omit, PacketAccessRejectStruct_wait__ind__size_descr_.raw->forceomit);
  decoded_field_length = field_wait__ind__size().RAW_decode(PacketAccessRejectStruct_wait__ind__size_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit);
  if (decoded_field_length < 1) {
  field_wait__ind__size = 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_wait__ind__size=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int PacketAccessRejectStruct::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, PacketAccessRejectStruct_id__type_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PacketAccessRejectStruct_id_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PacketAccessRejectStruct_wait__ind__presence_descr_.raw);
  if (field_wait__ind.ispresent()) {
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, PacketAccessRejectStruct_wait__ind_descr_.raw);
  }
  else myleaf.body.node.nodes[3] = NULL;
  if (field_wait__ind__size.ispresent()) {
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, PacketAccessRejectStruct_wait__ind__size_descr_.raw);
  }
  else myleaf.body.node.nodes[4] = NULL;
  encoded_length += field_id__type.RAW_encode(PacketAccessRejectStruct_id__type_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_id.RAW_encode(PacketAccessRejectStruct_id_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_wait__ind__presence.RAW_encode(PacketAccessRejectStruct_wait__ind__presence_descr_, *myleaf.body.node.nodes[2]);
  if (field_wait__ind.ispresent()) {
  encoded_length += field_wait__ind().RAW_encode(PacketAccessRejectStruct_wait__ind_descr_, *myleaf.body.node.nodes[3]);
  }
  if (field_wait__ind__size.ispresent()) {
  encoded_length += field_wait__ind__size().RAW_encode(PacketAccessRejectStruct_wait__ind__size_descr_, *myleaf.body.node.nodes[4]);
  }
  switch (field_id.get_selection()) {
  case PacketAccessRejectID::ALT_tlli:
  if (field_id__type !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_1.RAW_encode(PacketAccessRejectStruct_id__type_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case PacketAccessRejectID::ALT_id__sub:
  if (field_id__type !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     bs_0.RAW_encode(PacketAccessRejectStruct_id__type_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  default:;
  }
  if (field_wait__ind.ispresent() && (field_wait__ind__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[]={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(PacketAccessRejectStruct_wait__ind__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_wait__ind__size.ispresent() && (field_wait__ind__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[]={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(PacketAccessRejectStruct_wait__ind__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 PacketAccessRejectStruct_template::single_value_struct {
BITSTRING_template field_id__type;
PacketAccessRejectID_template field_id;
BITSTRING_template field_wait__ind__presence;
INTEGER_template field_wait__ind;
BITSTRING_template field_wait__ind__size;
};

void PacketAccessRejectStruct_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_id__type = ANY_VALUE;
single_value->field_id = ANY_VALUE;
single_value->field_wait__ind__presence = ANY_VALUE;
single_value->field_wait__ind = ANY_OR_OMIT;
single_value->field_wait__ind__size = ANY_OR_OMIT;
}
}
}

void PacketAccessRejectStruct_template::copy_value(const PacketAccessRejectStruct& other_value)
{
single_value = new single_value_struct;
if (other_value.id__type().is_bound()) {
  single_value->field_id__type = other_value.id__type();
} else {
  single_value->field_id__type.clean_up();
}
if (other_value.id().is_bound()) {
  single_value->field_id = other_value.id();
} else {
  single_value->field_id.clean_up();
}
if (other_value.wait__ind__presence().is_bound()) {
  single_value->field_wait__ind__presence = other_value.wait__ind__presence();
} else {
  single_value->field_wait__ind__presence.clean_up();
}
if (other_value.wait__ind().is_bound()) {
  if (other_value.wait__ind().ispresent()) single_value->field_wait__ind = other_value.wait__ind()();
  else single_value->field_wait__ind = OMIT_VALUE;
} else {
  single_value->field_wait__ind.clean_up();
}
if (other_value.wait__ind__size().is_bound()) {
  if (other_value.wait__ind__size().ispresent()) single_value->field_wait__ind__size = other_value.wait__ind__size()();
  else single_value->field_wait__ind__size = OMIT_VALUE;
} else {
  single_value->field_wait__ind__size.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PacketAccessRejectStruct_template::copy_template(const PacketAccessRejectStruct_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.id__type().get_selection()) {
single_value->field_id__type = other_value.id__type();
} else {
single_value->field_id__type.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.id().get_selection()) {
single_value->field_id = other_value.id();
} else {
single_value->field_id.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.wait__ind__presence().get_selection()) {
single_value->field_wait__ind__presence = other_value.wait__ind__presence();
} else {
single_value->field_wait__ind__presence.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.wait__ind().get_selection()) {
single_value->field_wait__ind = other_value.wait__ind();
} else {
single_value->field_wait__ind.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.wait__ind__size().get_selection()) {
single_value->field_wait__ind__size = other_value.wait__ind__size();
} else {
single_value->field_wait__ind__size.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 PacketAccessRejectStruct_template[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 PacketAccessRejectStruct_template(*other_value.implication_.precondition);
implication_.implied_template = new PacketAccessRejectStruct_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.PacketAccessRejectStruct.");
break;
}
set_selection(other_value);
}

PacketAccessRejectStruct_template::PacketAccessRejectStruct_template()
{
}

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

PacketAccessRejectStruct_template::PacketAccessRejectStruct_template(const PacketAccessRejectStruct& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PacketAccessRejectStruct_template::match(const PacketAccessRejectStruct& 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.id__type().is_bound()) return FALSE;
if(!single_value->field_id__type.match(other_value.id__type(), legacy))return FALSE;
if(!other_value.id().is_bound()) return FALSE;
if(!single_value->field_id.match(other_value.id(), legacy))return FALSE;
if(!other_value.wait__ind__presence().is_bound()) return FALSE;
if(!single_value->field_wait__ind__presence.match(other_value.wait__ind__presence(), legacy))return FALSE;
if(!other_value.wait__ind().is_bound()) return FALSE;
if((other_value.wait__ind().ispresent() ? !single_value->field_wait__ind.match((const INTEGER&)other_value.wait__ind(), legacy) : !single_value->field_wait__ind.match_omit(legacy)))return FALSE;
if(!other_value.wait__ind__size().is_bound()) return FALSE;
if((other_value.wait__ind__size().ispresent() ? !single_value->field_wait__ind__size.match((const BITSTRING&)other_value.wait__ind__size(), legacy) : !single_value->field_wait__ind__size.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.PacketAccessRejectStruct.");
}
return FALSE;
}

boolean PacketAccessRejectStruct_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_id__type.is_bound()
 || single_value->field_id.is_bound()
 || single_value->field_wait__ind__presence.is_bound()
 || (single_value->field_wait__ind.is_omit() || single_value->field_wait__ind.is_bound())
 || (single_value->field_wait__ind__size.is_omit() || single_value->field_wait__ind__size.is_bound());
}

boolean PacketAccessRejectStruct_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_id__type.is_value()
 && single_value->field_id.is_value()
 && single_value->field_wait__ind__presence.is_value()
 && (single_value->field_wait__ind.is_omit() || single_value->field_wait__ind.is_value())
 && (single_value->field_wait__ind__size.is_omit() || single_value->field_wait__ind__size.is_value());
}

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

PacketAccessRejectStruct PacketAccessRejectStruct_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.PacketAccessRejectStruct.");
PacketAccessRejectStruct ret_val;
if (single_value->field_id__type.is_bound()) {
ret_val.id__type() = single_value->field_id__type.valueof();
}
if (single_value->field_id.is_bound()) {
ret_val.id() = single_value->field_id.valueof();
}
if (single_value->field_wait__ind__presence.is_bound()) {
ret_val.wait__ind__presence() = single_value->field_wait__ind__presence.valueof();
}
if (single_value->field_wait__ind.is_omit()) ret_val.wait__ind() = OMIT_VALUE;
else if (single_value->field_wait__ind.is_bound()) {
ret_val.wait__ind() = single_value->field_wait__ind.valueof();
}
if (single_value->field_wait__ind__size.is_omit()) ret_val.wait__ind__size() = OMIT_VALUE;
else if (single_value->field_wait__ind__size.is_bound()) {
ret_val.wait__ind__size() = single_value->field_wait__ind__size.valueof();
}
return ret_val;
}

void PacketAccessRejectStruct_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.PacketAccessRejectStruct.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PacketAccessRejectStruct_template[list_length];
}

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

BITSTRING_template& PacketAccessRejectStruct_template::id__type()
{
set_specific();
return single_value->field_id__type;
}

const BITSTRING_template& PacketAccessRejectStruct_template::id__type() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field id_type of a non-specific template of type @RLCMAC_CSN1_Types.PacketAccessRejectStruct.");
return single_value->field_id__type;
}

PacketAccessRejectID_template& PacketAccessRejectStruct_template::id()
{
set_specific();
return single_value->field_id;
}

const PacketAccessRejectID_template& PacketAccessRejectStruct_template::id() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field id of a non-specific template of type @RLCMAC_CSN1_Types.PacketAccessRejectStruct.");
return single_value->field_id;
}

BITSTRING_template& PacketAccessRejectStruct_template::wait__ind__presence()
{
set_specific();
return single_value->field_wait__ind__presence;
}

const BITSTRING_template& PacketAccessRejectStruct_template::wait__ind__presence() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field wait_ind_presence of a non-specific template of type @RLCMAC_CSN1_Types.PacketAccessRejectStruct.");
return single_value->field_wait__ind__presence;
}

INTEGER_template& PacketAccessRejectStruct_template::wait__ind()
{
set_specific();
return single_value->field_wait__ind;
}

const INTEGER_template& PacketAccessRejectStruct_template::wait__ind() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field wait_ind of a non-specific template of type @RLCMAC_CSN1_Types.PacketAccessRejectStruct.");
return single_value->field_wait__ind;
}

BITSTRING_template& PacketAccessRejectStruct_template::wait__ind__size()
{
set_specific();
return single_value->field_wait__ind__size;
}

const BITSTRING_template& PacketAccessRejectStruct_template::wait__ind__size() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field wait_ind_size of a non-specific template of type @RLCMAC_CSN1_Types.PacketAccessRejectStruct.");
return single_value->field_wait__ind__size;
}

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

void PacketAccessRejectStruct_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ id_type := ");
single_value->field_id__type.log();
TTCN_Logger::log_event_str(", id := ");
single_value->field_id.log();
TTCN_Logger::log_event_str(", wait_ind_presence := ");
single_value->field_wait__ind__presence.log();
TTCN_Logger::log_event_str(", wait_ind := ");
single_value->field_wait__ind.log();
TTCN_Logger::log_event_str(", wait_ind_size := ");
single_value->field_wait__ind__size.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 PacketAccessRejectStruct_template::log_match(const PacketAccessRejectStruct& 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_id__type.match(match_value.id__type(), legacy)){
TTCN_Logger::log_logmatch_info(".id_type");
single_value->field_id__type.log_match(match_value.id__type(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_id.match(match_value.id(), legacy)){
TTCN_Logger::log_logmatch_info(".id");
single_value->field_id.log_match(match_value.id(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_wait__ind__presence.match(match_value.wait__ind__presence(), legacy)){
TTCN_Logger::log_logmatch_info(".wait_ind_presence");
single_value->field_wait__ind__presence.log_match(match_value.wait__ind__presence(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.wait__ind().ispresent()){
if(!single_value->field_wait__ind.match(match_value.wait__ind(), legacy)){
TTCN_Logger::log_logmatch_info(".wait_ind");
single_value->field_wait__ind.log_match(match_value.wait__ind(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_wait__ind.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".wait_ind := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_wait__ind.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.wait__ind__size().ispresent()){
if(!single_value->field_wait__ind__size.match(match_value.wait__ind__size(), legacy)){
TTCN_Logger::log_logmatch_info(".wait_ind_size");
single_value->field_wait__ind__size.log_match(match_value.wait__ind__size(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_wait__ind__size.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".wait_ind_size := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_wait__ind__size.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("{ id_type := ");
single_value->field_id__type.log_match(match_value.id__type(), legacy);
TTCN_Logger::log_event_str(", id := ");
single_value->field_id.log_match(match_value.id(), legacy);
TTCN_Logger::log_event_str(", wait_ind_presence := ");
single_value->field_wait__ind__presence.log_match(match_value.wait__ind__presence(), legacy);
TTCN_Logger::log_event_str(", wait_ind := ");
if (match_value.wait__ind().ispresent()) {
single_value->field_wait__ind.log_match(match_value.wait__ind(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_wait__ind.log();
if (single_value->field_wait__ind.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", wait_ind_size := ");
if (match_value.wait__ind__size().ispresent()) {
single_value->field_wait__ind__size.log_match(match_value.wait__ind__size(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_wait__ind__size.log();
if (single_value->field_wait__ind__size.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 PacketAccessRejectStruct_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (id__type().is_bound()) id__type().set_implicit_omit();
if (id().is_bound()) id().set_implicit_omit();
if (wait__ind__presence().is_bound()) wait__ind__presence().set_implicit_omit();
if (!wait__ind().is_bound()) wait__ind() = OMIT_VALUE;
else wait__ind().set_implicit_omit();
if (!wait__ind__size().is_bound()) wait__ind__size() = OMIT_VALUE;
else wait__ind__size().set_implicit_omit();
}

void PacketAccessRejectStruct_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_id__type.encode_text(text_buf);
single_value->field_id.encode_text(text_buf);
single_value->field_wait__ind__presence.encode_text(text_buf);
single_value->field_wait__ind.encode_text(text_buf);
single_value->field_wait__ind__size.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.PacketAccessRejectStruct.");
}
}

void PacketAccessRejectStruct_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_id__type.decode_text(text_buf);
single_value->field_id.decode_text(text_buf);
single_value->field_wait__ind__presence.decode_text(text_buf);
single_value->field_wait__ind.decode_text(text_buf);
single_value->field_wait__ind__size.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 PacketAccessRejectStruct_template[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.PacketAccessRejectStruct.");
}
}

void PacketAccessRejectStruct_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: {
    PacketAccessRejectStruct_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.PacketAccessRejectStruct 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) id__type().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) id().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) wait__ind__presence().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) wait__ind().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) wait__ind__size().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(), "id_type")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          id__type().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          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(), "wait_ind_presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          wait__ind__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(), "wait_ind")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          wait__ind().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "wait_ind_size")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          wait__ind__size().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.PacketAccessRejectStruct: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PacketAccessRejectStruct_template* precondition = new PacketAccessRejectStruct_template;
    precondition->set_param(*param.get_elem(0));
    PacketAccessRejectStruct_template* implied_template = new PacketAccessRejectStruct_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PacketAccessRejectStruct_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.PacketAccessRejectStruct");
  }
  is_ifpresent = param.get_ifpresent();
}

void PacketAccessRejectStruct_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_id__type.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketAccessRejectStruct");
single_value->field_id.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketAccessRejectStruct");
single_value->field_wait__ind__presence.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketAccessRejectStruct");
single_value->field_wait__ind.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketAccessRejectStruct");
single_value->field_wait__ind__size.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketAccessRejectStruct");
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.PacketAccessRejectStruct");
}

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

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

PacketAccessReject::PacketAccessReject()
{
}

PacketAccessReject::PacketAccessReject(const PageMode& par_page__mode,
    const PacketAccessRejectStruct& par_reject__struct)
  :   field_page__mode(par_page__mode),
  field_reject__struct(par_reject__struct)
{
}

PacketAccessReject::PacketAccessReject(const PacketAccessReject& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PacketAccessReject.");
if (other_value.page__mode().is_bound()) field_page__mode = other_value.page__mode();
else field_page__mode.clean_up();
if (other_value.reject__struct().is_bound()) field_reject__struct = other_value.reject__struct();
else field_reject__struct.clean_up();
}

void PacketAccessReject::clean_up()
{
field_page__mode.clean_up();
field_reject__struct.clean_up();
}

const TTCN_Typedescriptor_t* PacketAccessReject::get_descriptor() const { return &PacketAccessReject_descr_; }
PacketAccessReject& PacketAccessReject::operator=(const PacketAccessReject& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PacketAccessReject.");
  if (other_value.page__mode().is_bound()) field_page__mode = other_value.page__mode();
  else field_page__mode.clean_up();
  if (other_value.reject__struct().is_bound()) field_reject__struct = other_value.reject__struct();
  else field_reject__struct.clean_up();
}
return *this;
}

boolean PacketAccessReject::operator==(const PacketAccessReject& other_value) const
{
return field_page__mode==other_value.field_page__mode
  && field_reject__struct==other_value.field_reject__struct;
}

boolean PacketAccessReject::is_bound() const
{
return (field_page__mode.is_bound())
  || (field_reject__struct.is_bound());
}
boolean PacketAccessReject::is_value() const
{
return field_page__mode.is_value()
  && field_reject__struct.is_value();
}
void PacketAccessReject::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(", reject_struct := ");
field_reject__struct.log();
TTCN_Logger::log_event_str(" }");
}

void PacketAccessReject::set_implicit_omit()
{
if (page__mode().is_bound()) page__mode().set_implicit_omit();
if (reject__struct().is_bound()) reject__struct().set_implicit_omit();
}

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

void PacketAccessReject::encode_text(Text_Buf& text_buf) const
{
field_page__mode.encode_text(text_buf);
field_reject__struct.encode_text(text_buf);
}

void PacketAccessReject::decode_text(Text_Buf& text_buf)
{
field_page__mode.decode_text(text_buf);
field_reject__struct.decode_text(text_buf);
}

void PacketAccessReject::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 PacketAccessReject::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 PacketAccessReject::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, PacketAccessReject_page__mode_descr_.raw->forceomit);
  decoded_field_length = field_page__mode.RAW_decode(PacketAccessReject_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, PacketAccessReject_reject__struct_descr_.raw->forceomit);
  decoded_field_length = field_reject__struct.RAW_decode(PacketAccessReject_reject__struct_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 PacketAccessReject::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, PacketAccessReject_page__mode_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PacketAccessReject_reject__struct_descr_.raw);
  encoded_length += field_page__mode.RAW_encode(PacketAccessReject_page__mode_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_reject__struct.RAW_encode(PacketAccessReject_reject__struct_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct PacketAccessReject_template::single_value_struct {
PageMode_template field_page__mode;
PacketAccessRejectStruct_template field_reject__struct;
};

void PacketAccessReject_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_reject__struct = ANY_VALUE;
}
}
}

void PacketAccessReject_template::copy_value(const PacketAccessReject& 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.reject__struct().is_bound()) {
  single_value->field_reject__struct = other_value.reject__struct();
} else {
  single_value->field_reject__struct.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PacketAccessReject_template::copy_template(const PacketAccessReject_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.reject__struct().get_selection()) {
single_value->field_reject__struct = other_value.reject__struct();
} else {
single_value->field_reject__struct.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 PacketAccessReject_template[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 PacketAccessReject_template(*other_value.implication_.precondition);
implication_.implied_template = new PacketAccessReject_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.PacketAccessReject.");
break;
}
set_selection(other_value);
}

PacketAccessReject_template::PacketAccessReject_template()
{
}

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

PacketAccessReject_template::PacketAccessReject_template(const PacketAccessReject& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PacketAccessReject_template::match(const PacketAccessReject& 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.reject__struct().is_bound()) return FALSE;
if(!single_value->field_reject__struct.match(other_value.reject__struct(), 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.PacketAccessReject.");
}
return FALSE;
}

boolean PacketAccessReject_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_reject__struct.is_bound();
}

boolean PacketAccessReject_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_page__mode.is_value()
 && single_value->field_reject__struct.is_value();
}

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

PacketAccessReject PacketAccessReject_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.PacketAccessReject.");
PacketAccessReject ret_val;
if (single_value->field_page__mode.is_bound()) {
ret_val.page__mode() = single_value->field_page__mode.valueof();
}
if (single_value->field_reject__struct.is_bound()) {
ret_val.reject__struct() = single_value->field_reject__struct.valueof();
}
return ret_val;
}

void PacketAccessReject_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.PacketAccessReject.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PacketAccessReject_template[list_length];
}

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

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

const PageMode_template& PacketAccessReject_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.PacketAccessReject.");
return single_value->field_page__mode;
}

PacketAccessRejectStruct_template& PacketAccessReject_template::reject__struct()
{
set_specific();
return single_value->field_reject__struct;
}

const PacketAccessRejectStruct_template& PacketAccessReject_template::reject__struct() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field reject_struct of a non-specific template of type @RLCMAC_CSN1_Types.PacketAccessReject.");
return single_value->field_reject__struct;
}

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

void PacketAccessReject_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(", reject_struct := ");
single_value->field_reject__struct.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 PacketAccessReject_template::log_match(const PacketAccessReject& 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_reject__struct.match(match_value.reject__struct(), legacy)){
TTCN_Logger::log_logmatch_info(".reject_struct");
single_value->field_reject__struct.log_match(match_value.reject__struct(), 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(", reject_struct := ");
single_value->field_reject__struct.log_match(match_value.reject__struct(), 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 PacketAccessReject_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (page__mode().is_bound()) page__mode().set_implicit_omit();
if (reject__struct().is_bound()) reject__struct().set_implicit_omit();
}

void PacketAccessReject_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_reject__struct.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.PacketAccessReject.");
}
}

void PacketAccessReject_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_reject__struct.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 PacketAccessReject_template[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.PacketAccessReject.");
}
}

void PacketAccessReject_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: {
    PacketAccessReject_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.PacketAccessReject 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) page__mode().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) reject__struct().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(), "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(), "reject_struct")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          reject__struct().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.PacketAccessReject: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PacketAccessReject_template* precondition = new PacketAccessReject_template;
    precondition->set_param(*param.get_elem(0));
    PacketAccessReject_template* implied_template = new PacketAccessReject_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PacketAccessReject_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.PacketAccessReject");
  }
  is_ifpresent = param.get_ifpresent();
}

void PacketAccessReject_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.PacketAccessReject");
single_value->field_reject__struct.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketAccessReject");
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.PacketAccessReject");
}

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

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

RlcmacDlCtrlMsg::RlcmacDlCtrlMsg()
{
}

RlcmacDlCtrlMsg::RlcmacDlCtrlMsg(const RlcmacDlCtrlMsgType& par_msg__type,
    const RlcmacDlCtrlUnion& par_u)
  :   field_msg__type(par_msg__type),
  field_u(par_u)
{
}

RlcmacDlCtrlMsg::RlcmacDlCtrlMsg(const RlcmacDlCtrlMsg& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.RlcmacDlCtrlMsg.");
if (other_value.msg__type().is_bound()) field_msg__type = other_value.msg__type();
else field_msg__type.clean_up();
if (other_value.u().is_bound()) field_u = other_value.u();
else field_u.clean_up();
}

void RlcmacDlCtrlMsg::clean_up()
{
field_msg__type.clean_up();
field_u.clean_up();
}

const TTCN_Typedescriptor_t* RlcmacDlCtrlMsg::get_descriptor() const { return &RlcmacDlCtrlMsg_descr_; }
RlcmacDlCtrlMsg& RlcmacDlCtrlMsg::operator=(const RlcmacDlCtrlMsg& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.RlcmacDlCtrlMsg.");
  if (other_value.msg__type().is_bound()) field_msg__type = other_value.msg__type();
  else field_msg__type.clean_up();
  if (other_value.u().is_bound()) field_u = other_value.u();
  else field_u.clean_up();
}
return *this;
}

boolean RlcmacDlCtrlMsg::operator==(const RlcmacDlCtrlMsg& other_value) const
{
return field_msg__type==other_value.field_msg__type
  && field_u==other_value.field_u;
}

boolean RlcmacDlCtrlMsg::is_bound() const
{
return (field_msg__type.is_bound())
  || (field_u.is_bound());
}
boolean RlcmacDlCtrlMsg::is_value() const
{
return field_msg__type.is_value()
  && field_u.is_value();
}
void RlcmacDlCtrlMsg::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ msg_type := ");
field_msg__type.log();
TTCN_Logger::log_event_str(", u := ");
field_u.log();
TTCN_Logger::log_event_str(" }");
}

void RlcmacDlCtrlMsg::set_implicit_omit()
{
if (msg__type().is_bound()) msg__type().set_implicit_omit();
if (u().is_bound()) u().set_implicit_omit();
}

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

void RlcmacDlCtrlMsg::encode_text(Text_Buf& text_buf) const
{
field_msg__type.encode_text(text_buf);
field_u.encode_text(text_buf);
}

void RlcmacDlCtrlMsg::decode_text(Text_Buf& text_buf)
{
field_msg__type.decode_text(text_buf);
field_u.decode_text(text_buf);
}

void RlcmacDlCtrlMsg::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 RlcmacDlCtrlMsg::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 RlcmacDlCtrlMsg::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  int selected_field = -1;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, RlcmacDlCtrlMsg_msg__type_descr_.raw->forceomit);
  decoded_field_length = field_msg__type.RAW_decode(RlcmacDlCtrlMsg_msg__type_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_msg__type == RlcmacDlCtrlMsgType::PACKET__ACCESS__REJECT) selected_field = 0;
  else if (field_msg__type == RlcmacDlCtrlMsgType::PACKET__DL__ASSIGNMENT) selected_field = 1;
  else if (field_msg__type == RlcmacDlCtrlMsgType::PACKET__MEASUREMENT__ORDER) selected_field = 2;
  else if (field_msg__type == RlcmacDlCtrlMsgType::PACKET__UL__ASSIGNMENT) selected_field = 3;
  else if (field_msg__type == RlcmacDlCtrlMsgType::PACKET__PAGING__REQUEST) selected_field = 4;
  else if (field_msg__type == RlcmacDlCtrlMsgType::PACKET__UL__ACK__NACK) selected_field = 5;
  else if (field_msg__type == RlcmacDlCtrlMsgType::PACKET__DL__DUMMY__CTRL) selected_field = 6;
  else if (field_msg__type == RlcmacDlCtrlMsgType::PACKET__PWR__CONTROL__TA) selected_field = 7;
  else if (field_msg__type == RlcmacDlCtrlMsgType::PACKET__CELL__CHANGE__CONTINUE) selected_field = 8;
  else if (field_msg__type == RlcmacDlCtrlMsgType::PACKET__NEIGHBOUR__CELL__DATA) selected_field = 9;
  else selected_field = 10;
  RAW_Force_Omit field_1_force_omit(1, force_omit, RlcmacDlCtrlMsg_u_descr_.raw->forceomit);
  decoded_field_length = field_u.RAW_decode(RlcmacDlCtrlMsg_u_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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 RlcmacDlCtrlMsg::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, RlcmacDlCtrlMsg_msg__type_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RlcmacDlCtrlMsg_u_descr_.raw);
  encoded_length += field_msg__type.RAW_encode(RlcmacDlCtrlMsg_msg__type_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_u.RAW_encode(RlcmacDlCtrlMsg_u_descr_, *myleaf.body.node.nodes[1]);
  switch (field_u.get_selection()) {
  case RlcmacDlCtrlUnion::ALT_access__reject:
  if (field_msg__type != RlcmacDlCtrlMsgType::PACKET__ACCESS__REJECT) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RlcmacDlCtrlMsgType new_val(RlcmacDlCtrlMsgType::PACKET__ACCESS__REJECT);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
    new_val.RAW_encode(RlcmacDlCtrlMsg_msg__type_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case RlcmacDlCtrlUnion::ALT_dl__assignment:
  if (field_msg__type != RlcmacDlCtrlMsgType::PACKET__DL__ASSIGNMENT) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RlcmacDlCtrlMsgType new_val(RlcmacDlCtrlMsgType::PACKET__DL__ASSIGNMENT);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
    new_val.RAW_encode(RlcmacDlCtrlMsg_msg__type_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case RlcmacDlCtrlUnion::ALT_meas__order:
  if (field_msg__type != RlcmacDlCtrlMsgType::PACKET__MEASUREMENT__ORDER) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RlcmacDlCtrlMsgType new_val(RlcmacDlCtrlMsgType::PACKET__MEASUREMENT__ORDER);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
    new_val.RAW_encode(RlcmacDlCtrlMsg_msg__type_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case RlcmacDlCtrlUnion::ALT_ul__assignment:
  if (field_msg__type != RlcmacDlCtrlMsgType::PACKET__UL__ASSIGNMENT) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RlcmacDlCtrlMsgType new_val(RlcmacDlCtrlMsgType::PACKET__UL__ASSIGNMENT);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
    new_val.RAW_encode(RlcmacDlCtrlMsg_msg__type_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case RlcmacDlCtrlUnion::ALT_paging:
  if (field_msg__type != RlcmacDlCtrlMsgType::PACKET__PAGING__REQUEST) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RlcmacDlCtrlMsgType new_val(RlcmacDlCtrlMsgType::PACKET__PAGING__REQUEST);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
    new_val.RAW_encode(RlcmacDlCtrlMsg_msg__type_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case RlcmacDlCtrlUnion::ALT_ul__ack__nack:
  if (field_msg__type != RlcmacDlCtrlMsgType::PACKET__UL__ACK__NACK) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RlcmacDlCtrlMsgType new_val(RlcmacDlCtrlMsgType::PACKET__UL__ACK__NACK);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
    new_val.RAW_encode(RlcmacDlCtrlMsg_msg__type_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case RlcmacDlCtrlUnion::ALT_dl__dummy:
  if (field_msg__type != RlcmacDlCtrlMsgType::PACKET__DL__DUMMY__CTRL) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RlcmacDlCtrlMsgType new_val(RlcmacDlCtrlMsgType::PACKET__DL__DUMMY__CTRL);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
    new_val.RAW_encode(RlcmacDlCtrlMsg_msg__type_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case RlcmacDlCtrlUnion::ALT_pwr__ta:
  if (field_msg__type != RlcmacDlCtrlMsgType::PACKET__PWR__CONTROL__TA) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RlcmacDlCtrlMsgType new_val(RlcmacDlCtrlMsgType::PACKET__PWR__CONTROL__TA);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
    new_val.RAW_encode(RlcmacDlCtrlMsg_msg__type_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case RlcmacDlCtrlUnion::ALT_cell__chg__continue:
  if (field_msg__type != RlcmacDlCtrlMsgType::PACKET__CELL__CHANGE__CONTINUE) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RlcmacDlCtrlMsgType new_val(RlcmacDlCtrlMsgType::PACKET__CELL__CHANGE__CONTINUE);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
    new_val.RAW_encode(RlcmacDlCtrlMsg_msg__type_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  case RlcmacDlCtrlUnion::ALT_neighbour__cell__data:
  if (field_msg__type != RlcmacDlCtrlMsgType::PACKET__NEIGHBOUR__CELL__DATA) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 0 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos);
  RlcmacDlCtrlMsgType new_val(RlcmacDlCtrlMsgType::PACKET__NEIGHBOUR__CELL__DATA);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
    new_val.RAW_encode(RlcmacDlCtrlMsg_msg__type_descr_,*temp_leaf);
  else
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  free_tree_pos(pr_pos.pos);
  }
  break;
  default:;
  }
  return myleaf.length = encoded_length;
}

struct RlcmacDlCtrlMsg_template::single_value_struct {
RlcmacDlCtrlMsgType_template field_msg__type;
RlcmacDlCtrlUnion_template field_u;
};

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

void RlcmacDlCtrlMsg_template::copy_value(const RlcmacDlCtrlMsg& other_value)
{
single_value = new single_value_struct;
if (other_value.msg__type().is_bound()) {
  single_value->field_msg__type = other_value.msg__type();
} else {
  single_value->field_msg__type.clean_up();
}
if (other_value.u().is_bound()) {
  single_value->field_u = other_value.u();
} else {
  single_value->field_u.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RlcmacDlCtrlMsg_template::copy_template(const RlcmacDlCtrlMsg_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.msg__type().get_selection()) {
single_value->field_msg__type = other_value.msg__type();
} else {
single_value->field_msg__type.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.u().get_selection()) {
single_value->field_u = other_value.u();
} else {
single_value->field_u.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 RlcmacDlCtrlMsg_template[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 RlcmacDlCtrlMsg_template(*other_value.implication_.precondition);
implication_.implied_template = new RlcmacDlCtrlMsg_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.RlcmacDlCtrlMsg.");
break;
}
set_selection(other_value);
}

RlcmacDlCtrlMsg_template::RlcmacDlCtrlMsg_template()
{
}

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

RlcmacDlCtrlMsg_template::RlcmacDlCtrlMsg_template(const RlcmacDlCtrlMsg& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean RlcmacDlCtrlMsg_template::match(const RlcmacDlCtrlMsg& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.msg__type().is_bound()) return FALSE;
if(!single_value->field_msg__type.match(other_value.msg__type(), legacy))return FALSE;
if(!other_value.u().is_bound()) return FALSE;
if(!single_value->field_u.match(other_value.u(), 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.RlcmacDlCtrlMsg.");
}
return FALSE;
}

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

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

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

RlcmacDlCtrlMsg RlcmacDlCtrlMsg_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.RlcmacDlCtrlMsg.");
RlcmacDlCtrlMsg ret_val;
if (single_value->field_msg__type.is_bound()) {
ret_val.msg__type() = single_value->field_msg__type.valueof();
}
if (single_value->field_u.is_bound()) {
ret_val.u() = single_value->field_u.valueof();
}
return ret_val;
}

void RlcmacDlCtrlMsg_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.RlcmacDlCtrlMsg.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RlcmacDlCtrlMsg_template[list_length];
}

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

RlcmacDlCtrlMsgType_template& RlcmacDlCtrlMsg_template::msg__type()
{
set_specific();
return single_value->field_msg__type;
}

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

RlcmacDlCtrlUnion_template& RlcmacDlCtrlMsg_template::u()
{
set_specific();
return single_value->field_u;
}

const RlcmacDlCtrlUnion_template& RlcmacDlCtrlMsg_template::u() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field u of a non-specific template of type @RLCMAC_CSN1_Types.RlcmacDlCtrlMsg.");
return single_value->field_u;
}

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

void RlcmacDlCtrlMsg_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ msg_type := ");
single_value->field_msg__type.log();
TTCN_Logger::log_event_str(", u := ");
single_value->field_u.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 RlcmacDlCtrlMsg_template::log_match(const RlcmacDlCtrlMsg& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_msg__type.match(match_value.msg__type(), legacy)){
TTCN_Logger::log_logmatch_info(".msg_type");
single_value->field_msg__type.log_match(match_value.msg__type(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_u.match(match_value.u(), legacy)){
TTCN_Logger::log_logmatch_info(".u");
single_value->field_u.log_match(match_value.u(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ msg_type := ");
single_value->field_msg__type.log_match(match_value.msg__type(), legacy);
TTCN_Logger::log_event_str(", u := ");
single_value->field_u.log_match(match_value.u(), 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 RlcmacDlCtrlMsg_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (msg__type().is_bound()) msg__type().set_implicit_omit();
if (u().is_bound()) u().set_implicit_omit();
}

void RlcmacDlCtrlMsg_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_msg__type.encode_text(text_buf);
single_value->field_u.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.RlcmacDlCtrlMsg.");
}
}

void RlcmacDlCtrlMsg_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_msg__type.decode_text(text_buf);
single_value->field_u.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 RlcmacDlCtrlMsg_template[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.RlcmacDlCtrlMsg.");
}
}

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

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

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

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

ILevel::ILevel()
{
}

ILevel::ILevel(const BITSTRING& par_presence,
    const OPTIONAL< INTEGER >& par_i__level)
  :   field_presence(par_presence),
  field_i__level(par_i__level)
{
}

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

void ILevel::clean_up()
{
field_presence.clean_up();
field_i__level.clean_up();
}

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

boolean ILevel::operator==(const ILevel& other_value) const
{
return field_presence==other_value.field_presence
  && field_i__level==other_value.field_i__level;
}

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

void ILevel::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(", i_level := ");
field_i__level.log();
TTCN_Logger::log_event_str(" }");
}

void ILevel::set_implicit_omit()
{
if (presence().is_bound()) presence().set_implicit_omit();
if (!i__level().is_bound()) i__level() = OMIT_VALUE;
else i__level().set_implicit_omit();
}

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

void ILevel::encode_text(Text_Buf& text_buf) const
{
field_presence.encode_text(text_buf);
field_i__level.encode_text(text_buf);
}

void ILevel::decode_text(Text_Buf& text_buf)
{
field_presence.decode_text(text_buf);
field_i__level.decode_text(text_buf);
}

void ILevel::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 ILevel::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 ILevel::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, ILevel_presence_descr_.raw->forceomit);
  decoded_field_length = field_presence.RAW_decode(ILevel_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_i__level = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_1_force_omit(1, force_omit, ILevel_i__level_descr_.raw->forceomit);
  decoded_field_length = field_i__level().RAW_decode(ILevel_i__level_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 1) {
  field_i__level = 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_i__level=OMIT_VALUE;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int ILevel::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, ILevel_presence_descr_.raw);
  if (field_i__level.ispresent()) {
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, ILevel_i__level_descr_.raw);
  }
  else myleaf.body.node.nodes[1] = NULL;
  encoded_length += field_presence.RAW_encode(ILevel_presence_descr_, *myleaf.body.node.nodes[0]);
  if (field_i__level.ispresent()) {
  encoded_length += field_i__level().RAW_encode(ILevel_i__level_descr_, *myleaf.body.node.nodes[1]);
  }
  if (field_i__level.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(ILevel_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 ILevel_template::single_value_struct {
BITSTRING_template field_presence;
INTEGER_template field_i__level;
};

void ILevel_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_i__level = ANY_OR_OMIT;
}
}
}

void ILevel_template::copy_value(const ILevel& 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.i__level().is_bound()) {
  if (other_value.i__level().ispresent()) single_value->field_i__level = other_value.i__level()();
  else single_value->field_i__level = OMIT_VALUE;
} else {
  single_value->field_i__level.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void ILevel_template::copy_template(const ILevel_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.i__level().get_selection()) {
single_value->field_i__level = other_value.i__level();
} else {
single_value->field_i__level.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new ILevel_template[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 ILevel_template(*other_value.implication_.precondition);
implication_.implied_template = new ILevel_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.ILevel.");
break;
}
set_selection(other_value);
}

ILevel_template::ILevel_template()
{
}

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

ILevel_template::ILevel_template(const ILevel& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean ILevel_template::match(const ILevel& 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.i__level().is_bound()) return FALSE;
if((other_value.i__level().ispresent() ? !single_value->field_i__level.match((const INTEGER&)other_value.i__level(), legacy) : !single_value->field_i__level.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.ILevel.");
}
return FALSE;
}

boolean ILevel_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_i__level.is_omit() || single_value->field_i__level.is_bound());
}

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

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

ILevel ILevel_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.ILevel.");
ILevel ret_val;
if (single_value->field_presence.is_bound()) {
ret_val.presence() = single_value->field_presence.valueof();
}
if (single_value->field_i__level.is_omit()) ret_val.i__level() = OMIT_VALUE;
else if (single_value->field_i__level.is_bound()) {
ret_val.i__level() = single_value->field_i__level.valueof();
}
return ret_val;
}

void ILevel_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.ILevel.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new ILevel_template[list_length];
}

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

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

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

INTEGER_template& ILevel_template::i__level()
{
set_specific();
return single_value->field_i__level;
}

const INTEGER_template& ILevel_template::i__level() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field i_level of a non-specific template of type @RLCMAC_CSN1_Types.ILevel.");
return single_value->field_i__level;
}

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

void ILevel_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(", i_level := ");
single_value->field_i__level.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void ILevel_template::log_match(const ILevel& 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.i__level().ispresent()){
if(!single_value->field_i__level.match(match_value.i__level(), legacy)){
TTCN_Logger::log_logmatch_info(".i_level");
single_value->field_i__level.log_match(match_value.i__level(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_i__level.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".i_level := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_i__level.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(", i_level := ");
if (match_value.i__level().ispresent()) {
single_value->field_i__level.log_match(match_value.i__level(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_i__level.log();
if (single_value->field_i__level.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 ILevel_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (presence().is_bound()) presence().set_implicit_omit();
if (!i__level().is_bound()) i__level() = OMIT_VALUE;
else i__level().set_implicit_omit();
}

void ILevel_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_i__level.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @RLCMAC_CSN1_Types.ILevel.");
}
}

void ILevel_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_i__level.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new ILevel_template[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.ILevel.");
}
}

void ILevel_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: {
    ILevel_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.ILevel 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) i__level().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(), "i_level")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          i__level().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @RLCMAC_CSN1_Types.ILevel: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    ILevel_template* precondition = new ILevel_template;
    precondition->set_param(*param.get_elem(0));
    ILevel_template* implied_template = new ILevel_template;
    implied_template->set_param(*param.get_elem(1));
    *this = ILevel_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.ILevel");
  }
  is_ifpresent = param.get_ifpresent();
}

void ILevel_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.ILevel");
single_value->field_i__level.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.ILevel");
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.ILevel");
}

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

boolean ILevel_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 ILevel ILevels::UNBOUND_ELEM;
ILevels::ILevels()
{
val_ptr = NULL;
}

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

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

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

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

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

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

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

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

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

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

const ILevel& ILevels::operator[](int index_value) const
{
if (val_ptr == NULL)
TTCN_error("Accessing an element in an unbound value of type @RLCMAC_CSN1_Types.ILevels.");
if (index_value < 0) TTCN_error("Accessing an element of type @RLCMAC_CSN1_Types.ILevels 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.ILevels: 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 ILevel& ILevels::operator[](const INTEGER& index_value) const
{
index_value.must_bound("Using an unbound integer value for indexing a value of type @RLCMAC_CSN1_Types.ILevels.");
return (*this)[(int)index_value];
}

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

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

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

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

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

ILevels ILevels::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.ILevels.");
check_substr_arguments(val_ptr->n_elements, index, returncount, "@RLCMAC_CSN1_Types.ILevels","element");
ILevels 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 ILevel(*val_ptr->value_elements[i+index]);
}
}
return ret_val;
}

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

ILevels ILevels::replace(int index, int len, const ILevels_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 ILevels::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.ILevels.");
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 = (ILevel**)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 ILevel(*(val_ptr->value_elements[elem_count]));
}
}
clean_up();
val_ptr = new_val_ptr;
}
if (new_size > val_ptr->n_elements) {
val_ptr->value_elements = (ILevel**)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.ILevels: %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 = (ILevel**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size);
val_ptr->n_elements = new_size;
}
}

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

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

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

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

void ILevels_template::copy_template(const ILevels_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 = (ILevel_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 ILevel_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new ILevel_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 ILevels_template[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 ILevels_template(*other_value.implication_.precondition);
implication_.implied_template = new ILevels_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.ILevels.");
break;
}
set_selection(other_value);
}

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

ILevels_template::ILevels_template()
{
}

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

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

ILevels_template::ILevels_template(const ILevels& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

const ILevel_template& ILevels_template::operator[](int index_value) const
{
if (index_value < 0) TTCN_error("Accessing an element of a template for type @RLCMAC_CSN1_Types.ILevels 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.ILevels.");
if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @RLCMAC_CSN1_Types.ILevels: 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 ILevel_template& ILevels_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.ILevels.");
return (*this)[(int)index_value];
}

void ILevels_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.ILevels.");
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 = (ILevel_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 ILevel_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 ILevel_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 = (ILevel_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size);
single_value.n_elements = new_size;
}
}

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

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

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

ILevels ILevels_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.ILevels.");
ILevels 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;
}

ILevels ILevels_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);
}

ILevels ILevels_template::replace(int index, int len, const ILevels_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());
}

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

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

void ILevels_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 ILevels_template::log_match(const ILevels& 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 ILevels_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.ILevels.");
}
}

void ILevels_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.ILevels.");
single_value.value_elements = (ILevel_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 ILevel_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 ILevels_template[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.ILevels.");
}
}

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

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

void ILevels_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.ILevels");
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.ILevels");
}

boolean ILevels_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);
}
}
ChannelQualityReport::ChannelQualityReport()
{
}

ChannelQualityReport::ChannelQualityReport(const INTEGER& par_c__value,
    const INTEGER& par_rxqual,
    const INTEGER& par_sign__var,
    const ILevels& par_i__levels)
  :   field_c__value(par_c__value),
  field_rxqual(par_rxqual),
  field_sign__var(par_sign__var),
  field_i__levels(par_i__levels)
{
}

ChannelQualityReport::ChannelQualityReport(const ChannelQualityReport& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.ChannelQualityReport.");
if (other_value.c__value().is_bound()) field_c__value = other_value.c__value();
else field_c__value.clean_up();
if (other_value.rxqual().is_bound()) field_rxqual = other_value.rxqual();
else field_rxqual.clean_up();
if (other_value.sign__var().is_bound()) field_sign__var = other_value.sign__var();
else field_sign__var.clean_up();
if (other_value.i__levels().is_bound()) field_i__levels = other_value.i__levels();
else field_i__levels.clean_up();
}

void ChannelQualityReport::clean_up()
{
field_c__value.clean_up();
field_rxqual.clean_up();
field_sign__var.clean_up();
field_i__levels.clean_up();
}

const TTCN_Typedescriptor_t* ChannelQualityReport::get_descriptor() const { return &ChannelQualityReport_descr_; }
ChannelQualityReport& ChannelQualityReport::operator=(const ChannelQualityReport& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.ChannelQualityReport.");
  if (other_value.c__value().is_bound()) field_c__value = other_value.c__value();
  else field_c__value.clean_up();
  if (other_value.rxqual().is_bound()) field_rxqual = other_value.rxqual();
  else field_rxqual.clean_up();
  if (other_value.sign__var().is_bound()) field_sign__var = other_value.sign__var();
  else field_sign__var.clean_up();
  if (other_value.i__levels().is_bound()) field_i__levels = other_value.i__levels();
  else field_i__levels.clean_up();
}
return *this;
}

boolean ChannelQualityReport::operator==(const ChannelQualityReport& other_value) const
{
return field_c__value==other_value.field_c__value
  && field_rxqual==other_value.field_rxqual
  && field_sign__var==other_value.field_sign__var
  && field_i__levels==other_value.field_i__levels;
}

boolean ChannelQualityReport::is_bound() const
{
return (field_c__value.is_bound())
  || (field_rxqual.is_bound())
  || (field_sign__var.is_bound())
  || (field_i__levels.is_bound());
}
boolean ChannelQualityReport::is_value() const
{
return field_c__value.is_value()
  && field_rxqual.is_value()
  && field_sign__var.is_value()
  && field_i__levels.is_value();
}
void ChannelQualityReport::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ c_value := ");
field_c__value.log();
TTCN_Logger::log_event_str(", rxqual := ");
field_rxqual.log();
TTCN_Logger::log_event_str(", sign_var := ");
field_sign__var.log();
TTCN_Logger::log_event_str(", i_levels := ");
field_i__levels.log();
TTCN_Logger::log_event_str(" }");
}

void ChannelQualityReport::set_implicit_omit()
{
if (c__value().is_bound()) c__value().set_implicit_omit();
if (rxqual().is_bound()) rxqual().set_implicit_omit();
if (sign__var().is_bound()) sign__var().set_implicit_omit();
if (i__levels().is_bound()) i__levels().set_implicit_omit();
}

void ChannelQualityReport::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.ChannelQualityReport 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) c__value().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) rxqual().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) sign__var().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) i__levels().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(), "c_value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          c__value().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rxqual")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rxqual().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "sign_var")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sign__var().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "i_levels")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          i__levels().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.ChannelQualityReport: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.ChannelQualityReport");
  }
}

void ChannelQualityReport::encode_text(Text_Buf& text_buf) const
{
field_c__value.encode_text(text_buf);
field_rxqual.encode_text(text_buf);
field_sign__var.encode_text(text_buf);
field_i__levels.encode_text(text_buf);
}

void ChannelQualityReport::decode_text(Text_Buf& text_buf)
{
field_c__value.decode_text(text_buf);
field_rxqual.decode_text(text_buf);
field_sign__var.decode_text(text_buf);
field_i__levels.decode_text(text_buf);
}

void ChannelQualityReport::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 ChannelQualityReport::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 ChannelQualityReport::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, ChannelQualityReport_c__value_descr_.raw->forceomit);
  decoded_field_length = field_c__value.RAW_decode(ChannelQualityReport_c__value_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, ChannelQualityReport_rxqual_descr_.raw->forceomit);
  decoded_field_length = field_rxqual.RAW_decode(ChannelQualityReport_rxqual_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, ChannelQualityReport_sign__var_descr_.raw->forceomit);
  decoded_field_length = field_sign__var.RAW_decode(ChannelQualityReport_sign__var_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, ChannelQualityReport_i__levels_descr_.raw->forceomit);
  decoded_field_length = field_i__levels.RAW_decode(ChannelQualityReport_i__levels_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int ChannelQualityReport::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, ChannelQualityReport_c__value_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, ChannelQualityReport_rxqual_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, ChannelQualityReport_sign__var_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, ChannelQualityReport_i__levels_descr_.raw);
  encoded_length += field_c__value.RAW_encode(ChannelQualityReport_c__value_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_rxqual.RAW_encode(ChannelQualityReport_rxqual_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_sign__var.RAW_encode(ChannelQualityReport_sign__var_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_i__levels.RAW_encode(ChannelQualityReport_i__levels_descr_, *myleaf.body.node.nodes[3]);
  return myleaf.length = encoded_length;
}

struct ChannelQualityReport_template::single_value_struct {
INTEGER_template field_c__value;
INTEGER_template field_rxqual;
INTEGER_template field_sign__var;
ILevels_template field_i__levels;
};

void ChannelQualityReport_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_c__value = ANY_VALUE;
single_value->field_rxqual = ANY_VALUE;
single_value->field_sign__var = ANY_VALUE;
single_value->field_i__levels = ANY_VALUE;
}
}
}

void ChannelQualityReport_template::copy_value(const ChannelQualityReport& other_value)
{
single_value = new single_value_struct;
if (other_value.c__value().is_bound()) {
  single_value->field_c__value = other_value.c__value();
} else {
  single_value->field_c__value.clean_up();
}
if (other_value.rxqual().is_bound()) {
  single_value->field_rxqual = other_value.rxqual();
} else {
  single_value->field_rxqual.clean_up();
}
if (other_value.sign__var().is_bound()) {
  single_value->field_sign__var = other_value.sign__var();
} else {
  single_value->field_sign__var.clean_up();
}
if (other_value.i__levels().is_bound()) {
  single_value->field_i__levels = other_value.i__levels();
} else {
  single_value->field_i__levels.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void ChannelQualityReport_template::copy_template(const ChannelQualityReport_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.c__value().get_selection()) {
single_value->field_c__value = other_value.c__value();
} else {
single_value->field_c__value.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rxqual().get_selection()) {
single_value->field_rxqual = other_value.rxqual();
} else {
single_value->field_rxqual.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.sign__var().get_selection()) {
single_value->field_sign__var = other_value.sign__var();
} else {
single_value->field_sign__var.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.i__levels().get_selection()) {
single_value->field_i__levels = other_value.i__levels();
} else {
single_value->field_i__levels.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 ChannelQualityReport_template[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 ChannelQualityReport_template(*other_value.implication_.precondition);
implication_.implied_template = new ChannelQualityReport_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.ChannelQualityReport.");
break;
}
set_selection(other_value);
}

ChannelQualityReport_template::ChannelQualityReport_template()
{
}

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

ChannelQualityReport_template::ChannelQualityReport_template(const ChannelQualityReport& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean ChannelQualityReport_template::match(const ChannelQualityReport& 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.c__value().is_bound()) return FALSE;
if(!single_value->field_c__value.match(other_value.c__value(), legacy))return FALSE;
if(!other_value.rxqual().is_bound()) return FALSE;
if(!single_value->field_rxqual.match(other_value.rxqual(), legacy))return FALSE;
if(!other_value.sign__var().is_bound()) return FALSE;
if(!single_value->field_sign__var.match(other_value.sign__var(), legacy))return FALSE;
if(!other_value.i__levels().is_bound()) return FALSE;
if(!single_value->field_i__levels.match(other_value.i__levels(), 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.ChannelQualityReport.");
}
return FALSE;
}

boolean ChannelQualityReport_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_c__value.is_bound()
 || single_value->field_rxqual.is_bound()
 || single_value->field_sign__var.is_bound()
 || single_value->field_i__levels.is_bound();
}

boolean ChannelQualityReport_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_c__value.is_value()
 && single_value->field_rxqual.is_value()
 && single_value->field_sign__var.is_value()
 && single_value->field_i__levels.is_value();
}

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

ChannelQualityReport ChannelQualityReport_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.ChannelQualityReport.");
ChannelQualityReport ret_val;
if (single_value->field_c__value.is_bound()) {
ret_val.c__value() = single_value->field_c__value.valueof();
}
if (single_value->field_rxqual.is_bound()) {
ret_val.rxqual() = single_value->field_rxqual.valueof();
}
if (single_value->field_sign__var.is_bound()) {
ret_val.sign__var() = single_value->field_sign__var.valueof();
}
if (single_value->field_i__levels.is_bound()) {
ret_val.i__levels() = single_value->field_i__levels.valueof();
}
return ret_val;
}

void ChannelQualityReport_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.ChannelQualityReport.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new ChannelQualityReport_template[list_length];
}

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

INTEGER_template& ChannelQualityReport_template::c__value()
{
set_specific();
return single_value->field_c__value;
}

const INTEGER_template& ChannelQualityReport_template::c__value() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field c_value of a non-specific template of type @RLCMAC_CSN1_Types.ChannelQualityReport.");
return single_value->field_c__value;
}

INTEGER_template& ChannelQualityReport_template::rxqual()
{
set_specific();
return single_value->field_rxqual;
}

const INTEGER_template& ChannelQualityReport_template::rxqual() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rxqual of a non-specific template of type @RLCMAC_CSN1_Types.ChannelQualityReport.");
return single_value->field_rxqual;
}

INTEGER_template& ChannelQualityReport_template::sign__var()
{
set_specific();
return single_value->field_sign__var;
}

const INTEGER_template& ChannelQualityReport_template::sign__var() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field sign_var of a non-specific template of type @RLCMAC_CSN1_Types.ChannelQualityReport.");
return single_value->field_sign__var;
}

ILevels_template& ChannelQualityReport_template::i__levels()
{
set_specific();
return single_value->field_i__levels;
}

const ILevels_template& ChannelQualityReport_template::i__levels() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field i_levels of a non-specific template of type @RLCMAC_CSN1_Types.ChannelQualityReport.");
return single_value->field_i__levels;
}

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

void ChannelQualityReport_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ c_value := ");
single_value->field_c__value.log();
TTCN_Logger::log_event_str(", rxqual := ");
single_value->field_rxqual.log();
TTCN_Logger::log_event_str(", sign_var := ");
single_value->field_sign__var.log();
TTCN_Logger::log_event_str(", i_levels := ");
single_value->field_i__levels.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 ChannelQualityReport_template::log_match(const ChannelQualityReport& 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_c__value.match(match_value.c__value(), legacy)){
TTCN_Logger::log_logmatch_info(".c_value");
single_value->field_c__value.log_match(match_value.c__value(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rxqual.match(match_value.rxqual(), legacy)){
TTCN_Logger::log_logmatch_info(".rxqual");
single_value->field_rxqual.log_match(match_value.rxqual(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_sign__var.match(match_value.sign__var(), legacy)){
TTCN_Logger::log_logmatch_info(".sign_var");
single_value->field_sign__var.log_match(match_value.sign__var(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_i__levels.match(match_value.i__levels(), legacy)){
TTCN_Logger::log_logmatch_info(".i_levels");
single_value->field_i__levels.log_match(match_value.i__levels(), 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("{ c_value := ");
single_value->field_c__value.log_match(match_value.c__value(), legacy);
TTCN_Logger::log_event_str(", rxqual := ");
single_value->field_rxqual.log_match(match_value.rxqual(), legacy);
TTCN_Logger::log_event_str(", sign_var := ");
single_value->field_sign__var.log_match(match_value.sign__var(), legacy);
TTCN_Logger::log_event_str(", i_levels := ");
single_value->field_i__levels.log_match(match_value.i__levels(), 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 ChannelQualityReport_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (c__value().is_bound()) c__value().set_implicit_omit();
if (rxqual().is_bound()) rxqual().set_implicit_omit();
if (sign__var().is_bound()) sign__var().set_implicit_omit();
if (i__levels().is_bound()) i__levels().set_implicit_omit();
}

void ChannelQualityReport_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_c__value.encode_text(text_buf);
single_value->field_rxqual.encode_text(text_buf);
single_value->field_sign__var.encode_text(text_buf);
single_value->field_i__levels.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.ChannelQualityReport.");
}
}

void ChannelQualityReport_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_c__value.decode_text(text_buf);
single_value->field_rxqual.decode_text(text_buf);
single_value->field_sign__var.decode_text(text_buf);
single_value->field_i__levels.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 ChannelQualityReport_template[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.ChannelQualityReport.");
}
}

void ChannelQualityReport_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: {
    ChannelQualityReport_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.ChannelQualityReport 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) c__value().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) rxqual().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) sign__var().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) i__levels().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(), "c_value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          c__value().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rxqual")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rxqual().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "sign_var")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sign__var().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "i_levels")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          i__levels().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.ChannelQualityReport: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    ChannelQualityReport_template* precondition = new ChannelQualityReport_template;
    precondition->set_param(*param.get_elem(0));
    ChannelQualityReport_template* implied_template = new ChannelQualityReport_template;
    implied_template->set_param(*param.get_elem(1));
    *this = ChannelQualityReport_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.ChannelQualityReport");
  }
  is_ifpresent = param.get_ifpresent();
}

void ChannelQualityReport_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_c__value.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.ChannelQualityReport");
single_value->field_rxqual.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.ChannelQualityReport");
single_value->field_sign__var.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.ChannelQualityReport");
single_value->field_i__levels.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.ChannelQualityReport");
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.ChannelQualityReport");
}

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

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

PacketDlAckNack::PacketDlAckNack()
{
}

PacketDlAckNack::PacketDlAckNack(const INTEGER& par_dl__tfi,
    const AckNackDescription& par_ack__nack__desc,
    const BITSTRING& par_chreq__desc__presence,
    const OPTIONAL< ChannelReqDescription >& par_chreq__desc,
    const ChannelQualityReport& par_ch__qual__rep)
  :   field_dl__tfi(par_dl__tfi),
  field_ack__nack__desc(par_ack__nack__desc),
  field_chreq__desc__presence(par_chreq__desc__presence),
  field_chreq__desc(par_chreq__desc),
  field_ch__qual__rep(par_ch__qual__rep)
{
}

PacketDlAckNack::PacketDlAckNack(const PacketDlAckNack& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @RLCMAC_CSN1_Types.PacketDlAckNack.");
if (other_value.dl__tfi().is_bound()) field_dl__tfi = other_value.dl__tfi();
else field_dl__tfi.clean_up();
if (other_value.ack__nack__desc().is_bound()) field_ack__nack__desc = other_value.ack__nack__desc();
else field_ack__nack__desc.clean_up();
if (other_value.chreq__desc__presence().is_bound()) field_chreq__desc__presence = other_value.chreq__desc__presence();
else field_chreq__desc__presence.clean_up();
if (other_value.chreq__desc().is_bound()) field_chreq__desc = other_value.chreq__desc();
else field_chreq__desc.clean_up();
if (other_value.ch__qual__rep().is_bound()) field_ch__qual__rep = other_value.ch__qual__rep();
else field_ch__qual__rep.clean_up();
}

void PacketDlAckNack::clean_up()
{
field_dl__tfi.clean_up();
field_ack__nack__desc.clean_up();
field_chreq__desc__presence.clean_up();
field_chreq__desc.clean_up();
field_ch__qual__rep.clean_up();
}

const TTCN_Typedescriptor_t* PacketDlAckNack::get_descriptor() const { return &PacketDlAckNack_descr_; }
PacketDlAckNack& PacketDlAckNack::operator=(const PacketDlAckNack& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @RLCMAC_CSN1_Types.PacketDlAckNack.");
  if (other_value.dl__tfi().is_bound()) field_dl__tfi = other_value.dl__tfi();
  else field_dl__tfi.clean_up();
  if (other_value.ack__nack__desc().is_bound()) field_ack__nack__desc = other_value.ack__nack__desc();
  else field_ack__nack__desc.clean_up();
  if (other_value.chreq__desc__presence().is_bound()) field_chreq__desc__presence = other_value.chreq__desc__presence();
  else field_chreq__desc__presence.clean_up();
  if (other_value.chreq__desc().is_bound()) field_chreq__desc = other_value.chreq__desc();
  else field_chreq__desc.clean_up();
  if (other_value.ch__qual__rep().is_bound()) field_ch__qual__rep = other_value.ch__qual__rep();
  else field_ch__qual__rep.clean_up();
}
return *this;
}

boolean PacketDlAckNack::operator==(const PacketDlAckNack& other_value) const
{
return field_dl__tfi==other_value.field_dl__tfi
  && field_ack__nack__desc==other_value.field_ack__nack__desc
  && field_chreq__desc__presence==other_value.field_chreq__desc__presence
  && field_chreq__desc==other_value.field_chreq__desc
  && field_ch__qual__rep==other_value.field_ch__qual__rep;
}

boolean PacketDlAckNack::is_bound() const
{
return (field_dl__tfi.is_bound())
  || (field_ack__nack__desc.is_bound())
  || (field_chreq__desc__presence.is_bound())
  || (OPTIONAL_OMIT == field_chreq__desc.get_selection() || field_chreq__desc.is_bound())
  || (field_ch__qual__rep.is_bound());
}
boolean PacketDlAckNack::is_value() const
{
return field_dl__tfi.is_value()
  && field_ack__nack__desc.is_value()
  && field_chreq__desc__presence.is_value()
  && (OPTIONAL_OMIT == field_chreq__desc.get_selection() || field_chreq__desc.is_value())
  && field_ch__qual__rep.is_value();
}
int PacketDlAckNack::size_of() const
{
  int ret_val = 4;
  if (field_chreq__desc.ispresent()) ret_val++;
  return ret_val;
}

void PacketDlAckNack::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ dl_tfi := ");
field_dl__tfi.log();
TTCN_Logger::log_event_str(", ack_nack_desc := ");
field_ack__nack__desc.log();
TTCN_Logger::log_event_str(", chreq_desc_presence := ");
field_chreq__desc__presence.log();
TTCN_Logger::log_event_str(", chreq_desc := ");
field_chreq__desc.log();
TTCN_Logger::log_event_str(", ch_qual_rep := ");
field_ch__qual__rep.log();
TTCN_Logger::log_event_str(" }");
}

void PacketDlAckNack::set_implicit_omit()
{
if (dl__tfi().is_bound()) dl__tfi().set_implicit_omit();
if (ack__nack__desc().is_bound()) ack__nack__desc().set_implicit_omit();
if (chreq__desc__presence().is_bound()) chreq__desc__presence().set_implicit_omit();
if (!chreq__desc().is_bound()) chreq__desc() = OMIT_VALUE;
else chreq__desc().set_implicit_omit();
if (ch__qual__rep().is_bound()) ch__qual__rep().set_implicit_omit();
}

void PacketDlAckNack::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.PacketDlAckNack 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) dl__tfi().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ack__nack__desc().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) chreq__desc__presence().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) chreq__desc().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) ch__qual__rep().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(), "dl_tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          dl__tfi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ack_nack_desc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ack__nack__desc().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "chreq_desc_presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          chreq__desc__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(), "chreq_desc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          chreq__desc().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_qual_rep")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ch__qual__rep().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.PacketDlAckNack: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@RLCMAC_CSN1_Types.PacketDlAckNack");
  }
}

void PacketDlAckNack::encode_text(Text_Buf& text_buf) const
{
field_dl__tfi.encode_text(text_buf);
field_ack__nack__desc.encode_text(text_buf);
field_chreq__desc__presence.encode_text(text_buf);
field_chreq__desc.encode_text(text_buf);
field_ch__qual__rep.encode_text(text_buf);
}

void PacketDlAckNack::decode_text(Text_Buf& text_buf)
{
field_dl__tfi.decode_text(text_buf);
field_ack__nack__desc.decode_text(text_buf);
field_chreq__desc__presence.decode_text(text_buf);
field_chreq__desc.decode_text(text_buf);
field_ch__qual__rep.decode_text(text_buf);
}

void PacketDlAckNack::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 PacketDlAckNack::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 PacketDlAckNack::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, PacketDlAckNack_dl__tfi_descr_.raw->forceomit);
  decoded_field_length = field_dl__tfi.RAW_decode(PacketDlAckNack_dl__tfi_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, PacketDlAckNack_ack__nack__desc_descr_.raw->forceomit);
  decoded_field_length = field_ack__nack__desc.RAW_decode(PacketDlAckNack_ack__nack__desc_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, PacketDlAckNack_chreq__desc__presence_descr_.raw->forceomit);
  decoded_field_length = field_chreq__desc__presence.RAW_decode(PacketDlAckNack_chreq__desc__presence_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_chreq__desc__presence ==  bs_0){
  if (force_omit != NULL && (*force_omit)(3)) {
    field_chreq__desc = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_3_force_omit(3, force_omit, PacketDlAckNack_chreq__desc_descr_.raw->forceomit);
  decoded_field_length = field_chreq__desc().RAW_decode(PacketDlAckNack_chreq__desc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit);
  if (decoded_field_length < 1) {
  field_chreq__desc = 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_chreq__desc=OMIT_VALUE;
  RAW_Force_Omit field_4_force_omit(4, force_omit, PacketDlAckNack_ch__qual__rep_descr_.raw->forceomit);
  decoded_field_length = field_ch__qual__rep.RAW_decode(PacketDlAckNack_ch__qual__rep_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 PacketDlAckNack::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, PacketDlAckNack_dl__tfi_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PacketDlAckNack_ack__nack__desc_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PacketDlAckNack_chreq__desc__presence_descr_.raw);
  if (field_chreq__desc.ispresent()) {
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, PacketDlAckNack_chreq__desc_descr_.raw);
  }
  else myleaf.body.node.nodes[3] = NULL;
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, PacketDlAckNack_ch__qual__rep_descr_.raw);
  encoded_length += field_dl__tfi.RAW_encode(PacketDlAckNack_dl__tfi_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ack__nack__desc.RAW_encode(PacketDlAckNack_ack__nack__desc_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_chreq__desc__presence.RAW_encode(PacketDlAckNack_chreq__desc__presence_descr_, *myleaf.body.node.nodes[2]);
  if (field_chreq__desc.ispresent()) {
  encoded_length += field_chreq__desc().RAW_encode(PacketDlAckNack_chreq__desc_descr_, *myleaf.body.node.nodes[3]);
  }
  encoded_length += field_ch__qual__rep.RAW_encode(PacketDlAckNack_ch__qual__rep_descr_, *myleaf.body.node.nodes[4]);
  if (field_chreq__desc.ispresent() && (field_chreq__desc__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[]={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(PacketDlAckNack_chreq__desc__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 PacketDlAckNack_template::single_value_struct {
INTEGER_template field_dl__tfi;
AckNackDescription_template field_ack__nack__desc;
BITSTRING_template field_chreq__desc__presence;
ChannelReqDescription_template field_chreq__desc;
ChannelQualityReport_template field_ch__qual__rep;
};

void PacketDlAckNack_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_dl__tfi = ANY_VALUE;
single_value->field_ack__nack__desc = ANY_VALUE;
single_value->field_chreq__desc__presence = ANY_VALUE;
single_value->field_chreq__desc = ANY_OR_OMIT;
single_value->field_ch__qual__rep = ANY_VALUE;
}
}
}

void PacketDlAckNack_template::copy_value(const PacketDlAckNack& other_value)
{
single_value = new single_value_struct;
if (other_value.dl__tfi().is_bound()) {
  single_value->field_dl__tfi = other_value.dl__tfi();
} else {
  single_value->field_dl__tfi.clean_up();
}
if (other_value.ack__nack__desc().is_bound()) {
  single_value->field_ack__nack__desc = other_value.ack__nack__desc();
} else {
  single_value->field_ack__nack__desc.clean_up();
}
if (other_value.chreq__desc__presence().is_bound()) {
  single_value->field_chreq__desc__presence = other_value.chreq__desc__presence();
} else {
  single_value->field_chreq__desc__presence.clean_up();
}
if (other_value.chreq__desc().is_bound()) {
  if (other_value.chreq__desc().ispresent()) single_value->field_chreq__desc = other_value.chreq__desc()();
  else single_value->field_chreq__desc = OMIT_VALUE;
} else {
  single_value->field_chreq__desc.clean_up();
}
if (other_value.ch__qual__rep().is_bound()) {
  single_value->field_ch__qual__rep = other_value.ch__qual__rep();
} else {
  single_value->field_ch__qual__rep.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PacketDlAckNack_template::copy_template(const PacketDlAckNack_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.dl__tfi().get_selection()) {
single_value->field_dl__tfi = other_value.dl__tfi();
} else {
single_value->field_dl__tfi.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ack__nack__desc().get_selection()) {
single_value->field_ack__nack__desc = other_value.ack__nack__desc();
} else {
single_value->field_ack__nack__desc.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.chreq__desc__presence().get_selection()) {
single_value->field_chreq__desc__presence = other_value.chreq__desc__presence();
} else {
single_value->field_chreq__desc__presence.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.chreq__desc().get_selection()) {
single_value->field_chreq__desc = other_value.chreq__desc();
} else {
single_value->field_chreq__desc.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ch__qual__rep().get_selection()) {
single_value->field_ch__qual__rep = other_value.ch__qual__rep();
} else {
single_value->field_ch__qual__rep.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 PacketDlAckNack_template[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 PacketDlAckNack_template(*other_value.implication_.precondition);
implication_.implied_template = new PacketDlAckNack_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.PacketDlAckNack.");
break;
}
set_selection(other_value);
}

PacketDlAckNack_template::PacketDlAckNack_template()
{
}

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

PacketDlAckNack_template::PacketDlAckNack_template(const PacketDlAckNack& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PacketDlAckNack_template::match(const PacketDlAckNack& 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.dl__tfi().is_bound()) return FALSE;
if(!single_value->field_dl__tfi.match(other_value.dl__tfi(), legacy))return FALSE;
if(!other_value.ack__nack__desc().is_bound()) return FALSE;
if(!single_value->field_ack__nack__desc.match(other_value.ack__nack__desc(), legacy))return FALSE;
if(!other_value.chreq__desc__presence().is_bound()) return FALSE;
if(!single_value->field_chreq__desc__presence.match(other_value.chreq__desc__presence(), legacy))return FALSE;
if(!other_value.chreq__desc().is_bound()) return FALSE;
if((other_value.chreq__desc().ispresent() ? !single_value->field_chreq__desc.match((const ChannelReqDescription&)other_value.chreq__desc(), legacy) : !single_value->field_chreq__desc.match_omit(legacy)))return FALSE;
if(!other_value.ch__qual__rep().is_bound()) return FALSE;
if(!single_value->field_ch__qual__rep.match(other_value.ch__qual__rep(), 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.PacketDlAckNack.");
}
return FALSE;
}

boolean PacketDlAckNack_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_dl__tfi.is_bound()
 || single_value->field_ack__nack__desc.is_bound()
 || single_value->field_chreq__desc__presence.is_bound()
 || (single_value->field_chreq__desc.is_omit() || single_value->field_chreq__desc.is_bound())
 || single_value->field_ch__qual__rep.is_bound();
}

boolean PacketDlAckNack_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_dl__tfi.is_value()
 && single_value->field_ack__nack__desc.is_value()
 && single_value->field_chreq__desc__presence.is_value()
 && (single_value->field_chreq__desc.is_omit() || single_value->field_chreq__desc.is_value())
 && single_value->field_ch__qual__rep.is_value();
}

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

PacketDlAckNack PacketDlAckNack_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.PacketDlAckNack.");
PacketDlAckNack ret_val;
if (single_value->field_dl__tfi.is_bound()) {
ret_val.dl__tfi() = single_value->field_dl__tfi.valueof();
}
if (single_value->field_ack__nack__desc.is_bound()) {
ret_val.ack__nack__desc() = single_value->field_ack__nack__desc.valueof();
}
if (single_value->field_chreq__desc__presence.is_bound()) {
ret_val.chreq__desc__presence() = single_value->field_chreq__desc__presence.valueof();
}
if (single_value->field_chreq__desc.is_omit()) ret_val.chreq__desc() = OMIT_VALUE;
else if (single_value->field_chreq__desc.is_bound()) {
ret_val.chreq__desc() = single_value->field_chreq__desc.valueof();
}
if (single_value->field_ch__qual__rep.is_bound()) {
ret_val.ch__qual__rep() = single_value->field_ch__qual__rep.valueof();
}
return ret_val;
}

void PacketDlAckNack_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.PacketDlAckNack.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PacketDlAckNack_template[list_length];
}

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

INTEGER_template& PacketDlAckNack_template::dl__tfi()
{
set_specific();
return single_value->field_dl__tfi;
}

const INTEGER_template& PacketDlAckNack_template::dl__tfi() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field dl_tfi of a non-specific template of type @RLCMAC_CSN1_Types.PacketDlAckNack.");
return single_value->field_dl__tfi;
}

AckNackDescription_template& PacketDlAckNack_template::ack__nack__desc()
{
set_specific();
return single_value->field_ack__nack__desc;
}

const AckNackDescription_template& PacketDlAckNack_template::ack__nack__desc() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ack_nack_desc of a non-specific template of type @RLCMAC_CSN1_Types.PacketDlAckNack.");
return single_value->field_ack__nack__desc;
}

BITSTRING_template& PacketDlAckNack_template::chreq__desc__presence()
{
set_specific();
return single_value->field_chreq__desc__presence;
}

const BITSTRING_template& PacketDlAckNack_template::chreq__desc__presence() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field chreq_desc_presence of a non-specific template of type @RLCMAC_CSN1_Types.PacketDlAckNack.");
return single_value->field_chreq__desc__presence;
}

ChannelReqDescription_template& PacketDlAckNack_template::chreq__desc()
{
set_specific();
return single_value->field_chreq__desc;
}

const ChannelReqDescription_template& PacketDlAckNack_template::chreq__desc() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field chreq_desc of a non-specific template of type @RLCMAC_CSN1_Types.PacketDlAckNack.");
return single_value->field_chreq__desc;
}

ChannelQualityReport_template& PacketDlAckNack_template::ch__qual__rep()
{
set_specific();
return single_value->field_ch__qual__rep;
}

const ChannelQualityReport_template& PacketDlAckNack_template::ch__qual__rep() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ch_qual_rep of a non-specific template of type @RLCMAC_CSN1_Types.PacketDlAckNack.");
return single_value->field_ch__qual__rep;
}

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

void PacketDlAckNack_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ dl_tfi := ");
single_value->field_dl__tfi.log();
TTCN_Logger::log_event_str(", ack_nack_desc := ");
single_value->field_ack__nack__desc.log();
TTCN_Logger::log_event_str(", chreq_desc_presence := ");
single_value->field_chreq__desc__presence.log();
TTCN_Logger::log_event_str(", chreq_desc := ");
single_value->field_chreq__desc.log();
TTCN_Logger::log_event_str(", ch_qual_rep := ");
single_value->field_ch__qual__rep.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 PacketDlAckNack_template::log_match(const PacketDlAckNack& 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_dl__tfi.match(match_value.dl__tfi(), legacy)){
TTCN_Logger::log_logmatch_info(".dl_tfi");
single_value->field_dl__tfi.log_match(match_value.dl__tfi(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ack__nack__desc.match(match_value.ack__nack__desc(), legacy)){
TTCN_Logger::log_logmatch_info(".ack_nack_desc");
single_value->field_ack__nack__desc.log_match(match_value.ack__nack__desc(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_chreq__desc__presence.match(match_value.chreq__desc__presence(), legacy)){
TTCN_Logger::log_logmatch_info(".chreq_desc_presence");
single_value->field_chreq__desc__presence.log_match(match_value.chreq__desc__presence(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.chreq__desc().ispresent()){
if(!single_value->field_chreq__desc.match(match_value.chreq__desc(), legacy)){
TTCN_Logger::log_logmatch_info(".chreq_desc");
single_value->field_chreq__desc.log_match(match_value.chreq__desc(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_chreq__desc.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".chreq_desc := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_chreq__desc.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_ch__qual__rep.match(match_value.ch__qual__rep(), legacy)){
TTCN_Logger::log_logmatch_info(".ch_qual_rep");
single_value->field_ch__qual__rep.log_match(match_value.ch__qual__rep(), 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("{ dl_tfi := ");
single_value->field_dl__tfi.log_match(match_value.dl__tfi(), legacy);
TTCN_Logger::log_event_str(", ack_nack_desc := ");
single_value->field_ack__nack__desc.log_match(match_value.ack__nack__desc(), legacy);
TTCN_Logger::log_event_str(", chreq_desc_presence := ");
single_value->field_chreq__desc__presence.log_match(match_value.chreq__desc__presence(), legacy);
TTCN_Logger::log_event_str(", chreq_desc := ");
if (match_value.chreq__desc().ispresent()) {
single_value->field_chreq__desc.log_match(match_value.chreq__desc(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_chreq__desc.log();
if (single_value->field_chreq__desc.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", ch_qual_rep := ");
single_value->field_ch__qual__rep.log_match(match_value.ch__qual__rep(), 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 PacketDlAckNack_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (dl__tfi().is_bound()) dl__tfi().set_implicit_omit();
if (ack__nack__desc().is_bound()) ack__nack__desc().set_implicit_omit();
if (chreq__desc__presence().is_bound()) chreq__desc__presence().set_implicit_omit();
if (!chreq__desc().is_bound()) chreq__desc() = OMIT_VALUE;
else chreq__desc().set_implicit_omit();
if (ch__qual__rep().is_bound()) ch__qual__rep().set_implicit_omit();
}

void PacketDlAckNack_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_dl__tfi.encode_text(text_buf);
single_value->field_ack__nack__desc.encode_text(text_buf);
single_value->field_chreq__desc__presence.encode_text(text_buf);
single_value->field_chreq__desc.encode_text(text_buf);
single_value->field_ch__qual__rep.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.PacketDlAckNack.");
}
}

void PacketDlAckNack_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_dl__tfi.decode_text(text_buf);
single_value->field_ack__nack__desc.decode_text(text_buf);
single_value->field_chreq__desc__presence.decode_text(text_buf);
single_value->field_chreq__desc.decode_text(text_buf);
single_value->field_ch__qual__rep.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 PacketDlAckNack_template[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.PacketDlAckNack.");
}
}

void PacketDlAckNack_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: {
    PacketDlAckNack_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.PacketDlAckNack 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) dl__tfi().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ack__nack__desc().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) chreq__desc__presence().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) chreq__desc().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) ch__qual__rep().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(), "dl_tfi")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          dl__tfi().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "ack_nack_desc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ack__nack__desc().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "chreq_desc_presence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          chreq__desc__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(), "chreq_desc")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          chreq__desc().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_qual_rep")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ch__qual__rep().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.PacketDlAckNack: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PacketDlAckNack_template* precondition = new PacketDlAckNack_template;
    precondition->set_param(*param.get_elem(0));
    PacketDlAckNack_template* implied_template = new PacketDlAckNack_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PacketDlAckNack_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@RLCMAC_CSN1_Types.PacketDlAckNack");
  }
  is_ifpresent = param.get_ifpresent();
}

void PacketDlAckNack_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_dl__tfi.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketDlAckNack");
single_value->field_ack__nack__desc.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketDlAckNack");
single_value->field_chreq__desc__presence.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketDlAckNack");
single_value->field_chreq__desc.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketDlAckNack");
single_value->field_ch__qual__rep.check_restriction(t_res, t_name ? t_name : "@RLCMAC_CSN1_Types.PacketDlAckNack");
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.PacketDlAckNack");
}

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

boolean PacketDlAckNack_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 */
