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

namespace BSSGP__Types {

/* Member functions of C++ classes */

QoS__Profile__V::QoS__Profile__V()
{
}

QoS__Profile__V::QoS__Profile__V(const OCTETSTRING& par_peak__Bit__Rate,
    const BITSTRING& par_precedence,
    const BITSTRING& par_a__bit,
    const BITSTRING& par_t__bit,
    const BITSTRING& par_c__r__bit,
    const BITSTRING& par_peakBitRateGranularity)
  :   field_peak__Bit__Rate(par_peak__Bit__Rate),
  field_precedence(par_precedence),
  field_a__bit(par_a__bit),
  field_t__bit(par_t__bit),
  field_c__r__bit(par_c__r__bit),
  field_peakBitRateGranularity(par_peakBitRateGranularity)
{
}

QoS__Profile__V::QoS__Profile__V(const QoS__Profile__V& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.QoS_Profile_V.");
if (other_value.peak__Bit__Rate().is_bound()) field_peak__Bit__Rate = other_value.peak__Bit__Rate();
else field_peak__Bit__Rate.clean_up();
if (other_value.precedence().is_bound()) field_precedence = other_value.precedence();
else field_precedence.clean_up();
if (other_value.a__bit().is_bound()) field_a__bit = other_value.a__bit();
else field_a__bit.clean_up();
if (other_value.t__bit().is_bound()) field_t__bit = other_value.t__bit();
else field_t__bit.clean_up();
if (other_value.c__r__bit().is_bound()) field_c__r__bit = other_value.c__r__bit();
else field_c__r__bit.clean_up();
if (other_value.peakBitRateGranularity().is_bound()) field_peakBitRateGranularity = other_value.peakBitRateGranularity();
else field_peakBitRateGranularity.clean_up();
}

void QoS__Profile__V::clean_up()
{
field_peak__Bit__Rate.clean_up();
field_precedence.clean_up();
field_a__bit.clean_up();
field_t__bit.clean_up();
field_c__r__bit.clean_up();
field_peakBitRateGranularity.clean_up();
}

const TTCN_Typedescriptor_t* QoS__Profile__V::get_descriptor() const { return &QoS__Profile__V_descr_; }
QoS__Profile__V& QoS__Profile__V::operator=(const QoS__Profile__V& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.QoS_Profile_V.");
  if (other_value.peak__Bit__Rate().is_bound()) field_peak__Bit__Rate = other_value.peak__Bit__Rate();
  else field_peak__Bit__Rate.clean_up();
  if (other_value.precedence().is_bound()) field_precedence = other_value.precedence();
  else field_precedence.clean_up();
  if (other_value.a__bit().is_bound()) field_a__bit = other_value.a__bit();
  else field_a__bit.clean_up();
  if (other_value.t__bit().is_bound()) field_t__bit = other_value.t__bit();
  else field_t__bit.clean_up();
  if (other_value.c__r__bit().is_bound()) field_c__r__bit = other_value.c__r__bit();
  else field_c__r__bit.clean_up();
  if (other_value.peakBitRateGranularity().is_bound()) field_peakBitRateGranularity = other_value.peakBitRateGranularity();
  else field_peakBitRateGranularity.clean_up();
}
return *this;
}

boolean QoS__Profile__V::operator==(const QoS__Profile__V& other_value) const
{
return field_peak__Bit__Rate==other_value.field_peak__Bit__Rate
  && field_precedence==other_value.field_precedence
  && field_a__bit==other_value.field_a__bit
  && field_t__bit==other_value.field_t__bit
  && field_c__r__bit==other_value.field_c__r__bit
  && field_peakBitRateGranularity==other_value.field_peakBitRateGranularity;
}

boolean QoS__Profile__V::is_bound() const
{
return (field_peak__Bit__Rate.is_bound())
  || (field_precedence.is_bound())
  || (field_a__bit.is_bound())
  || (field_t__bit.is_bound())
  || (field_c__r__bit.is_bound())
  || (field_peakBitRateGranularity.is_bound());
}
boolean QoS__Profile__V::is_value() const
{
return field_peak__Bit__Rate.is_value()
  && field_precedence.is_value()
  && field_a__bit.is_value()
  && field_t__bit.is_value()
  && field_c__r__bit.is_value()
  && field_peakBitRateGranularity.is_value();
}
void QoS__Profile__V::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ peak_Bit_Rate := ");
field_peak__Bit__Rate.log();
TTCN_Logger::log_event_str(", precedence := ");
field_precedence.log();
TTCN_Logger::log_event_str(", a_bit := ");
field_a__bit.log();
TTCN_Logger::log_event_str(", t_bit := ");
field_t__bit.log();
TTCN_Logger::log_event_str(", c_r_bit := ");
field_c__r__bit.log();
TTCN_Logger::log_event_str(", peakBitRateGranularity := ");
field_peakBitRateGranularity.log();
TTCN_Logger::log_event_str(" }");
}

void QoS__Profile__V::set_implicit_omit()
{
if (peak__Bit__Rate().is_bound()) peak__Bit__Rate().set_implicit_omit();
if (precedence().is_bound()) precedence().set_implicit_omit();
if (a__bit().is_bound()) a__bit().set_implicit_omit();
if (t__bit().is_bound()) t__bit().set_implicit_omit();
if (c__r__bit().is_bound()) c__r__bit().set_implicit_omit();
if (peakBitRateGranularity().is_bound()) peakBitRateGranularity().set_implicit_omit();
}

void QoS__Profile__V::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 @BSSGP_Types.QoS_Profile_V 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) peak__Bit__Rate().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) precedence().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) a__bit().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) t__bit().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) c__r__bit().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) peakBitRateGranularity().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(), "peak_Bit_Rate")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          peak__Bit__Rate().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "precedence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          precedence().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "a_bit")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          a__bit().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_bit")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          t__bit().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "c_r_bit")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          c__r__bit().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "peakBitRateGranularity")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          peakBitRateGranularity().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 @BSSGP_Types.QoS_Profile_V: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.QoS_Profile_V");
  }
}

void QoS__Profile__V::encode_text(Text_Buf& text_buf) const
{
field_peak__Bit__Rate.encode_text(text_buf);
field_precedence.encode_text(text_buf);
field_a__bit.encode_text(text_buf);
field_t__bit.encode_text(text_buf);
field_c__r__bit.encode_text(text_buf);
field_peakBitRateGranularity.encode_text(text_buf);
}

void QoS__Profile__V::decode_text(Text_Buf& text_buf)
{
field_peak__Bit__Rate.decode_text(text_buf);
field_precedence.decode_text(text_buf);
field_a__bit.decode_text(text_buf);
field_t__bit.decode_text(text_buf);
field_c__r__bit.decode_text(text_buf);
field_peakBitRateGranularity.decode_text(text_buf);
}

void QoS__Profile__V::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 QoS__Profile__V::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 QoS__Profile__V::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT2_descr_.raw->forceomit);
  decoded_field_length = field_peak__Bit__Rate.RAW_decode(General__Types::OCT2_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::BIT3_descr_.raw->forceomit);
  decoded_field_length = field_precedence.RAW_decode(General__Types::BIT3_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_a__bit.RAW_decode(General__Types::BIT1_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, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_t__bit.RAW_decode(General__Types::BIT1_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, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_c__r__bit.RAW_decode(General__Types::BIT1_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, General__Types::BIT2_descr_.raw->forceomit);
  decoded_field_length = field_peakBitRateGranularity.RAW_decode(General__Types::BIT2_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int QoS__Profile__V::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, General__Types::OCT2_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::BIT3_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::BIT2_descr_.raw);
  encoded_length += field_peak__Bit__Rate.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_precedence.RAW_encode(General__Types::BIT3_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_a__bit.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_t__bit.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_c__r__bit.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_peakBitRateGranularity.RAW_encode(General__Types::BIT2_descr_, *myleaf.body.node.nodes[5]);
  return myleaf.length = encoded_length;
}

struct QoS__Profile__V_template::single_value_struct {
OCTETSTRING_template field_peak__Bit__Rate;
BITSTRING_template field_precedence;
BITSTRING_template field_a__bit;
BITSTRING_template field_t__bit;
BITSTRING_template field_c__r__bit;
BITSTRING_template field_peakBitRateGranularity;
};

void QoS__Profile__V_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_peak__Bit__Rate = ANY_VALUE;
single_value->field_precedence = ANY_VALUE;
single_value->field_a__bit = ANY_VALUE;
single_value->field_t__bit = ANY_VALUE;
single_value->field_c__r__bit = ANY_VALUE;
single_value->field_peakBitRateGranularity = ANY_VALUE;
}
}
}

void QoS__Profile__V_template::copy_value(const QoS__Profile__V& other_value)
{
single_value = new single_value_struct;
if (other_value.peak__Bit__Rate().is_bound()) {
  single_value->field_peak__Bit__Rate = other_value.peak__Bit__Rate();
} else {
  single_value->field_peak__Bit__Rate.clean_up();
}
if (other_value.precedence().is_bound()) {
  single_value->field_precedence = other_value.precedence();
} else {
  single_value->field_precedence.clean_up();
}
if (other_value.a__bit().is_bound()) {
  single_value->field_a__bit = other_value.a__bit();
} else {
  single_value->field_a__bit.clean_up();
}
if (other_value.t__bit().is_bound()) {
  single_value->field_t__bit = other_value.t__bit();
} else {
  single_value->field_t__bit.clean_up();
}
if (other_value.c__r__bit().is_bound()) {
  single_value->field_c__r__bit = other_value.c__r__bit();
} else {
  single_value->field_c__r__bit.clean_up();
}
if (other_value.peakBitRateGranularity().is_bound()) {
  single_value->field_peakBitRateGranularity = other_value.peakBitRateGranularity();
} else {
  single_value->field_peakBitRateGranularity.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void QoS__Profile__V_template::copy_template(const QoS__Profile__V_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.peak__Bit__Rate().get_selection()) {
single_value->field_peak__Bit__Rate = other_value.peak__Bit__Rate();
} else {
single_value->field_peak__Bit__Rate.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.precedence().get_selection()) {
single_value->field_precedence = other_value.precedence();
} else {
single_value->field_precedence.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.a__bit().get_selection()) {
single_value->field_a__bit = other_value.a__bit();
} else {
single_value->field_a__bit.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.t__bit().get_selection()) {
single_value->field_t__bit = other_value.t__bit();
} else {
single_value->field_t__bit.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.c__r__bit().get_selection()) {
single_value->field_c__r__bit = other_value.c__r__bit();
} else {
single_value->field_c__r__bit.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.peakBitRateGranularity().get_selection()) {
single_value->field_peakBitRateGranularity = other_value.peakBitRateGranularity();
} else {
single_value->field_peakBitRateGranularity.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 QoS__Profile__V_template[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 QoS__Profile__V_template(*other_value.implication_.precondition);
implication_.implied_template = new QoS__Profile__V_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 @BSSGP_Types.QoS_Profile_V.");
break;
}
set_selection(other_value);
}

QoS__Profile__V_template::QoS__Profile__V_template()
{
}

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

QoS__Profile__V_template::QoS__Profile__V_template(const QoS__Profile__V& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean QoS__Profile__V_template::match(const QoS__Profile__V& 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.peak__Bit__Rate().is_bound()) return FALSE;
if(!single_value->field_peak__Bit__Rate.match(other_value.peak__Bit__Rate(), legacy))return FALSE;
if(!other_value.precedence().is_bound()) return FALSE;
if(!single_value->field_precedence.match(other_value.precedence(), legacy))return FALSE;
if(!other_value.a__bit().is_bound()) return FALSE;
if(!single_value->field_a__bit.match(other_value.a__bit(), legacy))return FALSE;
if(!other_value.t__bit().is_bound()) return FALSE;
if(!single_value->field_t__bit.match(other_value.t__bit(), legacy))return FALSE;
if(!other_value.c__r__bit().is_bound()) return FALSE;
if(!single_value->field_c__r__bit.match(other_value.c__r__bit(), legacy))return FALSE;
if(!other_value.peakBitRateGranularity().is_bound()) return FALSE;
if(!single_value->field_peakBitRateGranularity.match(other_value.peakBitRateGranularity(), 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 @BSSGP_Types.QoS_Profile_V.");
}
return FALSE;
}

boolean QoS__Profile__V_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_peak__Bit__Rate.is_bound()
 || single_value->field_precedence.is_bound()
 || single_value->field_a__bit.is_bound()
 || single_value->field_t__bit.is_bound()
 || single_value->field_c__r__bit.is_bound()
 || single_value->field_peakBitRateGranularity.is_bound();
}

boolean QoS__Profile__V_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_peak__Bit__Rate.is_value()
 && single_value->field_precedence.is_value()
 && single_value->field_a__bit.is_value()
 && single_value->field_t__bit.is_value()
 && single_value->field_c__r__bit.is_value()
 && single_value->field_peakBitRateGranularity.is_value();
}

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

QoS__Profile__V QoS__Profile__V_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 @BSSGP_Types.QoS_Profile_V.");
QoS__Profile__V ret_val;
if (single_value->field_peak__Bit__Rate.is_bound()) {
ret_val.peak__Bit__Rate() = single_value->field_peak__Bit__Rate.valueof();
}
if (single_value->field_precedence.is_bound()) {
ret_val.precedence() = single_value->field_precedence.valueof();
}
if (single_value->field_a__bit.is_bound()) {
ret_val.a__bit() = single_value->field_a__bit.valueof();
}
if (single_value->field_t__bit.is_bound()) {
ret_val.t__bit() = single_value->field_t__bit.valueof();
}
if (single_value->field_c__r__bit.is_bound()) {
ret_val.c__r__bit() = single_value->field_c__r__bit.valueof();
}
if (single_value->field_peakBitRateGranularity.is_bound()) {
ret_val.peakBitRateGranularity() = single_value->field_peakBitRateGranularity.valueof();
}
return ret_val;
}

void QoS__Profile__V_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 @BSSGP_Types.QoS_Profile_V.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new QoS__Profile__V_template[list_length];
}

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

OCTETSTRING_template& QoS__Profile__V_template::peak__Bit__Rate()
{
set_specific();
return single_value->field_peak__Bit__Rate;
}

const OCTETSTRING_template& QoS__Profile__V_template::peak__Bit__Rate() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field peak_Bit_Rate of a non-specific template of type @BSSGP_Types.QoS_Profile_V.");
return single_value->field_peak__Bit__Rate;
}

BITSTRING_template& QoS__Profile__V_template::precedence()
{
set_specific();
return single_value->field_precedence;
}

const BITSTRING_template& QoS__Profile__V_template::precedence() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field precedence of a non-specific template of type @BSSGP_Types.QoS_Profile_V.");
return single_value->field_precedence;
}

BITSTRING_template& QoS__Profile__V_template::a__bit()
{
set_specific();
return single_value->field_a__bit;
}

const BITSTRING_template& QoS__Profile__V_template::a__bit() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field a_bit of a non-specific template of type @BSSGP_Types.QoS_Profile_V.");
return single_value->field_a__bit;
}

BITSTRING_template& QoS__Profile__V_template::t__bit()
{
set_specific();
return single_value->field_t__bit;
}

const BITSTRING_template& QoS__Profile__V_template::t__bit() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field t_bit of a non-specific template of type @BSSGP_Types.QoS_Profile_V.");
return single_value->field_t__bit;
}

BITSTRING_template& QoS__Profile__V_template::c__r__bit()
{
set_specific();
return single_value->field_c__r__bit;
}

const BITSTRING_template& QoS__Profile__V_template::c__r__bit() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field c_r_bit of a non-specific template of type @BSSGP_Types.QoS_Profile_V.");
return single_value->field_c__r__bit;
}

BITSTRING_template& QoS__Profile__V_template::peakBitRateGranularity()
{
set_specific();
return single_value->field_peakBitRateGranularity;
}

const BITSTRING_template& QoS__Profile__V_template::peakBitRateGranularity() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field peakBitRateGranularity of a non-specific template of type @BSSGP_Types.QoS_Profile_V.");
return single_value->field_peakBitRateGranularity;
}

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

void QoS__Profile__V_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ peak_Bit_Rate := ");
single_value->field_peak__Bit__Rate.log();
TTCN_Logger::log_event_str(", precedence := ");
single_value->field_precedence.log();
TTCN_Logger::log_event_str(", a_bit := ");
single_value->field_a__bit.log();
TTCN_Logger::log_event_str(", t_bit := ");
single_value->field_t__bit.log();
TTCN_Logger::log_event_str(", c_r_bit := ");
single_value->field_c__r__bit.log();
TTCN_Logger::log_event_str(", peakBitRateGranularity := ");
single_value->field_peakBitRateGranularity.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 QoS__Profile__V_template::log_match(const QoS__Profile__V& 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_peak__Bit__Rate.match(match_value.peak__Bit__Rate(), legacy)){
TTCN_Logger::log_logmatch_info(".peak_Bit_Rate");
single_value->field_peak__Bit__Rate.log_match(match_value.peak__Bit__Rate(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_precedence.match(match_value.precedence(), legacy)){
TTCN_Logger::log_logmatch_info(".precedence");
single_value->field_precedence.log_match(match_value.precedence(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_a__bit.match(match_value.a__bit(), legacy)){
TTCN_Logger::log_logmatch_info(".a_bit");
single_value->field_a__bit.log_match(match_value.a__bit(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_t__bit.match(match_value.t__bit(), legacy)){
TTCN_Logger::log_logmatch_info(".t_bit");
single_value->field_t__bit.log_match(match_value.t__bit(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_c__r__bit.match(match_value.c__r__bit(), legacy)){
TTCN_Logger::log_logmatch_info(".c_r_bit");
single_value->field_c__r__bit.log_match(match_value.c__r__bit(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_peakBitRateGranularity.match(match_value.peakBitRateGranularity(), legacy)){
TTCN_Logger::log_logmatch_info(".peakBitRateGranularity");
single_value->field_peakBitRateGranularity.log_match(match_value.peakBitRateGranularity(), 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("{ peak_Bit_Rate := ");
single_value->field_peak__Bit__Rate.log_match(match_value.peak__Bit__Rate(), legacy);
TTCN_Logger::log_event_str(", precedence := ");
single_value->field_precedence.log_match(match_value.precedence(), legacy);
TTCN_Logger::log_event_str(", a_bit := ");
single_value->field_a__bit.log_match(match_value.a__bit(), legacy);
TTCN_Logger::log_event_str(", t_bit := ");
single_value->field_t__bit.log_match(match_value.t__bit(), legacy);
TTCN_Logger::log_event_str(", c_r_bit := ");
single_value->field_c__r__bit.log_match(match_value.c__r__bit(), legacy);
TTCN_Logger::log_event_str(", peakBitRateGranularity := ");
single_value->field_peakBitRateGranularity.log_match(match_value.peakBitRateGranularity(), 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 QoS__Profile__V_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (peak__Bit__Rate().is_bound()) peak__Bit__Rate().set_implicit_omit();
if (precedence().is_bound()) precedence().set_implicit_omit();
if (a__bit().is_bound()) a__bit().set_implicit_omit();
if (t__bit().is_bound()) t__bit().set_implicit_omit();
if (c__r__bit().is_bound()) c__r__bit().set_implicit_omit();
if (peakBitRateGranularity().is_bound()) peakBitRateGranularity().set_implicit_omit();
}

void QoS__Profile__V_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_peak__Bit__Rate.encode_text(text_buf);
single_value->field_precedence.encode_text(text_buf);
single_value->field_a__bit.encode_text(text_buf);
single_value->field_t__bit.encode_text(text_buf);
single_value->field_c__r__bit.encode_text(text_buf);
single_value->field_peakBitRateGranularity.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 @BSSGP_Types.QoS_Profile_V.");
}
}

void QoS__Profile__V_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_peak__Bit__Rate.decode_text(text_buf);
single_value->field_precedence.decode_text(text_buf);
single_value->field_a__bit.decode_text(text_buf);
single_value->field_t__bit.decode_text(text_buf);
single_value->field_c__r__bit.decode_text(text_buf);
single_value->field_peakBitRateGranularity.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 QoS__Profile__V_template[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 @BSSGP_Types.QoS_Profile_V.");
}
}

void QoS__Profile__V_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: {
    QoS__Profile__V_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 @BSSGP_Types.QoS_Profile_V 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) peak__Bit__Rate().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) precedence().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) a__bit().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) t__bit().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) c__r__bit().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) peakBitRateGranularity().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(), "peak_Bit_Rate")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          peak__Bit__Rate().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "precedence")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          precedence().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "a_bit")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          a__bit().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_bit")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          t__bit().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "c_r_bit")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          c__r__bit().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "peakBitRateGranularity")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          peakBitRateGranularity().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 @BSSGP_Types.QoS_Profile_V: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    QoS__Profile__V_template* precondition = new QoS__Profile__V_template;
    precondition->set_param(*param.get_elem(0));
    QoS__Profile__V_template* implied_template = new QoS__Profile__V_template;
    implied_template->set_param(*param.get_elem(1));
    *this = QoS__Profile__V_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.QoS_Profile_V");
  }
  is_ifpresent = param.get_ifpresent();
}

void QoS__Profile__V_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_peak__Bit__Rate.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.QoS_Profile_V");
single_value->field_precedence.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.QoS_Profile_V");
single_value->field_a__bit.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.QoS_Profile_V");
single_value->field_t__bit.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.QoS_Profile_V");
single_value->field_c__r__bit.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.QoS_Profile_V");
single_value->field_peakBitRateGranularity.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.QoS_Profile_V");
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 : "@BSSGP_Types.QoS_Profile_V");
}

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

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

Radio__Cause::Radio__Cause()
{
}

Radio__Cause::Radio__Cause(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_radio__Cause__Value)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_radio__Cause__Value(par_radio__Cause__Value)
{
}

Radio__Cause::Radio__Cause(const Radio__Cause& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.Radio_Cause.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.radio__Cause__Value().is_bound()) field_radio__Cause__Value = other_value.radio__Cause__Value();
else field_radio__Cause__Value.clean_up();
}

void Radio__Cause::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_radio__Cause__Value.clean_up();
}

const TTCN_Typedescriptor_t* Radio__Cause::get_descriptor() const { return &Radio__Cause_descr_; }
Radio__Cause& Radio__Cause::operator=(const Radio__Cause& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.Radio_Cause.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.radio__Cause__Value().is_bound()) field_radio__Cause__Value = other_value.radio__Cause__Value();
  else field_radio__Cause__Value.clean_up();
}
return *this;
}

boolean Radio__Cause::operator==(const Radio__Cause& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_radio__Cause__Value==other_value.field_radio__Cause__Value;
}

boolean Radio__Cause::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_radio__Cause__Value.is_bound());
}
boolean Radio__Cause::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_radio__Cause__Value.is_value();
}
void Radio__Cause::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", radio_Cause_Value := ");
field_radio__Cause__Value.log();
TTCN_Logger::log_event_str(" }");
}

void Radio__Cause::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (radio__Cause__Value().is_bound()) radio__Cause__Value().set_implicit_omit();
}

void Radio__Cause::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 @BSSGP_Types.Radio_Cause 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) radio__Cause__Value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "radio_Cause_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          radio__Cause__Value().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 @BSSGP_Types.Radio_Cause: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.Radio_Cause");
  }
}

void Radio__Cause::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_radio__Cause__Value.encode_text(text_buf);
}

void Radio__Cause::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_radio__Cause__Value.decode_text(text_buf);
}

void Radio__Cause::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 Radio__Cause::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 Radio__Cause::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, Radio__Cause_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(Radio__Cause_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, Radio__Cause_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(Radio__Cause_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_radio__Cause__Value.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_44) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Radio__Cause::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Radio__Cause_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Radio__Cause_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT1_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(Radio__Cause_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(Radio__Cause_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_radio__Cause__Value.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Radio__Cause_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Radio__Cause_ext_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_iEI !=  os_44) {
  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){
   os_44.RAW_encode(General__Types::OCT1_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 Radio__Cause_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_radio__Cause__Value;
};

void Radio__Cause_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_radio__Cause__Value = ANY_VALUE;
}
}
}

void Radio__Cause_template::copy_value(const Radio__Cause& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.radio__Cause__Value().is_bound()) {
  single_value->field_radio__Cause__Value = other_value.radio__Cause__Value();
} else {
  single_value->field_radio__Cause__Value.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Radio__Cause_template::copy_template(const Radio__Cause_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.radio__Cause__Value().get_selection()) {
single_value->field_radio__Cause__Value = other_value.radio__Cause__Value();
} else {
single_value->field_radio__Cause__Value.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 Radio__Cause_template[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 Radio__Cause_template(*other_value.implication_.precondition);
implication_.implied_template = new Radio__Cause_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 @BSSGP_Types.Radio_Cause.");
break;
}
set_selection(other_value);
}

Radio__Cause_template::Radio__Cause_template()
{
}

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

Radio__Cause_template::Radio__Cause_template(const Radio__Cause& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean Radio__Cause_template::match(const Radio__Cause& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.radio__Cause__Value().is_bound()) return FALSE;
if(!single_value->field_radio__Cause__Value.match(other_value.radio__Cause__Value(), 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 @BSSGP_Types.Radio_Cause.");
}
return FALSE;
}

boolean Radio__Cause_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_radio__Cause__Value.is_bound();
}

boolean Radio__Cause_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_radio__Cause__Value.is_value();
}

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

Radio__Cause Radio__Cause_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 @BSSGP_Types.Radio_Cause.");
Radio__Cause ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_radio__Cause__Value.is_bound()) {
ret_val.radio__Cause__Value() = single_value->field_radio__Cause__Value.valueof();
}
return ret_val;
}

void Radio__Cause_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 @BSSGP_Types.Radio_Cause.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Radio__Cause_template[list_length];
}

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

OCTETSTRING_template& Radio__Cause_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& Radio__Cause_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.Radio_Cause.");
return single_value->field_iEI;
}

BITSTRING_template& Radio__Cause_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& Radio__Cause_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.Radio_Cause.");
return single_value->field_ext;
}

LIN2__2a_template& Radio__Cause_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& Radio__Cause_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.Radio_Cause.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& Radio__Cause_template::radio__Cause__Value()
{
set_specific();
return single_value->field_radio__Cause__Value;
}

const OCTETSTRING_template& Radio__Cause_template::radio__Cause__Value() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field radio_Cause_Value of a non-specific template of type @BSSGP_Types.Radio_Cause.");
return single_value->field_radio__Cause__Value;
}

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

void Radio__Cause_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", radio_Cause_Value := ");
single_value->field_radio__Cause__Value.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 Radio__Cause_template::log_match(const Radio__Cause& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_radio__Cause__Value.match(match_value.radio__Cause__Value(), legacy)){
TTCN_Logger::log_logmatch_info(".radio_Cause_Value");
single_value->field_radio__Cause__Value.log_match(match_value.radio__Cause__Value(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", radio_Cause_Value := ");
single_value->field_radio__Cause__Value.log_match(match_value.radio__Cause__Value(), 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 Radio__Cause_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (radio__Cause__Value().is_bound()) radio__Cause__Value().set_implicit_omit();
}

void Radio__Cause_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_radio__Cause__Value.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 @BSSGP_Types.Radio_Cause.");
}
}

void Radio__Cause_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_radio__Cause__Value.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 Radio__Cause_template[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 @BSSGP_Types.Radio_Cause.");
}
}

void Radio__Cause_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: {
    Radio__Cause_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 @BSSGP_Types.Radio_Cause 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) radio__Cause__Value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "radio_Cause_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          radio__Cause__Value().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 @BSSGP_Types.Radio_Cause: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Radio__Cause_template* precondition = new Radio__Cause_template;
    precondition->set_param(*param.get_elem(0));
    Radio__Cause_template* implied_template = new Radio__Cause_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Radio__Cause_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.Radio_Cause");
  }
  is_ifpresent = param.get_ifpresent();
}

void Radio__Cause_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Radio_Cause");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Radio_Cause");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Radio_Cause");
single_value->field_radio__Cause__Value.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Radio_Cause");
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 : "@BSSGP_Types.Radio_Cause");
}

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

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

RA__Cap__UPD__CAUSE::RA__Cap__UPD__CAUSE()
{
}

RA__Cap__UPD__CAUSE::RA__Cap__UPD__CAUSE(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_rA__CAP__UPD__Cause__value)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_rA__CAP__UPD__Cause__value(par_rA__CAP__UPD__Cause__value)
{
}

RA__Cap__UPD__CAUSE::RA__Cap__UPD__CAUSE(const RA__Cap__UPD__CAUSE& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.RA_Cap_UPD_CAUSE.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.rA__CAP__UPD__Cause__value().is_bound()) field_rA__CAP__UPD__Cause__value = other_value.rA__CAP__UPD__Cause__value();
else field_rA__CAP__UPD__Cause__value.clean_up();
}

void RA__Cap__UPD__CAUSE::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_rA__CAP__UPD__Cause__value.clean_up();
}

const TTCN_Typedescriptor_t* RA__Cap__UPD__CAUSE::get_descriptor() const { return &RA__Cap__UPD__CAUSE_descr_; }
RA__Cap__UPD__CAUSE& RA__Cap__UPD__CAUSE::operator=(const RA__Cap__UPD__CAUSE& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.RA_Cap_UPD_CAUSE.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.rA__CAP__UPD__Cause__value().is_bound()) field_rA__CAP__UPD__Cause__value = other_value.rA__CAP__UPD__Cause__value();
  else field_rA__CAP__UPD__Cause__value.clean_up();
}
return *this;
}

boolean RA__Cap__UPD__CAUSE::operator==(const RA__Cap__UPD__CAUSE& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_rA__CAP__UPD__Cause__value==other_value.field_rA__CAP__UPD__Cause__value;
}

boolean RA__Cap__UPD__CAUSE::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_rA__CAP__UPD__Cause__value.is_bound());
}
boolean RA__Cap__UPD__CAUSE::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_rA__CAP__UPD__Cause__value.is_value();
}
void RA__Cap__UPD__CAUSE::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", rA_CAP_UPD_Cause_value := ");
field_rA__CAP__UPD__Cause__value.log();
TTCN_Logger::log_event_str(" }");
}

void RA__Cap__UPD__CAUSE::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (rA__CAP__UPD__Cause__value().is_bound()) rA__CAP__UPD__Cause__value().set_implicit_omit();
}

void RA__Cap__UPD__CAUSE::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 @BSSGP_Types.RA_Cap_UPD_CAUSE 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rA__CAP__UPD__Cause__value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rA_CAP_UPD_Cause_value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rA__CAP__UPD__Cause__value().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 @BSSGP_Types.RA_Cap_UPD_CAUSE: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.RA_Cap_UPD_CAUSE");
  }
}

void RA__Cap__UPD__CAUSE::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_rA__CAP__UPD__Cause__value.encode_text(text_buf);
}

void RA__Cap__UPD__CAUSE::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_rA__CAP__UPD__Cause__value.decode_text(text_buf);
}

void RA__Cap__UPD__CAUSE::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 RA__Cap__UPD__CAUSE::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 RA__Cap__UPD__CAUSE::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, RA__Cap__UPD__CAUSE_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(RA__Cap__UPD__CAUSE_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, RA__Cap__UPD__CAUSE_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(RA__Cap__UPD__CAUSE_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_rA__CAP__UPD__Cause__value.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_43) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int RA__Cap__UPD__CAUSE::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RA__Cap__UPD__CAUSE_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, RA__Cap__UPD__CAUSE_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT1_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(RA__Cap__UPD__CAUSE_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(RA__Cap__UPD__CAUSE_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_rA__CAP__UPD__Cause__value.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(RA__Cap__UPD__CAUSE_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(RA__Cap__UPD__CAUSE_ext_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_iEI !=  os_43) {
  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){
   os_43.RAW_encode(General__Types::OCT1_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 RA__Cap__UPD__CAUSE_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_rA__CAP__UPD__Cause__value;
};

void RA__Cap__UPD__CAUSE_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_rA__CAP__UPD__Cause__value = ANY_VALUE;
}
}
}

void RA__Cap__UPD__CAUSE_template::copy_value(const RA__Cap__UPD__CAUSE& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.rA__CAP__UPD__Cause__value().is_bound()) {
  single_value->field_rA__CAP__UPD__Cause__value = other_value.rA__CAP__UPD__Cause__value();
} else {
  single_value->field_rA__CAP__UPD__Cause__value.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RA__Cap__UPD__CAUSE_template::copy_template(const RA__Cap__UPD__CAUSE_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rA__CAP__UPD__Cause__value().get_selection()) {
single_value->field_rA__CAP__UPD__Cause__value = other_value.rA__CAP__UPD__Cause__value();
} else {
single_value->field_rA__CAP__UPD__Cause__value.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 RA__Cap__UPD__CAUSE_template[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 RA__Cap__UPD__CAUSE_template(*other_value.implication_.precondition);
implication_.implied_template = new RA__Cap__UPD__CAUSE_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 @BSSGP_Types.RA_Cap_UPD_CAUSE.");
break;
}
set_selection(other_value);
}

RA__Cap__UPD__CAUSE_template::RA__Cap__UPD__CAUSE_template()
{
}

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

RA__Cap__UPD__CAUSE_template::RA__Cap__UPD__CAUSE_template(const RA__Cap__UPD__CAUSE& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean RA__Cap__UPD__CAUSE_template::match(const RA__Cap__UPD__CAUSE& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.rA__CAP__UPD__Cause__value().is_bound()) return FALSE;
if(!single_value->field_rA__CAP__UPD__Cause__value.match(other_value.rA__CAP__UPD__Cause__value(), 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 @BSSGP_Types.RA_Cap_UPD_CAUSE.");
}
return FALSE;
}

boolean RA__Cap__UPD__CAUSE_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_rA__CAP__UPD__Cause__value.is_bound();
}

boolean RA__Cap__UPD__CAUSE_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_rA__CAP__UPD__Cause__value.is_value();
}

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

RA__Cap__UPD__CAUSE RA__Cap__UPD__CAUSE_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 @BSSGP_Types.RA_Cap_UPD_CAUSE.");
RA__Cap__UPD__CAUSE ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_rA__CAP__UPD__Cause__value.is_bound()) {
ret_val.rA__CAP__UPD__Cause__value() = single_value->field_rA__CAP__UPD__Cause__value.valueof();
}
return ret_val;
}

void RA__Cap__UPD__CAUSE_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 @BSSGP_Types.RA_Cap_UPD_CAUSE.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RA__Cap__UPD__CAUSE_template[list_length];
}

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

OCTETSTRING_template& RA__Cap__UPD__CAUSE_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& RA__Cap__UPD__CAUSE_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.RA_Cap_UPD_CAUSE.");
return single_value->field_iEI;
}

BITSTRING_template& RA__Cap__UPD__CAUSE_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& RA__Cap__UPD__CAUSE_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.RA_Cap_UPD_CAUSE.");
return single_value->field_ext;
}

LIN2__2a_template& RA__Cap__UPD__CAUSE_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& RA__Cap__UPD__CAUSE_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.RA_Cap_UPD_CAUSE.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& RA__Cap__UPD__CAUSE_template::rA__CAP__UPD__Cause__value()
{
set_specific();
return single_value->field_rA__CAP__UPD__Cause__value;
}

const OCTETSTRING_template& RA__Cap__UPD__CAUSE_template::rA__CAP__UPD__Cause__value() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rA_CAP_UPD_Cause_value of a non-specific template of type @BSSGP_Types.RA_Cap_UPD_CAUSE.");
return single_value->field_rA__CAP__UPD__Cause__value;
}

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

void RA__Cap__UPD__CAUSE_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", rA_CAP_UPD_Cause_value := ");
single_value->field_rA__CAP__UPD__Cause__value.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 RA__Cap__UPD__CAUSE_template::log_match(const RA__Cap__UPD__CAUSE& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rA__CAP__UPD__Cause__value.match(match_value.rA__CAP__UPD__Cause__value(), legacy)){
TTCN_Logger::log_logmatch_info(".rA_CAP_UPD_Cause_value");
single_value->field_rA__CAP__UPD__Cause__value.log_match(match_value.rA__CAP__UPD__Cause__value(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", rA_CAP_UPD_Cause_value := ");
single_value->field_rA__CAP__UPD__Cause__value.log_match(match_value.rA__CAP__UPD__Cause__value(), 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 RA__Cap__UPD__CAUSE_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (rA__CAP__UPD__Cause__value().is_bound()) rA__CAP__UPD__Cause__value().set_implicit_omit();
}

void RA__Cap__UPD__CAUSE_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_rA__CAP__UPD__Cause__value.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 @BSSGP_Types.RA_Cap_UPD_CAUSE.");
}
}

void RA__Cap__UPD__CAUSE_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_rA__CAP__UPD__Cause__value.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 RA__Cap__UPD__CAUSE_template[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 @BSSGP_Types.RA_Cap_UPD_CAUSE.");
}
}

void RA__Cap__UPD__CAUSE_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: {
    RA__Cap__UPD__CAUSE_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 @BSSGP_Types.RA_Cap_UPD_CAUSE 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rA__CAP__UPD__Cause__value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rA_CAP_UPD_Cause_value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rA__CAP__UPD__Cause__value().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 @BSSGP_Types.RA_Cap_UPD_CAUSE: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    RA__Cap__UPD__CAUSE_template* precondition = new RA__Cap__UPD__CAUSE_template;
    precondition->set_param(*param.get_elem(0));
    RA__Cap__UPD__CAUSE_template* implied_template = new RA__Cap__UPD__CAUSE_template;
    implied_template->set_param(*param.get_elem(1));
    *this = RA__Cap__UPD__CAUSE_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.RA_Cap_UPD_CAUSE");
  }
  is_ifpresent = param.get_ifpresent();
}

void RA__Cap__UPD__CAUSE_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RA_Cap_UPD_CAUSE");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RA_Cap_UPD_CAUSE");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RA_Cap_UPD_CAUSE");
single_value->field_rA__CAP__UPD__Cause__value.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RA_Cap_UPD_CAUSE");
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 : "@BSSGP_Types.RA_Cap_UPD_CAUSE");
}

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

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

Routeing__Area::Routeing__Area()
{
}

Routeing__Area::Routeing__Area(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const HEXSTRING& par_mccDigit1,
    const HEXSTRING& par_mccDigit2,
    const HEXSTRING& par_mccDigit3,
    const HEXSTRING& par_mncDigit3,
    const HEXSTRING& par_mncDigit1,
    const HEXSTRING& par_mncDigit2,
    const OCTETSTRING& par_lac,
    const OCTETSTRING& par_rac)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_mccDigit1(par_mccDigit1),
  field_mccDigit2(par_mccDigit2),
  field_mccDigit3(par_mccDigit3),
  field_mncDigit3(par_mncDigit3),
  field_mncDigit1(par_mncDigit1),
  field_mncDigit2(par_mncDigit2),
  field_lac(par_lac),
  field_rac(par_rac)
{
}

Routeing__Area::Routeing__Area(const Routeing__Area& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.Routeing_Area.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.mccDigit1().is_bound()) field_mccDigit1 = other_value.mccDigit1();
else field_mccDigit1.clean_up();
if (other_value.mccDigit2().is_bound()) field_mccDigit2 = other_value.mccDigit2();
else field_mccDigit2.clean_up();
if (other_value.mccDigit3().is_bound()) field_mccDigit3 = other_value.mccDigit3();
else field_mccDigit3.clean_up();
if (other_value.mncDigit3().is_bound()) field_mncDigit3 = other_value.mncDigit3();
else field_mncDigit3.clean_up();
if (other_value.mncDigit1().is_bound()) field_mncDigit1 = other_value.mncDigit1();
else field_mncDigit1.clean_up();
if (other_value.mncDigit2().is_bound()) field_mncDigit2 = other_value.mncDigit2();
else field_mncDigit2.clean_up();
if (other_value.lac().is_bound()) field_lac = other_value.lac();
else field_lac.clean_up();
if (other_value.rac().is_bound()) field_rac = other_value.rac();
else field_rac.clean_up();
}

void Routeing__Area::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_mccDigit1.clean_up();
field_mccDigit2.clean_up();
field_mccDigit3.clean_up();
field_mncDigit3.clean_up();
field_mncDigit1.clean_up();
field_mncDigit2.clean_up();
field_lac.clean_up();
field_rac.clean_up();
}

const TTCN_Typedescriptor_t* Routeing__Area::get_descriptor() const { return &Routeing__Area_descr_; }
Routeing__Area& Routeing__Area::operator=(const Routeing__Area& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.Routeing_Area.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.mccDigit1().is_bound()) field_mccDigit1 = other_value.mccDigit1();
  else field_mccDigit1.clean_up();
  if (other_value.mccDigit2().is_bound()) field_mccDigit2 = other_value.mccDigit2();
  else field_mccDigit2.clean_up();
  if (other_value.mccDigit3().is_bound()) field_mccDigit3 = other_value.mccDigit3();
  else field_mccDigit3.clean_up();
  if (other_value.mncDigit3().is_bound()) field_mncDigit3 = other_value.mncDigit3();
  else field_mncDigit3.clean_up();
  if (other_value.mncDigit1().is_bound()) field_mncDigit1 = other_value.mncDigit1();
  else field_mncDigit1.clean_up();
  if (other_value.mncDigit2().is_bound()) field_mncDigit2 = other_value.mncDigit2();
  else field_mncDigit2.clean_up();
  if (other_value.lac().is_bound()) field_lac = other_value.lac();
  else field_lac.clean_up();
  if (other_value.rac().is_bound()) field_rac = other_value.rac();
  else field_rac.clean_up();
}
return *this;
}

boolean Routeing__Area::operator==(const Routeing__Area& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_mccDigit1==other_value.field_mccDigit1
  && field_mccDigit2==other_value.field_mccDigit2
  && field_mccDigit3==other_value.field_mccDigit3
  && field_mncDigit3==other_value.field_mncDigit3
  && field_mncDigit1==other_value.field_mncDigit1
  && field_mncDigit2==other_value.field_mncDigit2
  && field_lac==other_value.field_lac
  && field_rac==other_value.field_rac;
}

boolean Routeing__Area::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_mccDigit1.is_bound())
  || (field_mccDigit2.is_bound())
  || (field_mccDigit3.is_bound())
  || (field_mncDigit3.is_bound())
  || (field_mncDigit1.is_bound())
  || (field_mncDigit2.is_bound())
  || (field_lac.is_bound())
  || (field_rac.is_bound());
}
boolean Routeing__Area::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_mccDigit1.is_value()
  && field_mccDigit2.is_value()
  && field_mccDigit3.is_value()
  && field_mncDigit3.is_value()
  && field_mncDigit1.is_value()
  && field_mncDigit2.is_value()
  && field_lac.is_value()
  && field_rac.is_value();
}
void Routeing__Area::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", mccDigit1 := ");
field_mccDigit1.log();
TTCN_Logger::log_event_str(", mccDigit2 := ");
field_mccDigit2.log();
TTCN_Logger::log_event_str(", mccDigit3 := ");
field_mccDigit3.log();
TTCN_Logger::log_event_str(", mncDigit3 := ");
field_mncDigit3.log();
TTCN_Logger::log_event_str(", mncDigit1 := ");
field_mncDigit1.log();
TTCN_Logger::log_event_str(", mncDigit2 := ");
field_mncDigit2.log();
TTCN_Logger::log_event_str(", lac := ");
field_lac.log();
TTCN_Logger::log_event_str(", rac := ");
field_rac.log();
TTCN_Logger::log_event_str(" }");
}

void Routeing__Area::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (mccDigit1().is_bound()) mccDigit1().set_implicit_omit();
if (mccDigit2().is_bound()) mccDigit2().set_implicit_omit();
if (mccDigit3().is_bound()) mccDigit3().set_implicit_omit();
if (mncDigit3().is_bound()) mncDigit3().set_implicit_omit();
if (mncDigit1().is_bound()) mncDigit1().set_implicit_omit();
if (mncDigit2().is_bound()) mncDigit2().set_implicit_omit();
if (lac().is_bound()) lac().set_implicit_omit();
if (rac().is_bound()) rac().set_implicit_omit();
}

void Routeing__Area::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (11<param.get_size()) {
      param.error("record value of type @BSSGP_Types.Routeing_Area has 11 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) mccDigit1().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) mccDigit2().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) mccDigit3().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) mncDigit3().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) mncDigit1().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) mncDigit2().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) lac().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) rac().set_param(*param.get_elem(10));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mccDigit1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mccDigit1().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mccDigit2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mccDigit2().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mccDigit3")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mccDigit3().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mncDigit3")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mncDigit3().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mncDigit1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mncDigit1().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mncDigit2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mncDigit2().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lac")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lac().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rac")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rac().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 @BSSGP_Types.Routeing_Area: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.Routeing_Area");
  }
}

void Routeing__Area::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_mccDigit1.encode_text(text_buf);
field_mccDigit2.encode_text(text_buf);
field_mccDigit3.encode_text(text_buf);
field_mncDigit3.encode_text(text_buf);
field_mncDigit1.encode_text(text_buf);
field_mncDigit2.encode_text(text_buf);
field_lac.encode_text(text_buf);
field_rac.encode_text(text_buf);
}

void Routeing__Area::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_mccDigit1.decode_text(text_buf);
field_mccDigit2.decode_text(text_buf);
field_mccDigit3.decode_text(text_buf);
field_mncDigit3.decode_text(text_buf);
field_mncDigit1.decode_text(text_buf);
field_mncDigit2.decode_text(text_buf);
field_lac.decode_text(text_buf);
field_rac.decode_text(text_buf);
}

void Routeing__Area::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 Routeing__Area::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 Routeing__Area::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, Routeing__Area_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(Routeing__Area_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, Routeing__Area_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(Routeing__Area_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::HEX1_descr_.raw->forceomit);
  decoded_field_length = field_mccDigit1.RAW_decode(General__Types::HEX1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::HEX1_descr_.raw->forceomit);
  decoded_field_length = field_mccDigit2.RAW_decode(General__Types::HEX1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::HEX1_descr_.raw->forceomit);
  decoded_field_length = field_mccDigit3.RAW_decode(General__Types::HEX1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, no_err, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_6_force_omit(6, force_omit, General__Types::HEX1_descr_.raw->forceomit);
  decoded_field_length = field_mncDigit3.RAW_decode(General__Types::HEX1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_7_force_omit(7, force_omit, General__Types::HEX1_descr_.raw->forceomit);
  decoded_field_length = field_mncDigit1.RAW_decode(General__Types::HEX1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, no_err, -1, TRUE, &field_7_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_8_force_omit(8, force_omit, General__Types::HEX1_descr_.raw->forceomit);
  decoded_field_length = field_mncDigit2.RAW_decode(General__Types::HEX1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_9_force_omit(9, force_omit, General__Types::OCT2_descr_.raw->forceomit);
  decoded_field_length = field_lac.RAW_decode(General__Types::OCT2_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_10_force_omit(10, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_rac.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_33) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Routeing__Area::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 11;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(11);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Routeing__Area_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Routeing__Area_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::HEX1_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::HEX1_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::HEX1_descr_.raw);
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, General__Types::HEX1_descr_.raw);
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, General__Types::HEX1_descr_.raw);
  myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, General__Types::HEX1_descr_.raw);
  myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, General__Types::OCT2_descr_.raw);
  myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 10, General__Types::OCT1_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(Routeing__Area_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(Routeing__Area_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_mccDigit1.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_mccDigit2.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_mccDigit3.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[5]);
  encoded_length += field_mncDigit3.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[6]);
  encoded_length += field_mncDigit1.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[7]);
  encoded_length += field_mncDigit2.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[8]);
  encoded_length += field_lac.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[9]);
  encoded_length += field_rac.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[10]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(8);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[4]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[4]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[5]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[5]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[6]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[6]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[4].level = myleaf.body.node.nodes[7]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[4].pos = myleaf.body.node.nodes[7]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[5].level = myleaf.body.node.nodes[8]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[5].pos = myleaf.body.node.nodes[8]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[6].level = myleaf.body.node.nodes[9]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[6].pos = myleaf.body.node.nodes[9]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[7].level = myleaf.body.node.nodes[10]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[7].pos = myleaf.body.node.nodes[10]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Routeing__Area_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Routeing__Area_ext_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_iEI !=  os_33) {
  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){
   os_33.RAW_encode(General__Types::OCT1_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 Routeing__Area_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
HEXSTRING_template field_mccDigit1;
HEXSTRING_template field_mccDigit2;
HEXSTRING_template field_mccDigit3;
HEXSTRING_template field_mncDigit3;
HEXSTRING_template field_mncDigit1;
HEXSTRING_template field_mncDigit2;
OCTETSTRING_template field_lac;
OCTETSTRING_template field_rac;
};

void Routeing__Area_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_mccDigit1 = ANY_VALUE;
single_value->field_mccDigit2 = ANY_VALUE;
single_value->field_mccDigit3 = ANY_VALUE;
single_value->field_mncDigit3 = ANY_VALUE;
single_value->field_mncDigit1 = ANY_VALUE;
single_value->field_mncDigit2 = ANY_VALUE;
single_value->field_lac = ANY_VALUE;
single_value->field_rac = ANY_VALUE;
}
}
}

void Routeing__Area_template::copy_value(const Routeing__Area& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.mccDigit1().is_bound()) {
  single_value->field_mccDigit1 = other_value.mccDigit1();
} else {
  single_value->field_mccDigit1.clean_up();
}
if (other_value.mccDigit2().is_bound()) {
  single_value->field_mccDigit2 = other_value.mccDigit2();
} else {
  single_value->field_mccDigit2.clean_up();
}
if (other_value.mccDigit3().is_bound()) {
  single_value->field_mccDigit3 = other_value.mccDigit3();
} else {
  single_value->field_mccDigit3.clean_up();
}
if (other_value.mncDigit3().is_bound()) {
  single_value->field_mncDigit3 = other_value.mncDigit3();
} else {
  single_value->field_mncDigit3.clean_up();
}
if (other_value.mncDigit1().is_bound()) {
  single_value->field_mncDigit1 = other_value.mncDigit1();
} else {
  single_value->field_mncDigit1.clean_up();
}
if (other_value.mncDigit2().is_bound()) {
  single_value->field_mncDigit2 = other_value.mncDigit2();
} else {
  single_value->field_mncDigit2.clean_up();
}
if (other_value.lac().is_bound()) {
  single_value->field_lac = other_value.lac();
} else {
  single_value->field_lac.clean_up();
}
if (other_value.rac().is_bound()) {
  single_value->field_rac = other_value.rac();
} else {
  single_value->field_rac.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Routeing__Area_template::copy_template(const Routeing__Area_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.mccDigit1().get_selection()) {
single_value->field_mccDigit1 = other_value.mccDigit1();
} else {
single_value->field_mccDigit1.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.mccDigit2().get_selection()) {
single_value->field_mccDigit2 = other_value.mccDigit2();
} else {
single_value->field_mccDigit2.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.mccDigit3().get_selection()) {
single_value->field_mccDigit3 = other_value.mccDigit3();
} else {
single_value->field_mccDigit3.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.mncDigit3().get_selection()) {
single_value->field_mncDigit3 = other_value.mncDigit3();
} else {
single_value->field_mncDigit3.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.mncDigit1().get_selection()) {
single_value->field_mncDigit1 = other_value.mncDigit1();
} else {
single_value->field_mncDigit1.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.mncDigit2().get_selection()) {
single_value->field_mncDigit2 = other_value.mncDigit2();
} else {
single_value->field_mncDigit2.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lac().get_selection()) {
single_value->field_lac = other_value.lac();
} else {
single_value->field_lac.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rac().get_selection()) {
single_value->field_rac = other_value.rac();
} else {
single_value->field_rac.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 Routeing__Area_template[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 Routeing__Area_template(*other_value.implication_.precondition);
implication_.implied_template = new Routeing__Area_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 @BSSGP_Types.Routeing_Area.");
break;
}
set_selection(other_value);
}

Routeing__Area_template::Routeing__Area_template()
{
}

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

Routeing__Area_template::Routeing__Area_template(const Routeing__Area& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean Routeing__Area_template::match(const Routeing__Area& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.mccDigit1().is_bound()) return FALSE;
if(!single_value->field_mccDigit1.match(other_value.mccDigit1(), legacy))return FALSE;
if(!other_value.mccDigit2().is_bound()) return FALSE;
if(!single_value->field_mccDigit2.match(other_value.mccDigit2(), legacy))return FALSE;
if(!other_value.mccDigit3().is_bound()) return FALSE;
if(!single_value->field_mccDigit3.match(other_value.mccDigit3(), legacy))return FALSE;
if(!other_value.mncDigit3().is_bound()) return FALSE;
if(!single_value->field_mncDigit3.match(other_value.mncDigit3(), legacy))return FALSE;
if(!other_value.mncDigit1().is_bound()) return FALSE;
if(!single_value->field_mncDigit1.match(other_value.mncDigit1(), legacy))return FALSE;
if(!other_value.mncDigit2().is_bound()) return FALSE;
if(!single_value->field_mncDigit2.match(other_value.mncDigit2(), legacy))return FALSE;
if(!other_value.lac().is_bound()) return FALSE;
if(!single_value->field_lac.match(other_value.lac(), legacy))return FALSE;
if(!other_value.rac().is_bound()) return FALSE;
if(!single_value->field_rac.match(other_value.rac(), 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 @BSSGP_Types.Routeing_Area.");
}
return FALSE;
}

boolean Routeing__Area_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_mccDigit1.is_bound()
 || single_value->field_mccDigit2.is_bound()
 || single_value->field_mccDigit3.is_bound()
 || single_value->field_mncDigit3.is_bound()
 || single_value->field_mncDigit1.is_bound()
 || single_value->field_mncDigit2.is_bound()
 || single_value->field_lac.is_bound()
 || single_value->field_rac.is_bound();
}

boolean Routeing__Area_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_mccDigit1.is_value()
 && single_value->field_mccDigit2.is_value()
 && single_value->field_mccDigit3.is_value()
 && single_value->field_mncDigit3.is_value()
 && single_value->field_mncDigit1.is_value()
 && single_value->field_mncDigit2.is_value()
 && single_value->field_lac.is_value()
 && single_value->field_rac.is_value();
}

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

Routeing__Area Routeing__Area_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 @BSSGP_Types.Routeing_Area.");
Routeing__Area ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_mccDigit1.is_bound()) {
ret_val.mccDigit1() = single_value->field_mccDigit1.valueof();
}
if (single_value->field_mccDigit2.is_bound()) {
ret_val.mccDigit2() = single_value->field_mccDigit2.valueof();
}
if (single_value->field_mccDigit3.is_bound()) {
ret_val.mccDigit3() = single_value->field_mccDigit3.valueof();
}
if (single_value->field_mncDigit3.is_bound()) {
ret_val.mncDigit3() = single_value->field_mncDigit3.valueof();
}
if (single_value->field_mncDigit1.is_bound()) {
ret_val.mncDigit1() = single_value->field_mncDigit1.valueof();
}
if (single_value->field_mncDigit2.is_bound()) {
ret_val.mncDigit2() = single_value->field_mncDigit2.valueof();
}
if (single_value->field_lac.is_bound()) {
ret_val.lac() = single_value->field_lac.valueof();
}
if (single_value->field_rac.is_bound()) {
ret_val.rac() = single_value->field_rac.valueof();
}
return ret_val;
}

void Routeing__Area_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 @BSSGP_Types.Routeing_Area.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Routeing__Area_template[list_length];
}

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

OCTETSTRING_template& Routeing__Area_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& Routeing__Area_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.Routeing_Area.");
return single_value->field_iEI;
}

BITSTRING_template& Routeing__Area_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& Routeing__Area_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.Routeing_Area.");
return single_value->field_ext;
}

LIN2__2a_template& Routeing__Area_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& Routeing__Area_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.Routeing_Area.");
return single_value->field_lengthIndicator;
}

HEXSTRING_template& Routeing__Area_template::mccDigit1()
{
set_specific();
return single_value->field_mccDigit1;
}

const HEXSTRING_template& Routeing__Area_template::mccDigit1() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mccDigit1 of a non-specific template of type @BSSGP_Types.Routeing_Area.");
return single_value->field_mccDigit1;
}

HEXSTRING_template& Routeing__Area_template::mccDigit2()
{
set_specific();
return single_value->field_mccDigit2;
}

const HEXSTRING_template& Routeing__Area_template::mccDigit2() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mccDigit2 of a non-specific template of type @BSSGP_Types.Routeing_Area.");
return single_value->field_mccDigit2;
}

HEXSTRING_template& Routeing__Area_template::mccDigit3()
{
set_specific();
return single_value->field_mccDigit3;
}

const HEXSTRING_template& Routeing__Area_template::mccDigit3() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mccDigit3 of a non-specific template of type @BSSGP_Types.Routeing_Area.");
return single_value->field_mccDigit3;
}

HEXSTRING_template& Routeing__Area_template::mncDigit3()
{
set_specific();
return single_value->field_mncDigit3;
}

const HEXSTRING_template& Routeing__Area_template::mncDigit3() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mncDigit3 of a non-specific template of type @BSSGP_Types.Routeing_Area.");
return single_value->field_mncDigit3;
}

HEXSTRING_template& Routeing__Area_template::mncDigit1()
{
set_specific();
return single_value->field_mncDigit1;
}

const HEXSTRING_template& Routeing__Area_template::mncDigit1() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mncDigit1 of a non-specific template of type @BSSGP_Types.Routeing_Area.");
return single_value->field_mncDigit1;
}

HEXSTRING_template& Routeing__Area_template::mncDigit2()
{
set_specific();
return single_value->field_mncDigit2;
}

const HEXSTRING_template& Routeing__Area_template::mncDigit2() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mncDigit2 of a non-specific template of type @BSSGP_Types.Routeing_Area.");
return single_value->field_mncDigit2;
}

OCTETSTRING_template& Routeing__Area_template::lac()
{
set_specific();
return single_value->field_lac;
}

const OCTETSTRING_template& Routeing__Area_template::lac() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lac of a non-specific template of type @BSSGP_Types.Routeing_Area.");
return single_value->field_lac;
}

OCTETSTRING_template& Routeing__Area_template::rac()
{
set_specific();
return single_value->field_rac;
}

const OCTETSTRING_template& Routeing__Area_template::rac() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rac of a non-specific template of type @BSSGP_Types.Routeing_Area.");
return single_value->field_rac;
}

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

void Routeing__Area_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", mccDigit1 := ");
single_value->field_mccDigit1.log();
TTCN_Logger::log_event_str(", mccDigit2 := ");
single_value->field_mccDigit2.log();
TTCN_Logger::log_event_str(", mccDigit3 := ");
single_value->field_mccDigit3.log();
TTCN_Logger::log_event_str(", mncDigit3 := ");
single_value->field_mncDigit3.log();
TTCN_Logger::log_event_str(", mncDigit1 := ");
single_value->field_mncDigit1.log();
TTCN_Logger::log_event_str(", mncDigit2 := ");
single_value->field_mncDigit2.log();
TTCN_Logger::log_event_str(", lac := ");
single_value->field_lac.log();
TTCN_Logger::log_event_str(", rac := ");
single_value->field_rac.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 Routeing__Area_template::log_match(const Routeing__Area& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_mccDigit1.match(match_value.mccDigit1(), legacy)){
TTCN_Logger::log_logmatch_info(".mccDigit1");
single_value->field_mccDigit1.log_match(match_value.mccDigit1(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_mccDigit2.match(match_value.mccDigit2(), legacy)){
TTCN_Logger::log_logmatch_info(".mccDigit2");
single_value->field_mccDigit2.log_match(match_value.mccDigit2(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_mccDigit3.match(match_value.mccDigit3(), legacy)){
TTCN_Logger::log_logmatch_info(".mccDigit3");
single_value->field_mccDigit3.log_match(match_value.mccDigit3(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_mncDigit3.match(match_value.mncDigit3(), legacy)){
TTCN_Logger::log_logmatch_info(".mncDigit3");
single_value->field_mncDigit3.log_match(match_value.mncDigit3(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_mncDigit1.match(match_value.mncDigit1(), legacy)){
TTCN_Logger::log_logmatch_info(".mncDigit1");
single_value->field_mncDigit1.log_match(match_value.mncDigit1(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_mncDigit2.match(match_value.mncDigit2(), legacy)){
TTCN_Logger::log_logmatch_info(".mncDigit2");
single_value->field_mncDigit2.log_match(match_value.mncDigit2(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lac.match(match_value.lac(), legacy)){
TTCN_Logger::log_logmatch_info(".lac");
single_value->field_lac.log_match(match_value.lac(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rac.match(match_value.rac(), legacy)){
TTCN_Logger::log_logmatch_info(".rac");
single_value->field_rac.log_match(match_value.rac(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", mccDigit1 := ");
single_value->field_mccDigit1.log_match(match_value.mccDigit1(), legacy);
TTCN_Logger::log_event_str(", mccDigit2 := ");
single_value->field_mccDigit2.log_match(match_value.mccDigit2(), legacy);
TTCN_Logger::log_event_str(", mccDigit3 := ");
single_value->field_mccDigit3.log_match(match_value.mccDigit3(), legacy);
TTCN_Logger::log_event_str(", mncDigit3 := ");
single_value->field_mncDigit3.log_match(match_value.mncDigit3(), legacy);
TTCN_Logger::log_event_str(", mncDigit1 := ");
single_value->field_mncDigit1.log_match(match_value.mncDigit1(), legacy);
TTCN_Logger::log_event_str(", mncDigit2 := ");
single_value->field_mncDigit2.log_match(match_value.mncDigit2(), legacy);
TTCN_Logger::log_event_str(", lac := ");
single_value->field_lac.log_match(match_value.lac(), legacy);
TTCN_Logger::log_event_str(", rac := ");
single_value->field_rac.log_match(match_value.rac(), 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 Routeing__Area_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (mccDigit1().is_bound()) mccDigit1().set_implicit_omit();
if (mccDigit2().is_bound()) mccDigit2().set_implicit_omit();
if (mccDigit3().is_bound()) mccDigit3().set_implicit_omit();
if (mncDigit3().is_bound()) mncDigit3().set_implicit_omit();
if (mncDigit1().is_bound()) mncDigit1().set_implicit_omit();
if (mncDigit2().is_bound()) mncDigit2().set_implicit_omit();
if (lac().is_bound()) lac().set_implicit_omit();
if (rac().is_bound()) rac().set_implicit_omit();
}

void Routeing__Area_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_mccDigit1.encode_text(text_buf);
single_value->field_mccDigit2.encode_text(text_buf);
single_value->field_mccDigit3.encode_text(text_buf);
single_value->field_mncDigit3.encode_text(text_buf);
single_value->field_mncDigit1.encode_text(text_buf);
single_value->field_mncDigit2.encode_text(text_buf);
single_value->field_lac.encode_text(text_buf);
single_value->field_rac.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 @BSSGP_Types.Routeing_Area.");
}
}

void Routeing__Area_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_mccDigit1.decode_text(text_buf);
single_value->field_mccDigit2.decode_text(text_buf);
single_value->field_mccDigit3.decode_text(text_buf);
single_value->field_mncDigit3.decode_text(text_buf);
single_value->field_mncDigit1.decode_text(text_buf);
single_value->field_mncDigit2.decode_text(text_buf);
single_value->field_lac.decode_text(text_buf);
single_value->field_rac.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 Routeing__Area_template[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 @BSSGP_Types.Routeing_Area.");
}
}

void Routeing__Area_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: {
    Routeing__Area_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (11<param.get_size()) {
      param.error("record template of type @BSSGP_Types.Routeing_Area has 11 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) mccDigit1().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) mccDigit2().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) mccDigit3().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) mncDigit3().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) mncDigit1().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) mncDigit2().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) lac().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) rac().set_param(*param.get_elem(10));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mccDigit1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mccDigit1().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mccDigit2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mccDigit2().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mccDigit3")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mccDigit3().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mncDigit3")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mncDigit3().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mncDigit1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mncDigit1().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mncDigit2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mncDigit2().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lac")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lac().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rac")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rac().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 @BSSGP_Types.Routeing_Area: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Routeing__Area_template* precondition = new Routeing__Area_template;
    precondition->set_param(*param.get_elem(0));
    Routeing__Area_template* implied_template = new Routeing__Area_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Routeing__Area_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.Routeing_Area");
  }
  is_ifpresent = param.get_ifpresent();
}

void Routeing__Area_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Routeing_Area");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Routeing_Area");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Routeing_Area");
single_value->field_mccDigit1.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Routeing_Area");
single_value->field_mccDigit2.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Routeing_Area");
single_value->field_mccDigit3.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Routeing_Area");
single_value->field_mncDigit3.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Routeing_Area");
single_value->field_mncDigit1.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Routeing_Area");
single_value->field_mncDigit2.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Routeing_Area");
single_value->field_lac.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Routeing_Area");
single_value->field_rac.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Routeing_Area");
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 : "@BSSGP_Types.Routeing_Area");
}

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

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

R__default__MS::R__default__MS()
{
}

R__default__MS::R__default__MS(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_r__default__MS__value)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_r__default__MS__value(par_r__default__MS__value)
{
}

R__default__MS::R__default__MS(const R__default__MS& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.R_default_MS.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.r__default__MS__value().is_bound()) field_r__default__MS__value = other_value.r__default__MS__value();
else field_r__default__MS__value.clean_up();
}

void R__default__MS::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_r__default__MS__value.clean_up();
}

const TTCN_Typedescriptor_t* R__default__MS::get_descriptor() const { return &R__default__MS_descr_; }
R__default__MS& R__default__MS::operator=(const R__default__MS& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.R_default_MS.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.r__default__MS__value().is_bound()) field_r__default__MS__value = other_value.r__default__MS__value();
  else field_r__default__MS__value.clean_up();
}
return *this;
}

boolean R__default__MS::operator==(const R__default__MS& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_r__default__MS__value==other_value.field_r__default__MS__value;
}

boolean R__default__MS::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_r__default__MS__value.is_bound());
}
boolean R__default__MS::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_r__default__MS__value.is_value();
}
void R__default__MS::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", r_default_MS_value := ");
field_r__default__MS__value.log();
TTCN_Logger::log_event_str(" }");
}

void R__default__MS::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (r__default__MS__value().is_bound()) r__default__MS__value().set_implicit_omit();
}

void R__default__MS::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 @BSSGP_Types.R_default_MS 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) r__default__MS__value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "r_default_MS_value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          r__default__MS__value().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 @BSSGP_Types.R_default_MS: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.R_default_MS");
  }
}

void R__default__MS::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_r__default__MS__value.encode_text(text_buf);
}

void R__default__MS::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_r__default__MS__value.decode_text(text_buf);
}

void R__default__MS::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 R__default__MS::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 R__default__MS::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, R__default__MS_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(R__default__MS_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, R__default__MS_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(R__default__MS_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT2_descr_.raw->forceomit);
  decoded_field_length = field_r__default__MS__value.RAW_decode(General__Types::OCT2_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_60) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int R__default__MS::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, R__default__MS_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, R__default__MS_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT2_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(R__default__MS_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(R__default__MS_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_r__default__MS__value.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(R__default__MS_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(R__default__MS_ext_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_iEI !=  os_60) {
  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){
   os_60.RAW_encode(General__Types::OCT1_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 R__default__MS_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_r__default__MS__value;
};

void R__default__MS_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_r__default__MS__value = ANY_VALUE;
}
}
}

void R__default__MS_template::copy_value(const R__default__MS& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.r__default__MS__value().is_bound()) {
  single_value->field_r__default__MS__value = other_value.r__default__MS__value();
} else {
  single_value->field_r__default__MS__value.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void R__default__MS_template::copy_template(const R__default__MS_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.r__default__MS__value().get_selection()) {
single_value->field_r__default__MS__value = other_value.r__default__MS__value();
} else {
single_value->field_r__default__MS__value.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 R__default__MS_template[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 R__default__MS_template(*other_value.implication_.precondition);
implication_.implied_template = new R__default__MS_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 @BSSGP_Types.R_default_MS.");
break;
}
set_selection(other_value);
}

R__default__MS_template::R__default__MS_template()
{
}

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

R__default__MS_template::R__default__MS_template(const R__default__MS& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean R__default__MS_template::match(const R__default__MS& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.r__default__MS__value().is_bound()) return FALSE;
if(!single_value->field_r__default__MS__value.match(other_value.r__default__MS__value(), 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 @BSSGP_Types.R_default_MS.");
}
return FALSE;
}

boolean R__default__MS_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_r__default__MS__value.is_bound();
}

boolean R__default__MS_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_r__default__MS__value.is_value();
}

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

R__default__MS R__default__MS_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 @BSSGP_Types.R_default_MS.");
R__default__MS ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_r__default__MS__value.is_bound()) {
ret_val.r__default__MS__value() = single_value->field_r__default__MS__value.valueof();
}
return ret_val;
}

void R__default__MS_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 @BSSGP_Types.R_default_MS.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new R__default__MS_template[list_length];
}

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

OCTETSTRING_template& R__default__MS_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& R__default__MS_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.R_default_MS.");
return single_value->field_iEI;
}

BITSTRING_template& R__default__MS_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& R__default__MS_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.R_default_MS.");
return single_value->field_ext;
}

LIN2__2a_template& R__default__MS_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& R__default__MS_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.R_default_MS.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& R__default__MS_template::r__default__MS__value()
{
set_specific();
return single_value->field_r__default__MS__value;
}

const OCTETSTRING_template& R__default__MS_template::r__default__MS__value() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field r_default_MS_value of a non-specific template of type @BSSGP_Types.R_default_MS.");
return single_value->field_r__default__MS__value;
}

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

void R__default__MS_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", r_default_MS_value := ");
single_value->field_r__default__MS__value.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 R__default__MS_template::log_match(const R__default__MS& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_r__default__MS__value.match(match_value.r__default__MS__value(), legacy)){
TTCN_Logger::log_logmatch_info(".r_default_MS_value");
single_value->field_r__default__MS__value.log_match(match_value.r__default__MS__value(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", r_default_MS_value := ");
single_value->field_r__default__MS__value.log_match(match_value.r__default__MS__value(), 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 R__default__MS_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (r__default__MS__value().is_bound()) r__default__MS__value().set_implicit_omit();
}

void R__default__MS_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_r__default__MS__value.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 @BSSGP_Types.R_default_MS.");
}
}

void R__default__MS_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_r__default__MS__value.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 R__default__MS_template[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 @BSSGP_Types.R_default_MS.");
}
}

void R__default__MS_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: {
    R__default__MS_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 @BSSGP_Types.R_default_MS 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) r__default__MS__value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "r_default_MS_value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          r__default__MS__value().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 @BSSGP_Types.R_default_MS: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    R__default__MS_template* precondition = new R__default__MS_template;
    precondition->set_param(*param.get_elem(0));
    R__default__MS_template* implied_template = new R__default__MS_template;
    implied_template->set_param(*param.get_elem(1));
    *this = R__default__MS_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.R_default_MS");
  }
  is_ifpresent = param.get_ifpresent();
}

void R__default__MS_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.R_default_MS");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.R_default_MS");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.R_default_MS");
single_value->field_r__default__MS__value.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.R_default_MS");
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 : "@BSSGP_Types.R_default_MS");
}

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

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

Suspend__Reference__Number::Suspend__Reference__Number()
{
}

Suspend__Reference__Number::Suspend__Reference__Number(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_suspend__Reference__Number__value)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_suspend__Reference__Number__value(par_suspend__Reference__Number__value)
{
}

Suspend__Reference__Number::Suspend__Reference__Number(const Suspend__Reference__Number& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.Suspend_Reference_Number.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.suspend__Reference__Number__value().is_bound()) field_suspend__Reference__Number__value = other_value.suspend__Reference__Number__value();
else field_suspend__Reference__Number__value.clean_up();
}

void Suspend__Reference__Number::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_suspend__Reference__Number__value.clean_up();
}

const TTCN_Typedescriptor_t* Suspend__Reference__Number::get_descriptor() const { return &Suspend__Reference__Number_descr_; }
Suspend__Reference__Number& Suspend__Reference__Number::operator=(const Suspend__Reference__Number& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.Suspend_Reference_Number.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.suspend__Reference__Number__value().is_bound()) field_suspend__Reference__Number__value = other_value.suspend__Reference__Number__value();
  else field_suspend__Reference__Number__value.clean_up();
}
return *this;
}

boolean Suspend__Reference__Number::operator==(const Suspend__Reference__Number& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_suspend__Reference__Number__value==other_value.field_suspend__Reference__Number__value;
}

boolean Suspend__Reference__Number::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_suspend__Reference__Number__value.is_bound());
}
boolean Suspend__Reference__Number::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_suspend__Reference__Number__value.is_value();
}
void Suspend__Reference__Number::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", suspend_Reference_Number_value := ");
field_suspend__Reference__Number__value.log();
TTCN_Logger::log_event_str(" }");
}

void Suspend__Reference__Number::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (suspend__Reference__Number__value().is_bound()) suspend__Reference__Number__value().set_implicit_omit();
}

void Suspend__Reference__Number::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 @BSSGP_Types.Suspend_Reference_Number 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) suspend__Reference__Number__value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "suspend_Reference_Number_value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          suspend__Reference__Number__value().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 @BSSGP_Types.Suspend_Reference_Number: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.Suspend_Reference_Number");
  }
}

void Suspend__Reference__Number::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_suspend__Reference__Number__value.encode_text(text_buf);
}

void Suspend__Reference__Number::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_suspend__Reference__Number__value.decode_text(text_buf);
}

void Suspend__Reference__Number::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 Suspend__Reference__Number::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 Suspend__Reference__Number::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, Suspend__Reference__Number_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(Suspend__Reference__Number_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, Suspend__Reference__Number_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(Suspend__Reference__Number_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_suspend__Reference__Number__value.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_45) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Suspend__Reference__Number::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Suspend__Reference__Number_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Suspend__Reference__Number_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT1_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(Suspend__Reference__Number_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(Suspend__Reference__Number_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_suspend__Reference__Number__value.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Suspend__Reference__Number_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Suspend__Reference__Number_ext_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_iEI !=  os_45) {
  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){
   os_45.RAW_encode(General__Types::OCT1_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 Suspend__Reference__Number_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_suspend__Reference__Number__value;
};

void Suspend__Reference__Number_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_suspend__Reference__Number__value = ANY_VALUE;
}
}
}

void Suspend__Reference__Number_template::copy_value(const Suspend__Reference__Number& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.suspend__Reference__Number__value().is_bound()) {
  single_value->field_suspend__Reference__Number__value = other_value.suspend__Reference__Number__value();
} else {
  single_value->field_suspend__Reference__Number__value.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Suspend__Reference__Number_template::copy_template(const Suspend__Reference__Number_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.suspend__Reference__Number__value().get_selection()) {
single_value->field_suspend__Reference__Number__value = other_value.suspend__Reference__Number__value();
} else {
single_value->field_suspend__Reference__Number__value.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 Suspend__Reference__Number_template[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 Suspend__Reference__Number_template(*other_value.implication_.precondition);
implication_.implied_template = new Suspend__Reference__Number_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 @BSSGP_Types.Suspend_Reference_Number.");
break;
}
set_selection(other_value);
}

Suspend__Reference__Number_template::Suspend__Reference__Number_template()
{
}

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

Suspend__Reference__Number_template::Suspend__Reference__Number_template(const Suspend__Reference__Number& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean Suspend__Reference__Number_template::match(const Suspend__Reference__Number& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.suspend__Reference__Number__value().is_bound()) return FALSE;
if(!single_value->field_suspend__Reference__Number__value.match(other_value.suspend__Reference__Number__value(), 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 @BSSGP_Types.Suspend_Reference_Number.");
}
return FALSE;
}

boolean Suspend__Reference__Number_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_suspend__Reference__Number__value.is_bound();
}

boolean Suspend__Reference__Number_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_suspend__Reference__Number__value.is_value();
}

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

Suspend__Reference__Number Suspend__Reference__Number_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 @BSSGP_Types.Suspend_Reference_Number.");
Suspend__Reference__Number ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_suspend__Reference__Number__value.is_bound()) {
ret_val.suspend__Reference__Number__value() = single_value->field_suspend__Reference__Number__value.valueof();
}
return ret_val;
}

void Suspend__Reference__Number_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 @BSSGP_Types.Suspend_Reference_Number.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Suspend__Reference__Number_template[list_length];
}

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

OCTETSTRING_template& Suspend__Reference__Number_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& Suspend__Reference__Number_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.Suspend_Reference_Number.");
return single_value->field_iEI;
}

BITSTRING_template& Suspend__Reference__Number_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& Suspend__Reference__Number_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.Suspend_Reference_Number.");
return single_value->field_ext;
}

LIN2__2a_template& Suspend__Reference__Number_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& Suspend__Reference__Number_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.Suspend_Reference_Number.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& Suspend__Reference__Number_template::suspend__Reference__Number__value()
{
set_specific();
return single_value->field_suspend__Reference__Number__value;
}

const OCTETSTRING_template& Suspend__Reference__Number_template::suspend__Reference__Number__value() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field suspend_Reference_Number_value of a non-specific template of type @BSSGP_Types.Suspend_Reference_Number.");
return single_value->field_suspend__Reference__Number__value;
}

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

void Suspend__Reference__Number_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", suspend_Reference_Number_value := ");
single_value->field_suspend__Reference__Number__value.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 Suspend__Reference__Number_template::log_match(const Suspend__Reference__Number& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_suspend__Reference__Number__value.match(match_value.suspend__Reference__Number__value(), legacy)){
TTCN_Logger::log_logmatch_info(".suspend_Reference_Number_value");
single_value->field_suspend__Reference__Number__value.log_match(match_value.suspend__Reference__Number__value(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", suspend_Reference_Number_value := ");
single_value->field_suspend__Reference__Number__value.log_match(match_value.suspend__Reference__Number__value(), 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 Suspend__Reference__Number_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (suspend__Reference__Number__value().is_bound()) suspend__Reference__Number__value().set_implicit_omit();
}

void Suspend__Reference__Number_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_suspend__Reference__Number__value.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 @BSSGP_Types.Suspend_Reference_Number.");
}
}

void Suspend__Reference__Number_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_suspend__Reference__Number__value.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 Suspend__Reference__Number_template[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 @BSSGP_Types.Suspend_Reference_Number.");
}
}

void Suspend__Reference__Number_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: {
    Suspend__Reference__Number_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 @BSSGP_Types.Suspend_Reference_Number 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) suspend__Reference__Number__value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "suspend_Reference_Number_value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          suspend__Reference__Number__value().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 @BSSGP_Types.Suspend_Reference_Number: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Suspend__Reference__Number_template* precondition = new Suspend__Reference__Number_template;
    precondition->set_param(*param.get_elem(0));
    Suspend__Reference__Number_template* implied_template = new Suspend__Reference__Number_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Suspend__Reference__Number_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.Suspend_Reference_Number");
  }
  is_ifpresent = param.get_ifpresent();
}

void Suspend__Reference__Number_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Suspend_Reference_Number");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Suspend_Reference_Number");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Suspend_Reference_Number");
single_value->field_suspend__Reference__Number__value.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Suspend_Reference_Number");
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 : "@BSSGP_Types.Suspend_Reference_Number");
}

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

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

Tag::Tag()
{
}

Tag::Tag(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_unstructured__Value)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_unstructured__Value(par_unstructured__Value)
{
}

Tag::Tag(const Tag& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.Tag.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.unstructured__Value().is_bound()) field_unstructured__Value = other_value.unstructured__Value();
else field_unstructured__Value.clean_up();
}

void Tag::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_unstructured__Value.clean_up();
}

const TTCN_Typedescriptor_t* Tag::get_descriptor() const { return &Tag_descr_; }
Tag& Tag::operator=(const Tag& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.Tag.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.unstructured__Value().is_bound()) field_unstructured__Value = other_value.unstructured__Value();
  else field_unstructured__Value.clean_up();
}
return *this;
}

boolean Tag::operator==(const Tag& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_unstructured__Value==other_value.field_unstructured__Value;
}

boolean Tag::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_unstructured__Value.is_bound());
}
boolean Tag::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_unstructured__Value.is_value();
}
void Tag::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", unstructured_Value := ");
field_unstructured__Value.log();
TTCN_Logger::log_event_str(" }");
}

void Tag::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (unstructured__Value().is_bound()) unstructured__Value().set_implicit_omit();
}

void Tag::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 @BSSGP_Types.Tag 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) unstructured__Value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "unstructured_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          unstructured__Value().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 @BSSGP_Types.Tag: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.Tag");
  }
}

void Tag::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_unstructured__Value.encode_text(text_buf);
}

void Tag::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_unstructured__Value.decode_text(text_buf);
}

void Tag::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 Tag::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 Tag::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, Tag_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(Tag_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, Tag_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(Tag_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_unstructured__Value.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_42) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Tag::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Tag_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Tag_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT1_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(Tag_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(Tag_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_unstructured__Value.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Tag_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Tag_ext_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_iEI !=  os_42) {
  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){
   os_42.RAW_encode(General__Types::OCT1_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 Tag_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_unstructured__Value;
};

void Tag_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_unstructured__Value = ANY_VALUE;
}
}
}

void Tag_template::copy_value(const Tag& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.unstructured__Value().is_bound()) {
  single_value->field_unstructured__Value = other_value.unstructured__Value();
} else {
  single_value->field_unstructured__Value.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Tag_template::copy_template(const Tag_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.unstructured__Value().get_selection()) {
single_value->field_unstructured__Value = other_value.unstructured__Value();
} else {
single_value->field_unstructured__Value.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 Tag_template[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 Tag_template(*other_value.implication_.precondition);
implication_.implied_template = new Tag_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 @BSSGP_Types.Tag.");
break;
}
set_selection(other_value);
}

Tag_template::Tag_template()
{
}

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

Tag_template::Tag_template(const Tag& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean Tag_template::match(const Tag& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.unstructured__Value().is_bound()) return FALSE;
if(!single_value->field_unstructured__Value.match(other_value.unstructured__Value(), 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 @BSSGP_Types.Tag.");
}
return FALSE;
}

boolean Tag_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_unstructured__Value.is_bound();
}

boolean Tag_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_unstructured__Value.is_value();
}

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

Tag Tag_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 @BSSGP_Types.Tag.");
Tag ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_unstructured__Value.is_bound()) {
ret_val.unstructured__Value() = single_value->field_unstructured__Value.valueof();
}
return ret_val;
}

void Tag_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 @BSSGP_Types.Tag.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Tag_template[list_length];
}

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

OCTETSTRING_template& Tag_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& Tag_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.Tag.");
return single_value->field_iEI;
}

BITSTRING_template& Tag_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& Tag_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.Tag.");
return single_value->field_ext;
}

LIN2__2a_template& Tag_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& Tag_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.Tag.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& Tag_template::unstructured__Value()
{
set_specific();
return single_value->field_unstructured__Value;
}

const OCTETSTRING_template& Tag_template::unstructured__Value() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field unstructured_Value of a non-specific template of type @BSSGP_Types.Tag.");
return single_value->field_unstructured__Value;
}

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

void Tag_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", unstructured_Value := ");
single_value->field_unstructured__Value.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 Tag_template::log_match(const Tag& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_unstructured__Value.match(match_value.unstructured__Value(), legacy)){
TTCN_Logger::log_logmatch_info(".unstructured_Value");
single_value->field_unstructured__Value.log_match(match_value.unstructured__Value(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", unstructured_Value := ");
single_value->field_unstructured__Value.log_match(match_value.unstructured__Value(), 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 Tag_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (unstructured__Value().is_bound()) unstructured__Value().set_implicit_omit();
}

void Tag_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_unstructured__Value.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 @BSSGP_Types.Tag.");
}
}

void Tag_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_unstructured__Value.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 Tag_template[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 @BSSGP_Types.Tag.");
}
}

void Tag_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: {
    Tag_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 @BSSGP_Types.Tag 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) unstructured__Value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "unstructured_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          unstructured__Value().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 @BSSGP_Types.Tag: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Tag_template* precondition = new Tag_template;
    precondition->set_param(*param.get_elem(0));
    Tag_template* implied_template = new Tag_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Tag_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.Tag");
  }
  is_ifpresent = param.get_ifpresent();
}

void Tag_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Tag");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Tag");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Tag");
single_value->field_unstructured__Value.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Tag");
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 : "@BSSGP_Types.Tag");
}

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

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

TLLI__BSSGP::TLLI__BSSGP()
{
}

TLLI__BSSGP::TLLI__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_tLLI__Value)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_tLLI__Value(par_tLLI__Value)
{
}

TLLI__BSSGP::TLLI__BSSGP(const TLLI__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.TLLI_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.tLLI__Value().is_bound()) field_tLLI__Value = other_value.tLLI__Value();
else field_tLLI__Value.clean_up();
}

void TLLI__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_tLLI__Value.clean_up();
}

const TTCN_Typedescriptor_t* TLLI__BSSGP::get_descriptor() const { return &TLLI__BSSGP_descr_; }
TLLI__BSSGP& TLLI__BSSGP::operator=(const TLLI__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.TLLI_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.tLLI__Value().is_bound()) field_tLLI__Value = other_value.tLLI__Value();
  else field_tLLI__Value.clean_up();
}
return *this;
}

boolean TLLI__BSSGP::operator==(const TLLI__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_tLLI__Value==other_value.field_tLLI__Value;
}

boolean TLLI__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_tLLI__Value.is_bound());
}
boolean TLLI__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_tLLI__Value.is_value();
}
void TLLI__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", tLLI_Value := ");
field_tLLI__Value.log();
TTCN_Logger::log_event_str(" }");
}

void TLLI__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (tLLI__Value().is_bound()) tLLI__Value().set_implicit_omit();
}

void TLLI__BSSGP::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 @BSSGP_Types.TLLI_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) tLLI__Value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tLLI_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tLLI__Value().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 @BSSGP_Types.TLLI_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.TLLI_BSSGP");
  }
}

void TLLI__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_tLLI__Value.encode_text(text_buf);
}

void TLLI__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_tLLI__Value.decode_text(text_buf);
}

void TLLI__BSSGP::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 TLLI__BSSGP::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 TLLI__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, TLLI__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(TLLI__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, TLLI__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(TLLI__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT4_descr_.raw->forceomit);
  decoded_field_length = field_tLLI__Value.RAW_decode(General__Types::OCT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_5) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int TLLI__BSSGP::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, TLLI__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, TLLI__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT4_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(TLLI__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(TLLI__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_tLLI__Value.RAW_encode(General__Types::OCT4_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(TLLI__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(TLLI__BSSGP_ext_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_iEI !=  os_5) {
  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){
   os_5.RAW_encode(General__Types::OCT1_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 TLLI__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_tLLI__Value;
};

void TLLI__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_tLLI__Value = ANY_VALUE;
}
}
}

void TLLI__BSSGP_template::copy_value(const TLLI__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.tLLI__Value().is_bound()) {
  single_value->field_tLLI__Value = other_value.tLLI__Value();
} else {
  single_value->field_tLLI__Value.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void TLLI__BSSGP_template::copy_template(const TLLI__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tLLI__Value().get_selection()) {
single_value->field_tLLI__Value = other_value.tLLI__Value();
} else {
single_value->field_tLLI__Value.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 TLLI__BSSGP_template[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 TLLI__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new TLLI__BSSGP_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 @BSSGP_Types.TLLI_BSSGP.");
break;
}
set_selection(other_value);
}

TLLI__BSSGP_template::TLLI__BSSGP_template()
{
}

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

TLLI__BSSGP_template::TLLI__BSSGP_template(const TLLI__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean TLLI__BSSGP_template::match(const TLLI__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.tLLI__Value().is_bound()) return FALSE;
if(!single_value->field_tLLI__Value.match(other_value.tLLI__Value(), 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 @BSSGP_Types.TLLI_BSSGP.");
}
return FALSE;
}

boolean TLLI__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_tLLI__Value.is_bound();
}

boolean TLLI__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_tLLI__Value.is_value();
}

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

TLLI__BSSGP TLLI__BSSGP_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 @BSSGP_Types.TLLI_BSSGP.");
TLLI__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_tLLI__Value.is_bound()) {
ret_val.tLLI__Value() = single_value->field_tLLI__Value.valueof();
}
return ret_val;
}

void TLLI__BSSGP_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 @BSSGP_Types.TLLI_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new TLLI__BSSGP_template[list_length];
}

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

OCTETSTRING_template& TLLI__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& TLLI__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.TLLI_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& TLLI__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& TLLI__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.TLLI_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& TLLI__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& TLLI__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.TLLI_BSSGP.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& TLLI__BSSGP_template::tLLI__Value()
{
set_specific();
return single_value->field_tLLI__Value;
}

const OCTETSTRING_template& TLLI__BSSGP_template::tLLI__Value() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tLLI_Value of a non-specific template of type @BSSGP_Types.TLLI_BSSGP.");
return single_value->field_tLLI__Value;
}

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

void TLLI__BSSGP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", tLLI_Value := ");
single_value->field_tLLI__Value.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 TLLI__BSSGP_template::log_match(const TLLI__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tLLI__Value.match(match_value.tLLI__Value(), legacy)){
TTCN_Logger::log_logmatch_info(".tLLI_Value");
single_value->field_tLLI__Value.log_match(match_value.tLLI__Value(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", tLLI_Value := ");
single_value->field_tLLI__Value.log_match(match_value.tLLI__Value(), 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 TLLI__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (tLLI__Value().is_bound()) tLLI__Value().set_implicit_omit();
}

void TLLI__BSSGP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_tLLI__Value.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 @BSSGP_Types.TLLI_BSSGP.");
}
}

void TLLI__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_tLLI__Value.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 TLLI__BSSGP_template[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 @BSSGP_Types.TLLI_BSSGP.");
}
}

void TLLI__BSSGP_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: {
    TLLI__BSSGP_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 @BSSGP_Types.TLLI_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) tLLI__Value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "tLLI_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tLLI__Value().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 @BSSGP_Types.TLLI_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    TLLI__BSSGP_template* precondition = new TLLI__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    TLLI__BSSGP_template* implied_template = new TLLI__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = TLLI__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.TLLI_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void TLLI__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.TLLI_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.TLLI_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.TLLI_BSSGP");
single_value->field_tLLI__Value.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.TLLI_BSSGP");
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 : "@BSSGP_Types.TLLI_BSSGP");
}

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

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

TMSI__BSSGP::TMSI__BSSGP()
{
}

TMSI__BSSGP::TMSI__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_tMSI__Value)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_tMSI__Value(par_tMSI__Value)
{
}

TMSI__BSSGP::TMSI__BSSGP(const TMSI__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.TMSI_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.tMSI__Value().is_bound()) field_tMSI__Value = other_value.tMSI__Value();
else field_tMSI__Value.clean_up();
}

void TMSI__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_tMSI__Value.clean_up();
}

const TTCN_Typedescriptor_t* TMSI__BSSGP::get_descriptor() const { return &TMSI__BSSGP_descr_; }
TMSI__BSSGP& TMSI__BSSGP::operator=(const TMSI__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.TMSI_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.tMSI__Value().is_bound()) field_tMSI__Value = other_value.tMSI__Value();
  else field_tMSI__Value.clean_up();
}
return *this;
}

boolean TMSI__BSSGP::operator==(const TMSI__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_tMSI__Value==other_value.field_tMSI__Value;
}

boolean TMSI__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_tMSI__Value.is_bound());
}
boolean TMSI__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_tMSI__Value.is_value();
}
void TMSI__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", tMSI_Value := ");
field_tMSI__Value.log();
TTCN_Logger::log_event_str(" }");
}

void TMSI__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (tMSI__Value().is_bound()) tMSI__Value().set_implicit_omit();
}

void TMSI__BSSGP::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 @BSSGP_Types.TMSI_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) tMSI__Value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tMSI__Value().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 @BSSGP_Types.TMSI_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.TMSI_BSSGP");
  }
}

void TMSI__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_tMSI__Value.encode_text(text_buf);
}

void TMSI__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_tMSI__Value.decode_text(text_buf);
}

void TMSI__BSSGP::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 TMSI__BSSGP::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 TMSI__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, TMSI__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(TMSI__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, TMSI__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(TMSI__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT4_descr_.raw->forceomit);
  decoded_field_length = field_tMSI__Value.RAW_decode(General__Types::OCT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_36) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int TMSI__BSSGP::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, TMSI__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, TMSI__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT4_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(TMSI__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(TMSI__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_tMSI__Value.RAW_encode(General__Types::OCT4_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(TMSI__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(TMSI__BSSGP_ext_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_iEI !=  os_36) {
  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){
   os_36.RAW_encode(General__Types::OCT1_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 TMSI__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_tMSI__Value;
};

void TMSI__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_tMSI__Value = ANY_VALUE;
}
}
}

void TMSI__BSSGP_template::copy_value(const TMSI__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.tMSI__Value().is_bound()) {
  single_value->field_tMSI__Value = other_value.tMSI__Value();
} else {
  single_value->field_tMSI__Value.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void TMSI__BSSGP_template::copy_template(const TMSI__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.tMSI__Value().get_selection()) {
single_value->field_tMSI__Value = other_value.tMSI__Value();
} else {
single_value->field_tMSI__Value.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 TMSI__BSSGP_template[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 TMSI__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new TMSI__BSSGP_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 @BSSGP_Types.TMSI_BSSGP.");
break;
}
set_selection(other_value);
}

TMSI__BSSGP_template::TMSI__BSSGP_template()
{
}

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

TMSI__BSSGP_template::TMSI__BSSGP_template(const TMSI__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean TMSI__BSSGP_template::match(const TMSI__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.tMSI__Value().is_bound()) return FALSE;
if(!single_value->field_tMSI__Value.match(other_value.tMSI__Value(), 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 @BSSGP_Types.TMSI_BSSGP.");
}
return FALSE;
}

boolean TMSI__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_tMSI__Value.is_bound();
}

boolean TMSI__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_tMSI__Value.is_value();
}

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

TMSI__BSSGP TMSI__BSSGP_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 @BSSGP_Types.TMSI_BSSGP.");
TMSI__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_tMSI__Value.is_bound()) {
ret_val.tMSI__Value() = single_value->field_tMSI__Value.valueof();
}
return ret_val;
}

void TMSI__BSSGP_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 @BSSGP_Types.TMSI_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new TMSI__BSSGP_template[list_length];
}

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

OCTETSTRING_template& TMSI__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& TMSI__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.TMSI_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& TMSI__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& TMSI__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.TMSI_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& TMSI__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& TMSI__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.TMSI_BSSGP.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& TMSI__BSSGP_template::tMSI__Value()
{
set_specific();
return single_value->field_tMSI__Value;
}

const OCTETSTRING_template& TMSI__BSSGP_template::tMSI__Value() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field tMSI_Value of a non-specific template of type @BSSGP_Types.TMSI_BSSGP.");
return single_value->field_tMSI__Value;
}

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

void TMSI__BSSGP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", tMSI_Value := ");
single_value->field_tMSI__Value.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 TMSI__BSSGP_template::log_match(const TMSI__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_tMSI__Value.match(match_value.tMSI__Value(), legacy)){
TTCN_Logger::log_logmatch_info(".tMSI_Value");
single_value->field_tMSI__Value.log_match(match_value.tMSI__Value(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", tMSI_Value := ");
single_value->field_tMSI__Value.log_match(match_value.tMSI__Value(), 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 TMSI__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (tMSI__Value().is_bound()) tMSI__Value().set_implicit_omit();
}

void TMSI__BSSGP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_tMSI__Value.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 @BSSGP_Types.TMSI_BSSGP.");
}
}

void TMSI__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_tMSI__Value.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 TMSI__BSSGP_template[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 @BSSGP_Types.TMSI_BSSGP.");
}
}

void TMSI__BSSGP_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: {
    TMSI__BSSGP_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 @BSSGP_Types.TMSI_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) tMSI__Value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          tMSI__Value().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 @BSSGP_Types.TMSI_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    TMSI__BSSGP_template* precondition = new TMSI__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    TMSI__BSSGP_template* implied_template = new TMSI__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = TMSI__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.TMSI_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void TMSI__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.TMSI_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.TMSI_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.TMSI_BSSGP");
single_value->field_tMSI__Value.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.TMSI_BSSGP");
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 : "@BSSGP_Types.TMSI_BSSGP");
}

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

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

Trace__Reference__BSSGP::Trace__Reference__BSSGP()
{
}

Trace__Reference__BSSGP::Trace__Reference__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_trace__Reference)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_trace__Reference(par_trace__Reference)
{
}

Trace__Reference__BSSGP::Trace__Reference__BSSGP(const Trace__Reference__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.Trace_Reference_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.trace__Reference().is_bound()) field_trace__Reference = other_value.trace__Reference();
else field_trace__Reference.clean_up();
}

void Trace__Reference__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_trace__Reference.clean_up();
}

const TTCN_Typedescriptor_t* Trace__Reference__BSSGP::get_descriptor() const { return &Trace__Reference__BSSGP_descr_; }
Trace__Reference__BSSGP& Trace__Reference__BSSGP::operator=(const Trace__Reference__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.Trace_Reference_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.trace__Reference().is_bound()) field_trace__Reference = other_value.trace__Reference();
  else field_trace__Reference.clean_up();
}
return *this;
}

boolean Trace__Reference__BSSGP::operator==(const Trace__Reference__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_trace__Reference==other_value.field_trace__Reference;
}

boolean Trace__Reference__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_trace__Reference.is_bound());
}
boolean Trace__Reference__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_trace__Reference.is_value();
}
void Trace__Reference__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", trace_Reference := ");
field_trace__Reference.log();
TTCN_Logger::log_event_str(" }");
}

void Trace__Reference__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (trace__Reference().is_bound()) trace__Reference().set_implicit_omit();
}

void Trace__Reference__BSSGP::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 @BSSGP_Types.Trace_Reference_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) trace__Reference().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "trace_Reference")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          trace__Reference().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 @BSSGP_Types.Trace_Reference_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.Trace_Reference_BSSGP");
  }
}

void Trace__Reference__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_trace__Reference.encode_text(text_buf);
}

void Trace__Reference__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_trace__Reference.decode_text(text_buf);
}

void Trace__Reference__BSSGP::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 Trace__Reference__BSSGP::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 Trace__Reference__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, Trace__Reference__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(Trace__Reference__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, Trace__Reference__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(Trace__Reference__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT2_descr_.raw->forceomit);
  decoded_field_length = field_trace__Reference.RAW_decode(General__Types::OCT2_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_68) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Trace__Reference__BSSGP::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Trace__Reference__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Trace__Reference__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT2_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(Trace__Reference__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(Trace__Reference__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_trace__Reference.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Trace__Reference__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Trace__Reference__BSSGP_ext_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_iEI !=  os_68) {
  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){
   os_68.RAW_encode(General__Types::OCT1_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 Trace__Reference__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_trace__Reference;
};

void Trace__Reference__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_trace__Reference = ANY_VALUE;
}
}
}

void Trace__Reference__BSSGP_template::copy_value(const Trace__Reference__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.trace__Reference().is_bound()) {
  single_value->field_trace__Reference = other_value.trace__Reference();
} else {
  single_value->field_trace__Reference.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Trace__Reference__BSSGP_template::copy_template(const Trace__Reference__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.trace__Reference().get_selection()) {
single_value->field_trace__Reference = other_value.trace__Reference();
} else {
single_value->field_trace__Reference.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 Trace__Reference__BSSGP_template[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 Trace__Reference__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new Trace__Reference__BSSGP_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 @BSSGP_Types.Trace_Reference_BSSGP.");
break;
}
set_selection(other_value);
}

Trace__Reference__BSSGP_template::Trace__Reference__BSSGP_template()
{
}

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

Trace__Reference__BSSGP_template::Trace__Reference__BSSGP_template(const Trace__Reference__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean Trace__Reference__BSSGP_template::match(const Trace__Reference__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.trace__Reference().is_bound()) return FALSE;
if(!single_value->field_trace__Reference.match(other_value.trace__Reference(), 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 @BSSGP_Types.Trace_Reference_BSSGP.");
}
return FALSE;
}

boolean Trace__Reference__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_trace__Reference.is_bound();
}

boolean Trace__Reference__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_trace__Reference.is_value();
}

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

Trace__Reference__BSSGP Trace__Reference__BSSGP_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 @BSSGP_Types.Trace_Reference_BSSGP.");
Trace__Reference__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_trace__Reference.is_bound()) {
ret_val.trace__Reference() = single_value->field_trace__Reference.valueof();
}
return ret_val;
}

void Trace__Reference__BSSGP_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 @BSSGP_Types.Trace_Reference_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Trace__Reference__BSSGP_template[list_length];
}

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

OCTETSTRING_template& Trace__Reference__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& Trace__Reference__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.Trace_Reference_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& Trace__Reference__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& Trace__Reference__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.Trace_Reference_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& Trace__Reference__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& Trace__Reference__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.Trace_Reference_BSSGP.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& Trace__Reference__BSSGP_template::trace__Reference()
{
set_specific();
return single_value->field_trace__Reference;
}

const OCTETSTRING_template& Trace__Reference__BSSGP_template::trace__Reference() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field trace_Reference of a non-specific template of type @BSSGP_Types.Trace_Reference_BSSGP.");
return single_value->field_trace__Reference;
}

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

void Trace__Reference__BSSGP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", trace_Reference := ");
single_value->field_trace__Reference.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 Trace__Reference__BSSGP_template::log_match(const Trace__Reference__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_trace__Reference.match(match_value.trace__Reference(), legacy)){
TTCN_Logger::log_logmatch_info(".trace_Reference");
single_value->field_trace__Reference.log_match(match_value.trace__Reference(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", trace_Reference := ");
single_value->field_trace__Reference.log_match(match_value.trace__Reference(), 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 Trace__Reference__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (trace__Reference().is_bound()) trace__Reference().set_implicit_omit();
}

void Trace__Reference__BSSGP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_trace__Reference.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 @BSSGP_Types.Trace_Reference_BSSGP.");
}
}

void Trace__Reference__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_trace__Reference.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 Trace__Reference__BSSGP_template[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 @BSSGP_Types.Trace_Reference_BSSGP.");
}
}

void Trace__Reference__BSSGP_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: {
    Trace__Reference__BSSGP_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 @BSSGP_Types.Trace_Reference_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) trace__Reference().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "trace_Reference")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          trace__Reference().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 @BSSGP_Types.Trace_Reference_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Trace__Reference__BSSGP_template* precondition = new Trace__Reference__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    Trace__Reference__BSSGP_template* implied_template = new Trace__Reference__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Trace__Reference__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.Trace_Reference_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void Trace__Reference__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Trace_Reference_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Trace_Reference_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Trace_Reference_BSSGP");
single_value->field_trace__Reference.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Trace_Reference_BSSGP");
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 : "@BSSGP_Types.Trace_Reference_BSSGP");
}

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

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

Trace__Type__BSSGP::Trace__Type__BSSGP()
{
}

Trace__Type__BSSGP::Trace__Type__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_equipment__Trace)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_equipment__Trace(par_equipment__Trace)
{
}

Trace__Type__BSSGP::Trace__Type__BSSGP(const Trace__Type__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.Trace_Type_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.equipment__Trace().is_bound()) field_equipment__Trace = other_value.equipment__Trace();
else field_equipment__Trace.clean_up();
}

void Trace__Type__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_equipment__Trace.clean_up();
}

const TTCN_Typedescriptor_t* Trace__Type__BSSGP::get_descriptor() const { return &Trace__Type__BSSGP_descr_; }
Trace__Type__BSSGP& Trace__Type__BSSGP::operator=(const Trace__Type__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.Trace_Type_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.equipment__Trace().is_bound()) field_equipment__Trace = other_value.equipment__Trace();
  else field_equipment__Trace.clean_up();
}
return *this;
}

boolean Trace__Type__BSSGP::operator==(const Trace__Type__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_equipment__Trace==other_value.field_equipment__Trace;
}

boolean Trace__Type__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_equipment__Trace.is_bound());
}
boolean Trace__Type__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_equipment__Trace.is_value();
}
void Trace__Type__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", equipment_Trace := ");
field_equipment__Trace.log();
TTCN_Logger::log_event_str(" }");
}

void Trace__Type__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (equipment__Trace().is_bound()) equipment__Trace().set_implicit_omit();
}

void Trace__Type__BSSGP::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 @BSSGP_Types.Trace_Type_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) equipment__Trace().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "equipment_Trace")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          equipment__Trace().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 @BSSGP_Types.Trace_Type_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.Trace_Type_BSSGP");
  }
}

void Trace__Type__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_equipment__Trace.encode_text(text_buf);
}

void Trace__Type__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_equipment__Trace.decode_text(text_buf);
}

void Trace__Type__BSSGP::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 Trace__Type__BSSGP::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 Trace__Type__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, Trace__Type__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(Trace__Type__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, Trace__Type__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(Trace__Type__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_equipment__Trace.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_72) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Trace__Type__BSSGP::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Trace__Type__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Trace__Type__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT1_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(Trace__Type__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(Trace__Type__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_equipment__Trace.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Trace__Type__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Trace__Type__BSSGP_ext_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_iEI !=  os_72) {
  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){
   os_72.RAW_encode(General__Types::OCT1_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 Trace__Type__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_equipment__Trace;
};

void Trace__Type__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_equipment__Trace = ANY_VALUE;
}
}
}

void Trace__Type__BSSGP_template::copy_value(const Trace__Type__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.equipment__Trace().is_bound()) {
  single_value->field_equipment__Trace = other_value.equipment__Trace();
} else {
  single_value->field_equipment__Trace.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Trace__Type__BSSGP_template::copy_template(const Trace__Type__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.equipment__Trace().get_selection()) {
single_value->field_equipment__Trace = other_value.equipment__Trace();
} else {
single_value->field_equipment__Trace.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 Trace__Type__BSSGP_template[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 Trace__Type__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new Trace__Type__BSSGP_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 @BSSGP_Types.Trace_Type_BSSGP.");
break;
}
set_selection(other_value);
}

Trace__Type__BSSGP_template::Trace__Type__BSSGP_template()
{
}

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

Trace__Type__BSSGP_template::Trace__Type__BSSGP_template(const Trace__Type__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean Trace__Type__BSSGP_template::match(const Trace__Type__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.equipment__Trace().is_bound()) return FALSE;
if(!single_value->field_equipment__Trace.match(other_value.equipment__Trace(), 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 @BSSGP_Types.Trace_Type_BSSGP.");
}
return FALSE;
}

boolean Trace__Type__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_equipment__Trace.is_bound();
}

boolean Trace__Type__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_equipment__Trace.is_value();
}

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

Trace__Type__BSSGP Trace__Type__BSSGP_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 @BSSGP_Types.Trace_Type_BSSGP.");
Trace__Type__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_equipment__Trace.is_bound()) {
ret_val.equipment__Trace() = single_value->field_equipment__Trace.valueof();
}
return ret_val;
}

void Trace__Type__BSSGP_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 @BSSGP_Types.Trace_Type_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Trace__Type__BSSGP_template[list_length];
}

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

OCTETSTRING_template& Trace__Type__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& Trace__Type__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.Trace_Type_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& Trace__Type__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& Trace__Type__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.Trace_Type_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& Trace__Type__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& Trace__Type__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.Trace_Type_BSSGP.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& Trace__Type__BSSGP_template::equipment__Trace()
{
set_specific();
return single_value->field_equipment__Trace;
}

const OCTETSTRING_template& Trace__Type__BSSGP_template::equipment__Trace() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field equipment_Trace of a non-specific template of type @BSSGP_Types.Trace_Type_BSSGP.");
return single_value->field_equipment__Trace;
}

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

void Trace__Type__BSSGP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", equipment_Trace := ");
single_value->field_equipment__Trace.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 Trace__Type__BSSGP_template::log_match(const Trace__Type__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_equipment__Trace.match(match_value.equipment__Trace(), legacy)){
TTCN_Logger::log_logmatch_info(".equipment_Trace");
single_value->field_equipment__Trace.log_match(match_value.equipment__Trace(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", equipment_Trace := ");
single_value->field_equipment__Trace.log_match(match_value.equipment__Trace(), 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 Trace__Type__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (equipment__Trace().is_bound()) equipment__Trace().set_implicit_omit();
}

void Trace__Type__BSSGP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_equipment__Trace.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 @BSSGP_Types.Trace_Type_BSSGP.");
}
}

void Trace__Type__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_equipment__Trace.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 Trace__Type__BSSGP_template[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 @BSSGP_Types.Trace_Type_BSSGP.");
}
}

void Trace__Type__BSSGP_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: {
    Trace__Type__BSSGP_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 @BSSGP_Types.Trace_Type_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) equipment__Trace().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "equipment_Trace")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          equipment__Trace().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 @BSSGP_Types.Trace_Type_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Trace__Type__BSSGP_template* precondition = new Trace__Type__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    Trace__Type__BSSGP_template* implied_template = new Trace__Type__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Trace__Type__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.Trace_Type_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void Trace__Type__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Trace_Type_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Trace_Type_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Trace_Type_BSSGP");
single_value->field_equipment__Trace.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Trace_Type_BSSGP");
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 : "@BSSGP_Types.Trace_Type_BSSGP");
}

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

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

TransactionId__BSSGP::TransactionId__BSSGP()
{
}

TransactionId__BSSGP::TransactionId__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_transaction__Id)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_transaction__Id(par_transaction__Id)
{
}

TransactionId__BSSGP::TransactionId__BSSGP(const TransactionId__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.TransactionId_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.transaction__Id().is_bound()) field_transaction__Id = other_value.transaction__Id();
else field_transaction__Id.clean_up();
}

void TransactionId__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_transaction__Id.clean_up();
}

const TTCN_Typedescriptor_t* TransactionId__BSSGP::get_descriptor() const { return &TransactionId__BSSGP_descr_; }
TransactionId__BSSGP& TransactionId__BSSGP::operator=(const TransactionId__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.TransactionId_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.transaction__Id().is_bound()) field_transaction__Id = other_value.transaction__Id();
  else field_transaction__Id.clean_up();
}
return *this;
}

boolean TransactionId__BSSGP::operator==(const TransactionId__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_transaction__Id==other_value.field_transaction__Id;
}

boolean TransactionId__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_transaction__Id.is_bound());
}
boolean TransactionId__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_transaction__Id.is_value();
}
void TransactionId__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", transaction_Id := ");
field_transaction__Id.log();
TTCN_Logger::log_event_str(" }");
}

void TransactionId__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (transaction__Id().is_bound()) transaction__Id().set_implicit_omit();
}

void TransactionId__BSSGP::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 @BSSGP_Types.TransactionId_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) transaction__Id().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "transaction_Id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          transaction__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 @BSSGP_Types.TransactionId_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.TransactionId_BSSGP");
  }
}

void TransactionId__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_transaction__Id.encode_text(text_buf);
}

void TransactionId__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_transaction__Id.decode_text(text_buf);
}

void TransactionId__BSSGP::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 TransactionId__BSSGP::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 TransactionId__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, TransactionId__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(TransactionId__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, TransactionId__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(TransactionId__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT2_descr_.raw->forceomit);
  decoded_field_length = field_transaction__Id.RAW_decode(General__Types::OCT2_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_73) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int TransactionId__BSSGP::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, TransactionId__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, TransactionId__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT2_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(TransactionId__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(TransactionId__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_transaction__Id.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(TransactionId__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(TransactionId__BSSGP_ext_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_iEI !=  os_73) {
  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){
   os_73.RAW_encode(General__Types::OCT1_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 TransactionId__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_transaction__Id;
};

void TransactionId__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_transaction__Id = ANY_VALUE;
}
}
}

void TransactionId__BSSGP_template::copy_value(const TransactionId__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.transaction__Id().is_bound()) {
  single_value->field_transaction__Id = other_value.transaction__Id();
} else {
  single_value->field_transaction__Id.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void TransactionId__BSSGP_template::copy_template(const TransactionId__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.transaction__Id().get_selection()) {
single_value->field_transaction__Id = other_value.transaction__Id();
} else {
single_value->field_transaction__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 TransactionId__BSSGP_template[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 TransactionId__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new TransactionId__BSSGP_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 @BSSGP_Types.TransactionId_BSSGP.");
break;
}
set_selection(other_value);
}

TransactionId__BSSGP_template::TransactionId__BSSGP_template()
{
}

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

TransactionId__BSSGP_template::TransactionId__BSSGP_template(const TransactionId__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean TransactionId__BSSGP_template::match(const TransactionId__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.transaction__Id().is_bound()) return FALSE;
if(!single_value->field_transaction__Id.match(other_value.transaction__Id(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @BSSGP_Types.TransactionId_BSSGP.");
}
return FALSE;
}

boolean TransactionId__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_transaction__Id.is_bound();
}

boolean TransactionId__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_transaction__Id.is_value();
}

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

TransactionId__BSSGP TransactionId__BSSGP_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 @BSSGP_Types.TransactionId_BSSGP.");
TransactionId__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_transaction__Id.is_bound()) {
ret_val.transaction__Id() = single_value->field_transaction__Id.valueof();
}
return ret_val;
}

void TransactionId__BSSGP_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 @BSSGP_Types.TransactionId_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new TransactionId__BSSGP_template[list_length];
}

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

OCTETSTRING_template& TransactionId__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& TransactionId__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.TransactionId_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& TransactionId__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& TransactionId__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.TransactionId_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& TransactionId__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& TransactionId__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.TransactionId_BSSGP.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& TransactionId__BSSGP_template::transaction__Id()
{
set_specific();
return single_value->field_transaction__Id;
}

const OCTETSTRING_template& TransactionId__BSSGP_template::transaction__Id() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field transaction_Id of a non-specific template of type @BSSGP_Types.TransactionId_BSSGP.");
return single_value->field_transaction__Id;
}

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

void TransactionId__BSSGP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", transaction_Id := ");
single_value->field_transaction__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 TransactionId__BSSGP_template::log_match(const TransactionId__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_transaction__Id.match(match_value.transaction__Id(), legacy)){
TTCN_Logger::log_logmatch_info(".transaction_Id");
single_value->field_transaction__Id.log_match(match_value.transaction__Id(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", transaction_Id := ");
single_value->field_transaction__Id.log_match(match_value.transaction__Id(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void TransactionId__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (transaction__Id().is_bound()) transaction__Id().set_implicit_omit();
}

void TransactionId__BSSGP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_transaction__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 @BSSGP_Types.TransactionId_BSSGP.");
}
}

void TransactionId__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_transaction__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 TransactionId__BSSGP_template[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 @BSSGP_Types.TransactionId_BSSGP.");
}
}

void TransactionId__BSSGP_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: {
    TransactionId__BSSGP_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 @BSSGP_Types.TransactionId_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) transaction__Id().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "transaction_Id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          transaction__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 @BSSGP_Types.TransactionId_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    TransactionId__BSSGP_template* precondition = new TransactionId__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    TransactionId__BSSGP_template* implied_template = new TransactionId__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = TransactionId__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.TransactionId_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void TransactionId__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.TransactionId_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.TransactionId_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.TransactionId_BSSGP");
single_value->field_transaction__Id.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.TransactionId_BSSGP");
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 : "@BSSGP_Types.TransactionId_BSSGP");
}

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

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

Trigger__Id__BSSGP::Trigger__Id__BSSGP()
{
}

Trigger__Id__BSSGP::Trigger__Id__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_entity__Identity)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_entity__Identity(par_entity__Identity)
{
}

Trigger__Id__BSSGP::Trigger__Id__BSSGP(const Trigger__Id__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.Trigger_Id_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.entity__Identity().is_bound()) field_entity__Identity = other_value.entity__Identity();
else field_entity__Identity.clean_up();
}

void Trigger__Id__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_entity__Identity.clean_up();
}

const TTCN_Typedescriptor_t* Trigger__Id__BSSGP::get_descriptor() const { return &Trigger__Id__BSSGP_descr_; }
Trigger__Id__BSSGP& Trigger__Id__BSSGP::operator=(const Trigger__Id__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.Trigger_Id_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.entity__Identity().is_bound()) field_entity__Identity = other_value.entity__Identity();
  else field_entity__Identity.clean_up();
}
return *this;
}

boolean Trigger__Id__BSSGP::operator==(const Trigger__Id__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_entity__Identity==other_value.field_entity__Identity;
}

boolean Trigger__Id__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_entity__Identity.is_bound());
}
boolean Trigger__Id__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_entity__Identity.is_value();
}
void Trigger__Id__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", entity_Identity := ");
field_entity__Identity.log();
TTCN_Logger::log_event_str(" }");
}

void Trigger__Id__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (entity__Identity().is_bound()) entity__Identity().set_implicit_omit();
}

void Trigger__Id__BSSGP::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 @BSSGP_Types.Trigger_Id_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) entity__Identity().set_param(*param.get_elem(3));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "entity_Identity")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          entity__Identity().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @BSSGP_Types.Trigger_Id_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.Trigger_Id_BSSGP");
  }
}

void Trigger__Id__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_entity__Identity.encode_text(text_buf);
}

void Trigger__Id__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_entity__Identity.decode_text(text_buf);
}

void Trigger__Id__BSSGP::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 Trigger__Id__BSSGP::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 Trigger__Id__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, Trigger__Id__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(Trigger__Id__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, Trigger__Id__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(Trigger__Id__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT20_descr_.raw->forceomit);
  decoded_field_length = field_entity__Identity.RAW_decode(General__Types::OCT20_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_69) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Trigger__Id__BSSGP::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Trigger__Id__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Trigger__Id__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT20_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(Trigger__Id__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(Trigger__Id__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_entity__Identity.RAW_encode(General__Types::OCT20_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Trigger__Id__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Trigger__Id__BSSGP_ext_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_iEI !=  os_69) {
  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){
   os_69.RAW_encode(General__Types::OCT1_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 Trigger__Id__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_entity__Identity;
};

void Trigger__Id__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_entity__Identity = ANY_VALUE;
}
}
}

void Trigger__Id__BSSGP_template::copy_value(const Trigger__Id__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.entity__Identity().is_bound()) {
  single_value->field_entity__Identity = other_value.entity__Identity();
} else {
  single_value->field_entity__Identity.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Trigger__Id__BSSGP_template::copy_template(const Trigger__Id__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.entity__Identity().get_selection()) {
single_value->field_entity__Identity = other_value.entity__Identity();
} else {
single_value->field_entity__Identity.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new Trigger__Id__BSSGP_template[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 Trigger__Id__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new Trigger__Id__BSSGP_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 @BSSGP_Types.Trigger_Id_BSSGP.");
break;
}
set_selection(other_value);
}

Trigger__Id__BSSGP_template::Trigger__Id__BSSGP_template()
{
}

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

Trigger__Id__BSSGP_template::Trigger__Id__BSSGP_template(const Trigger__Id__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean Trigger__Id__BSSGP_template::match(const Trigger__Id__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.entity__Identity().is_bound()) return FALSE;
if(!single_value->field_entity__Identity.match(other_value.entity__Identity(), 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 @BSSGP_Types.Trigger_Id_BSSGP.");
}
return FALSE;
}

boolean Trigger__Id__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_entity__Identity.is_bound();
}

boolean Trigger__Id__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_entity__Identity.is_value();
}

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

Trigger__Id__BSSGP Trigger__Id__BSSGP_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 @BSSGP_Types.Trigger_Id_BSSGP.");
Trigger__Id__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_entity__Identity.is_bound()) {
ret_val.entity__Identity() = single_value->field_entity__Identity.valueof();
}
return ret_val;
}

void Trigger__Id__BSSGP_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 @BSSGP_Types.Trigger_Id_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Trigger__Id__BSSGP_template[list_length];
}

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

OCTETSTRING_template& Trigger__Id__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& Trigger__Id__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.Trigger_Id_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& Trigger__Id__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& Trigger__Id__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.Trigger_Id_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& Trigger__Id__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& Trigger__Id__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.Trigger_Id_BSSGP.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& Trigger__Id__BSSGP_template::entity__Identity()
{
set_specific();
return single_value->field_entity__Identity;
}

const OCTETSTRING_template& Trigger__Id__BSSGP_template::entity__Identity() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field entity_Identity of a non-specific template of type @BSSGP_Types.Trigger_Id_BSSGP.");
return single_value->field_entity__Identity;
}

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

void Trigger__Id__BSSGP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", entity_Identity := ");
single_value->field_entity__Identity.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void Trigger__Id__BSSGP_template::log_match(const Trigger__Id__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_entity__Identity.match(match_value.entity__Identity(), legacy)){
TTCN_Logger::log_logmatch_info(".entity_Identity");
single_value->field_entity__Identity.log_match(match_value.entity__Identity(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", entity_Identity := ");
single_value->field_entity__Identity.log_match(match_value.entity__Identity(), 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 Trigger__Id__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (entity__Identity().is_bound()) entity__Identity().set_implicit_omit();
}

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

void Trigger__Id__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_entity__Identity.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new Trigger__Id__BSSGP_template[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 @BSSGP_Types.Trigger_Id_BSSGP.");
}
}

void Trigger__Id__BSSGP_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: {
    Trigger__Id__BSSGP_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 @BSSGP_Types.Trigger_Id_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) entity__Identity().set_param(*param.get_elem(3));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "entity_Identity")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          entity__Identity().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @BSSGP_Types.Trigger_Id_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Trigger__Id__BSSGP_template* precondition = new Trigger__Id__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    Trigger__Id__BSSGP_template* implied_template = new Trigger__Id__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Trigger__Id__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.Trigger_Id_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void Trigger__Id__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Trigger_Id_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Trigger_Id_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Trigger_Id_BSSGP");
single_value->field_entity__Identity.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Trigger_Id_BSSGP");
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 : "@BSSGP_Types.Trigger_Id_BSSGP");
}

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

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

Number__of__octets__affected::Number__of__octets__affected()
{
}

Number__of__octets__affected::Number__of__octets__affected(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_number__of__octets__transfered__or__deleted)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_number__of__octets__transfered__or__deleted(par_number__of__octets__transfered__or__deleted)
{
}

Number__of__octets__affected::Number__of__octets__affected(const Number__of__octets__affected& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.Number_of_octets_affected.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.number__of__octets__transfered__or__deleted().is_bound()) field_number__of__octets__transfered__or__deleted = other_value.number__of__octets__transfered__or__deleted();
else field_number__of__octets__transfered__or__deleted.clean_up();
}

void Number__of__octets__affected::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_number__of__octets__transfered__or__deleted.clean_up();
}

const TTCN_Typedescriptor_t* Number__of__octets__affected::get_descriptor() const { return &Number__of__octets__affected_descr_; }
Number__of__octets__affected& Number__of__octets__affected::operator=(const Number__of__octets__affected& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.Number_of_octets_affected.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.number__of__octets__transfered__or__deleted().is_bound()) field_number__of__octets__transfered__or__deleted = other_value.number__of__octets__transfered__or__deleted();
  else field_number__of__octets__transfered__or__deleted.clean_up();
}
return *this;
}

boolean Number__of__octets__affected::operator==(const Number__of__octets__affected& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_number__of__octets__transfered__or__deleted==other_value.field_number__of__octets__transfered__or__deleted;
}

boolean Number__of__octets__affected::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_number__of__octets__transfered__or__deleted.is_bound());
}
boolean Number__of__octets__affected::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_number__of__octets__transfered__or__deleted.is_value();
}
void Number__of__octets__affected::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", number_of_octets_transfered_or_deleted := ");
field_number__of__octets__transfered__or__deleted.log();
TTCN_Logger::log_event_str(" }");
}

void Number__of__octets__affected::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (number__of__octets__transfered__or__deleted().is_bound()) number__of__octets__transfered__or__deleted().set_implicit_omit();
}

void Number__of__octets__affected::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 @BSSGP_Types.Number_of_octets_affected 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) number__of__octets__transfered__or__deleted().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "number_of_octets_transfered_or_deleted")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          number__of__octets__transfered__or__deleted().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 @BSSGP_Types.Number_of_octets_affected: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.Number_of_octets_affected");
  }
}

void Number__of__octets__affected::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_number__of__octets__transfered__or__deleted.encode_text(text_buf);
}

void Number__of__octets__affected::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_number__of__octets__transfered__or__deleted.decode_text(text_buf);
}

void Number__of__octets__affected::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 Number__of__octets__affected::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 Number__of__octets__affected::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, Number__of__octets__affected_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(Number__of__octets__affected_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, Number__of__octets__affected_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(Number__of__octets__affected_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT3_descr_.raw->forceomit);
  decoded_field_length = field_number__of__octets__transfered__or__deleted.RAW_decode(General__Types::OCT3_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_56) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Number__of__octets__affected::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Number__of__octets__affected_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Number__of__octets__affected_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT3_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(Number__of__octets__affected_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(Number__of__octets__affected_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_number__of__octets__transfered__or__deleted.RAW_encode(General__Types::OCT3_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Number__of__octets__affected_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Number__of__octets__affected_ext_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_iEI !=  os_56) {
  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){
   os_56.RAW_encode(General__Types::OCT1_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 Number__of__octets__affected_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_number__of__octets__transfered__or__deleted;
};

void Number__of__octets__affected_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_number__of__octets__transfered__or__deleted = ANY_VALUE;
}
}
}

void Number__of__octets__affected_template::copy_value(const Number__of__octets__affected& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.number__of__octets__transfered__or__deleted().is_bound()) {
  single_value->field_number__of__octets__transfered__or__deleted = other_value.number__of__octets__transfered__or__deleted();
} else {
  single_value->field_number__of__octets__transfered__or__deleted.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Number__of__octets__affected_template::copy_template(const Number__of__octets__affected_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.number__of__octets__transfered__or__deleted().get_selection()) {
single_value->field_number__of__octets__transfered__or__deleted = other_value.number__of__octets__transfered__or__deleted();
} else {
single_value->field_number__of__octets__transfered__or__deleted.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 Number__of__octets__affected_template[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 Number__of__octets__affected_template(*other_value.implication_.precondition);
implication_.implied_template = new Number__of__octets__affected_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 @BSSGP_Types.Number_of_octets_affected.");
break;
}
set_selection(other_value);
}

Number__of__octets__affected_template::Number__of__octets__affected_template()
{
}

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

Number__of__octets__affected_template::Number__of__octets__affected_template(const Number__of__octets__affected& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean Number__of__octets__affected_template::match(const Number__of__octets__affected& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.number__of__octets__transfered__or__deleted().is_bound()) return FALSE;
if(!single_value->field_number__of__octets__transfered__or__deleted.match(other_value.number__of__octets__transfered__or__deleted(), 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 @BSSGP_Types.Number_of_octets_affected.");
}
return FALSE;
}

boolean Number__of__octets__affected_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_number__of__octets__transfered__or__deleted.is_bound();
}

boolean Number__of__octets__affected_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_number__of__octets__transfered__or__deleted.is_value();
}

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

Number__of__octets__affected Number__of__octets__affected_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 @BSSGP_Types.Number_of_octets_affected.");
Number__of__octets__affected ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_number__of__octets__transfered__or__deleted.is_bound()) {
ret_val.number__of__octets__transfered__or__deleted() = single_value->field_number__of__octets__transfered__or__deleted.valueof();
}
return ret_val;
}

void Number__of__octets__affected_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 @BSSGP_Types.Number_of_octets_affected.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Number__of__octets__affected_template[list_length];
}

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

OCTETSTRING_template& Number__of__octets__affected_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& Number__of__octets__affected_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.Number_of_octets_affected.");
return single_value->field_iEI;
}

BITSTRING_template& Number__of__octets__affected_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& Number__of__octets__affected_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.Number_of_octets_affected.");
return single_value->field_ext;
}

LIN2__2a_template& Number__of__octets__affected_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& Number__of__octets__affected_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.Number_of_octets_affected.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& Number__of__octets__affected_template::number__of__octets__transfered__or__deleted()
{
set_specific();
return single_value->field_number__of__octets__transfered__or__deleted;
}

const OCTETSTRING_template& Number__of__octets__affected_template::number__of__octets__transfered__or__deleted() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field number_of_octets_transfered_or_deleted of a non-specific template of type @BSSGP_Types.Number_of_octets_affected.");
return single_value->field_number__of__octets__transfered__or__deleted;
}

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

void Number__of__octets__affected_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", number_of_octets_transfered_or_deleted := ");
single_value->field_number__of__octets__transfered__or__deleted.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 Number__of__octets__affected_template::log_match(const Number__of__octets__affected& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_number__of__octets__transfered__or__deleted.match(match_value.number__of__octets__transfered__or__deleted(), legacy)){
TTCN_Logger::log_logmatch_info(".number_of_octets_transfered_or_deleted");
single_value->field_number__of__octets__transfered__or__deleted.log_match(match_value.number__of__octets__transfered__or__deleted(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", number_of_octets_transfered_or_deleted := ");
single_value->field_number__of__octets__transfered__or__deleted.log_match(match_value.number__of__octets__transfered__or__deleted(), 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 Number__of__octets__affected_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (number__of__octets__transfered__or__deleted().is_bound()) number__of__octets__transfered__or__deleted().set_implicit_omit();
}

void Number__of__octets__affected_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_number__of__octets__transfered__or__deleted.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 @BSSGP_Types.Number_of_octets_affected.");
}
}

void Number__of__octets__affected_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_number__of__octets__transfered__or__deleted.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 Number__of__octets__affected_template[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 @BSSGP_Types.Number_of_octets_affected.");
}
}

void Number__of__octets__affected_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: {
    Number__of__octets__affected_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 @BSSGP_Types.Number_of_octets_affected 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) number__of__octets__transfered__or__deleted().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "number_of_octets_transfered_or_deleted")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          number__of__octets__transfered__or__deleted().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 @BSSGP_Types.Number_of_octets_affected: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Number__of__octets__affected_template* precondition = new Number__of__octets__affected_template;
    precondition->set_param(*param.get_elem(0));
    Number__of__octets__affected_template* implied_template = new Number__of__octets__affected_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Number__of__octets__affected_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.Number_of_octets_affected");
  }
  is_ifpresent = param.get_ifpresent();
}

void Number__of__octets__affected_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Number_of_octets_affected");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Number_of_octets_affected");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Number_of_octets_affected");
single_value->field_number__of__octets__transfered__or__deleted.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Number_of_octets_affected");
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 : "@BSSGP_Types.Number_of_octets_affected");
}

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

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

PFI::PFI()
{
}

PFI::PFI(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const BITSTRING& par_pFI__Value,
    const BITSTRING& par_spare)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_pFI__Value(par_pFI__Value),
  field_spare(par_spare)
{
}

PFI::PFI(const PFI& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.PFI.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.pFI__Value().is_bound()) field_pFI__Value = other_value.pFI__Value();
else field_pFI__Value.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
}

void PFI::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_pFI__Value.clean_up();
field_spare.clean_up();
}

const TTCN_Typedescriptor_t* PFI::get_descriptor() const { return &PFI_descr_; }
PFI& PFI::operator=(const PFI& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.PFI.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.pFI__Value().is_bound()) field_pFI__Value = other_value.pFI__Value();
  else field_pFI__Value.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
}
return *this;
}

boolean PFI::operator==(const PFI& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_pFI__Value==other_value.field_pFI__Value
  && field_spare==other_value.field_spare;
}

boolean PFI::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_pFI__Value.is_bound())
  || (field_spare.is_bound());
}
boolean PFI::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_pFI__Value.is_value()
  && field_spare.is_value();
}
void PFI::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", pFI_Value := ");
field_pFI__Value.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(" }");
}

void PFI::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (pFI__Value().is_bound()) pFI__Value().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void PFI::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 @BSSGP_Types.PFI 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) pFI__Value().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));
    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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pFI_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pFI__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(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @BSSGP_Types.PFI: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.PFI");
  }
}

void PFI::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_pFI__Value.encode_text(text_buf);
field_spare.encode_text(text_buf);
}

void PFI::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_pFI__Value.decode_text(text_buf);
field_spare.decode_text(text_buf);
}

void PFI::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 PFI::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 PFI::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, PFI_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(PFI_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, PFI_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(PFI_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT7_descr_.raw->forceomit);
  decoded_field_length = field_pFI__Value.RAW_decode(General__Types::BIT7_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_6) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int PFI::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 5;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(5);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PFI_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PFI_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT7_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::BIT1_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(PFI_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(PFI_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_pFI__Value.RAW_encode(General__Types::BIT7_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_spare.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[4]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 2;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(2);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[4]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[4]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(PFI_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(PFI_ext_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_iEI !=  os_6) {
  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){
   os_6.RAW_encode(General__Types::OCT1_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 PFI_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
BITSTRING_template field_pFI__Value;
BITSTRING_template field_spare;
};

void PFI_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_pFI__Value = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
}
}
}

void PFI_template::copy_value(const PFI& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.pFI__Value().is_bound()) {
  single_value->field_pFI__Value = other_value.pFI__Value();
} else {
  single_value->field_pFI__Value.clean_up();
}
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PFI_template::copy_template(const PFI_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pFI__Value().get_selection()) {
single_value->field_pFI__Value = other_value.pFI__Value();
} else {
single_value->field_pFI__Value.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new PFI_template[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 PFI_template(*other_value.implication_.precondition);
implication_.implied_template = new PFI_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 @BSSGP_Types.PFI.");
break;
}
set_selection(other_value);
}

PFI_template::PFI_template()
{
}

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

PFI_template::PFI_template(const PFI& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PFI_template::match(const PFI& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.pFI__Value().is_bound()) return FALSE;
if(!single_value->field_pFI__Value.match(other_value.pFI__Value(), legacy))return FALSE;
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @BSSGP_Types.PFI.");
}
return FALSE;
}

boolean PFI_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_pFI__Value.is_bound()
 || single_value->field_spare.is_bound();
}

boolean PFI_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_pFI__Value.is_value()
 && single_value->field_spare.is_value();
}

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

PFI PFI_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 @BSSGP_Types.PFI.");
PFI ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_pFI__Value.is_bound()) {
ret_val.pFI__Value() = single_value->field_pFI__Value.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
return ret_val;
}

void PFI_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 @BSSGP_Types.PFI.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PFI_template[list_length];
}

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

OCTETSTRING_template& PFI_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& PFI_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.PFI.");
return single_value->field_iEI;
}

BITSTRING_template& PFI_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& PFI_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.PFI.");
return single_value->field_ext;
}

LIN2__2a_template& PFI_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& PFI_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.PFI.");
return single_value->field_lengthIndicator;
}

BITSTRING_template& PFI_template::pFI__Value()
{
set_specific();
return single_value->field_pFI__Value;
}

const BITSTRING_template& PFI_template::pFI__Value() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pFI_Value of a non-specific template of type @BSSGP_Types.PFI.");
return single_value->field_pFI__Value;
}

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

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

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

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

void PFI_template::log_match(const PFI& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pFI__Value.match(match_value.pFI__Value(), legacy)){
TTCN_Logger::log_logmatch_info(".pFI_Value");
single_value->field_pFI__Value.log_match(match_value.pFI__Value(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", pFI_Value := ");
single_value->field_pFI__Value.log_match(match_value.pFI__Value(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void PFI_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (pFI__Value().is_bound()) pFI__Value().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

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

void PFI_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_pFI__Value.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new PFI_template[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 @BSSGP_Types.PFI.");
}
}

void PFI_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: {
    PFI_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 @BSSGP_Types.PFI 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) pFI__Value().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));
    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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pFI_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pFI__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(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @BSSGP_Types.PFI: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PFI_template* precondition = new PFI_template;
    precondition->set_param(*param.get_elem(0));
    PFI_template* implied_template = new PFI_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PFI_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.PFI");
  }
  is_ifpresent = param.get_ifpresent();
}

void PFI_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.PFI");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.PFI");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.PFI");
single_value->field_pFI__Value.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.PFI");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.PFI");
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 : "@BSSGP_Types.PFI");
}

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

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

ABQP::ABQP()
{
}

ABQP::ABQP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const BITSTRING& par_reliabilityClass,
    const BITSTRING& par_delayClass,
    const BITSTRING& par_spare1,
    const BITSTRING& par_precedenceClass,
    const BITSTRING& par_spare2,
    const BITSTRING& par_peakThroughput,
    const BITSTRING& par_meanThroughput,
    const BITSTRING& par_spare3,
    const OPTIONAL< BITSTRING >& par_deliverErroneusSDU,
    const OPTIONAL< BITSTRING >& par_deliveryOrder,
    const OPTIONAL< BITSTRING >& par_trafficClass,
    const OPTIONAL< OCTETSTRING >& par_maxSDUSize,
    const OPTIONAL< OCTETSTRING >& par_maxBitrateUplink,
    const OPTIONAL< OCTETSTRING >& par_maxBitrateDownlink,
    const OPTIONAL< BITSTRING >& par_sduErrorRatio,
    const OPTIONAL< BITSTRING >& par_residualBER,
    const OPTIONAL< BITSTRING >& par_trafficHandlingPriority,
    const OPTIONAL< BITSTRING >& par_transferDelay,
    const OPTIONAL< OCTETSTRING >& par_guaranteedBitRateUplink,
    const OPTIONAL< OCTETSTRING >& par_guaranteedBitRateDownlink,
    const OPTIONAL< BITSTRING >& par_sourceStatisticsDescriptor,
    const OPTIONAL< BITSTRING >& par_signallingIndication,
    const OPTIONAL< BITSTRING >& par_spare4,
    const OPTIONAL< OCTETSTRING >& par_maxBitRateDownlinkExtended,
    const OPTIONAL< OCTETSTRING >& par_guaranteedBitRateDownlinkExtended,
    const OPTIONAL< OCTETSTRING >& par_maxBitrateUplinkExtended,
    const OPTIONAL< OCTETSTRING >& par_guaranteedBitRateUplinkExtended)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_reliabilityClass(par_reliabilityClass),
  field_delayClass(par_delayClass),
  field_spare1(par_spare1),
  field_precedenceClass(par_precedenceClass),
  field_spare2(par_spare2),
  field_peakThroughput(par_peakThroughput),
  field_meanThroughput(par_meanThroughput),
  field_spare3(par_spare3),
  field_deliverErroneusSDU(par_deliverErroneusSDU),
  field_deliveryOrder(par_deliveryOrder),
  field_trafficClass(par_trafficClass),
  field_maxSDUSize(par_maxSDUSize),
  field_maxBitrateUplink(par_maxBitrateUplink),
  field_maxBitrateDownlink(par_maxBitrateDownlink),
  field_sduErrorRatio(par_sduErrorRatio),
  field_residualBER(par_residualBER),
  field_trafficHandlingPriority(par_trafficHandlingPriority),
  field_transferDelay(par_transferDelay),
  field_guaranteedBitRateUplink(par_guaranteedBitRateUplink),
  field_guaranteedBitRateDownlink(par_guaranteedBitRateDownlink),
  field_sourceStatisticsDescriptor(par_sourceStatisticsDescriptor),
  field_signallingIndication(par_signallingIndication),
  field_spare4(par_spare4),
  field_maxBitRateDownlinkExtended(par_maxBitRateDownlinkExtended),
  field_guaranteedBitRateDownlinkExtended(par_guaranteedBitRateDownlinkExtended),
  field_maxBitrateUplinkExtended(par_maxBitrateUplinkExtended),
  field_guaranteedBitRateUplinkExtended(par_guaranteedBitRateUplinkExtended)
{
}

ABQP::ABQP(const ABQP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.ABQP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.reliabilityClass().is_bound()) field_reliabilityClass = other_value.reliabilityClass();
else field_reliabilityClass.clean_up();
if (other_value.delayClass().is_bound()) field_delayClass = other_value.delayClass();
else field_delayClass.clean_up();
if (other_value.spare1().is_bound()) field_spare1 = other_value.spare1();
else field_spare1.clean_up();
if (other_value.precedenceClass().is_bound()) field_precedenceClass = other_value.precedenceClass();
else field_precedenceClass.clean_up();
if (other_value.spare2().is_bound()) field_spare2 = other_value.spare2();
else field_spare2.clean_up();
if (other_value.peakThroughput().is_bound()) field_peakThroughput = other_value.peakThroughput();
else field_peakThroughput.clean_up();
if (other_value.meanThroughput().is_bound()) field_meanThroughput = other_value.meanThroughput();
else field_meanThroughput.clean_up();
if (other_value.spare3().is_bound()) field_spare3 = other_value.spare3();
else field_spare3.clean_up();
if (other_value.deliverErroneusSDU().is_bound()) field_deliverErroneusSDU = other_value.deliverErroneusSDU();
else field_deliverErroneusSDU.clean_up();
if (other_value.deliveryOrder().is_bound()) field_deliveryOrder = other_value.deliveryOrder();
else field_deliveryOrder.clean_up();
if (other_value.trafficClass().is_bound()) field_trafficClass = other_value.trafficClass();
else field_trafficClass.clean_up();
if (other_value.maxSDUSize().is_bound()) field_maxSDUSize = other_value.maxSDUSize();
else field_maxSDUSize.clean_up();
if (other_value.maxBitrateUplink().is_bound()) field_maxBitrateUplink = other_value.maxBitrateUplink();
else field_maxBitrateUplink.clean_up();
if (other_value.maxBitrateDownlink().is_bound()) field_maxBitrateDownlink = other_value.maxBitrateDownlink();
else field_maxBitrateDownlink.clean_up();
if (other_value.sduErrorRatio().is_bound()) field_sduErrorRatio = other_value.sduErrorRatio();
else field_sduErrorRatio.clean_up();
if (other_value.residualBER().is_bound()) field_residualBER = other_value.residualBER();
else field_residualBER.clean_up();
if (other_value.trafficHandlingPriority().is_bound()) field_trafficHandlingPriority = other_value.trafficHandlingPriority();
else field_trafficHandlingPriority.clean_up();
if (other_value.transferDelay().is_bound()) field_transferDelay = other_value.transferDelay();
else field_transferDelay.clean_up();
if (other_value.guaranteedBitRateUplink().is_bound()) field_guaranteedBitRateUplink = other_value.guaranteedBitRateUplink();
else field_guaranteedBitRateUplink.clean_up();
if (other_value.guaranteedBitRateDownlink().is_bound()) field_guaranteedBitRateDownlink = other_value.guaranteedBitRateDownlink();
else field_guaranteedBitRateDownlink.clean_up();
if (other_value.sourceStatisticsDescriptor().is_bound()) field_sourceStatisticsDescriptor = other_value.sourceStatisticsDescriptor();
else field_sourceStatisticsDescriptor.clean_up();
if (other_value.signallingIndication().is_bound()) field_signallingIndication = other_value.signallingIndication();
else field_signallingIndication.clean_up();
if (other_value.spare4().is_bound()) field_spare4 = other_value.spare4();
else field_spare4.clean_up();
if (other_value.maxBitRateDownlinkExtended().is_bound()) field_maxBitRateDownlinkExtended = other_value.maxBitRateDownlinkExtended();
else field_maxBitRateDownlinkExtended.clean_up();
if (other_value.guaranteedBitRateDownlinkExtended().is_bound()) field_guaranteedBitRateDownlinkExtended = other_value.guaranteedBitRateDownlinkExtended();
else field_guaranteedBitRateDownlinkExtended.clean_up();
if (other_value.maxBitrateUplinkExtended().is_bound()) field_maxBitrateUplinkExtended = other_value.maxBitrateUplinkExtended();
else field_maxBitrateUplinkExtended.clean_up();
if (other_value.guaranteedBitRateUplinkExtended().is_bound()) field_guaranteedBitRateUplinkExtended = other_value.guaranteedBitRateUplinkExtended();
else field_guaranteedBitRateUplinkExtended.clean_up();
}

void ABQP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_reliabilityClass.clean_up();
field_delayClass.clean_up();
field_spare1.clean_up();
field_precedenceClass.clean_up();
field_spare2.clean_up();
field_peakThroughput.clean_up();
field_meanThroughput.clean_up();
field_spare3.clean_up();
field_deliverErroneusSDU.clean_up();
field_deliveryOrder.clean_up();
field_trafficClass.clean_up();
field_maxSDUSize.clean_up();
field_maxBitrateUplink.clean_up();
field_maxBitrateDownlink.clean_up();
field_sduErrorRatio.clean_up();
field_residualBER.clean_up();
field_trafficHandlingPriority.clean_up();
field_transferDelay.clean_up();
field_guaranteedBitRateUplink.clean_up();
field_guaranteedBitRateDownlink.clean_up();
field_sourceStatisticsDescriptor.clean_up();
field_signallingIndication.clean_up();
field_spare4.clean_up();
field_maxBitRateDownlinkExtended.clean_up();
field_guaranteedBitRateDownlinkExtended.clean_up();
field_maxBitrateUplinkExtended.clean_up();
field_guaranteedBitRateUplinkExtended.clean_up();
}

const TTCN_Typedescriptor_t* ABQP::get_descriptor() const { return &ABQP_descr_; }
ABQP& ABQP::operator=(const ABQP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.ABQP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.reliabilityClass().is_bound()) field_reliabilityClass = other_value.reliabilityClass();
  else field_reliabilityClass.clean_up();
  if (other_value.delayClass().is_bound()) field_delayClass = other_value.delayClass();
  else field_delayClass.clean_up();
  if (other_value.spare1().is_bound()) field_spare1 = other_value.spare1();
  else field_spare1.clean_up();
  if (other_value.precedenceClass().is_bound()) field_precedenceClass = other_value.precedenceClass();
  else field_precedenceClass.clean_up();
  if (other_value.spare2().is_bound()) field_spare2 = other_value.spare2();
  else field_spare2.clean_up();
  if (other_value.peakThroughput().is_bound()) field_peakThroughput = other_value.peakThroughput();
  else field_peakThroughput.clean_up();
  if (other_value.meanThroughput().is_bound()) field_meanThroughput = other_value.meanThroughput();
  else field_meanThroughput.clean_up();
  if (other_value.spare3().is_bound()) field_spare3 = other_value.spare3();
  else field_spare3.clean_up();
  if (other_value.deliverErroneusSDU().is_bound()) field_deliverErroneusSDU = other_value.deliverErroneusSDU();
  else field_deliverErroneusSDU.clean_up();
  if (other_value.deliveryOrder().is_bound()) field_deliveryOrder = other_value.deliveryOrder();
  else field_deliveryOrder.clean_up();
  if (other_value.trafficClass().is_bound()) field_trafficClass = other_value.trafficClass();
  else field_trafficClass.clean_up();
  if (other_value.maxSDUSize().is_bound()) field_maxSDUSize = other_value.maxSDUSize();
  else field_maxSDUSize.clean_up();
  if (other_value.maxBitrateUplink().is_bound()) field_maxBitrateUplink = other_value.maxBitrateUplink();
  else field_maxBitrateUplink.clean_up();
  if (other_value.maxBitrateDownlink().is_bound()) field_maxBitrateDownlink = other_value.maxBitrateDownlink();
  else field_maxBitrateDownlink.clean_up();
  if (other_value.sduErrorRatio().is_bound()) field_sduErrorRatio = other_value.sduErrorRatio();
  else field_sduErrorRatio.clean_up();
  if (other_value.residualBER().is_bound()) field_residualBER = other_value.residualBER();
  else field_residualBER.clean_up();
  if (other_value.trafficHandlingPriority().is_bound()) field_trafficHandlingPriority = other_value.trafficHandlingPriority();
  else field_trafficHandlingPriority.clean_up();
  if (other_value.transferDelay().is_bound()) field_transferDelay = other_value.transferDelay();
  else field_transferDelay.clean_up();
  if (other_value.guaranteedBitRateUplink().is_bound()) field_guaranteedBitRateUplink = other_value.guaranteedBitRateUplink();
  else field_guaranteedBitRateUplink.clean_up();
  if (other_value.guaranteedBitRateDownlink().is_bound()) field_guaranteedBitRateDownlink = other_value.guaranteedBitRateDownlink();
  else field_guaranteedBitRateDownlink.clean_up();
  if (other_value.sourceStatisticsDescriptor().is_bound()) field_sourceStatisticsDescriptor = other_value.sourceStatisticsDescriptor();
  else field_sourceStatisticsDescriptor.clean_up();
  if (other_value.signallingIndication().is_bound()) field_signallingIndication = other_value.signallingIndication();
  else field_signallingIndication.clean_up();
  if (other_value.spare4().is_bound()) field_spare4 = other_value.spare4();
  else field_spare4.clean_up();
  if (other_value.maxBitRateDownlinkExtended().is_bound()) field_maxBitRateDownlinkExtended = other_value.maxBitRateDownlinkExtended();
  else field_maxBitRateDownlinkExtended.clean_up();
  if (other_value.guaranteedBitRateDownlinkExtended().is_bound()) field_guaranteedBitRateDownlinkExtended = other_value.guaranteedBitRateDownlinkExtended();
  else field_guaranteedBitRateDownlinkExtended.clean_up();
  if (other_value.maxBitrateUplinkExtended().is_bound()) field_maxBitrateUplinkExtended = other_value.maxBitrateUplinkExtended();
  else field_maxBitrateUplinkExtended.clean_up();
  if (other_value.guaranteedBitRateUplinkExtended().is_bound()) field_guaranteedBitRateUplinkExtended = other_value.guaranteedBitRateUplinkExtended();
  else field_guaranteedBitRateUplinkExtended.clean_up();
}
return *this;
}

boolean ABQP::operator==(const ABQP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_reliabilityClass==other_value.field_reliabilityClass
  && field_delayClass==other_value.field_delayClass
  && field_spare1==other_value.field_spare1
  && field_precedenceClass==other_value.field_precedenceClass
  && field_spare2==other_value.field_spare2
  && field_peakThroughput==other_value.field_peakThroughput
  && field_meanThroughput==other_value.field_meanThroughput
  && field_spare3==other_value.field_spare3
  && field_deliverErroneusSDU==other_value.field_deliverErroneusSDU
  && field_deliveryOrder==other_value.field_deliveryOrder
  && field_trafficClass==other_value.field_trafficClass
  && field_maxSDUSize==other_value.field_maxSDUSize
  && field_maxBitrateUplink==other_value.field_maxBitrateUplink
  && field_maxBitrateDownlink==other_value.field_maxBitrateDownlink
  && field_sduErrorRatio==other_value.field_sduErrorRatio
  && field_residualBER==other_value.field_residualBER
  && field_trafficHandlingPriority==other_value.field_trafficHandlingPriority
  && field_transferDelay==other_value.field_transferDelay
  && field_guaranteedBitRateUplink==other_value.field_guaranteedBitRateUplink
  && field_guaranteedBitRateDownlink==other_value.field_guaranteedBitRateDownlink
  && field_sourceStatisticsDescriptor==other_value.field_sourceStatisticsDescriptor
  && field_signallingIndication==other_value.field_signallingIndication
  && field_spare4==other_value.field_spare4
  && field_maxBitRateDownlinkExtended==other_value.field_maxBitRateDownlinkExtended
  && field_guaranteedBitRateDownlinkExtended==other_value.field_guaranteedBitRateDownlinkExtended
  && field_maxBitrateUplinkExtended==other_value.field_maxBitrateUplinkExtended
  && field_guaranteedBitRateUplinkExtended==other_value.field_guaranteedBitRateUplinkExtended;
}

boolean ABQP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_reliabilityClass.is_bound())
  || (field_delayClass.is_bound())
  || (field_spare1.is_bound())
  || (field_precedenceClass.is_bound())
  || (field_spare2.is_bound())
  || (field_peakThroughput.is_bound())
  || (field_meanThroughput.is_bound())
  || (field_spare3.is_bound())
  || (OPTIONAL_OMIT == field_deliverErroneusSDU.get_selection() || field_deliverErroneusSDU.is_bound())
  || (OPTIONAL_OMIT == field_deliveryOrder.get_selection() || field_deliveryOrder.is_bound())
  || (OPTIONAL_OMIT == field_trafficClass.get_selection() || field_trafficClass.is_bound())
  || (OPTIONAL_OMIT == field_maxSDUSize.get_selection() || field_maxSDUSize.is_bound())
  || (OPTIONAL_OMIT == field_maxBitrateUplink.get_selection() || field_maxBitrateUplink.is_bound())
  || (OPTIONAL_OMIT == field_maxBitrateDownlink.get_selection() || field_maxBitrateDownlink.is_bound())
  || (OPTIONAL_OMIT == field_sduErrorRatio.get_selection() || field_sduErrorRatio.is_bound())
  || (OPTIONAL_OMIT == field_residualBER.get_selection() || field_residualBER.is_bound())
  || (OPTIONAL_OMIT == field_trafficHandlingPriority.get_selection() || field_trafficHandlingPriority.is_bound())
  || (OPTIONAL_OMIT == field_transferDelay.get_selection() || field_transferDelay.is_bound())
  || (OPTIONAL_OMIT == field_guaranteedBitRateUplink.get_selection() || field_guaranteedBitRateUplink.is_bound())
  || (OPTIONAL_OMIT == field_guaranteedBitRateDownlink.get_selection() || field_guaranteedBitRateDownlink.is_bound())
  || (OPTIONAL_OMIT == field_sourceStatisticsDescriptor.get_selection() || field_sourceStatisticsDescriptor.is_bound())
  || (OPTIONAL_OMIT == field_signallingIndication.get_selection() || field_signallingIndication.is_bound())
  || (OPTIONAL_OMIT == field_spare4.get_selection() || field_spare4.is_bound())
  || (OPTIONAL_OMIT == field_maxBitRateDownlinkExtended.get_selection() || field_maxBitRateDownlinkExtended.is_bound())
  || (OPTIONAL_OMIT == field_guaranteedBitRateDownlinkExtended.get_selection() || field_guaranteedBitRateDownlinkExtended.is_bound())
  || (OPTIONAL_OMIT == field_maxBitrateUplinkExtended.get_selection() || field_maxBitrateUplinkExtended.is_bound())
  || (OPTIONAL_OMIT == field_guaranteedBitRateUplinkExtended.get_selection() || field_guaranteedBitRateUplinkExtended.is_bound());
}
boolean ABQP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_reliabilityClass.is_value()
  && field_delayClass.is_value()
  && field_spare1.is_value()
  && field_precedenceClass.is_value()
  && field_spare2.is_value()
  && field_peakThroughput.is_value()
  && field_meanThroughput.is_value()
  && field_spare3.is_value()
  && (OPTIONAL_OMIT == field_deliverErroneusSDU.get_selection() || field_deliverErroneusSDU.is_value())
  && (OPTIONAL_OMIT == field_deliveryOrder.get_selection() || field_deliveryOrder.is_value())
  && (OPTIONAL_OMIT == field_trafficClass.get_selection() || field_trafficClass.is_value())
  && (OPTIONAL_OMIT == field_maxSDUSize.get_selection() || field_maxSDUSize.is_value())
  && (OPTIONAL_OMIT == field_maxBitrateUplink.get_selection() || field_maxBitrateUplink.is_value())
  && (OPTIONAL_OMIT == field_maxBitrateDownlink.get_selection() || field_maxBitrateDownlink.is_value())
  && (OPTIONAL_OMIT == field_sduErrorRatio.get_selection() || field_sduErrorRatio.is_value())
  && (OPTIONAL_OMIT == field_residualBER.get_selection() || field_residualBER.is_value())
  && (OPTIONAL_OMIT == field_trafficHandlingPriority.get_selection() || field_trafficHandlingPriority.is_value())
  && (OPTIONAL_OMIT == field_transferDelay.get_selection() || field_transferDelay.is_value())
  && (OPTIONAL_OMIT == field_guaranteedBitRateUplink.get_selection() || field_guaranteedBitRateUplink.is_value())
  && (OPTIONAL_OMIT == field_guaranteedBitRateDownlink.get_selection() || field_guaranteedBitRateDownlink.is_value())
  && (OPTIONAL_OMIT == field_sourceStatisticsDescriptor.get_selection() || field_sourceStatisticsDescriptor.is_value())
  && (OPTIONAL_OMIT == field_signallingIndication.get_selection() || field_signallingIndication.is_value())
  && (OPTIONAL_OMIT == field_spare4.get_selection() || field_spare4.is_value())
  && (OPTIONAL_OMIT == field_maxBitRateDownlinkExtended.get_selection() || field_maxBitRateDownlinkExtended.is_value())
  && (OPTIONAL_OMIT == field_guaranteedBitRateDownlinkExtended.get_selection() || field_guaranteedBitRateDownlinkExtended.is_value())
  && (OPTIONAL_OMIT == field_maxBitrateUplinkExtended.get_selection() || field_maxBitrateUplinkExtended.is_value())
  && (OPTIONAL_OMIT == field_guaranteedBitRateUplinkExtended.get_selection() || field_guaranteedBitRateUplinkExtended.is_value());
}
int ABQP::size_of() const
{
  int ret_val = 11;
  if (field_deliverErroneusSDU.ispresent()) ret_val++;
  if (field_deliveryOrder.ispresent()) ret_val++;
  if (field_trafficClass.ispresent()) ret_val++;
  if (field_maxSDUSize.ispresent()) ret_val++;
  if (field_maxBitrateUplink.ispresent()) ret_val++;
  if (field_maxBitrateDownlink.ispresent()) ret_val++;
  if (field_sduErrorRatio.ispresent()) ret_val++;
  if (field_residualBER.ispresent()) ret_val++;
  if (field_trafficHandlingPriority.ispresent()) ret_val++;
  if (field_transferDelay.ispresent()) ret_val++;
  if (field_guaranteedBitRateUplink.ispresent()) ret_val++;
  if (field_guaranteedBitRateDownlink.ispresent()) ret_val++;
  if (field_sourceStatisticsDescriptor.ispresent()) ret_val++;
  if (field_signallingIndication.ispresent()) ret_val++;
  if (field_spare4.ispresent()) ret_val++;
  if (field_maxBitRateDownlinkExtended.ispresent()) ret_val++;
  if (field_guaranteedBitRateDownlinkExtended.ispresent()) ret_val++;
  if (field_maxBitrateUplinkExtended.ispresent()) ret_val++;
  if (field_guaranteedBitRateUplinkExtended.ispresent()) ret_val++;
  return ret_val;
}

void ABQP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", reliabilityClass := ");
field_reliabilityClass.log();
TTCN_Logger::log_event_str(", delayClass := ");
field_delayClass.log();
TTCN_Logger::log_event_str(", spare1 := ");
field_spare1.log();
TTCN_Logger::log_event_str(", precedenceClass := ");
field_precedenceClass.log();
TTCN_Logger::log_event_str(", spare2 := ");
field_spare2.log();
TTCN_Logger::log_event_str(", peakThroughput := ");
field_peakThroughput.log();
TTCN_Logger::log_event_str(", meanThroughput := ");
field_meanThroughput.log();
TTCN_Logger::log_event_str(", spare3 := ");
field_spare3.log();
TTCN_Logger::log_event_str(", deliverErroneusSDU := ");
field_deliverErroneusSDU.log();
TTCN_Logger::log_event_str(", deliveryOrder := ");
field_deliveryOrder.log();
TTCN_Logger::log_event_str(", trafficClass := ");
field_trafficClass.log();
TTCN_Logger::log_event_str(", maxSDUSize := ");
field_maxSDUSize.log();
TTCN_Logger::log_event_str(", maxBitrateUplink := ");
field_maxBitrateUplink.log();
TTCN_Logger::log_event_str(", maxBitrateDownlink := ");
field_maxBitrateDownlink.log();
TTCN_Logger::log_event_str(", sduErrorRatio := ");
field_sduErrorRatio.log();
TTCN_Logger::log_event_str(", residualBER := ");
field_residualBER.log();
TTCN_Logger::log_event_str(", trafficHandlingPriority := ");
field_trafficHandlingPriority.log();
TTCN_Logger::log_event_str(", transferDelay := ");
field_transferDelay.log();
TTCN_Logger::log_event_str(", guaranteedBitRateUplink := ");
field_guaranteedBitRateUplink.log();
TTCN_Logger::log_event_str(", guaranteedBitRateDownlink := ");
field_guaranteedBitRateDownlink.log();
TTCN_Logger::log_event_str(", sourceStatisticsDescriptor := ");
field_sourceStatisticsDescriptor.log();
TTCN_Logger::log_event_str(", signallingIndication := ");
field_signallingIndication.log();
TTCN_Logger::log_event_str(", spare4 := ");
field_spare4.log();
TTCN_Logger::log_event_str(", maxBitRateDownlinkExtended := ");
field_maxBitRateDownlinkExtended.log();
TTCN_Logger::log_event_str(", guaranteedBitRateDownlinkExtended := ");
field_guaranteedBitRateDownlinkExtended.log();
TTCN_Logger::log_event_str(", maxBitrateUplinkExtended := ");
field_maxBitrateUplinkExtended.log();
TTCN_Logger::log_event_str(", guaranteedBitRateUplinkExtended := ");
field_guaranteedBitRateUplinkExtended.log();
TTCN_Logger::log_event_str(" }");
}

void ABQP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (reliabilityClass().is_bound()) reliabilityClass().set_implicit_omit();
if (delayClass().is_bound()) delayClass().set_implicit_omit();
if (spare1().is_bound()) spare1().set_implicit_omit();
if (precedenceClass().is_bound()) precedenceClass().set_implicit_omit();
if (spare2().is_bound()) spare2().set_implicit_omit();
if (peakThroughput().is_bound()) peakThroughput().set_implicit_omit();
if (meanThroughput().is_bound()) meanThroughput().set_implicit_omit();
if (spare3().is_bound()) spare3().set_implicit_omit();
if (!deliverErroneusSDU().is_bound()) deliverErroneusSDU() = OMIT_VALUE;
else deliverErroneusSDU().set_implicit_omit();
if (!deliveryOrder().is_bound()) deliveryOrder() = OMIT_VALUE;
else deliveryOrder().set_implicit_omit();
if (!trafficClass().is_bound()) trafficClass() = OMIT_VALUE;
else trafficClass().set_implicit_omit();
if (!maxSDUSize().is_bound()) maxSDUSize() = OMIT_VALUE;
else maxSDUSize().set_implicit_omit();
if (!maxBitrateUplink().is_bound()) maxBitrateUplink() = OMIT_VALUE;
else maxBitrateUplink().set_implicit_omit();
if (!maxBitrateDownlink().is_bound()) maxBitrateDownlink() = OMIT_VALUE;
else maxBitrateDownlink().set_implicit_omit();
if (!sduErrorRatio().is_bound()) sduErrorRatio() = OMIT_VALUE;
else sduErrorRatio().set_implicit_omit();
if (!residualBER().is_bound()) residualBER() = OMIT_VALUE;
else residualBER().set_implicit_omit();
if (!trafficHandlingPriority().is_bound()) trafficHandlingPriority() = OMIT_VALUE;
else trafficHandlingPriority().set_implicit_omit();
if (!transferDelay().is_bound()) transferDelay() = OMIT_VALUE;
else transferDelay().set_implicit_omit();
if (!guaranteedBitRateUplink().is_bound()) guaranteedBitRateUplink() = OMIT_VALUE;
else guaranteedBitRateUplink().set_implicit_omit();
if (!guaranteedBitRateDownlink().is_bound()) guaranteedBitRateDownlink() = OMIT_VALUE;
else guaranteedBitRateDownlink().set_implicit_omit();
if (!sourceStatisticsDescriptor().is_bound()) sourceStatisticsDescriptor() = OMIT_VALUE;
else sourceStatisticsDescriptor().set_implicit_omit();
if (!signallingIndication().is_bound()) signallingIndication() = OMIT_VALUE;
else signallingIndication().set_implicit_omit();
if (!spare4().is_bound()) spare4() = OMIT_VALUE;
else spare4().set_implicit_omit();
if (!maxBitRateDownlinkExtended().is_bound()) maxBitRateDownlinkExtended() = OMIT_VALUE;
else maxBitRateDownlinkExtended().set_implicit_omit();
if (!guaranteedBitRateDownlinkExtended().is_bound()) guaranteedBitRateDownlinkExtended() = OMIT_VALUE;
else guaranteedBitRateDownlinkExtended().set_implicit_omit();
if (!maxBitrateUplinkExtended().is_bound()) maxBitrateUplinkExtended() = OMIT_VALUE;
else maxBitrateUplinkExtended().set_implicit_omit();
if (!guaranteedBitRateUplinkExtended().is_bound()) guaranteedBitRateUplinkExtended() = OMIT_VALUE;
else guaranteedBitRateUplinkExtended().set_implicit_omit();
}

void ABQP::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 (30<param.get_size()) {
      param.error("record value of type @BSSGP_Types.ABQP has 30 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) reliabilityClass().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) delayClass().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) spare1().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) precedenceClass().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) spare2().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) peakThroughput().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) meanThroughput().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) spare3().set_param(*param.get_elem(10));
    if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) deliverErroneusSDU().set_param(*param.get_elem(11));
    if (param.get_size()>12 && param.get_elem(12)->get_type()!=Module_Param::MP_NotUsed) deliveryOrder().set_param(*param.get_elem(12));
    if (param.get_size()>13 && param.get_elem(13)->get_type()!=Module_Param::MP_NotUsed) trafficClass().set_param(*param.get_elem(13));
    if (param.get_size()>14 && param.get_elem(14)->get_type()!=Module_Param::MP_NotUsed) maxSDUSize().set_param(*param.get_elem(14));
    if (param.get_size()>15 && param.get_elem(15)->get_type()!=Module_Param::MP_NotUsed) maxBitrateUplink().set_param(*param.get_elem(15));
    if (param.get_size()>16 && param.get_elem(16)->get_type()!=Module_Param::MP_NotUsed) maxBitrateDownlink().set_param(*param.get_elem(16));
    if (param.get_size()>17 && param.get_elem(17)->get_type()!=Module_Param::MP_NotUsed) sduErrorRatio().set_param(*param.get_elem(17));
    if (param.get_size()>18 && param.get_elem(18)->get_type()!=Module_Param::MP_NotUsed) residualBER().set_param(*param.get_elem(18));
    if (param.get_size()>19 && param.get_elem(19)->get_type()!=Module_Param::MP_NotUsed) trafficHandlingPriority().set_param(*param.get_elem(19));
    if (param.get_size()>20 && param.get_elem(20)->get_type()!=Module_Param::MP_NotUsed) transferDelay().set_param(*param.get_elem(20));
    if (param.get_size()>21 && param.get_elem(21)->get_type()!=Module_Param::MP_NotUsed) guaranteedBitRateUplink().set_param(*param.get_elem(21));
    if (param.get_size()>22 && param.get_elem(22)->get_type()!=Module_Param::MP_NotUsed) guaranteedBitRateDownlink().set_param(*param.get_elem(22));
    if (param.get_size()>23 && param.get_elem(23)->get_type()!=Module_Param::MP_NotUsed) sourceStatisticsDescriptor().set_param(*param.get_elem(23));
    if (param.get_size()>24 && param.get_elem(24)->get_type()!=Module_Param::MP_NotUsed) signallingIndication().set_param(*param.get_elem(24));
    if (param.get_size()>25 && param.get_elem(25)->get_type()!=Module_Param::MP_NotUsed) spare4().set_param(*param.get_elem(25));
    if (param.get_size()>26 && param.get_elem(26)->get_type()!=Module_Param::MP_NotUsed) maxBitRateDownlinkExtended().set_param(*param.get_elem(26));
    if (param.get_size()>27 && param.get_elem(27)->get_type()!=Module_Param::MP_NotUsed) guaranteedBitRateDownlinkExtended().set_param(*param.get_elem(27));
    if (param.get_size()>28 && param.get_elem(28)->get_type()!=Module_Param::MP_NotUsed) maxBitrateUplinkExtended().set_param(*param.get_elem(28));
    if (param.get_size()>29 && param.get_elem(29)->get_type()!=Module_Param::MP_NotUsed) guaranteedBitRateUplinkExtended().set_param(*param.get_elem(29));
    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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "reliabilityClass")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          reliabilityClass().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "delayClass")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          delayClass().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare1().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "precedenceClass")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          precedenceClass().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare2().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "peakThroughput")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          peakThroughput().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "meanThroughput")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          meanThroughput().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare3")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare3().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "deliverErroneusSDU")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          deliverErroneusSDU().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "deliveryOrder")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          deliveryOrder().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "trafficClass")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          trafficClass().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "maxSDUSize")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          maxSDUSize().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "maxBitrateUplink")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          maxBitrateUplink().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "maxBitrateDownlink")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          maxBitrateDownlink().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "sduErrorRatio")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sduErrorRatio().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "residualBER")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          residualBER().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "trafficHandlingPriority")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          trafficHandlingPriority().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "transferDelay")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          transferDelay().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "guaranteedBitRateUplink")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          guaranteedBitRateUplink().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "guaranteedBitRateDownlink")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          guaranteedBitRateDownlink().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "sourceStatisticsDescriptor")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sourceStatisticsDescriptor().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "signallingIndication")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          signallingIndication().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare4")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare4().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "maxBitRateDownlinkExtended")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          maxBitRateDownlinkExtended().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "guaranteedBitRateDownlinkExtended")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          guaranteedBitRateDownlinkExtended().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "maxBitrateUplinkExtended")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          maxBitrateUplinkExtended().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "guaranteedBitRateUplinkExtended")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          guaranteedBitRateUplinkExtended().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 @BSSGP_Types.ABQP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.ABQP");
  }
}

void ABQP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_reliabilityClass.encode_text(text_buf);
field_delayClass.encode_text(text_buf);
field_spare1.encode_text(text_buf);
field_precedenceClass.encode_text(text_buf);
field_spare2.encode_text(text_buf);
field_peakThroughput.encode_text(text_buf);
field_meanThroughput.encode_text(text_buf);
field_spare3.encode_text(text_buf);
field_deliverErroneusSDU.encode_text(text_buf);
field_deliveryOrder.encode_text(text_buf);
field_trafficClass.encode_text(text_buf);
field_maxSDUSize.encode_text(text_buf);
field_maxBitrateUplink.encode_text(text_buf);
field_maxBitrateDownlink.encode_text(text_buf);
field_sduErrorRatio.encode_text(text_buf);
field_residualBER.encode_text(text_buf);
field_trafficHandlingPriority.encode_text(text_buf);
field_transferDelay.encode_text(text_buf);
field_guaranteedBitRateUplink.encode_text(text_buf);
field_guaranteedBitRateDownlink.encode_text(text_buf);
field_sourceStatisticsDescriptor.encode_text(text_buf);
field_signallingIndication.encode_text(text_buf);
field_spare4.encode_text(text_buf);
field_maxBitRateDownlinkExtended.encode_text(text_buf);
field_guaranteedBitRateDownlinkExtended.encode_text(text_buf);
field_maxBitrateUplinkExtended.encode_text(text_buf);
field_guaranteedBitRateUplinkExtended.encode_text(text_buf);
}

void ABQP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_reliabilityClass.decode_text(text_buf);
field_delayClass.decode_text(text_buf);
field_spare1.decode_text(text_buf);
field_precedenceClass.decode_text(text_buf);
field_spare2.decode_text(text_buf);
field_peakThroughput.decode_text(text_buf);
field_meanThroughput.decode_text(text_buf);
field_spare3.decode_text(text_buf);
field_deliverErroneusSDU.decode_text(text_buf);
field_deliveryOrder.decode_text(text_buf);
field_trafficClass.decode_text(text_buf);
field_maxSDUSize.decode_text(text_buf);
field_maxBitrateUplink.decode_text(text_buf);
field_maxBitrateDownlink.decode_text(text_buf);
field_sduErrorRatio.decode_text(text_buf);
field_residualBER.decode_text(text_buf);
field_trafficHandlingPriority.decode_text(text_buf);
field_transferDelay.decode_text(text_buf);
field_guaranteedBitRateUplink.decode_text(text_buf);
field_guaranteedBitRateDownlink.decode_text(text_buf);
field_sourceStatisticsDescriptor.decode_text(text_buf);
field_signallingIndication.decode_text(text_buf);
field_spare4.decode_text(text_buf);
field_maxBitRateDownlinkExtended.decode_text(text_buf);
field_guaranteedBitRateDownlinkExtended.decode_text(text_buf);
field_maxBitrateUplinkExtended.decode_text(text_buf);
field_guaranteedBitRateUplinkExtended.decode_text(text_buf);
}

void ABQP::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 ABQP::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 ABQP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, ABQP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(ABQP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, ABQP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(ABQP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT3_descr_.raw->forceomit);
  decoded_field_length = field_reliabilityClass.RAW_decode(General__Types::BIT3_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::BIT3_descr_.raw->forceomit);
  decoded_field_length = field_delayClass.RAW_decode(General__Types::BIT3_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::BIT2_descr_.raw->forceomit);
  decoded_field_length = field_spare1.RAW_decode(General__Types::BIT2_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, no_err, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_6_force_omit(6, force_omit, General__Types::BIT3_descr_.raw->forceomit);
  decoded_field_length = field_precedenceClass.RAW_decode(General__Types::BIT3_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_7_force_omit(7, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_spare2.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, no_err, -1, TRUE, &field_7_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_8_force_omit(8, force_omit, General__Types::BIT4_descr_.raw->forceomit);
  decoded_field_length = field_peakThroughput.RAW_decode(General__Types::BIT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_9_force_omit(9, force_omit, General__Types::BIT5_descr_.raw->forceomit);
  decoded_field_length = field_meanThroughput.RAW_decode(General__Types::BIT5_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_10_force_omit(10, force_omit, General__Types::BIT3_descr_.raw->forceomit);
  decoded_field_length = field_spare3.RAW_decode(General__Types::BIT3_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(11)) {
    field_deliverErroneusSDU = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_11_force_omit(11, force_omit, General__Types::BIT3_descr_.raw->forceomit);
  decoded_field_length = field_deliverErroneusSDU().RAW_decode(General__Types::BIT3_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_11_force_omit);
  if (decoded_field_length < 1) {
  field_deliverErroneusSDU = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_deliverErroneusSDU=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(12)) {
    field_deliveryOrder = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_12_force_omit(12, force_omit, General__Types::BIT2_descr_.raw->forceomit);
  decoded_field_length = field_deliveryOrder().RAW_decode(General__Types::BIT2_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_12_force_omit);
  if (decoded_field_length < 1) {
  field_deliveryOrder = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_deliveryOrder=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(13)) {
    field_trafficClass = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_13_force_omit(13, force_omit, General__Types::BIT3_descr_.raw->forceomit);
  decoded_field_length = field_trafficClass().RAW_decode(General__Types::BIT3_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_13_force_omit);
  if (decoded_field_length < 1) {
  field_trafficClass = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_trafficClass=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(14)) {
    field_maxSDUSize = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_14_force_omit(14, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_maxSDUSize().RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_14_force_omit);
  if (decoded_field_length < 1) {
  field_maxSDUSize = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_maxSDUSize=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(15)) {
    field_maxBitrateUplink = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_15_force_omit(15, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_maxBitrateUplink().RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_15_force_omit);
  if (decoded_field_length < 1) {
  field_maxBitrateUplink = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_maxBitrateUplink=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(16)) {
    field_maxBitrateDownlink = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_16_force_omit(16, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_maxBitrateDownlink().RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_16_force_omit);
  if (decoded_field_length < 1) {
  field_maxBitrateDownlink = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_maxBitrateDownlink=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(17)) {
    field_sduErrorRatio = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_17_force_omit(17, force_omit, General__Types::BIT4_descr_.raw->forceomit);
  decoded_field_length = field_sduErrorRatio().RAW_decode(General__Types::BIT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_17_force_omit);
  if (decoded_field_length < 1) {
  field_sduErrorRatio = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_sduErrorRatio=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(18)) {
    field_residualBER = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_18_force_omit(18, force_omit, General__Types::BIT4_descr_.raw->forceomit);
  decoded_field_length = field_residualBER().RAW_decode(General__Types::BIT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_18_force_omit);
  if (decoded_field_length < 1) {
  field_residualBER = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_residualBER=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(19)) {
    field_trafficHandlingPriority = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_19_force_omit(19, force_omit, General__Types::BIT2_descr_.raw->forceomit);
  decoded_field_length = field_trafficHandlingPriority().RAW_decode(General__Types::BIT2_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_19_force_omit);
  if (decoded_field_length < 1) {
  field_trafficHandlingPriority = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_trafficHandlingPriority=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(20)) {
    field_transferDelay = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_20_force_omit(20, force_omit, General__Types::BIT6_descr_.raw->forceomit);
  decoded_field_length = field_transferDelay().RAW_decode(General__Types::BIT6_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_20_force_omit);
  if (decoded_field_length < 1) {
  field_transferDelay = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_transferDelay=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(21)) {
    field_guaranteedBitRateUplink = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_21_force_omit(21, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_guaranteedBitRateUplink().RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_21_force_omit);
  if (decoded_field_length < 1) {
  field_guaranteedBitRateUplink = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_guaranteedBitRateUplink=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(22)) {
    field_guaranteedBitRateDownlink = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_22_force_omit(22, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_guaranteedBitRateDownlink().RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_22_force_omit);
  if (decoded_field_length < 1) {
  field_guaranteedBitRateDownlink = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_guaranteedBitRateDownlink=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(23)) {
    field_sourceStatisticsDescriptor = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_23_force_omit(23, force_omit, General__Types::BIT4_descr_.raw->forceomit);
  decoded_field_length = field_sourceStatisticsDescriptor().RAW_decode(General__Types::BIT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_23_force_omit);
  if (decoded_field_length < 1) {
  field_sourceStatisticsDescriptor = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_sourceStatisticsDescriptor=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(24)) {
    field_signallingIndication = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_24_force_omit(24, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_signallingIndication().RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_24_force_omit);
  if (decoded_field_length < 1) {
  field_signallingIndication = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_signallingIndication=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(25)) {
    field_spare4 = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_25_force_omit(25, force_omit, General__Types::BIT3_descr_.raw->forceomit);
  decoded_field_length = field_spare4().RAW_decode(General__Types::BIT3_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_25_force_omit);
  if (decoded_field_length < 1) {
  field_spare4 = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_spare4=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(26)) {
    field_maxBitRateDownlinkExtended = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_26_force_omit(26, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_maxBitRateDownlinkExtended().RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_26_force_omit);
  if (decoded_field_length < 1) {
  field_maxBitRateDownlinkExtended = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_maxBitRateDownlinkExtended=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(27)) {
    field_guaranteedBitRateDownlinkExtended = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_27_force_omit(27, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_guaranteedBitRateDownlinkExtended().RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_27_force_omit);
  if (decoded_field_length < 1) {
  field_guaranteedBitRateDownlinkExtended = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_guaranteedBitRateDownlinkExtended=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(28)) {
    field_maxBitrateUplinkExtended = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_28_force_omit(28, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_maxBitrateUplinkExtended().RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_28_force_omit);
  if (decoded_field_length < 1) {
  field_maxBitrateUplinkExtended = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_maxBitrateUplinkExtended=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(29)) {
    field_guaranteedBitRateUplinkExtended = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_29_force_omit(29, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_guaranteedBitRateUplinkExtended().RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_29_force_omit);
  if (decoded_field_length < 1) {
  field_guaranteedBitRateUplinkExtended = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_guaranteedBitRateUplinkExtended=OMIT_VALUE;
  if (field_iEI !=  os_34) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int ABQP::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 = 30;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(30);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, ABQP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, ABQP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT3_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::BIT3_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::BIT2_descr_.raw);
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, General__Types::BIT3_descr_.raw);
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, General__Types::BIT4_descr_.raw);
  myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, General__Types::BIT5_descr_.raw);
  myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 10, General__Types::BIT3_descr_.raw);
  if (field_deliverErroneusSDU.ispresent()) {
  myleaf.body.node.nodes[11] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 11, General__Types::BIT3_descr_.raw);
  }
  else myleaf.body.node.nodes[11] = NULL;
  if (field_deliveryOrder.ispresent()) {
  myleaf.body.node.nodes[12] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 12, General__Types::BIT2_descr_.raw);
  }
  else myleaf.body.node.nodes[12] = NULL;
  if (field_trafficClass.ispresent()) {
  myleaf.body.node.nodes[13] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 13, General__Types::BIT3_descr_.raw);
  }
  else myleaf.body.node.nodes[13] = NULL;
  if (field_maxSDUSize.ispresent()) {
  myleaf.body.node.nodes[14] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 14, General__Types::OCT1_descr_.raw);
  }
  else myleaf.body.node.nodes[14] = NULL;
  if (field_maxBitrateUplink.ispresent()) {
  myleaf.body.node.nodes[15] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 15, General__Types::OCT1_descr_.raw);
  }
  else myleaf.body.node.nodes[15] = NULL;
  if (field_maxBitrateDownlink.ispresent()) {
  myleaf.body.node.nodes[16] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 16, General__Types::OCT1_descr_.raw);
  }
  else myleaf.body.node.nodes[16] = NULL;
  if (field_sduErrorRatio.ispresent()) {
  myleaf.body.node.nodes[17] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 17, General__Types::BIT4_descr_.raw);
  }
  else myleaf.body.node.nodes[17] = NULL;
  if (field_residualBER.ispresent()) {
  myleaf.body.node.nodes[18] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 18, General__Types::BIT4_descr_.raw);
  }
  else myleaf.body.node.nodes[18] = NULL;
  if (field_trafficHandlingPriority.ispresent()) {
  myleaf.body.node.nodes[19] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 19, General__Types::BIT2_descr_.raw);
  }
  else myleaf.body.node.nodes[19] = NULL;
  if (field_transferDelay.ispresent()) {
  myleaf.body.node.nodes[20] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 20, General__Types::BIT6_descr_.raw);
  }
  else myleaf.body.node.nodes[20] = NULL;
  if (field_guaranteedBitRateUplink.ispresent()) {
  myleaf.body.node.nodes[21] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 21, General__Types::OCT1_descr_.raw);
  }
  else myleaf.body.node.nodes[21] = NULL;
  if (field_guaranteedBitRateDownlink.ispresent()) {
  myleaf.body.node.nodes[22] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 22, General__Types::OCT1_descr_.raw);
  }
  else myleaf.body.node.nodes[22] = NULL;
  if (field_sourceStatisticsDescriptor.ispresent()) {
  myleaf.body.node.nodes[23] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 23, General__Types::BIT4_descr_.raw);
  }
  else myleaf.body.node.nodes[23] = NULL;
  if (field_signallingIndication.ispresent()) {
  myleaf.body.node.nodes[24] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 24, General__Types::BIT1_descr_.raw);
  }
  else myleaf.body.node.nodes[24] = NULL;
  if (field_spare4.ispresent()) {
  myleaf.body.node.nodes[25] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 25, General__Types::BIT3_descr_.raw);
  }
  else myleaf.body.node.nodes[25] = NULL;
  if (field_maxBitRateDownlinkExtended.ispresent()) {
  myleaf.body.node.nodes[26] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 26, General__Types::OCT1_descr_.raw);
  }
  else myleaf.body.node.nodes[26] = NULL;
  if (field_guaranteedBitRateDownlinkExtended.ispresent()) {
  myleaf.body.node.nodes[27] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 27, General__Types::OCT1_descr_.raw);
  }
  else myleaf.body.node.nodes[27] = NULL;
  if (field_maxBitrateUplinkExtended.ispresent()) {
  myleaf.body.node.nodes[28] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 28, General__Types::OCT1_descr_.raw);
  }
  else myleaf.body.node.nodes[28] = NULL;
  if (field_guaranteedBitRateUplinkExtended.ispresent()) {
  myleaf.body.node.nodes[29] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 29, General__Types::OCT1_descr_.raw);
  }
  else myleaf.body.node.nodes[29] = NULL;
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(ABQP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(ABQP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_reliabilityClass.RAW_encode(General__Types::BIT3_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_delayClass.RAW_encode(General__Types::BIT3_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_spare1.RAW_encode(General__Types::BIT2_descr_, *myleaf.body.node.nodes[5]);
  encoded_length += field_precedenceClass.RAW_encode(General__Types::BIT3_descr_, *myleaf.body.node.nodes[6]);
  encoded_length += field_spare2.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[7]);
  encoded_length += field_peakThroughput.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[8]);
  encoded_length += field_meanThroughput.RAW_encode(General__Types::BIT5_descr_, *myleaf.body.node.nodes[9]);
  encoded_length += field_spare3.RAW_encode(General__Types::BIT3_descr_, *myleaf.body.node.nodes[10]);
  if (field_deliverErroneusSDU.ispresent()) {
  encoded_length += field_deliverErroneusSDU().RAW_encode(General__Types::BIT3_descr_, *myleaf.body.node.nodes[11]);
  }
  if (field_deliveryOrder.ispresent()) {
  encoded_length += field_deliveryOrder().RAW_encode(General__Types::BIT2_descr_, *myleaf.body.node.nodes[12]);
  }
  if (field_trafficClass.ispresent()) {
  encoded_length += field_trafficClass().RAW_encode(General__Types::BIT3_descr_, *myleaf.body.node.nodes[13]);
  }
  if (field_maxSDUSize.ispresent()) {
  encoded_length += field_maxSDUSize().RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[14]);
  }
  if (field_maxBitrateUplink.ispresent()) {
  encoded_length += field_maxBitrateUplink().RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[15]);
  }
  if (field_maxBitrateDownlink.ispresent()) {
  encoded_length += field_maxBitrateDownlink().RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[16]);
  }
  if (field_sduErrorRatio.ispresent()) {
  encoded_length += field_sduErrorRatio().RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[17]);
  }
  if (field_residualBER.ispresent()) {
  encoded_length += field_residualBER().RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[18]);
  }
  if (field_trafficHandlingPriority.ispresent()) {
  encoded_length += field_trafficHandlingPriority().RAW_encode(General__Types::BIT2_descr_, *myleaf.body.node.nodes[19]);
  }
  if (field_transferDelay.ispresent()) {
  encoded_length += field_transferDelay().RAW_encode(General__Types::BIT6_descr_, *myleaf.body.node.nodes[20]);
  }
  if (field_guaranteedBitRateUplink.ispresent()) {
  encoded_length += field_guaranteedBitRateUplink().RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[21]);
  }
  if (field_guaranteedBitRateDownlink.ispresent()) {
  encoded_length += field_guaranteedBitRateDownlink().RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[22]);
  }
  if (field_sourceStatisticsDescriptor.ispresent()) {
  encoded_length += field_sourceStatisticsDescriptor().RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[23]);
  }
  if (field_signallingIndication.ispresent()) {
  encoded_length += field_signallingIndication().RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[24]);
  }
  if (field_spare4.ispresent()) {
  encoded_length += field_spare4().RAW_encode(General__Types::BIT3_descr_, *myleaf.body.node.nodes[25]);
  }
  if (field_maxBitRateDownlinkExtended.ispresent()) {
  encoded_length += field_maxBitRateDownlinkExtended().RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[26]);
  }
  if (field_guaranteedBitRateDownlinkExtended.ispresent()) {
  encoded_length += field_guaranteedBitRateDownlinkExtended().RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[27]);
  }
  if (field_maxBitrateUplinkExtended.ispresent()) {
  encoded_length += field_maxBitrateUplinkExtended().RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[28]);
  }
  if (field_guaranteedBitRateUplinkExtended.ispresent()) {
  encoded_length += field_guaranteedBitRateUplinkExtended().RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[29]);
  }
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 27;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(27);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[4]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[4]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[5]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[5]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[6]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[6]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[4].level = myleaf.body.node.nodes[7]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[4].pos = myleaf.body.node.nodes[7]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[5].level = myleaf.body.node.nodes[8]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[5].pos = myleaf.body.node.nodes[8]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[6].level = myleaf.body.node.nodes[9]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[6].pos = myleaf.body.node.nodes[9]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[7].level = myleaf.body.node.nodes[10]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[7].pos = myleaf.body.node.nodes[10]->curr_pos.pos;
  if (field_deliverErroneusSDU.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[8].level = myleaf.body.node.nodes[11]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[8].pos = myleaf.body.node.nodes[11]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[8].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[8].pos = 0;
  }
  if (field_deliveryOrder.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[9].level = myleaf.body.node.nodes[12]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[9].pos = myleaf.body.node.nodes[12]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[9].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[9].pos = 0;
  }
  if (field_trafficClass.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[10].level = myleaf.body.node.nodes[13]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[10].pos = myleaf.body.node.nodes[13]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[10].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[10].pos = 0;
  }
  if (field_maxSDUSize.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[11].level = myleaf.body.node.nodes[14]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[11].pos = myleaf.body.node.nodes[14]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[11].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[11].pos = 0;
  }
  if (field_maxBitrateUplink.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[12].level = myleaf.body.node.nodes[15]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[12].pos = myleaf.body.node.nodes[15]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[12].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[12].pos = 0;
  }
  if (field_maxBitrateDownlink.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[13].level = myleaf.body.node.nodes[16]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[13].pos = myleaf.body.node.nodes[16]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[13].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[13].pos = 0;
  }
  if (field_sduErrorRatio.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[14].level = myleaf.body.node.nodes[17]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[14].pos = myleaf.body.node.nodes[17]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[14].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[14].pos = 0;
  }
  if (field_residualBER.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[15].level = myleaf.body.node.nodes[18]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[15].pos = myleaf.body.node.nodes[18]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[15].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[15].pos = 0;
  }
  if (field_trafficHandlingPriority.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[16].level = myleaf.body.node.nodes[19]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[16].pos = myleaf.body.node.nodes[19]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[16].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[16].pos = 0;
  }
  if (field_transferDelay.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[17].level = myleaf.body.node.nodes[20]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[17].pos = myleaf.body.node.nodes[20]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[17].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[17].pos = 0;
  }
  if (field_guaranteedBitRateUplink.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[18].level = myleaf.body.node.nodes[21]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[18].pos = myleaf.body.node.nodes[21]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[18].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[18].pos = 0;
  }
  if (field_guaranteedBitRateDownlink.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[19].level = myleaf.body.node.nodes[22]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[19].pos = myleaf.body.node.nodes[22]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[19].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[19].pos = 0;
  }
  if (field_sourceStatisticsDescriptor.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[20].level = myleaf.body.node.nodes[23]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[20].pos = myleaf.body.node.nodes[23]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[20].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[20].pos = 0;
  }
  if (field_signallingIndication.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[21].level = myleaf.body.node.nodes[24]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[21].pos = myleaf.body.node.nodes[24]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[21].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[21].pos = 0;
  }
  if (field_spare4.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[22].level = myleaf.body.node.nodes[25]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[22].pos = myleaf.body.node.nodes[25]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[22].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[22].pos = 0;
  }
  if (field_maxBitRateDownlinkExtended.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[23].level = myleaf.body.node.nodes[26]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[23].pos = myleaf.body.node.nodes[26]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[23].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[23].pos = 0;
  }
  if (field_guaranteedBitRateDownlinkExtended.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[24].level = myleaf.body.node.nodes[27]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[24].pos = myleaf.body.node.nodes[27]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[24].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[24].pos = 0;
  }
  if (field_maxBitrateUplinkExtended.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[25].level = myleaf.body.node.nodes[28]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[25].pos = myleaf.body.node.nodes[28]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[25].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[25].pos = 0;
  }
  if (field_guaranteedBitRateUplinkExtended.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[26].level = myleaf.body.node.nodes[29]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[26].pos = myleaf.body.node.nodes[29]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[26].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[26].pos = 0;
  }
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(ABQP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(ABQP_ext_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_iEI !=  os_34) {
  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){
   os_34.RAW_encode(General__Types::OCT1_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 ABQP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
BITSTRING_template field_reliabilityClass;
BITSTRING_template field_delayClass;
BITSTRING_template field_spare1;
BITSTRING_template field_precedenceClass;
BITSTRING_template field_spare2;
BITSTRING_template field_peakThroughput;
BITSTRING_template field_meanThroughput;
BITSTRING_template field_spare3;
BITSTRING_template field_deliverErroneusSDU;
BITSTRING_template field_deliveryOrder;
BITSTRING_template field_trafficClass;
OCTETSTRING_template field_maxSDUSize;
OCTETSTRING_template field_maxBitrateUplink;
OCTETSTRING_template field_maxBitrateDownlink;
BITSTRING_template field_sduErrorRatio;
BITSTRING_template field_residualBER;
BITSTRING_template field_trafficHandlingPriority;
BITSTRING_template field_transferDelay;
OCTETSTRING_template field_guaranteedBitRateUplink;
OCTETSTRING_template field_guaranteedBitRateDownlink;
BITSTRING_template field_sourceStatisticsDescriptor;
BITSTRING_template field_signallingIndication;
BITSTRING_template field_spare4;
OCTETSTRING_template field_maxBitRateDownlinkExtended;
OCTETSTRING_template field_guaranteedBitRateDownlinkExtended;
OCTETSTRING_template field_maxBitrateUplinkExtended;
OCTETSTRING_template field_guaranteedBitRateUplinkExtended;
};

void ABQP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_reliabilityClass = ANY_VALUE;
single_value->field_delayClass = ANY_VALUE;
single_value->field_spare1 = ANY_VALUE;
single_value->field_precedenceClass = ANY_VALUE;
single_value->field_spare2 = ANY_VALUE;
single_value->field_peakThroughput = ANY_VALUE;
single_value->field_meanThroughput = ANY_VALUE;
single_value->field_spare3 = ANY_VALUE;
single_value->field_deliverErroneusSDU = ANY_OR_OMIT;
single_value->field_deliveryOrder = ANY_OR_OMIT;
single_value->field_trafficClass = ANY_OR_OMIT;
single_value->field_maxSDUSize = ANY_OR_OMIT;
single_value->field_maxBitrateUplink = ANY_OR_OMIT;
single_value->field_maxBitrateDownlink = ANY_OR_OMIT;
single_value->field_sduErrorRatio = ANY_OR_OMIT;
single_value->field_residualBER = ANY_OR_OMIT;
single_value->field_trafficHandlingPriority = ANY_OR_OMIT;
single_value->field_transferDelay = ANY_OR_OMIT;
single_value->field_guaranteedBitRateUplink = ANY_OR_OMIT;
single_value->field_guaranteedBitRateDownlink = ANY_OR_OMIT;
single_value->field_sourceStatisticsDescriptor = ANY_OR_OMIT;
single_value->field_signallingIndication = ANY_OR_OMIT;
single_value->field_spare4 = ANY_OR_OMIT;
single_value->field_maxBitRateDownlinkExtended = ANY_OR_OMIT;
single_value->field_guaranteedBitRateDownlinkExtended = ANY_OR_OMIT;
single_value->field_maxBitrateUplinkExtended = ANY_OR_OMIT;
single_value->field_guaranteedBitRateUplinkExtended = ANY_OR_OMIT;
}
}
}

void ABQP_template::copy_value(const ABQP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.reliabilityClass().is_bound()) {
  single_value->field_reliabilityClass = other_value.reliabilityClass();
} else {
  single_value->field_reliabilityClass.clean_up();
}
if (other_value.delayClass().is_bound()) {
  single_value->field_delayClass = other_value.delayClass();
} else {
  single_value->field_delayClass.clean_up();
}
if (other_value.spare1().is_bound()) {
  single_value->field_spare1 = other_value.spare1();
} else {
  single_value->field_spare1.clean_up();
}
if (other_value.precedenceClass().is_bound()) {
  single_value->field_precedenceClass = other_value.precedenceClass();
} else {
  single_value->field_precedenceClass.clean_up();
}
if (other_value.spare2().is_bound()) {
  single_value->field_spare2 = other_value.spare2();
} else {
  single_value->field_spare2.clean_up();
}
if (other_value.peakThroughput().is_bound()) {
  single_value->field_peakThroughput = other_value.peakThroughput();
} else {
  single_value->field_peakThroughput.clean_up();
}
if (other_value.meanThroughput().is_bound()) {
  single_value->field_meanThroughput = other_value.meanThroughput();
} else {
  single_value->field_meanThroughput.clean_up();
}
if (other_value.spare3().is_bound()) {
  single_value->field_spare3 = other_value.spare3();
} else {
  single_value->field_spare3.clean_up();
}
if (other_value.deliverErroneusSDU().is_bound()) {
  if (other_value.deliverErroneusSDU().ispresent()) single_value->field_deliverErroneusSDU = other_value.deliverErroneusSDU()();
  else single_value->field_deliverErroneusSDU = OMIT_VALUE;
} else {
  single_value->field_deliverErroneusSDU.clean_up();
}
if (other_value.deliveryOrder().is_bound()) {
  if (other_value.deliveryOrder().ispresent()) single_value->field_deliveryOrder = other_value.deliveryOrder()();
  else single_value->field_deliveryOrder = OMIT_VALUE;
} else {
  single_value->field_deliveryOrder.clean_up();
}
if (other_value.trafficClass().is_bound()) {
  if (other_value.trafficClass().ispresent()) single_value->field_trafficClass = other_value.trafficClass()();
  else single_value->field_trafficClass = OMIT_VALUE;
} else {
  single_value->field_trafficClass.clean_up();
}
if (other_value.maxSDUSize().is_bound()) {
  if (other_value.maxSDUSize().ispresent()) single_value->field_maxSDUSize = other_value.maxSDUSize()();
  else single_value->field_maxSDUSize = OMIT_VALUE;
} else {
  single_value->field_maxSDUSize.clean_up();
}
if (other_value.maxBitrateUplink().is_bound()) {
  if (other_value.maxBitrateUplink().ispresent()) single_value->field_maxBitrateUplink = other_value.maxBitrateUplink()();
  else single_value->field_maxBitrateUplink = OMIT_VALUE;
} else {
  single_value->field_maxBitrateUplink.clean_up();
}
if (other_value.maxBitrateDownlink().is_bound()) {
  if (other_value.maxBitrateDownlink().ispresent()) single_value->field_maxBitrateDownlink = other_value.maxBitrateDownlink()();
  else single_value->field_maxBitrateDownlink = OMIT_VALUE;
} else {
  single_value->field_maxBitrateDownlink.clean_up();
}
if (other_value.sduErrorRatio().is_bound()) {
  if (other_value.sduErrorRatio().ispresent()) single_value->field_sduErrorRatio = other_value.sduErrorRatio()();
  else single_value->field_sduErrorRatio = OMIT_VALUE;
} else {
  single_value->field_sduErrorRatio.clean_up();
}
if (other_value.residualBER().is_bound()) {
  if (other_value.residualBER().ispresent()) single_value->field_residualBER = other_value.residualBER()();
  else single_value->field_residualBER = OMIT_VALUE;
} else {
  single_value->field_residualBER.clean_up();
}
if (other_value.trafficHandlingPriority().is_bound()) {
  if (other_value.trafficHandlingPriority().ispresent()) single_value->field_trafficHandlingPriority = other_value.trafficHandlingPriority()();
  else single_value->field_trafficHandlingPriority = OMIT_VALUE;
} else {
  single_value->field_trafficHandlingPriority.clean_up();
}
if (other_value.transferDelay().is_bound()) {
  if (other_value.transferDelay().ispresent()) single_value->field_transferDelay = other_value.transferDelay()();
  else single_value->field_transferDelay = OMIT_VALUE;
} else {
  single_value->field_transferDelay.clean_up();
}
if (other_value.guaranteedBitRateUplink().is_bound()) {
  if (other_value.guaranteedBitRateUplink().ispresent()) single_value->field_guaranteedBitRateUplink = other_value.guaranteedBitRateUplink()();
  else single_value->field_guaranteedBitRateUplink = OMIT_VALUE;
} else {
  single_value->field_guaranteedBitRateUplink.clean_up();
}
if (other_value.guaranteedBitRateDownlink().is_bound()) {
  if (other_value.guaranteedBitRateDownlink().ispresent()) single_value->field_guaranteedBitRateDownlink = other_value.guaranteedBitRateDownlink()();
  else single_value->field_guaranteedBitRateDownlink = OMIT_VALUE;
} else {
  single_value->field_guaranteedBitRateDownlink.clean_up();
}
if (other_value.sourceStatisticsDescriptor().is_bound()) {
  if (other_value.sourceStatisticsDescriptor().ispresent()) single_value->field_sourceStatisticsDescriptor = other_value.sourceStatisticsDescriptor()();
  else single_value->field_sourceStatisticsDescriptor = OMIT_VALUE;
} else {
  single_value->field_sourceStatisticsDescriptor.clean_up();
}
if (other_value.signallingIndication().is_bound()) {
  if (other_value.signallingIndication().ispresent()) single_value->field_signallingIndication = other_value.signallingIndication()();
  else single_value->field_signallingIndication = OMIT_VALUE;
} else {
  single_value->field_signallingIndication.clean_up();
}
if (other_value.spare4().is_bound()) {
  if (other_value.spare4().ispresent()) single_value->field_spare4 = other_value.spare4()();
  else single_value->field_spare4 = OMIT_VALUE;
} else {
  single_value->field_spare4.clean_up();
}
if (other_value.maxBitRateDownlinkExtended().is_bound()) {
  if (other_value.maxBitRateDownlinkExtended().ispresent()) single_value->field_maxBitRateDownlinkExtended = other_value.maxBitRateDownlinkExtended()();
  else single_value->field_maxBitRateDownlinkExtended = OMIT_VALUE;
} else {
  single_value->field_maxBitRateDownlinkExtended.clean_up();
}
if (other_value.guaranteedBitRateDownlinkExtended().is_bound()) {
  if (other_value.guaranteedBitRateDownlinkExtended().ispresent()) single_value->field_guaranteedBitRateDownlinkExtended = other_value.guaranteedBitRateDownlinkExtended()();
  else single_value->field_guaranteedBitRateDownlinkExtended = OMIT_VALUE;
} else {
  single_value->field_guaranteedBitRateDownlinkExtended.clean_up();
}
if (other_value.maxBitrateUplinkExtended().is_bound()) {
  if (other_value.maxBitrateUplinkExtended().ispresent()) single_value->field_maxBitrateUplinkExtended = other_value.maxBitrateUplinkExtended()();
  else single_value->field_maxBitrateUplinkExtended = OMIT_VALUE;
} else {
  single_value->field_maxBitrateUplinkExtended.clean_up();
}
if (other_value.guaranteedBitRateUplinkExtended().is_bound()) {
  if (other_value.guaranteedBitRateUplinkExtended().ispresent()) single_value->field_guaranteedBitRateUplinkExtended = other_value.guaranteedBitRateUplinkExtended()();
  else single_value->field_guaranteedBitRateUplinkExtended = OMIT_VALUE;
} else {
  single_value->field_guaranteedBitRateUplinkExtended.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void ABQP_template::copy_template(const ABQP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.reliabilityClass().get_selection()) {
single_value->field_reliabilityClass = other_value.reliabilityClass();
} else {
single_value->field_reliabilityClass.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.delayClass().get_selection()) {
single_value->field_delayClass = other_value.delayClass();
} else {
single_value->field_delayClass.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare1().get_selection()) {
single_value->field_spare1 = other_value.spare1();
} else {
single_value->field_spare1.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.precedenceClass().get_selection()) {
single_value->field_precedenceClass = other_value.precedenceClass();
} else {
single_value->field_precedenceClass.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare2().get_selection()) {
single_value->field_spare2 = other_value.spare2();
} else {
single_value->field_spare2.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.peakThroughput().get_selection()) {
single_value->field_peakThroughput = other_value.peakThroughput();
} else {
single_value->field_peakThroughput.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.meanThroughput().get_selection()) {
single_value->field_meanThroughput = other_value.meanThroughput();
} else {
single_value->field_meanThroughput.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare3().get_selection()) {
single_value->field_spare3 = other_value.spare3();
} else {
single_value->field_spare3.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.deliverErroneusSDU().get_selection()) {
single_value->field_deliverErroneusSDU = other_value.deliverErroneusSDU();
} else {
single_value->field_deliverErroneusSDU.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.deliveryOrder().get_selection()) {
single_value->field_deliveryOrder = other_value.deliveryOrder();
} else {
single_value->field_deliveryOrder.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.trafficClass().get_selection()) {
single_value->field_trafficClass = other_value.trafficClass();
} else {
single_value->field_trafficClass.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.maxSDUSize().get_selection()) {
single_value->field_maxSDUSize = other_value.maxSDUSize();
} else {
single_value->field_maxSDUSize.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.maxBitrateUplink().get_selection()) {
single_value->field_maxBitrateUplink = other_value.maxBitrateUplink();
} else {
single_value->field_maxBitrateUplink.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.maxBitrateDownlink().get_selection()) {
single_value->field_maxBitrateDownlink = other_value.maxBitrateDownlink();
} else {
single_value->field_maxBitrateDownlink.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.sduErrorRatio().get_selection()) {
single_value->field_sduErrorRatio = other_value.sduErrorRatio();
} else {
single_value->field_sduErrorRatio.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.residualBER().get_selection()) {
single_value->field_residualBER = other_value.residualBER();
} else {
single_value->field_residualBER.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.trafficHandlingPriority().get_selection()) {
single_value->field_trafficHandlingPriority = other_value.trafficHandlingPriority();
} else {
single_value->field_trafficHandlingPriority.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.transferDelay().get_selection()) {
single_value->field_transferDelay = other_value.transferDelay();
} else {
single_value->field_transferDelay.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.guaranteedBitRateUplink().get_selection()) {
single_value->field_guaranteedBitRateUplink = other_value.guaranteedBitRateUplink();
} else {
single_value->field_guaranteedBitRateUplink.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.guaranteedBitRateDownlink().get_selection()) {
single_value->field_guaranteedBitRateDownlink = other_value.guaranteedBitRateDownlink();
} else {
single_value->field_guaranteedBitRateDownlink.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.sourceStatisticsDescriptor().get_selection()) {
single_value->field_sourceStatisticsDescriptor = other_value.sourceStatisticsDescriptor();
} else {
single_value->field_sourceStatisticsDescriptor.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.signallingIndication().get_selection()) {
single_value->field_signallingIndication = other_value.signallingIndication();
} else {
single_value->field_signallingIndication.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare4().get_selection()) {
single_value->field_spare4 = other_value.spare4();
} else {
single_value->field_spare4.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.maxBitRateDownlinkExtended().get_selection()) {
single_value->field_maxBitRateDownlinkExtended = other_value.maxBitRateDownlinkExtended();
} else {
single_value->field_maxBitRateDownlinkExtended.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.guaranteedBitRateDownlinkExtended().get_selection()) {
single_value->field_guaranteedBitRateDownlinkExtended = other_value.guaranteedBitRateDownlinkExtended();
} else {
single_value->field_guaranteedBitRateDownlinkExtended.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.maxBitrateUplinkExtended().get_selection()) {
single_value->field_maxBitrateUplinkExtended = other_value.maxBitrateUplinkExtended();
} else {
single_value->field_maxBitrateUplinkExtended.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.guaranteedBitRateUplinkExtended().get_selection()) {
single_value->field_guaranteedBitRateUplinkExtended = other_value.guaranteedBitRateUplinkExtended();
} else {
single_value->field_guaranteedBitRateUplinkExtended.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 ABQP_template[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 ABQP_template(*other_value.implication_.precondition);
implication_.implied_template = new ABQP_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 @BSSGP_Types.ABQP.");
break;
}
set_selection(other_value);
}

ABQP_template::ABQP_template()
{
}

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

ABQP_template::ABQP_template(const ABQP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean ABQP_template::match(const ABQP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.reliabilityClass().is_bound()) return FALSE;
if(!single_value->field_reliabilityClass.match(other_value.reliabilityClass(), legacy))return FALSE;
if(!other_value.delayClass().is_bound()) return FALSE;
if(!single_value->field_delayClass.match(other_value.delayClass(), legacy))return FALSE;
if(!other_value.spare1().is_bound()) return FALSE;
if(!single_value->field_spare1.match(other_value.spare1(), legacy))return FALSE;
if(!other_value.precedenceClass().is_bound()) return FALSE;
if(!single_value->field_precedenceClass.match(other_value.precedenceClass(), legacy))return FALSE;
if(!other_value.spare2().is_bound()) return FALSE;
if(!single_value->field_spare2.match(other_value.spare2(), legacy))return FALSE;
if(!other_value.peakThroughput().is_bound()) return FALSE;
if(!single_value->field_peakThroughput.match(other_value.peakThroughput(), legacy))return FALSE;
if(!other_value.meanThroughput().is_bound()) return FALSE;
if(!single_value->field_meanThroughput.match(other_value.meanThroughput(), legacy))return FALSE;
if(!other_value.spare3().is_bound()) return FALSE;
if(!single_value->field_spare3.match(other_value.spare3(), legacy))return FALSE;
if(!other_value.deliverErroneusSDU().is_bound()) return FALSE;
if((other_value.deliverErroneusSDU().ispresent() ? !single_value->field_deliverErroneusSDU.match((const BITSTRING&)other_value.deliverErroneusSDU(), legacy) : !single_value->field_deliverErroneusSDU.match_omit(legacy)))return FALSE;
if(!other_value.deliveryOrder().is_bound()) return FALSE;
if((other_value.deliveryOrder().ispresent() ? !single_value->field_deliveryOrder.match((const BITSTRING&)other_value.deliveryOrder(), legacy) : !single_value->field_deliveryOrder.match_omit(legacy)))return FALSE;
if(!other_value.trafficClass().is_bound()) return FALSE;
if((other_value.trafficClass().ispresent() ? !single_value->field_trafficClass.match((const BITSTRING&)other_value.trafficClass(), legacy) : !single_value->field_trafficClass.match_omit(legacy)))return FALSE;
if(!other_value.maxSDUSize().is_bound()) return FALSE;
if((other_value.maxSDUSize().ispresent() ? !single_value->field_maxSDUSize.match((const OCTETSTRING&)other_value.maxSDUSize(), legacy) : !single_value->field_maxSDUSize.match_omit(legacy)))return FALSE;
if(!other_value.maxBitrateUplink().is_bound()) return FALSE;
if((other_value.maxBitrateUplink().ispresent() ? !single_value->field_maxBitrateUplink.match((const OCTETSTRING&)other_value.maxBitrateUplink(), legacy) : !single_value->field_maxBitrateUplink.match_omit(legacy)))return FALSE;
if(!other_value.maxBitrateDownlink().is_bound()) return FALSE;
if((other_value.maxBitrateDownlink().ispresent() ? !single_value->field_maxBitrateDownlink.match((const OCTETSTRING&)other_value.maxBitrateDownlink(), legacy) : !single_value->field_maxBitrateDownlink.match_omit(legacy)))return FALSE;
if(!other_value.sduErrorRatio().is_bound()) return FALSE;
if((other_value.sduErrorRatio().ispresent() ? !single_value->field_sduErrorRatio.match((const BITSTRING&)other_value.sduErrorRatio(), legacy) : !single_value->field_sduErrorRatio.match_omit(legacy)))return FALSE;
if(!other_value.residualBER().is_bound()) return FALSE;
if((other_value.residualBER().ispresent() ? !single_value->field_residualBER.match((const BITSTRING&)other_value.residualBER(), legacy) : !single_value->field_residualBER.match_omit(legacy)))return FALSE;
if(!other_value.trafficHandlingPriority().is_bound()) return FALSE;
if((other_value.trafficHandlingPriority().ispresent() ? !single_value->field_trafficHandlingPriority.match((const BITSTRING&)other_value.trafficHandlingPriority(), legacy) : !single_value->field_trafficHandlingPriority.match_omit(legacy)))return FALSE;
if(!other_value.transferDelay().is_bound()) return FALSE;
if((other_value.transferDelay().ispresent() ? !single_value->field_transferDelay.match((const BITSTRING&)other_value.transferDelay(), legacy) : !single_value->field_transferDelay.match_omit(legacy)))return FALSE;
if(!other_value.guaranteedBitRateUplink().is_bound()) return FALSE;
if((other_value.guaranteedBitRateUplink().ispresent() ? !single_value->field_guaranteedBitRateUplink.match((const OCTETSTRING&)other_value.guaranteedBitRateUplink(), legacy) : !single_value->field_guaranteedBitRateUplink.match_omit(legacy)))return FALSE;
if(!other_value.guaranteedBitRateDownlink().is_bound()) return FALSE;
if((other_value.guaranteedBitRateDownlink().ispresent() ? !single_value->field_guaranteedBitRateDownlink.match((const OCTETSTRING&)other_value.guaranteedBitRateDownlink(), legacy) : !single_value->field_guaranteedBitRateDownlink.match_omit(legacy)))return FALSE;
if(!other_value.sourceStatisticsDescriptor().is_bound()) return FALSE;
if((other_value.sourceStatisticsDescriptor().ispresent() ? !single_value->field_sourceStatisticsDescriptor.match((const BITSTRING&)other_value.sourceStatisticsDescriptor(), legacy) : !single_value->field_sourceStatisticsDescriptor.match_omit(legacy)))return FALSE;
if(!other_value.signallingIndication().is_bound()) return FALSE;
if((other_value.signallingIndication().ispresent() ? !single_value->field_signallingIndication.match((const BITSTRING&)other_value.signallingIndication(), legacy) : !single_value->field_signallingIndication.match_omit(legacy)))return FALSE;
if(!other_value.spare4().is_bound()) return FALSE;
if((other_value.spare4().ispresent() ? !single_value->field_spare4.match((const BITSTRING&)other_value.spare4(), legacy) : !single_value->field_spare4.match_omit(legacy)))return FALSE;
if(!other_value.maxBitRateDownlinkExtended().is_bound()) return FALSE;
if((other_value.maxBitRateDownlinkExtended().ispresent() ? !single_value->field_maxBitRateDownlinkExtended.match((const OCTETSTRING&)other_value.maxBitRateDownlinkExtended(), legacy) : !single_value->field_maxBitRateDownlinkExtended.match_omit(legacy)))return FALSE;
if(!other_value.guaranteedBitRateDownlinkExtended().is_bound()) return FALSE;
if((other_value.guaranteedBitRateDownlinkExtended().ispresent() ? !single_value->field_guaranteedBitRateDownlinkExtended.match((const OCTETSTRING&)other_value.guaranteedBitRateDownlinkExtended(), legacy) : !single_value->field_guaranteedBitRateDownlinkExtended.match_omit(legacy)))return FALSE;
if(!other_value.maxBitrateUplinkExtended().is_bound()) return FALSE;
if((other_value.maxBitrateUplinkExtended().ispresent() ? !single_value->field_maxBitrateUplinkExtended.match((const OCTETSTRING&)other_value.maxBitrateUplinkExtended(), legacy) : !single_value->field_maxBitrateUplinkExtended.match_omit(legacy)))return FALSE;
if(!other_value.guaranteedBitRateUplinkExtended().is_bound()) return FALSE;
if((other_value.guaranteedBitRateUplinkExtended().ispresent() ? !single_value->field_guaranteedBitRateUplinkExtended.match((const OCTETSTRING&)other_value.guaranteedBitRateUplinkExtended(), legacy) : !single_value->field_guaranteedBitRateUplinkExtended.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 @BSSGP_Types.ABQP.");
}
return FALSE;
}

boolean ABQP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_reliabilityClass.is_bound()
 || single_value->field_delayClass.is_bound()
 || single_value->field_spare1.is_bound()
 || single_value->field_precedenceClass.is_bound()
 || single_value->field_spare2.is_bound()
 || single_value->field_peakThroughput.is_bound()
 || single_value->field_meanThroughput.is_bound()
 || single_value->field_spare3.is_bound()
 || (single_value->field_deliverErroneusSDU.is_omit() || single_value->field_deliverErroneusSDU.is_bound())
 || (single_value->field_deliveryOrder.is_omit() || single_value->field_deliveryOrder.is_bound())
 || (single_value->field_trafficClass.is_omit() || single_value->field_trafficClass.is_bound())
 || (single_value->field_maxSDUSize.is_omit() || single_value->field_maxSDUSize.is_bound())
 || (single_value->field_maxBitrateUplink.is_omit() || single_value->field_maxBitrateUplink.is_bound())
 || (single_value->field_maxBitrateDownlink.is_omit() || single_value->field_maxBitrateDownlink.is_bound())
 || (single_value->field_sduErrorRatio.is_omit() || single_value->field_sduErrorRatio.is_bound())
 || (single_value->field_residualBER.is_omit() || single_value->field_residualBER.is_bound())
 || (single_value->field_trafficHandlingPriority.is_omit() || single_value->field_trafficHandlingPriority.is_bound())
 || (single_value->field_transferDelay.is_omit() || single_value->field_transferDelay.is_bound())
 || (single_value->field_guaranteedBitRateUplink.is_omit() || single_value->field_guaranteedBitRateUplink.is_bound())
 || (single_value->field_guaranteedBitRateDownlink.is_omit() || single_value->field_guaranteedBitRateDownlink.is_bound())
 || (single_value->field_sourceStatisticsDescriptor.is_omit() || single_value->field_sourceStatisticsDescriptor.is_bound())
 || (single_value->field_signallingIndication.is_omit() || single_value->field_signallingIndication.is_bound())
 || (single_value->field_spare4.is_omit() || single_value->field_spare4.is_bound())
 || (single_value->field_maxBitRateDownlinkExtended.is_omit() || single_value->field_maxBitRateDownlinkExtended.is_bound())
 || (single_value->field_guaranteedBitRateDownlinkExtended.is_omit() || single_value->field_guaranteedBitRateDownlinkExtended.is_bound())
 || (single_value->field_maxBitrateUplinkExtended.is_omit() || single_value->field_maxBitrateUplinkExtended.is_bound())
 || (single_value->field_guaranteedBitRateUplinkExtended.is_omit() || single_value->field_guaranteedBitRateUplinkExtended.is_bound());
}

boolean ABQP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_reliabilityClass.is_value()
 && single_value->field_delayClass.is_value()
 && single_value->field_spare1.is_value()
 && single_value->field_precedenceClass.is_value()
 && single_value->field_spare2.is_value()
 && single_value->field_peakThroughput.is_value()
 && single_value->field_meanThroughput.is_value()
 && single_value->field_spare3.is_value()
 && (single_value->field_deliverErroneusSDU.is_omit() || single_value->field_deliverErroneusSDU.is_value())
 && (single_value->field_deliveryOrder.is_omit() || single_value->field_deliveryOrder.is_value())
 && (single_value->field_trafficClass.is_omit() || single_value->field_trafficClass.is_value())
 && (single_value->field_maxSDUSize.is_omit() || single_value->field_maxSDUSize.is_value())
 && (single_value->field_maxBitrateUplink.is_omit() || single_value->field_maxBitrateUplink.is_value())
 && (single_value->field_maxBitrateDownlink.is_omit() || single_value->field_maxBitrateDownlink.is_value())
 && (single_value->field_sduErrorRatio.is_omit() || single_value->field_sduErrorRatio.is_value())
 && (single_value->field_residualBER.is_omit() || single_value->field_residualBER.is_value())
 && (single_value->field_trafficHandlingPriority.is_omit() || single_value->field_trafficHandlingPriority.is_value())
 && (single_value->field_transferDelay.is_omit() || single_value->field_transferDelay.is_value())
 && (single_value->field_guaranteedBitRateUplink.is_omit() || single_value->field_guaranteedBitRateUplink.is_value())
 && (single_value->field_guaranteedBitRateDownlink.is_omit() || single_value->field_guaranteedBitRateDownlink.is_value())
 && (single_value->field_sourceStatisticsDescriptor.is_omit() || single_value->field_sourceStatisticsDescriptor.is_value())
 && (single_value->field_signallingIndication.is_omit() || single_value->field_signallingIndication.is_value())
 && (single_value->field_spare4.is_omit() || single_value->field_spare4.is_value())
 && (single_value->field_maxBitRateDownlinkExtended.is_omit() || single_value->field_maxBitRateDownlinkExtended.is_value())
 && (single_value->field_guaranteedBitRateDownlinkExtended.is_omit() || single_value->field_guaranteedBitRateDownlinkExtended.is_value())
 && (single_value->field_maxBitrateUplinkExtended.is_omit() || single_value->field_maxBitrateUplinkExtended.is_value())
 && (single_value->field_guaranteedBitRateUplinkExtended.is_omit() || single_value->field_guaranteedBitRateUplinkExtended.is_value());
}

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

ABQP ABQP_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 @BSSGP_Types.ABQP.");
ABQP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_reliabilityClass.is_bound()) {
ret_val.reliabilityClass() = single_value->field_reliabilityClass.valueof();
}
if (single_value->field_delayClass.is_bound()) {
ret_val.delayClass() = single_value->field_delayClass.valueof();
}
if (single_value->field_spare1.is_bound()) {
ret_val.spare1() = single_value->field_spare1.valueof();
}
if (single_value->field_precedenceClass.is_bound()) {
ret_val.precedenceClass() = single_value->field_precedenceClass.valueof();
}
if (single_value->field_spare2.is_bound()) {
ret_val.spare2() = single_value->field_spare2.valueof();
}
if (single_value->field_peakThroughput.is_bound()) {
ret_val.peakThroughput() = single_value->field_peakThroughput.valueof();
}
if (single_value->field_meanThroughput.is_bound()) {
ret_val.meanThroughput() = single_value->field_meanThroughput.valueof();
}
if (single_value->field_spare3.is_bound()) {
ret_val.spare3() = single_value->field_spare3.valueof();
}
if (single_value->field_deliverErroneusSDU.is_omit()) ret_val.deliverErroneusSDU() = OMIT_VALUE;
else if (single_value->field_deliverErroneusSDU.is_bound()) {
ret_val.deliverErroneusSDU() = single_value->field_deliverErroneusSDU.valueof();
}
if (single_value->field_deliveryOrder.is_omit()) ret_val.deliveryOrder() = OMIT_VALUE;
else if (single_value->field_deliveryOrder.is_bound()) {
ret_val.deliveryOrder() = single_value->field_deliveryOrder.valueof();
}
if (single_value->field_trafficClass.is_omit()) ret_val.trafficClass() = OMIT_VALUE;
else if (single_value->field_trafficClass.is_bound()) {
ret_val.trafficClass() = single_value->field_trafficClass.valueof();
}
if (single_value->field_maxSDUSize.is_omit()) ret_val.maxSDUSize() = OMIT_VALUE;
else if (single_value->field_maxSDUSize.is_bound()) {
ret_val.maxSDUSize() = single_value->field_maxSDUSize.valueof();
}
if (single_value->field_maxBitrateUplink.is_omit()) ret_val.maxBitrateUplink() = OMIT_VALUE;
else if (single_value->field_maxBitrateUplink.is_bound()) {
ret_val.maxBitrateUplink() = single_value->field_maxBitrateUplink.valueof();
}
if (single_value->field_maxBitrateDownlink.is_omit()) ret_val.maxBitrateDownlink() = OMIT_VALUE;
else if (single_value->field_maxBitrateDownlink.is_bound()) {
ret_val.maxBitrateDownlink() = single_value->field_maxBitrateDownlink.valueof();
}
if (single_value->field_sduErrorRatio.is_omit()) ret_val.sduErrorRatio() = OMIT_VALUE;
else if (single_value->field_sduErrorRatio.is_bound()) {
ret_val.sduErrorRatio() = single_value->field_sduErrorRatio.valueof();
}
if (single_value->field_residualBER.is_omit()) ret_val.residualBER() = OMIT_VALUE;
else if (single_value->field_residualBER.is_bound()) {
ret_val.residualBER() = single_value->field_residualBER.valueof();
}
if (single_value->field_trafficHandlingPriority.is_omit()) ret_val.trafficHandlingPriority() = OMIT_VALUE;
else if (single_value->field_trafficHandlingPriority.is_bound()) {
ret_val.trafficHandlingPriority() = single_value->field_trafficHandlingPriority.valueof();
}
if (single_value->field_transferDelay.is_omit()) ret_val.transferDelay() = OMIT_VALUE;
else if (single_value->field_transferDelay.is_bound()) {
ret_val.transferDelay() = single_value->field_transferDelay.valueof();
}
if (single_value->field_guaranteedBitRateUplink.is_omit()) ret_val.guaranteedBitRateUplink() = OMIT_VALUE;
else if (single_value->field_guaranteedBitRateUplink.is_bound()) {
ret_val.guaranteedBitRateUplink() = single_value->field_guaranteedBitRateUplink.valueof();
}
if (single_value->field_guaranteedBitRateDownlink.is_omit()) ret_val.guaranteedBitRateDownlink() = OMIT_VALUE;
else if (single_value->field_guaranteedBitRateDownlink.is_bound()) {
ret_val.guaranteedBitRateDownlink() = single_value->field_guaranteedBitRateDownlink.valueof();
}
if (single_value->field_sourceStatisticsDescriptor.is_omit()) ret_val.sourceStatisticsDescriptor() = OMIT_VALUE;
else if (single_value->field_sourceStatisticsDescriptor.is_bound()) {
ret_val.sourceStatisticsDescriptor() = single_value->field_sourceStatisticsDescriptor.valueof();
}
if (single_value->field_signallingIndication.is_omit()) ret_val.signallingIndication() = OMIT_VALUE;
else if (single_value->field_signallingIndication.is_bound()) {
ret_val.signallingIndication() = single_value->field_signallingIndication.valueof();
}
if (single_value->field_spare4.is_omit()) ret_val.spare4() = OMIT_VALUE;
else if (single_value->field_spare4.is_bound()) {
ret_val.spare4() = single_value->field_spare4.valueof();
}
if (single_value->field_maxBitRateDownlinkExtended.is_omit()) ret_val.maxBitRateDownlinkExtended() = OMIT_VALUE;
else if (single_value->field_maxBitRateDownlinkExtended.is_bound()) {
ret_val.maxBitRateDownlinkExtended() = single_value->field_maxBitRateDownlinkExtended.valueof();
}
if (single_value->field_guaranteedBitRateDownlinkExtended.is_omit()) ret_val.guaranteedBitRateDownlinkExtended() = OMIT_VALUE;
else if (single_value->field_guaranteedBitRateDownlinkExtended.is_bound()) {
ret_val.guaranteedBitRateDownlinkExtended() = single_value->field_guaranteedBitRateDownlinkExtended.valueof();
}
if (single_value->field_maxBitrateUplinkExtended.is_omit()) ret_val.maxBitrateUplinkExtended() = OMIT_VALUE;
else if (single_value->field_maxBitrateUplinkExtended.is_bound()) {
ret_val.maxBitrateUplinkExtended() = single_value->field_maxBitrateUplinkExtended.valueof();
}
if (single_value->field_guaranteedBitRateUplinkExtended.is_omit()) ret_val.guaranteedBitRateUplinkExtended() = OMIT_VALUE;
else if (single_value->field_guaranteedBitRateUplinkExtended.is_bound()) {
ret_val.guaranteedBitRateUplinkExtended() = single_value->field_guaranteedBitRateUplinkExtended.valueof();
}
return ret_val;
}

void ABQP_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 @BSSGP_Types.ABQP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new ABQP_template[list_length];
}

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

OCTETSTRING_template& ABQP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& ABQP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_iEI;
}

BITSTRING_template& ABQP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& ABQP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_ext;
}

LIN2__2a_template& ABQP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& ABQP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_lengthIndicator;
}

BITSTRING_template& ABQP_template::reliabilityClass()
{
set_specific();
return single_value->field_reliabilityClass;
}

const BITSTRING_template& ABQP_template::reliabilityClass() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field reliabilityClass of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_reliabilityClass;
}

BITSTRING_template& ABQP_template::delayClass()
{
set_specific();
return single_value->field_delayClass;
}

const BITSTRING_template& ABQP_template::delayClass() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field delayClass of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_delayClass;
}

BITSTRING_template& ABQP_template::spare1()
{
set_specific();
return single_value->field_spare1;
}

const BITSTRING_template& ABQP_template::spare1() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare1 of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_spare1;
}

BITSTRING_template& ABQP_template::precedenceClass()
{
set_specific();
return single_value->field_precedenceClass;
}

const BITSTRING_template& ABQP_template::precedenceClass() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field precedenceClass of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_precedenceClass;
}

BITSTRING_template& ABQP_template::spare2()
{
set_specific();
return single_value->field_spare2;
}

const BITSTRING_template& ABQP_template::spare2() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare2 of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_spare2;
}

BITSTRING_template& ABQP_template::peakThroughput()
{
set_specific();
return single_value->field_peakThroughput;
}

const BITSTRING_template& ABQP_template::peakThroughput() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field peakThroughput of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_peakThroughput;
}

BITSTRING_template& ABQP_template::meanThroughput()
{
set_specific();
return single_value->field_meanThroughput;
}

const BITSTRING_template& ABQP_template::meanThroughput() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field meanThroughput of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_meanThroughput;
}

BITSTRING_template& ABQP_template::spare3()
{
set_specific();
return single_value->field_spare3;
}

const BITSTRING_template& ABQP_template::spare3() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare3 of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_spare3;
}

BITSTRING_template& ABQP_template::deliverErroneusSDU()
{
set_specific();
return single_value->field_deliverErroneusSDU;
}

const BITSTRING_template& ABQP_template::deliverErroneusSDU() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field deliverErroneusSDU of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_deliverErroneusSDU;
}

BITSTRING_template& ABQP_template::deliveryOrder()
{
set_specific();
return single_value->field_deliveryOrder;
}

const BITSTRING_template& ABQP_template::deliveryOrder() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field deliveryOrder of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_deliveryOrder;
}

BITSTRING_template& ABQP_template::trafficClass()
{
set_specific();
return single_value->field_trafficClass;
}

const BITSTRING_template& ABQP_template::trafficClass() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field trafficClass of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_trafficClass;
}

OCTETSTRING_template& ABQP_template::maxSDUSize()
{
set_specific();
return single_value->field_maxSDUSize;
}

const OCTETSTRING_template& ABQP_template::maxSDUSize() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field maxSDUSize of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_maxSDUSize;
}

OCTETSTRING_template& ABQP_template::maxBitrateUplink()
{
set_specific();
return single_value->field_maxBitrateUplink;
}

const OCTETSTRING_template& ABQP_template::maxBitrateUplink() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field maxBitrateUplink of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_maxBitrateUplink;
}

OCTETSTRING_template& ABQP_template::maxBitrateDownlink()
{
set_specific();
return single_value->field_maxBitrateDownlink;
}

const OCTETSTRING_template& ABQP_template::maxBitrateDownlink() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field maxBitrateDownlink of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_maxBitrateDownlink;
}

BITSTRING_template& ABQP_template::sduErrorRatio()
{
set_specific();
return single_value->field_sduErrorRatio;
}

const BITSTRING_template& ABQP_template::sduErrorRatio() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field sduErrorRatio of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_sduErrorRatio;
}

BITSTRING_template& ABQP_template::residualBER()
{
set_specific();
return single_value->field_residualBER;
}

const BITSTRING_template& ABQP_template::residualBER() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field residualBER of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_residualBER;
}

BITSTRING_template& ABQP_template::trafficHandlingPriority()
{
set_specific();
return single_value->field_trafficHandlingPriority;
}

const BITSTRING_template& ABQP_template::trafficHandlingPriority() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field trafficHandlingPriority of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_trafficHandlingPriority;
}

BITSTRING_template& ABQP_template::transferDelay()
{
set_specific();
return single_value->field_transferDelay;
}

const BITSTRING_template& ABQP_template::transferDelay() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field transferDelay of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_transferDelay;
}

OCTETSTRING_template& ABQP_template::guaranteedBitRateUplink()
{
set_specific();
return single_value->field_guaranteedBitRateUplink;
}

const OCTETSTRING_template& ABQP_template::guaranteedBitRateUplink() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field guaranteedBitRateUplink of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_guaranteedBitRateUplink;
}

OCTETSTRING_template& ABQP_template::guaranteedBitRateDownlink()
{
set_specific();
return single_value->field_guaranteedBitRateDownlink;
}

const OCTETSTRING_template& ABQP_template::guaranteedBitRateDownlink() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field guaranteedBitRateDownlink of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_guaranteedBitRateDownlink;
}

BITSTRING_template& ABQP_template::sourceStatisticsDescriptor()
{
set_specific();
return single_value->field_sourceStatisticsDescriptor;
}

const BITSTRING_template& ABQP_template::sourceStatisticsDescriptor() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field sourceStatisticsDescriptor of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_sourceStatisticsDescriptor;
}

BITSTRING_template& ABQP_template::signallingIndication()
{
set_specific();
return single_value->field_signallingIndication;
}

const BITSTRING_template& ABQP_template::signallingIndication() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field signallingIndication of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_signallingIndication;
}

BITSTRING_template& ABQP_template::spare4()
{
set_specific();
return single_value->field_spare4;
}

const BITSTRING_template& ABQP_template::spare4() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare4 of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_spare4;
}

OCTETSTRING_template& ABQP_template::maxBitRateDownlinkExtended()
{
set_specific();
return single_value->field_maxBitRateDownlinkExtended;
}

const OCTETSTRING_template& ABQP_template::maxBitRateDownlinkExtended() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field maxBitRateDownlinkExtended of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_maxBitRateDownlinkExtended;
}

OCTETSTRING_template& ABQP_template::guaranteedBitRateDownlinkExtended()
{
set_specific();
return single_value->field_guaranteedBitRateDownlinkExtended;
}

const OCTETSTRING_template& ABQP_template::guaranteedBitRateDownlinkExtended() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field guaranteedBitRateDownlinkExtended of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_guaranteedBitRateDownlinkExtended;
}

OCTETSTRING_template& ABQP_template::maxBitrateUplinkExtended()
{
set_specific();
return single_value->field_maxBitrateUplinkExtended;
}

const OCTETSTRING_template& ABQP_template::maxBitrateUplinkExtended() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field maxBitrateUplinkExtended of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_maxBitrateUplinkExtended;
}

OCTETSTRING_template& ABQP_template::guaranteedBitRateUplinkExtended()
{
set_specific();
return single_value->field_guaranteedBitRateUplinkExtended;
}

const OCTETSTRING_template& ABQP_template::guaranteedBitRateUplinkExtended() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field guaranteedBitRateUplinkExtended of a non-specific template of type @BSSGP_Types.ABQP.");
return single_value->field_guaranteedBitRateUplinkExtended;
}

int ABQP_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @BSSGP_Types.ABQP which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
  {    int ret_val = 11;
      if (single_value->field_deliverErroneusSDU.is_present()) ret_val++;
      if (single_value->field_deliveryOrder.is_present()) ret_val++;
      if (single_value->field_trafficClass.is_present()) ret_val++;
      if (single_value->field_maxSDUSize.is_present()) ret_val++;
      if (single_value->field_maxBitrateUplink.is_present()) ret_val++;
      if (single_value->field_maxBitrateDownlink.is_present()) ret_val++;
      if (single_value->field_sduErrorRatio.is_present()) ret_val++;
      if (single_value->field_residualBER.is_present()) ret_val++;
      if (single_value->field_trafficHandlingPriority.is_present()) ret_val++;
      if (single_value->field_transferDelay.is_present()) ret_val++;
      if (single_value->field_guaranteedBitRateUplink.is_present()) ret_val++;
      if (single_value->field_guaranteedBitRateDownlink.is_present()) ret_val++;
      if (single_value->field_sourceStatisticsDescriptor.is_present()) ret_val++;
      if (single_value->field_signallingIndication.is_present()) ret_val++;
      if (single_value->field_spare4.is_present()) ret_val++;
      if (single_value->field_maxBitRateDownlinkExtended.is_present()) ret_val++;
      if (single_value->field_guaranteedBitRateDownlinkExtended.is_present()) ret_val++;
      if (single_value->field_maxBitrateUplinkExtended.is_present()) ret_val++;
      if (single_value->field_guaranteedBitRateUplinkExtended.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 @BSSGP_Types.ABQP 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 @BSSGP_Types.ABQP containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @BSSGP_Types.ABQP containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @BSSGP_Types.ABQP containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @BSSGP_Types.ABQP containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @BSSGP_Types.ABQP containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @BSSGP_Types.ABQP containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @BSSGP_Types.ABQP containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @BSSGP_Types.ABQP.");
  }
  return 0;
}

void ABQP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", reliabilityClass := ");
single_value->field_reliabilityClass.log();
TTCN_Logger::log_event_str(", delayClass := ");
single_value->field_delayClass.log();
TTCN_Logger::log_event_str(", spare1 := ");
single_value->field_spare1.log();
TTCN_Logger::log_event_str(", precedenceClass := ");
single_value->field_precedenceClass.log();
TTCN_Logger::log_event_str(", spare2 := ");
single_value->field_spare2.log();
TTCN_Logger::log_event_str(", peakThroughput := ");
single_value->field_peakThroughput.log();
TTCN_Logger::log_event_str(", meanThroughput := ");
single_value->field_meanThroughput.log();
TTCN_Logger::log_event_str(", spare3 := ");
single_value->field_spare3.log();
TTCN_Logger::log_event_str(", deliverErroneusSDU := ");
single_value->field_deliverErroneusSDU.log();
TTCN_Logger::log_event_str(", deliveryOrder := ");
single_value->field_deliveryOrder.log();
TTCN_Logger::log_event_str(", trafficClass := ");
single_value->field_trafficClass.log();
TTCN_Logger::log_event_str(", maxSDUSize := ");
single_value->field_maxSDUSize.log();
TTCN_Logger::log_event_str(", maxBitrateUplink := ");
single_value->field_maxBitrateUplink.log();
TTCN_Logger::log_event_str(", maxBitrateDownlink := ");
single_value->field_maxBitrateDownlink.log();
TTCN_Logger::log_event_str(", sduErrorRatio := ");
single_value->field_sduErrorRatio.log();
TTCN_Logger::log_event_str(", residualBER := ");
single_value->field_residualBER.log();
TTCN_Logger::log_event_str(", trafficHandlingPriority := ");
single_value->field_trafficHandlingPriority.log();
TTCN_Logger::log_event_str(", transferDelay := ");
single_value->field_transferDelay.log();
TTCN_Logger::log_event_str(", guaranteedBitRateUplink := ");
single_value->field_guaranteedBitRateUplink.log();
TTCN_Logger::log_event_str(", guaranteedBitRateDownlink := ");
single_value->field_guaranteedBitRateDownlink.log();
TTCN_Logger::log_event_str(", sourceStatisticsDescriptor := ");
single_value->field_sourceStatisticsDescriptor.log();
TTCN_Logger::log_event_str(", signallingIndication := ");
single_value->field_signallingIndication.log();
TTCN_Logger::log_event_str(", spare4 := ");
single_value->field_spare4.log();
TTCN_Logger::log_event_str(", maxBitRateDownlinkExtended := ");
single_value->field_maxBitRateDownlinkExtended.log();
TTCN_Logger::log_event_str(", guaranteedBitRateDownlinkExtended := ");
single_value->field_guaranteedBitRateDownlinkExtended.log();
TTCN_Logger::log_event_str(", maxBitrateUplinkExtended := ");
single_value->field_maxBitrateUplinkExtended.log();
TTCN_Logger::log_event_str(", guaranteedBitRateUplinkExtended := ");
single_value->field_guaranteedBitRateUplinkExtended.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 ABQP_template::log_match(const ABQP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_reliabilityClass.match(match_value.reliabilityClass(), legacy)){
TTCN_Logger::log_logmatch_info(".reliabilityClass");
single_value->field_reliabilityClass.log_match(match_value.reliabilityClass(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_delayClass.match(match_value.delayClass(), legacy)){
TTCN_Logger::log_logmatch_info(".delayClass");
single_value->field_delayClass.log_match(match_value.delayClass(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare1.match(match_value.spare1(), legacy)){
TTCN_Logger::log_logmatch_info(".spare1");
single_value->field_spare1.log_match(match_value.spare1(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_precedenceClass.match(match_value.precedenceClass(), legacy)){
TTCN_Logger::log_logmatch_info(".precedenceClass");
single_value->field_precedenceClass.log_match(match_value.precedenceClass(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare2.match(match_value.spare2(), legacy)){
TTCN_Logger::log_logmatch_info(".spare2");
single_value->field_spare2.log_match(match_value.spare2(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_peakThroughput.match(match_value.peakThroughput(), legacy)){
TTCN_Logger::log_logmatch_info(".peakThroughput");
single_value->field_peakThroughput.log_match(match_value.peakThroughput(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_meanThroughput.match(match_value.meanThroughput(), legacy)){
TTCN_Logger::log_logmatch_info(".meanThroughput");
single_value->field_meanThroughput.log_match(match_value.meanThroughput(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare3.match(match_value.spare3(), legacy)){
TTCN_Logger::log_logmatch_info(".spare3");
single_value->field_spare3.log_match(match_value.spare3(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.deliverErroneusSDU().ispresent()){
if(!single_value->field_deliverErroneusSDU.match(match_value.deliverErroneusSDU(), legacy)){
TTCN_Logger::log_logmatch_info(".deliverErroneusSDU");
single_value->field_deliverErroneusSDU.log_match(match_value.deliverErroneusSDU(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_deliverErroneusSDU.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".deliverErroneusSDU := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_deliverErroneusSDU.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.deliveryOrder().ispresent()){
if(!single_value->field_deliveryOrder.match(match_value.deliveryOrder(), legacy)){
TTCN_Logger::log_logmatch_info(".deliveryOrder");
single_value->field_deliveryOrder.log_match(match_value.deliveryOrder(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_deliveryOrder.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".deliveryOrder := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_deliveryOrder.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.trafficClass().ispresent()){
if(!single_value->field_trafficClass.match(match_value.trafficClass(), legacy)){
TTCN_Logger::log_logmatch_info(".trafficClass");
single_value->field_trafficClass.log_match(match_value.trafficClass(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_trafficClass.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".trafficClass := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_trafficClass.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.maxSDUSize().ispresent()){
if(!single_value->field_maxSDUSize.match(match_value.maxSDUSize(), legacy)){
TTCN_Logger::log_logmatch_info(".maxSDUSize");
single_value->field_maxSDUSize.log_match(match_value.maxSDUSize(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_maxSDUSize.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".maxSDUSize := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_maxSDUSize.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.maxBitrateUplink().ispresent()){
if(!single_value->field_maxBitrateUplink.match(match_value.maxBitrateUplink(), legacy)){
TTCN_Logger::log_logmatch_info(".maxBitrateUplink");
single_value->field_maxBitrateUplink.log_match(match_value.maxBitrateUplink(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_maxBitrateUplink.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".maxBitrateUplink := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_maxBitrateUplink.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.maxBitrateDownlink().ispresent()){
if(!single_value->field_maxBitrateDownlink.match(match_value.maxBitrateDownlink(), legacy)){
TTCN_Logger::log_logmatch_info(".maxBitrateDownlink");
single_value->field_maxBitrateDownlink.log_match(match_value.maxBitrateDownlink(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_maxBitrateDownlink.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".maxBitrateDownlink := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_maxBitrateDownlink.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.sduErrorRatio().ispresent()){
if(!single_value->field_sduErrorRatio.match(match_value.sduErrorRatio(), legacy)){
TTCN_Logger::log_logmatch_info(".sduErrorRatio");
single_value->field_sduErrorRatio.log_match(match_value.sduErrorRatio(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_sduErrorRatio.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".sduErrorRatio := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_sduErrorRatio.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.residualBER().ispresent()){
if(!single_value->field_residualBER.match(match_value.residualBER(), legacy)){
TTCN_Logger::log_logmatch_info(".residualBER");
single_value->field_residualBER.log_match(match_value.residualBER(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_residualBER.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".residualBER := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_residualBER.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.trafficHandlingPriority().ispresent()){
if(!single_value->field_trafficHandlingPriority.match(match_value.trafficHandlingPriority(), legacy)){
TTCN_Logger::log_logmatch_info(".trafficHandlingPriority");
single_value->field_trafficHandlingPriority.log_match(match_value.trafficHandlingPriority(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_trafficHandlingPriority.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".trafficHandlingPriority := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_trafficHandlingPriority.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.transferDelay().ispresent()){
if(!single_value->field_transferDelay.match(match_value.transferDelay(), legacy)){
TTCN_Logger::log_logmatch_info(".transferDelay");
single_value->field_transferDelay.log_match(match_value.transferDelay(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_transferDelay.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".transferDelay := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_transferDelay.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.guaranteedBitRateUplink().ispresent()){
if(!single_value->field_guaranteedBitRateUplink.match(match_value.guaranteedBitRateUplink(), legacy)){
TTCN_Logger::log_logmatch_info(".guaranteedBitRateUplink");
single_value->field_guaranteedBitRateUplink.log_match(match_value.guaranteedBitRateUplink(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_guaranteedBitRateUplink.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".guaranteedBitRateUplink := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_guaranteedBitRateUplink.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.guaranteedBitRateDownlink().ispresent()){
if(!single_value->field_guaranteedBitRateDownlink.match(match_value.guaranteedBitRateDownlink(), legacy)){
TTCN_Logger::log_logmatch_info(".guaranteedBitRateDownlink");
single_value->field_guaranteedBitRateDownlink.log_match(match_value.guaranteedBitRateDownlink(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_guaranteedBitRateDownlink.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".guaranteedBitRateDownlink := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_guaranteedBitRateDownlink.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.sourceStatisticsDescriptor().ispresent()){
if(!single_value->field_sourceStatisticsDescriptor.match(match_value.sourceStatisticsDescriptor(), legacy)){
TTCN_Logger::log_logmatch_info(".sourceStatisticsDescriptor");
single_value->field_sourceStatisticsDescriptor.log_match(match_value.sourceStatisticsDescriptor(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_sourceStatisticsDescriptor.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".sourceStatisticsDescriptor := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_sourceStatisticsDescriptor.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.signallingIndication().ispresent()){
if(!single_value->field_signallingIndication.match(match_value.signallingIndication(), legacy)){
TTCN_Logger::log_logmatch_info(".signallingIndication");
single_value->field_signallingIndication.log_match(match_value.signallingIndication(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_signallingIndication.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".signallingIndication := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_signallingIndication.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.spare4().ispresent()){
if(!single_value->field_spare4.match(match_value.spare4(), legacy)){
TTCN_Logger::log_logmatch_info(".spare4");
single_value->field_spare4.log_match(match_value.spare4(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_spare4.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".spare4 := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_spare4.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.maxBitRateDownlinkExtended().ispresent()){
if(!single_value->field_maxBitRateDownlinkExtended.match(match_value.maxBitRateDownlinkExtended(), legacy)){
TTCN_Logger::log_logmatch_info(".maxBitRateDownlinkExtended");
single_value->field_maxBitRateDownlinkExtended.log_match(match_value.maxBitRateDownlinkExtended(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_maxBitRateDownlinkExtended.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".maxBitRateDownlinkExtended := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_maxBitRateDownlinkExtended.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.guaranteedBitRateDownlinkExtended().ispresent()){
if(!single_value->field_guaranteedBitRateDownlinkExtended.match(match_value.guaranteedBitRateDownlinkExtended(), legacy)){
TTCN_Logger::log_logmatch_info(".guaranteedBitRateDownlinkExtended");
single_value->field_guaranteedBitRateDownlinkExtended.log_match(match_value.guaranteedBitRateDownlinkExtended(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_guaranteedBitRateDownlinkExtended.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".guaranteedBitRateDownlinkExtended := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_guaranteedBitRateDownlinkExtended.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.maxBitrateUplinkExtended().ispresent()){
if(!single_value->field_maxBitrateUplinkExtended.match(match_value.maxBitrateUplinkExtended(), legacy)){
TTCN_Logger::log_logmatch_info(".maxBitrateUplinkExtended");
single_value->field_maxBitrateUplinkExtended.log_match(match_value.maxBitrateUplinkExtended(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_maxBitrateUplinkExtended.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".maxBitrateUplinkExtended := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_maxBitrateUplinkExtended.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.guaranteedBitRateUplinkExtended().ispresent()){
if(!single_value->field_guaranteedBitRateUplinkExtended.match(match_value.guaranteedBitRateUplinkExtended(), legacy)){
TTCN_Logger::log_logmatch_info(".guaranteedBitRateUplinkExtended");
single_value->field_guaranteedBitRateUplinkExtended.log_match(match_value.guaranteedBitRateUplinkExtended(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_guaranteedBitRateUplinkExtended.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".guaranteedBitRateUplinkExtended := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_guaranteedBitRateUplinkExtended.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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", reliabilityClass := ");
single_value->field_reliabilityClass.log_match(match_value.reliabilityClass(), legacy);
TTCN_Logger::log_event_str(", delayClass := ");
single_value->field_delayClass.log_match(match_value.delayClass(), legacy);
TTCN_Logger::log_event_str(", spare1 := ");
single_value->field_spare1.log_match(match_value.spare1(), legacy);
TTCN_Logger::log_event_str(", precedenceClass := ");
single_value->field_precedenceClass.log_match(match_value.precedenceClass(), legacy);
TTCN_Logger::log_event_str(", spare2 := ");
single_value->field_spare2.log_match(match_value.spare2(), legacy);
TTCN_Logger::log_event_str(", peakThroughput := ");
single_value->field_peakThroughput.log_match(match_value.peakThroughput(), legacy);
TTCN_Logger::log_event_str(", meanThroughput := ");
single_value->field_meanThroughput.log_match(match_value.meanThroughput(), legacy);
TTCN_Logger::log_event_str(", spare3 := ");
single_value->field_spare3.log_match(match_value.spare3(), legacy);
TTCN_Logger::log_event_str(", deliverErroneusSDU := ");
if (match_value.deliverErroneusSDU().ispresent()) {
single_value->field_deliverErroneusSDU.log_match(match_value.deliverErroneusSDU(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_deliverErroneusSDU.log();
if (single_value->field_deliverErroneusSDU.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", deliveryOrder := ");
if (match_value.deliveryOrder().ispresent()) {
single_value->field_deliveryOrder.log_match(match_value.deliveryOrder(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_deliveryOrder.log();
if (single_value->field_deliveryOrder.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", trafficClass := ");
if (match_value.trafficClass().ispresent()) {
single_value->field_trafficClass.log_match(match_value.trafficClass(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_trafficClass.log();
if (single_value->field_trafficClass.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", maxSDUSize := ");
if (match_value.maxSDUSize().ispresent()) {
single_value->field_maxSDUSize.log_match(match_value.maxSDUSize(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_maxSDUSize.log();
if (single_value->field_maxSDUSize.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", maxBitrateUplink := ");
if (match_value.maxBitrateUplink().ispresent()) {
single_value->field_maxBitrateUplink.log_match(match_value.maxBitrateUplink(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_maxBitrateUplink.log();
if (single_value->field_maxBitrateUplink.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", maxBitrateDownlink := ");
if (match_value.maxBitrateDownlink().ispresent()) {
single_value->field_maxBitrateDownlink.log_match(match_value.maxBitrateDownlink(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_maxBitrateDownlink.log();
if (single_value->field_maxBitrateDownlink.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", sduErrorRatio := ");
if (match_value.sduErrorRatio().ispresent()) {
single_value->field_sduErrorRatio.log_match(match_value.sduErrorRatio(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_sduErrorRatio.log();
if (single_value->field_sduErrorRatio.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", residualBER := ");
if (match_value.residualBER().ispresent()) {
single_value->field_residualBER.log_match(match_value.residualBER(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_residualBER.log();
if (single_value->field_residualBER.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", trafficHandlingPriority := ");
if (match_value.trafficHandlingPriority().ispresent()) {
single_value->field_trafficHandlingPriority.log_match(match_value.trafficHandlingPriority(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_trafficHandlingPriority.log();
if (single_value->field_trafficHandlingPriority.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", transferDelay := ");
if (match_value.transferDelay().ispresent()) {
single_value->field_transferDelay.log_match(match_value.transferDelay(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_transferDelay.log();
if (single_value->field_transferDelay.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", guaranteedBitRateUplink := ");
if (match_value.guaranteedBitRateUplink().ispresent()) {
single_value->field_guaranteedBitRateUplink.log_match(match_value.guaranteedBitRateUplink(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_guaranteedBitRateUplink.log();
if (single_value->field_guaranteedBitRateUplink.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", guaranteedBitRateDownlink := ");
if (match_value.guaranteedBitRateDownlink().ispresent()) {
single_value->field_guaranteedBitRateDownlink.log_match(match_value.guaranteedBitRateDownlink(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_guaranteedBitRateDownlink.log();
if (single_value->field_guaranteedBitRateDownlink.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", sourceStatisticsDescriptor := ");
if (match_value.sourceStatisticsDescriptor().ispresent()) {
single_value->field_sourceStatisticsDescriptor.log_match(match_value.sourceStatisticsDescriptor(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_sourceStatisticsDescriptor.log();
if (single_value->field_sourceStatisticsDescriptor.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", signallingIndication := ");
if (match_value.signallingIndication().ispresent()) {
single_value->field_signallingIndication.log_match(match_value.signallingIndication(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_signallingIndication.log();
if (single_value->field_signallingIndication.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", spare4 := ");
if (match_value.spare4().ispresent()) {
single_value->field_spare4.log_match(match_value.spare4(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_spare4.log();
if (single_value->field_spare4.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", maxBitRateDownlinkExtended := ");
if (match_value.maxBitRateDownlinkExtended().ispresent()) {
single_value->field_maxBitRateDownlinkExtended.log_match(match_value.maxBitRateDownlinkExtended(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_maxBitRateDownlinkExtended.log();
if (single_value->field_maxBitRateDownlinkExtended.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", guaranteedBitRateDownlinkExtended := ");
if (match_value.guaranteedBitRateDownlinkExtended().ispresent()) {
single_value->field_guaranteedBitRateDownlinkExtended.log_match(match_value.guaranteedBitRateDownlinkExtended(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_guaranteedBitRateDownlinkExtended.log();
if (single_value->field_guaranteedBitRateDownlinkExtended.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", maxBitrateUplinkExtended := ");
if (match_value.maxBitrateUplinkExtended().ispresent()) {
single_value->field_maxBitrateUplinkExtended.log_match(match_value.maxBitrateUplinkExtended(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_maxBitrateUplinkExtended.log();
if (single_value->field_maxBitrateUplinkExtended.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", guaranteedBitRateUplinkExtended := ");
if (match_value.guaranteedBitRateUplinkExtended().ispresent()) {
single_value->field_guaranteedBitRateUplinkExtended.log_match(match_value.guaranteedBitRateUplinkExtended(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_guaranteedBitRateUplinkExtended.log();
if (single_value->field_guaranteedBitRateUplinkExtended.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 ABQP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (reliabilityClass().is_bound()) reliabilityClass().set_implicit_omit();
if (delayClass().is_bound()) delayClass().set_implicit_omit();
if (spare1().is_bound()) spare1().set_implicit_omit();
if (precedenceClass().is_bound()) precedenceClass().set_implicit_omit();
if (spare2().is_bound()) spare2().set_implicit_omit();
if (peakThroughput().is_bound()) peakThroughput().set_implicit_omit();
if (meanThroughput().is_bound()) meanThroughput().set_implicit_omit();
if (spare3().is_bound()) spare3().set_implicit_omit();
if (!deliverErroneusSDU().is_bound()) deliverErroneusSDU() = OMIT_VALUE;
else deliverErroneusSDU().set_implicit_omit();
if (!deliveryOrder().is_bound()) deliveryOrder() = OMIT_VALUE;
else deliveryOrder().set_implicit_omit();
if (!trafficClass().is_bound()) trafficClass() = OMIT_VALUE;
else trafficClass().set_implicit_omit();
if (!maxSDUSize().is_bound()) maxSDUSize() = OMIT_VALUE;
else maxSDUSize().set_implicit_omit();
if (!maxBitrateUplink().is_bound()) maxBitrateUplink() = OMIT_VALUE;
else maxBitrateUplink().set_implicit_omit();
if (!maxBitrateDownlink().is_bound()) maxBitrateDownlink() = OMIT_VALUE;
else maxBitrateDownlink().set_implicit_omit();
if (!sduErrorRatio().is_bound()) sduErrorRatio() = OMIT_VALUE;
else sduErrorRatio().set_implicit_omit();
if (!residualBER().is_bound()) residualBER() = OMIT_VALUE;
else residualBER().set_implicit_omit();
if (!trafficHandlingPriority().is_bound()) trafficHandlingPriority() = OMIT_VALUE;
else trafficHandlingPriority().set_implicit_omit();
if (!transferDelay().is_bound()) transferDelay() = OMIT_VALUE;
else transferDelay().set_implicit_omit();
if (!guaranteedBitRateUplink().is_bound()) guaranteedBitRateUplink() = OMIT_VALUE;
else guaranteedBitRateUplink().set_implicit_omit();
if (!guaranteedBitRateDownlink().is_bound()) guaranteedBitRateDownlink() = OMIT_VALUE;
else guaranteedBitRateDownlink().set_implicit_omit();
if (!sourceStatisticsDescriptor().is_bound()) sourceStatisticsDescriptor() = OMIT_VALUE;
else sourceStatisticsDescriptor().set_implicit_omit();
if (!signallingIndication().is_bound()) signallingIndication() = OMIT_VALUE;
else signallingIndication().set_implicit_omit();
if (!spare4().is_bound()) spare4() = OMIT_VALUE;
else spare4().set_implicit_omit();
if (!maxBitRateDownlinkExtended().is_bound()) maxBitRateDownlinkExtended() = OMIT_VALUE;
else maxBitRateDownlinkExtended().set_implicit_omit();
if (!guaranteedBitRateDownlinkExtended().is_bound()) guaranteedBitRateDownlinkExtended() = OMIT_VALUE;
else guaranteedBitRateDownlinkExtended().set_implicit_omit();
if (!maxBitrateUplinkExtended().is_bound()) maxBitrateUplinkExtended() = OMIT_VALUE;
else maxBitrateUplinkExtended().set_implicit_omit();
if (!guaranteedBitRateUplinkExtended().is_bound()) guaranteedBitRateUplinkExtended() = OMIT_VALUE;
else guaranteedBitRateUplinkExtended().set_implicit_omit();
}

void ABQP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_reliabilityClass.encode_text(text_buf);
single_value->field_delayClass.encode_text(text_buf);
single_value->field_spare1.encode_text(text_buf);
single_value->field_precedenceClass.encode_text(text_buf);
single_value->field_spare2.encode_text(text_buf);
single_value->field_peakThroughput.encode_text(text_buf);
single_value->field_meanThroughput.encode_text(text_buf);
single_value->field_spare3.encode_text(text_buf);
single_value->field_deliverErroneusSDU.encode_text(text_buf);
single_value->field_deliveryOrder.encode_text(text_buf);
single_value->field_trafficClass.encode_text(text_buf);
single_value->field_maxSDUSize.encode_text(text_buf);
single_value->field_maxBitrateUplink.encode_text(text_buf);
single_value->field_maxBitrateDownlink.encode_text(text_buf);
single_value->field_sduErrorRatio.encode_text(text_buf);
single_value->field_residualBER.encode_text(text_buf);
single_value->field_trafficHandlingPriority.encode_text(text_buf);
single_value->field_transferDelay.encode_text(text_buf);
single_value->field_guaranteedBitRateUplink.encode_text(text_buf);
single_value->field_guaranteedBitRateDownlink.encode_text(text_buf);
single_value->field_sourceStatisticsDescriptor.encode_text(text_buf);
single_value->field_signallingIndication.encode_text(text_buf);
single_value->field_spare4.encode_text(text_buf);
single_value->field_maxBitRateDownlinkExtended.encode_text(text_buf);
single_value->field_guaranteedBitRateDownlinkExtended.encode_text(text_buf);
single_value->field_maxBitrateUplinkExtended.encode_text(text_buf);
single_value->field_guaranteedBitRateUplinkExtended.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 @BSSGP_Types.ABQP.");
}
}

void ABQP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_reliabilityClass.decode_text(text_buf);
single_value->field_delayClass.decode_text(text_buf);
single_value->field_spare1.decode_text(text_buf);
single_value->field_precedenceClass.decode_text(text_buf);
single_value->field_spare2.decode_text(text_buf);
single_value->field_peakThroughput.decode_text(text_buf);
single_value->field_meanThroughput.decode_text(text_buf);
single_value->field_spare3.decode_text(text_buf);
single_value->field_deliverErroneusSDU.decode_text(text_buf);
single_value->field_deliveryOrder.decode_text(text_buf);
single_value->field_trafficClass.decode_text(text_buf);
single_value->field_maxSDUSize.decode_text(text_buf);
single_value->field_maxBitrateUplink.decode_text(text_buf);
single_value->field_maxBitrateDownlink.decode_text(text_buf);
single_value->field_sduErrorRatio.decode_text(text_buf);
single_value->field_residualBER.decode_text(text_buf);
single_value->field_trafficHandlingPriority.decode_text(text_buf);
single_value->field_transferDelay.decode_text(text_buf);
single_value->field_guaranteedBitRateUplink.decode_text(text_buf);
single_value->field_guaranteedBitRateDownlink.decode_text(text_buf);
single_value->field_sourceStatisticsDescriptor.decode_text(text_buf);
single_value->field_signallingIndication.decode_text(text_buf);
single_value->field_spare4.decode_text(text_buf);
single_value->field_maxBitRateDownlinkExtended.decode_text(text_buf);
single_value->field_guaranteedBitRateDownlinkExtended.decode_text(text_buf);
single_value->field_maxBitrateUplinkExtended.decode_text(text_buf);
single_value->field_guaranteedBitRateUplinkExtended.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 ABQP_template[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 @BSSGP_Types.ABQP.");
}
}

void ABQP_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: {
    ABQP_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 (30<param.get_size()) {
      param.error("record template of type @BSSGP_Types.ABQP has 30 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) reliabilityClass().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) delayClass().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) spare1().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) precedenceClass().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) spare2().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) peakThroughput().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) meanThroughput().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) spare3().set_param(*param.get_elem(10));
    if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) deliverErroneusSDU().set_param(*param.get_elem(11));
    if (param.get_size()>12 && param.get_elem(12)->get_type()!=Module_Param::MP_NotUsed) deliveryOrder().set_param(*param.get_elem(12));
    if (param.get_size()>13 && param.get_elem(13)->get_type()!=Module_Param::MP_NotUsed) trafficClass().set_param(*param.get_elem(13));
    if (param.get_size()>14 && param.get_elem(14)->get_type()!=Module_Param::MP_NotUsed) maxSDUSize().set_param(*param.get_elem(14));
    if (param.get_size()>15 && param.get_elem(15)->get_type()!=Module_Param::MP_NotUsed) maxBitrateUplink().set_param(*param.get_elem(15));
    if (param.get_size()>16 && param.get_elem(16)->get_type()!=Module_Param::MP_NotUsed) maxBitrateDownlink().set_param(*param.get_elem(16));
    if (param.get_size()>17 && param.get_elem(17)->get_type()!=Module_Param::MP_NotUsed) sduErrorRatio().set_param(*param.get_elem(17));
    if (param.get_size()>18 && param.get_elem(18)->get_type()!=Module_Param::MP_NotUsed) residualBER().set_param(*param.get_elem(18));
    if (param.get_size()>19 && param.get_elem(19)->get_type()!=Module_Param::MP_NotUsed) trafficHandlingPriority().set_param(*param.get_elem(19));
    if (param.get_size()>20 && param.get_elem(20)->get_type()!=Module_Param::MP_NotUsed) transferDelay().set_param(*param.get_elem(20));
    if (param.get_size()>21 && param.get_elem(21)->get_type()!=Module_Param::MP_NotUsed) guaranteedBitRateUplink().set_param(*param.get_elem(21));
    if (param.get_size()>22 && param.get_elem(22)->get_type()!=Module_Param::MP_NotUsed) guaranteedBitRateDownlink().set_param(*param.get_elem(22));
    if (param.get_size()>23 && param.get_elem(23)->get_type()!=Module_Param::MP_NotUsed) sourceStatisticsDescriptor().set_param(*param.get_elem(23));
    if (param.get_size()>24 && param.get_elem(24)->get_type()!=Module_Param::MP_NotUsed) signallingIndication().set_param(*param.get_elem(24));
    if (param.get_size()>25 && param.get_elem(25)->get_type()!=Module_Param::MP_NotUsed) spare4().set_param(*param.get_elem(25));
    if (param.get_size()>26 && param.get_elem(26)->get_type()!=Module_Param::MP_NotUsed) maxBitRateDownlinkExtended().set_param(*param.get_elem(26));
    if (param.get_size()>27 && param.get_elem(27)->get_type()!=Module_Param::MP_NotUsed) guaranteedBitRateDownlinkExtended().set_param(*param.get_elem(27));
    if (param.get_size()>28 && param.get_elem(28)->get_type()!=Module_Param::MP_NotUsed) maxBitrateUplinkExtended().set_param(*param.get_elem(28));
    if (param.get_size()>29 && param.get_elem(29)->get_type()!=Module_Param::MP_NotUsed) guaranteedBitRateUplinkExtended().set_param(*param.get_elem(29));
    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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "reliabilityClass")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          reliabilityClass().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "delayClass")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          delayClass().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare1().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "precedenceClass")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          precedenceClass().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare2().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "peakThroughput")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          peakThroughput().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "meanThroughput")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          meanThroughput().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare3")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare3().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "deliverErroneusSDU")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          deliverErroneusSDU().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "deliveryOrder")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          deliveryOrder().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "trafficClass")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          trafficClass().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "maxSDUSize")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          maxSDUSize().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "maxBitrateUplink")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          maxBitrateUplink().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "maxBitrateDownlink")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          maxBitrateDownlink().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "sduErrorRatio")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sduErrorRatio().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "residualBER")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          residualBER().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "trafficHandlingPriority")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          trafficHandlingPriority().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "transferDelay")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          transferDelay().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "guaranteedBitRateUplink")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          guaranteedBitRateUplink().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "guaranteedBitRateDownlink")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          guaranteedBitRateDownlink().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "sourceStatisticsDescriptor")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sourceStatisticsDescriptor().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "signallingIndication")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          signallingIndication().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare4")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare4().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "maxBitRateDownlinkExtended")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          maxBitRateDownlinkExtended().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "guaranteedBitRateDownlinkExtended")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          guaranteedBitRateDownlinkExtended().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "maxBitrateUplinkExtended")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          maxBitrateUplinkExtended().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "guaranteedBitRateUplinkExtended")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          guaranteedBitRateUplinkExtended().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 @BSSGP_Types.ABQP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    ABQP_template* precondition = new ABQP_template;
    precondition->set_param(*param.get_elem(0));
    ABQP_template* implied_template = new ABQP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = ABQP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.ABQP");
  }
  is_ifpresent = param.get_ifpresent();
}

void ABQP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_reliabilityClass.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_delayClass.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_spare1.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_precedenceClass.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_spare2.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_peakThroughput.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_meanThroughput.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_spare3.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_deliverErroneusSDU.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_deliveryOrder.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_trafficClass.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_maxSDUSize.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_maxBitrateUplink.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_maxBitrateDownlink.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_sduErrorRatio.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_residualBER.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_trafficHandlingPriority.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_transferDelay.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_guaranteedBitRateUplink.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_guaranteedBitRateDownlink.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_sourceStatisticsDescriptor.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_signallingIndication.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_spare4.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_maxBitRateDownlinkExtended.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_guaranteedBitRateDownlinkExtended.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_maxBitrateUplinkExtended.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
single_value->field_guaranteedBitRateUplinkExtended.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.ABQP");
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 : "@BSSGP_Types.ABQP");
}

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

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

GPRS__Timer::GPRS__Timer()
{
}

GPRS__Timer::GPRS__Timer(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const BITSTRING& par_timer__Value,
    const BITSTRING& par_unit__Value)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_timer__Value(par_timer__Value),
  field_unit__Value(par_unit__Value)
{
}

GPRS__Timer::GPRS__Timer(const GPRS__Timer& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.GPRS_Timer.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.timer__Value().is_bound()) field_timer__Value = other_value.timer__Value();
else field_timer__Value.clean_up();
if (other_value.unit__Value().is_bound()) field_unit__Value = other_value.unit__Value();
else field_unit__Value.clean_up();
}

void GPRS__Timer::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_timer__Value.clean_up();
field_unit__Value.clean_up();
}

const TTCN_Typedescriptor_t* GPRS__Timer::get_descriptor() const { return &GPRS__Timer_descr_; }
GPRS__Timer& GPRS__Timer::operator=(const GPRS__Timer& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.GPRS_Timer.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.timer__Value().is_bound()) field_timer__Value = other_value.timer__Value();
  else field_timer__Value.clean_up();
  if (other_value.unit__Value().is_bound()) field_unit__Value = other_value.unit__Value();
  else field_unit__Value.clean_up();
}
return *this;
}

boolean GPRS__Timer::operator==(const GPRS__Timer& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_timer__Value==other_value.field_timer__Value
  && field_unit__Value==other_value.field_unit__Value;
}

boolean GPRS__Timer::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_timer__Value.is_bound())
  || (field_unit__Value.is_bound());
}
boolean GPRS__Timer::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_timer__Value.is_value()
  && field_unit__Value.is_value();
}
void GPRS__Timer::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", timer_Value := ");
field_timer__Value.log();
TTCN_Logger::log_event_str(", unit_Value := ");
field_unit__Value.log();
TTCN_Logger::log_event_str(" }");
}

void GPRS__Timer::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (timer__Value().is_bound()) timer__Value().set_implicit_omit();
if (unit__Value().is_bound()) unit__Value().set_implicit_omit();
}

void GPRS__Timer::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 @BSSGP_Types.GPRS_Timer 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) timer__Value().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) unit__Value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "timer_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          timer__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(), "unit_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          unit__Value().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 @BSSGP_Types.GPRS_Timer: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.GPRS_Timer");
  }
}

void GPRS__Timer::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_timer__Value.encode_text(text_buf);
field_unit__Value.encode_text(text_buf);
}

void GPRS__Timer::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_timer__Value.decode_text(text_buf);
field_unit__Value.decode_text(text_buf);
}

void GPRS__Timer::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 GPRS__Timer::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 GPRS__Timer::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, GPRS__Timer_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(GPRS__Timer_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, GPRS__Timer_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(GPRS__Timer_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT5_descr_.raw->forceomit);
  decoded_field_length = field_timer__Value.RAW_decode(General__Types::BIT5_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::BIT3_descr_.raw->forceomit);
  decoded_field_length = field_unit__Value.RAW_decode(General__Types::BIT3_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_63) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int GPRS__Timer::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 5;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(5);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, GPRS__Timer_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, GPRS__Timer_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT5_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::BIT3_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(GPRS__Timer_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(GPRS__Timer_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_timer__Value.RAW_encode(General__Types::BIT5_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_unit__Value.RAW_encode(General__Types::BIT3_descr_, *myleaf.body.node.nodes[4]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 2;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(2);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[4]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[4]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(GPRS__Timer_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(GPRS__Timer_ext_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_iEI !=  os_63) {
  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){
   os_63.RAW_encode(General__Types::OCT1_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 GPRS__Timer_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
BITSTRING_template field_timer__Value;
BITSTRING_template field_unit__Value;
};

void GPRS__Timer_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_timer__Value = ANY_VALUE;
single_value->field_unit__Value = ANY_VALUE;
}
}
}

void GPRS__Timer_template::copy_value(const GPRS__Timer& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.timer__Value().is_bound()) {
  single_value->field_timer__Value = other_value.timer__Value();
} else {
  single_value->field_timer__Value.clean_up();
}
if (other_value.unit__Value().is_bound()) {
  single_value->field_unit__Value = other_value.unit__Value();
} else {
  single_value->field_unit__Value.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void GPRS__Timer_template::copy_template(const GPRS__Timer_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.timer__Value().get_selection()) {
single_value->field_timer__Value = other_value.timer__Value();
} else {
single_value->field_timer__Value.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.unit__Value().get_selection()) {
single_value->field_unit__Value = other_value.unit__Value();
} else {
single_value->field_unit__Value.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 GPRS__Timer_template[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 GPRS__Timer_template(*other_value.implication_.precondition);
implication_.implied_template = new GPRS__Timer_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 @BSSGP_Types.GPRS_Timer.");
break;
}
set_selection(other_value);
}

GPRS__Timer_template::GPRS__Timer_template()
{
}

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

GPRS__Timer_template::GPRS__Timer_template(const GPRS__Timer& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean GPRS__Timer_template::match(const GPRS__Timer& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.timer__Value().is_bound()) return FALSE;
if(!single_value->field_timer__Value.match(other_value.timer__Value(), legacy))return FALSE;
if(!other_value.unit__Value().is_bound()) return FALSE;
if(!single_value->field_unit__Value.match(other_value.unit__Value(), 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 @BSSGP_Types.GPRS_Timer.");
}
return FALSE;
}

boolean GPRS__Timer_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_timer__Value.is_bound()
 || single_value->field_unit__Value.is_bound();
}

boolean GPRS__Timer_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_timer__Value.is_value()
 && single_value->field_unit__Value.is_value();
}

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

GPRS__Timer GPRS__Timer_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 @BSSGP_Types.GPRS_Timer.");
GPRS__Timer ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_timer__Value.is_bound()) {
ret_val.timer__Value() = single_value->field_timer__Value.valueof();
}
if (single_value->field_unit__Value.is_bound()) {
ret_val.unit__Value() = single_value->field_unit__Value.valueof();
}
return ret_val;
}

void GPRS__Timer_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 @BSSGP_Types.GPRS_Timer.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new GPRS__Timer_template[list_length];
}

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

OCTETSTRING_template& GPRS__Timer_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& GPRS__Timer_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.GPRS_Timer.");
return single_value->field_iEI;
}

BITSTRING_template& GPRS__Timer_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& GPRS__Timer_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.GPRS_Timer.");
return single_value->field_ext;
}

LIN2__2a_template& GPRS__Timer_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& GPRS__Timer_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.GPRS_Timer.");
return single_value->field_lengthIndicator;
}

BITSTRING_template& GPRS__Timer_template::timer__Value()
{
set_specific();
return single_value->field_timer__Value;
}

const BITSTRING_template& GPRS__Timer_template::timer__Value() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field timer_Value of a non-specific template of type @BSSGP_Types.GPRS_Timer.");
return single_value->field_timer__Value;
}

BITSTRING_template& GPRS__Timer_template::unit__Value()
{
set_specific();
return single_value->field_unit__Value;
}

const BITSTRING_template& GPRS__Timer_template::unit__Value() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field unit_Value of a non-specific template of type @BSSGP_Types.GPRS_Timer.");
return single_value->field_unit__Value;
}

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

void GPRS__Timer_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", timer_Value := ");
single_value->field_timer__Value.log();
TTCN_Logger::log_event_str(", unit_Value := ");
single_value->field_unit__Value.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 GPRS__Timer_template::log_match(const GPRS__Timer& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_timer__Value.match(match_value.timer__Value(), legacy)){
TTCN_Logger::log_logmatch_info(".timer_Value");
single_value->field_timer__Value.log_match(match_value.timer__Value(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_unit__Value.match(match_value.unit__Value(), legacy)){
TTCN_Logger::log_logmatch_info(".unit_Value");
single_value->field_unit__Value.log_match(match_value.unit__Value(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", timer_Value := ");
single_value->field_timer__Value.log_match(match_value.timer__Value(), legacy);
TTCN_Logger::log_event_str(", unit_Value := ");
single_value->field_unit__Value.log_match(match_value.unit__Value(), 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 GPRS__Timer_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (timer__Value().is_bound()) timer__Value().set_implicit_omit();
if (unit__Value().is_bound()) unit__Value().set_implicit_omit();
}

void GPRS__Timer_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_timer__Value.encode_text(text_buf);
single_value->field_unit__Value.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 @BSSGP_Types.GPRS_Timer.");
}
}

void GPRS__Timer_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_timer__Value.decode_text(text_buf);
single_value->field_unit__Value.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 GPRS__Timer_template[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 @BSSGP_Types.GPRS_Timer.");
}
}

void GPRS__Timer_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: {
    GPRS__Timer_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 @BSSGP_Types.GPRS_Timer 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) timer__Value().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) unit__Value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "timer_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          timer__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(), "unit_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          unit__Value().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 @BSSGP_Types.GPRS_Timer: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    GPRS__Timer_template* precondition = new GPRS__Timer_template;
    precondition->set_param(*param.get_elem(0));
    GPRS__Timer_template* implied_template = new GPRS__Timer_template;
    implied_template->set_param(*param.get_elem(1));
    *this = GPRS__Timer_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.GPRS_Timer");
  }
  is_ifpresent = param.get_ifpresent();
}

void GPRS__Timer_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.GPRS_Timer");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.GPRS_Timer");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.GPRS_Timer");
single_value->field_timer__Value.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.GPRS_Timer");
single_value->field_unit__Value.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.GPRS_Timer");
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 : "@BSSGP_Types.GPRS_Timer");
}

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

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

Feature__bitmap::Feature__bitmap()
{
}

Feature__bitmap::Feature__bitmap(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const BITSTRING& par_pFC,
    const BITSTRING& par_cBL,
    const BITSTRING& par_iNR,
    const BITSTRING& par_lCS,
    const BITSTRING& par_rIM,
    const BITSTRING& par_pFC__FC,
    const BITSTRING& par_enhancedRadioStatus,
    const BITSTRING& par_mBMS)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_pFC(par_pFC),
  field_cBL(par_cBL),
  field_iNR(par_iNR),
  field_lCS(par_lCS),
  field_rIM(par_rIM),
  field_pFC__FC(par_pFC__FC),
  field_enhancedRadioStatus(par_enhancedRadioStatus),
  field_mBMS(par_mBMS)
{
}

Feature__bitmap::Feature__bitmap(const Feature__bitmap& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.Feature_bitmap.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.pFC().is_bound()) field_pFC = other_value.pFC();
else field_pFC.clean_up();
if (other_value.cBL().is_bound()) field_cBL = other_value.cBL();
else field_cBL.clean_up();
if (other_value.iNR().is_bound()) field_iNR = other_value.iNR();
else field_iNR.clean_up();
if (other_value.lCS().is_bound()) field_lCS = other_value.lCS();
else field_lCS.clean_up();
if (other_value.rIM().is_bound()) field_rIM = other_value.rIM();
else field_rIM.clean_up();
if (other_value.pFC__FC().is_bound()) field_pFC__FC = other_value.pFC__FC();
else field_pFC__FC.clean_up();
if (other_value.enhancedRadioStatus().is_bound()) field_enhancedRadioStatus = other_value.enhancedRadioStatus();
else field_enhancedRadioStatus.clean_up();
if (other_value.mBMS().is_bound()) field_mBMS = other_value.mBMS();
else field_mBMS.clean_up();
}

void Feature__bitmap::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_pFC.clean_up();
field_cBL.clean_up();
field_iNR.clean_up();
field_lCS.clean_up();
field_rIM.clean_up();
field_pFC__FC.clean_up();
field_enhancedRadioStatus.clean_up();
field_mBMS.clean_up();
}

const TTCN_Typedescriptor_t* Feature__bitmap::get_descriptor() const { return &Feature__bitmap_descr_; }
Feature__bitmap& Feature__bitmap::operator=(const Feature__bitmap& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.Feature_bitmap.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.pFC().is_bound()) field_pFC = other_value.pFC();
  else field_pFC.clean_up();
  if (other_value.cBL().is_bound()) field_cBL = other_value.cBL();
  else field_cBL.clean_up();
  if (other_value.iNR().is_bound()) field_iNR = other_value.iNR();
  else field_iNR.clean_up();
  if (other_value.lCS().is_bound()) field_lCS = other_value.lCS();
  else field_lCS.clean_up();
  if (other_value.rIM().is_bound()) field_rIM = other_value.rIM();
  else field_rIM.clean_up();
  if (other_value.pFC__FC().is_bound()) field_pFC__FC = other_value.pFC__FC();
  else field_pFC__FC.clean_up();
  if (other_value.enhancedRadioStatus().is_bound()) field_enhancedRadioStatus = other_value.enhancedRadioStatus();
  else field_enhancedRadioStatus.clean_up();
  if (other_value.mBMS().is_bound()) field_mBMS = other_value.mBMS();
  else field_mBMS.clean_up();
}
return *this;
}

boolean Feature__bitmap::operator==(const Feature__bitmap& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_pFC==other_value.field_pFC
  && field_cBL==other_value.field_cBL
  && field_iNR==other_value.field_iNR
  && field_lCS==other_value.field_lCS
  && field_rIM==other_value.field_rIM
  && field_pFC__FC==other_value.field_pFC__FC
  && field_enhancedRadioStatus==other_value.field_enhancedRadioStatus
  && field_mBMS==other_value.field_mBMS;
}

boolean Feature__bitmap::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_pFC.is_bound())
  || (field_cBL.is_bound())
  || (field_iNR.is_bound())
  || (field_lCS.is_bound())
  || (field_rIM.is_bound())
  || (field_pFC__FC.is_bound())
  || (field_enhancedRadioStatus.is_bound())
  || (field_mBMS.is_bound());
}
boolean Feature__bitmap::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_pFC.is_value()
  && field_cBL.is_value()
  && field_iNR.is_value()
  && field_lCS.is_value()
  && field_rIM.is_value()
  && field_pFC__FC.is_value()
  && field_enhancedRadioStatus.is_value()
  && field_mBMS.is_value();
}
void Feature__bitmap::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", pFC := ");
field_pFC.log();
TTCN_Logger::log_event_str(", cBL := ");
field_cBL.log();
TTCN_Logger::log_event_str(", iNR := ");
field_iNR.log();
TTCN_Logger::log_event_str(", lCS := ");
field_lCS.log();
TTCN_Logger::log_event_str(", rIM := ");
field_rIM.log();
TTCN_Logger::log_event_str(", pFC_FC := ");
field_pFC__FC.log();
TTCN_Logger::log_event_str(", enhancedRadioStatus := ");
field_enhancedRadioStatus.log();
TTCN_Logger::log_event_str(", mBMS := ");
field_mBMS.log();
TTCN_Logger::log_event_str(" }");
}

void Feature__bitmap::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (pFC().is_bound()) pFC().set_implicit_omit();
if (cBL().is_bound()) cBL().set_implicit_omit();
if (iNR().is_bound()) iNR().set_implicit_omit();
if (lCS().is_bound()) lCS().set_implicit_omit();
if (rIM().is_bound()) rIM().set_implicit_omit();
if (pFC__FC().is_bound()) pFC__FC().set_implicit_omit();
if (enhancedRadioStatus().is_bound()) enhancedRadioStatus().set_implicit_omit();
if (mBMS().is_bound()) mBMS().set_implicit_omit();
}

void Feature__bitmap::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (11<param.get_size()) {
      param.error("record value of type @BSSGP_Types.Feature_bitmap has 11 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) pFC().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) cBL().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) iNR().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) lCS().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) rIM().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) pFC__FC().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) enhancedRadioStatus().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) mBMS().set_param(*param.get_elem(10));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pFC")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pFC().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cBL")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cBL().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "iNR")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iNR().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lCS")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lCS().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rIM")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rIM().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pFC_FC")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pFC__FC().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "enhancedRadioStatus")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          enhancedRadioStatus().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mBMS")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mBMS().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 @BSSGP_Types.Feature_bitmap: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.Feature_bitmap");
  }
}

void Feature__bitmap::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_pFC.encode_text(text_buf);
field_cBL.encode_text(text_buf);
field_iNR.encode_text(text_buf);
field_lCS.encode_text(text_buf);
field_rIM.encode_text(text_buf);
field_pFC__FC.encode_text(text_buf);
field_enhancedRadioStatus.encode_text(text_buf);
field_mBMS.encode_text(text_buf);
}

void Feature__bitmap::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_pFC.decode_text(text_buf);
field_cBL.decode_text(text_buf);
field_iNR.decode_text(text_buf);
field_lCS.decode_text(text_buf);
field_rIM.decode_text(text_buf);
field_pFC__FC.decode_text(text_buf);
field_enhancedRadioStatus.decode_text(text_buf);
field_mBMS.decode_text(text_buf);
}

void Feature__bitmap::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 Feature__bitmap::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 Feature__bitmap::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, Feature__bitmap_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(Feature__bitmap_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, Feature__bitmap_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(Feature__bitmap_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_pFC.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_cBL.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_iNR.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, no_err, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_6_force_omit(6, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_lCS.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_7_force_omit(7, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_rIM.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, no_err, -1, TRUE, &field_7_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_8_force_omit(8, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_pFC__FC.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_9_force_omit(9, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_enhancedRadioStatus.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_10_force_omit(10, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_mBMS.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_70) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Feature__bitmap::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 11;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(11);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Feature__bitmap_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Feature__bitmap_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 10, General__Types::BIT1_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(Feature__bitmap_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(Feature__bitmap_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_pFC.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_cBL.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_iNR.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[5]);
  encoded_length += field_lCS.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[6]);
  encoded_length += field_rIM.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[7]);
  encoded_length += field_pFC__FC.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[8]);
  encoded_length += field_enhancedRadioStatus.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[9]);
  encoded_length += field_mBMS.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[10]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(8);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[4]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[4]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[5]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[5]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[6]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[6]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[4].level = myleaf.body.node.nodes[7]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[4].pos = myleaf.body.node.nodes[7]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[5].level = myleaf.body.node.nodes[8]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[5].pos = myleaf.body.node.nodes[8]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[6].level = myleaf.body.node.nodes[9]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[6].pos = myleaf.body.node.nodes[9]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[7].level = myleaf.body.node.nodes[10]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[7].pos = myleaf.body.node.nodes[10]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Feature__bitmap_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Feature__bitmap_ext_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_iEI !=  os_70) {
  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){
   os_70.RAW_encode(General__Types::OCT1_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 Feature__bitmap_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
BITSTRING_template field_pFC;
BITSTRING_template field_cBL;
BITSTRING_template field_iNR;
BITSTRING_template field_lCS;
BITSTRING_template field_rIM;
BITSTRING_template field_pFC__FC;
BITSTRING_template field_enhancedRadioStatus;
BITSTRING_template field_mBMS;
};

void Feature__bitmap_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_pFC = ANY_VALUE;
single_value->field_cBL = ANY_VALUE;
single_value->field_iNR = ANY_VALUE;
single_value->field_lCS = ANY_VALUE;
single_value->field_rIM = ANY_VALUE;
single_value->field_pFC__FC = ANY_VALUE;
single_value->field_enhancedRadioStatus = ANY_VALUE;
single_value->field_mBMS = ANY_VALUE;
}
}
}

void Feature__bitmap_template::copy_value(const Feature__bitmap& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.pFC().is_bound()) {
  single_value->field_pFC = other_value.pFC();
} else {
  single_value->field_pFC.clean_up();
}
if (other_value.cBL().is_bound()) {
  single_value->field_cBL = other_value.cBL();
} else {
  single_value->field_cBL.clean_up();
}
if (other_value.iNR().is_bound()) {
  single_value->field_iNR = other_value.iNR();
} else {
  single_value->field_iNR.clean_up();
}
if (other_value.lCS().is_bound()) {
  single_value->field_lCS = other_value.lCS();
} else {
  single_value->field_lCS.clean_up();
}
if (other_value.rIM().is_bound()) {
  single_value->field_rIM = other_value.rIM();
} else {
  single_value->field_rIM.clean_up();
}
if (other_value.pFC__FC().is_bound()) {
  single_value->field_pFC__FC = other_value.pFC__FC();
} else {
  single_value->field_pFC__FC.clean_up();
}
if (other_value.enhancedRadioStatus().is_bound()) {
  single_value->field_enhancedRadioStatus = other_value.enhancedRadioStatus();
} else {
  single_value->field_enhancedRadioStatus.clean_up();
}
if (other_value.mBMS().is_bound()) {
  single_value->field_mBMS = other_value.mBMS();
} else {
  single_value->field_mBMS.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Feature__bitmap_template::copy_template(const Feature__bitmap_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pFC().get_selection()) {
single_value->field_pFC = other_value.pFC();
} else {
single_value->field_pFC.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.cBL().get_selection()) {
single_value->field_cBL = other_value.cBL();
} else {
single_value->field_cBL.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.iNR().get_selection()) {
single_value->field_iNR = other_value.iNR();
} else {
single_value->field_iNR.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lCS().get_selection()) {
single_value->field_lCS = other_value.lCS();
} else {
single_value->field_lCS.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rIM().get_selection()) {
single_value->field_rIM = other_value.rIM();
} else {
single_value->field_rIM.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pFC__FC().get_selection()) {
single_value->field_pFC__FC = other_value.pFC__FC();
} else {
single_value->field_pFC__FC.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.enhancedRadioStatus().get_selection()) {
single_value->field_enhancedRadioStatus = other_value.enhancedRadioStatus();
} else {
single_value->field_enhancedRadioStatus.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.mBMS().get_selection()) {
single_value->field_mBMS = other_value.mBMS();
} else {
single_value->field_mBMS.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 Feature__bitmap_template[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 Feature__bitmap_template(*other_value.implication_.precondition);
implication_.implied_template = new Feature__bitmap_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 @BSSGP_Types.Feature_bitmap.");
break;
}
set_selection(other_value);
}

Feature__bitmap_template::Feature__bitmap_template()
{
}

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

Feature__bitmap_template::Feature__bitmap_template(const Feature__bitmap& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean Feature__bitmap_template::match(const Feature__bitmap& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.pFC().is_bound()) return FALSE;
if(!single_value->field_pFC.match(other_value.pFC(), legacy))return FALSE;
if(!other_value.cBL().is_bound()) return FALSE;
if(!single_value->field_cBL.match(other_value.cBL(), legacy))return FALSE;
if(!other_value.iNR().is_bound()) return FALSE;
if(!single_value->field_iNR.match(other_value.iNR(), legacy))return FALSE;
if(!other_value.lCS().is_bound()) return FALSE;
if(!single_value->field_lCS.match(other_value.lCS(), legacy))return FALSE;
if(!other_value.rIM().is_bound()) return FALSE;
if(!single_value->field_rIM.match(other_value.rIM(), legacy))return FALSE;
if(!other_value.pFC__FC().is_bound()) return FALSE;
if(!single_value->field_pFC__FC.match(other_value.pFC__FC(), legacy))return FALSE;
if(!other_value.enhancedRadioStatus().is_bound()) return FALSE;
if(!single_value->field_enhancedRadioStatus.match(other_value.enhancedRadioStatus(), legacy))return FALSE;
if(!other_value.mBMS().is_bound()) return FALSE;
if(!single_value->field_mBMS.match(other_value.mBMS(), 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 @BSSGP_Types.Feature_bitmap.");
}
return FALSE;
}

boolean Feature__bitmap_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_pFC.is_bound()
 || single_value->field_cBL.is_bound()
 || single_value->field_iNR.is_bound()
 || single_value->field_lCS.is_bound()
 || single_value->field_rIM.is_bound()
 || single_value->field_pFC__FC.is_bound()
 || single_value->field_enhancedRadioStatus.is_bound()
 || single_value->field_mBMS.is_bound();
}

boolean Feature__bitmap_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_pFC.is_value()
 && single_value->field_cBL.is_value()
 && single_value->field_iNR.is_value()
 && single_value->field_lCS.is_value()
 && single_value->field_rIM.is_value()
 && single_value->field_pFC__FC.is_value()
 && single_value->field_enhancedRadioStatus.is_value()
 && single_value->field_mBMS.is_value();
}

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

Feature__bitmap Feature__bitmap_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 @BSSGP_Types.Feature_bitmap.");
Feature__bitmap ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_pFC.is_bound()) {
ret_val.pFC() = single_value->field_pFC.valueof();
}
if (single_value->field_cBL.is_bound()) {
ret_val.cBL() = single_value->field_cBL.valueof();
}
if (single_value->field_iNR.is_bound()) {
ret_val.iNR() = single_value->field_iNR.valueof();
}
if (single_value->field_lCS.is_bound()) {
ret_val.lCS() = single_value->field_lCS.valueof();
}
if (single_value->field_rIM.is_bound()) {
ret_val.rIM() = single_value->field_rIM.valueof();
}
if (single_value->field_pFC__FC.is_bound()) {
ret_val.pFC__FC() = single_value->field_pFC__FC.valueof();
}
if (single_value->field_enhancedRadioStatus.is_bound()) {
ret_val.enhancedRadioStatus() = single_value->field_enhancedRadioStatus.valueof();
}
if (single_value->field_mBMS.is_bound()) {
ret_val.mBMS() = single_value->field_mBMS.valueof();
}
return ret_val;
}

void Feature__bitmap_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 @BSSGP_Types.Feature_bitmap.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Feature__bitmap_template[list_length];
}

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

OCTETSTRING_template& Feature__bitmap_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& Feature__bitmap_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.Feature_bitmap.");
return single_value->field_iEI;
}

BITSTRING_template& Feature__bitmap_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& Feature__bitmap_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.Feature_bitmap.");
return single_value->field_ext;
}

LIN2__2a_template& Feature__bitmap_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& Feature__bitmap_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.Feature_bitmap.");
return single_value->field_lengthIndicator;
}

BITSTRING_template& Feature__bitmap_template::pFC()
{
set_specific();
return single_value->field_pFC;
}

const BITSTRING_template& Feature__bitmap_template::pFC() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pFC of a non-specific template of type @BSSGP_Types.Feature_bitmap.");
return single_value->field_pFC;
}

BITSTRING_template& Feature__bitmap_template::cBL()
{
set_specific();
return single_value->field_cBL;
}

const BITSTRING_template& Feature__bitmap_template::cBL() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field cBL of a non-specific template of type @BSSGP_Types.Feature_bitmap.");
return single_value->field_cBL;
}

BITSTRING_template& Feature__bitmap_template::iNR()
{
set_specific();
return single_value->field_iNR;
}

const BITSTRING_template& Feature__bitmap_template::iNR() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iNR of a non-specific template of type @BSSGP_Types.Feature_bitmap.");
return single_value->field_iNR;
}

BITSTRING_template& Feature__bitmap_template::lCS()
{
set_specific();
return single_value->field_lCS;
}

const BITSTRING_template& Feature__bitmap_template::lCS() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lCS of a non-specific template of type @BSSGP_Types.Feature_bitmap.");
return single_value->field_lCS;
}

BITSTRING_template& Feature__bitmap_template::rIM()
{
set_specific();
return single_value->field_rIM;
}

const BITSTRING_template& Feature__bitmap_template::rIM() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rIM of a non-specific template of type @BSSGP_Types.Feature_bitmap.");
return single_value->field_rIM;
}

BITSTRING_template& Feature__bitmap_template::pFC__FC()
{
set_specific();
return single_value->field_pFC__FC;
}

const BITSTRING_template& Feature__bitmap_template::pFC__FC() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pFC_FC of a non-specific template of type @BSSGP_Types.Feature_bitmap.");
return single_value->field_pFC__FC;
}

BITSTRING_template& Feature__bitmap_template::enhancedRadioStatus()
{
set_specific();
return single_value->field_enhancedRadioStatus;
}

const BITSTRING_template& Feature__bitmap_template::enhancedRadioStatus() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field enhancedRadioStatus of a non-specific template of type @BSSGP_Types.Feature_bitmap.");
return single_value->field_enhancedRadioStatus;
}

BITSTRING_template& Feature__bitmap_template::mBMS()
{
set_specific();
return single_value->field_mBMS;
}

const BITSTRING_template& Feature__bitmap_template::mBMS() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mBMS of a non-specific template of type @BSSGP_Types.Feature_bitmap.");
return single_value->field_mBMS;
}

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

void Feature__bitmap_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", pFC := ");
single_value->field_pFC.log();
TTCN_Logger::log_event_str(", cBL := ");
single_value->field_cBL.log();
TTCN_Logger::log_event_str(", iNR := ");
single_value->field_iNR.log();
TTCN_Logger::log_event_str(", lCS := ");
single_value->field_lCS.log();
TTCN_Logger::log_event_str(", rIM := ");
single_value->field_rIM.log();
TTCN_Logger::log_event_str(", pFC_FC := ");
single_value->field_pFC__FC.log();
TTCN_Logger::log_event_str(", enhancedRadioStatus := ");
single_value->field_enhancedRadioStatus.log();
TTCN_Logger::log_event_str(", mBMS := ");
single_value->field_mBMS.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 Feature__bitmap_template::log_match(const Feature__bitmap& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pFC.match(match_value.pFC(), legacy)){
TTCN_Logger::log_logmatch_info(".pFC");
single_value->field_pFC.log_match(match_value.pFC(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_cBL.match(match_value.cBL(), legacy)){
TTCN_Logger::log_logmatch_info(".cBL");
single_value->field_cBL.log_match(match_value.cBL(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_iNR.match(match_value.iNR(), legacy)){
TTCN_Logger::log_logmatch_info(".iNR");
single_value->field_iNR.log_match(match_value.iNR(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lCS.match(match_value.lCS(), legacy)){
TTCN_Logger::log_logmatch_info(".lCS");
single_value->field_lCS.log_match(match_value.lCS(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rIM.match(match_value.rIM(), legacy)){
TTCN_Logger::log_logmatch_info(".rIM");
single_value->field_rIM.log_match(match_value.rIM(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pFC__FC.match(match_value.pFC__FC(), legacy)){
TTCN_Logger::log_logmatch_info(".pFC_FC");
single_value->field_pFC__FC.log_match(match_value.pFC__FC(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_enhancedRadioStatus.match(match_value.enhancedRadioStatus(), legacy)){
TTCN_Logger::log_logmatch_info(".enhancedRadioStatus");
single_value->field_enhancedRadioStatus.log_match(match_value.enhancedRadioStatus(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_mBMS.match(match_value.mBMS(), legacy)){
TTCN_Logger::log_logmatch_info(".mBMS");
single_value->field_mBMS.log_match(match_value.mBMS(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", pFC := ");
single_value->field_pFC.log_match(match_value.pFC(), legacy);
TTCN_Logger::log_event_str(", cBL := ");
single_value->field_cBL.log_match(match_value.cBL(), legacy);
TTCN_Logger::log_event_str(", iNR := ");
single_value->field_iNR.log_match(match_value.iNR(), legacy);
TTCN_Logger::log_event_str(", lCS := ");
single_value->field_lCS.log_match(match_value.lCS(), legacy);
TTCN_Logger::log_event_str(", rIM := ");
single_value->field_rIM.log_match(match_value.rIM(), legacy);
TTCN_Logger::log_event_str(", pFC_FC := ");
single_value->field_pFC__FC.log_match(match_value.pFC__FC(), legacy);
TTCN_Logger::log_event_str(", enhancedRadioStatus := ");
single_value->field_enhancedRadioStatus.log_match(match_value.enhancedRadioStatus(), legacy);
TTCN_Logger::log_event_str(", mBMS := ");
single_value->field_mBMS.log_match(match_value.mBMS(), 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 Feature__bitmap_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (pFC().is_bound()) pFC().set_implicit_omit();
if (cBL().is_bound()) cBL().set_implicit_omit();
if (iNR().is_bound()) iNR().set_implicit_omit();
if (lCS().is_bound()) lCS().set_implicit_omit();
if (rIM().is_bound()) rIM().set_implicit_omit();
if (pFC__FC().is_bound()) pFC__FC().set_implicit_omit();
if (enhancedRadioStatus().is_bound()) enhancedRadioStatus().set_implicit_omit();
if (mBMS().is_bound()) mBMS().set_implicit_omit();
}

void Feature__bitmap_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_pFC.encode_text(text_buf);
single_value->field_cBL.encode_text(text_buf);
single_value->field_iNR.encode_text(text_buf);
single_value->field_lCS.encode_text(text_buf);
single_value->field_rIM.encode_text(text_buf);
single_value->field_pFC__FC.encode_text(text_buf);
single_value->field_enhancedRadioStatus.encode_text(text_buf);
single_value->field_mBMS.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 @BSSGP_Types.Feature_bitmap.");
}
}

void Feature__bitmap_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_pFC.decode_text(text_buf);
single_value->field_cBL.decode_text(text_buf);
single_value->field_iNR.decode_text(text_buf);
single_value->field_lCS.decode_text(text_buf);
single_value->field_rIM.decode_text(text_buf);
single_value->field_pFC__FC.decode_text(text_buf);
single_value->field_enhancedRadioStatus.decode_text(text_buf);
single_value->field_mBMS.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 Feature__bitmap_template[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 @BSSGP_Types.Feature_bitmap.");
}
}

void Feature__bitmap_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: {
    Feature__bitmap_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (11<param.get_size()) {
      param.error("record template of type @BSSGP_Types.Feature_bitmap has 11 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) pFC().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) cBL().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) iNR().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) lCS().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) rIM().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) pFC__FC().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) enhancedRadioStatus().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) mBMS().set_param(*param.get_elem(10));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pFC")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pFC().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cBL")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cBL().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "iNR")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iNR().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lCS")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lCS().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rIM")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rIM().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "pFC_FC")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pFC__FC().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "enhancedRadioStatus")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          enhancedRadioStatus().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "mBMS")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mBMS().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 @BSSGP_Types.Feature_bitmap: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Feature__bitmap_template* precondition = new Feature__bitmap_template;
    precondition->set_param(*param.get_elem(0));
    Feature__bitmap_template* implied_template = new Feature__bitmap_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Feature__bitmap_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.Feature_bitmap");
  }
  is_ifpresent = param.get_ifpresent();
}

void Feature__bitmap_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Feature_bitmap");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Feature_bitmap");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Feature_bitmap");
single_value->field_pFC.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Feature_bitmap");
single_value->field_cBL.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Feature_bitmap");
single_value->field_iNR.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Feature_bitmap");
single_value->field_lCS.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Feature_bitmap");
single_value->field_rIM.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Feature_bitmap");
single_value->field_pFC__FC.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Feature_bitmap");
single_value->field_enhancedRadioStatus.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Feature_bitmap");
single_value->field_mBMS.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Feature_bitmap");
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 : "@BSSGP_Types.Feature_bitmap");
}

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

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

Bucket__Full__Ratio::Bucket__Full__Ratio()
{
}

Bucket__Full__Ratio::Bucket__Full__Ratio(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_rate__of__the__Bucket)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_rate__of__the__Bucket(par_rate__of__the__Bucket)
{
}

Bucket__Full__Ratio::Bucket__Full__Ratio(const Bucket__Full__Ratio& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.Bucket_Full_Ratio.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.rate__of__the__Bucket().is_bound()) field_rate__of__the__Bucket = other_value.rate__of__the__Bucket();
else field_rate__of__the__Bucket.clean_up();
}

void Bucket__Full__Ratio::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_rate__of__the__Bucket.clean_up();
}

const TTCN_Typedescriptor_t* Bucket__Full__Ratio::get_descriptor() const { return &Bucket__Full__Ratio_descr_; }
Bucket__Full__Ratio& Bucket__Full__Ratio::operator=(const Bucket__Full__Ratio& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.Bucket_Full_Ratio.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.rate__of__the__Bucket().is_bound()) field_rate__of__the__Bucket = other_value.rate__of__the__Bucket();
  else field_rate__of__the__Bucket.clean_up();
}
return *this;
}

boolean Bucket__Full__Ratio::operator==(const Bucket__Full__Ratio& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_rate__of__the__Bucket==other_value.field_rate__of__the__Bucket;
}

boolean Bucket__Full__Ratio::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_rate__of__the__Bucket.is_bound());
}
boolean Bucket__Full__Ratio::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_rate__of__the__Bucket.is_value();
}
void Bucket__Full__Ratio::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", rate_of_the_Bucket := ");
field_rate__of__the__Bucket.log();
TTCN_Logger::log_event_str(" }");
}

void Bucket__Full__Ratio::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (rate__of__the__Bucket().is_bound()) rate__of__the__Bucket().set_implicit_omit();
}

void Bucket__Full__Ratio::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 @BSSGP_Types.Bucket_Full_Ratio 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rate__of__the__Bucket().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rate_of_the_Bucket")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rate__of__the__Bucket().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 @BSSGP_Types.Bucket_Full_Ratio: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.Bucket_Full_Ratio");
  }
}

void Bucket__Full__Ratio::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_rate__of__the__Bucket.encode_text(text_buf);
}

void Bucket__Full__Ratio::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_rate__of__the__Bucket.decode_text(text_buf);
}

void Bucket__Full__Ratio::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 Bucket__Full__Ratio::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 Bucket__Full__Ratio::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, Bucket__Full__Ratio_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(Bucket__Full__Ratio_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, Bucket__Full__Ratio_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(Bucket__Full__Ratio_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_rate__of__the__Bucket.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_61) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Bucket__Full__Ratio::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Bucket__Full__Ratio_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Bucket__Full__Ratio_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT1_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(Bucket__Full__Ratio_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(Bucket__Full__Ratio_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_rate__of__the__Bucket.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Bucket__Full__Ratio_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Bucket__Full__Ratio_ext_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_iEI !=  os_61) {
  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){
   os_61.RAW_encode(General__Types::OCT1_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 Bucket__Full__Ratio_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_rate__of__the__Bucket;
};

void Bucket__Full__Ratio_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_rate__of__the__Bucket = ANY_VALUE;
}
}
}

void Bucket__Full__Ratio_template::copy_value(const Bucket__Full__Ratio& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.rate__of__the__Bucket().is_bound()) {
  single_value->field_rate__of__the__Bucket = other_value.rate__of__the__Bucket();
} else {
  single_value->field_rate__of__the__Bucket.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Bucket__Full__Ratio_template::copy_template(const Bucket__Full__Ratio_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rate__of__the__Bucket().get_selection()) {
single_value->field_rate__of__the__Bucket = other_value.rate__of__the__Bucket();
} else {
single_value->field_rate__of__the__Bucket.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 Bucket__Full__Ratio_template[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 Bucket__Full__Ratio_template(*other_value.implication_.precondition);
implication_.implied_template = new Bucket__Full__Ratio_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 @BSSGP_Types.Bucket_Full_Ratio.");
break;
}
set_selection(other_value);
}

Bucket__Full__Ratio_template::Bucket__Full__Ratio_template()
{
}

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

Bucket__Full__Ratio_template::Bucket__Full__Ratio_template(const Bucket__Full__Ratio& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean Bucket__Full__Ratio_template::match(const Bucket__Full__Ratio& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.rate__of__the__Bucket().is_bound()) return FALSE;
if(!single_value->field_rate__of__the__Bucket.match(other_value.rate__of__the__Bucket(), 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 @BSSGP_Types.Bucket_Full_Ratio.");
}
return FALSE;
}

boolean Bucket__Full__Ratio_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_rate__of__the__Bucket.is_bound();
}

boolean Bucket__Full__Ratio_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_rate__of__the__Bucket.is_value();
}

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

Bucket__Full__Ratio Bucket__Full__Ratio_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 @BSSGP_Types.Bucket_Full_Ratio.");
Bucket__Full__Ratio ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_rate__of__the__Bucket.is_bound()) {
ret_val.rate__of__the__Bucket() = single_value->field_rate__of__the__Bucket.valueof();
}
return ret_val;
}

void Bucket__Full__Ratio_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 @BSSGP_Types.Bucket_Full_Ratio.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Bucket__Full__Ratio_template[list_length];
}

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

OCTETSTRING_template& Bucket__Full__Ratio_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& Bucket__Full__Ratio_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.Bucket_Full_Ratio.");
return single_value->field_iEI;
}

BITSTRING_template& Bucket__Full__Ratio_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& Bucket__Full__Ratio_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.Bucket_Full_Ratio.");
return single_value->field_ext;
}

LIN2__2a_template& Bucket__Full__Ratio_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& Bucket__Full__Ratio_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.Bucket_Full_Ratio.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& Bucket__Full__Ratio_template::rate__of__the__Bucket()
{
set_specific();
return single_value->field_rate__of__the__Bucket;
}

const OCTETSTRING_template& Bucket__Full__Ratio_template::rate__of__the__Bucket() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rate_of_the_Bucket of a non-specific template of type @BSSGP_Types.Bucket_Full_Ratio.");
return single_value->field_rate__of__the__Bucket;
}

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

void Bucket__Full__Ratio_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", rate_of_the_Bucket := ");
single_value->field_rate__of__the__Bucket.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 Bucket__Full__Ratio_template::log_match(const Bucket__Full__Ratio& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rate__of__the__Bucket.match(match_value.rate__of__the__Bucket(), legacy)){
TTCN_Logger::log_logmatch_info(".rate_of_the_Bucket");
single_value->field_rate__of__the__Bucket.log_match(match_value.rate__of__the__Bucket(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", rate_of_the_Bucket := ");
single_value->field_rate__of__the__Bucket.log_match(match_value.rate__of__the__Bucket(), 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 Bucket__Full__Ratio_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (rate__of__the__Bucket().is_bound()) rate__of__the__Bucket().set_implicit_omit();
}

void Bucket__Full__Ratio_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_rate__of__the__Bucket.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 @BSSGP_Types.Bucket_Full_Ratio.");
}
}

void Bucket__Full__Ratio_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_rate__of__the__Bucket.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 Bucket__Full__Ratio_template[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 @BSSGP_Types.Bucket_Full_Ratio.");
}
}

void Bucket__Full__Ratio_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: {
    Bucket__Full__Ratio_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 @BSSGP_Types.Bucket_Full_Ratio 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rate__of__the__Bucket().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rate_of_the_Bucket")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rate__of__the__Bucket().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 @BSSGP_Types.Bucket_Full_Ratio: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Bucket__Full__Ratio_template* precondition = new Bucket__Full__Ratio_template;
    precondition->set_param(*param.get_elem(0));
    Bucket__Full__Ratio_template* implied_template = new Bucket__Full__Ratio_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Bucket__Full__Ratio_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.Bucket_Full_Ratio");
  }
  is_ifpresent = param.get_ifpresent();
}

void Bucket__Full__Ratio_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Bucket_Full_Ratio");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Bucket_Full_Ratio");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Bucket_Full_Ratio");
single_value->field_rate__of__the__Bucket.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Bucket_Full_Ratio");
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 : "@BSSGP_Types.Bucket_Full_Ratio");
}

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

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

Service__UTRAN__CCO::Service__UTRAN__CCO()
{
}

Service__UTRAN__CCO::Service__UTRAN__CCO(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const BITSTRING& par_service__UTRAN__CCO__Value,
    const BITSTRING& par_service__E__UTRAN__CCO__Value,
    const BITSTRING& par_spare)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_service__UTRAN__CCO__Value(par_service__UTRAN__CCO__Value),
  field_service__E__UTRAN__CCO__Value(par_service__E__UTRAN__CCO__Value),
  field_spare(par_spare)
{
}

Service__UTRAN__CCO::Service__UTRAN__CCO(const Service__UTRAN__CCO& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.Service_UTRAN_CCO.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.service__UTRAN__CCO__Value().is_bound()) field_service__UTRAN__CCO__Value = other_value.service__UTRAN__CCO__Value();
else field_service__UTRAN__CCO__Value.clean_up();
if (other_value.service__E__UTRAN__CCO__Value().is_bound()) field_service__E__UTRAN__CCO__Value = other_value.service__E__UTRAN__CCO__Value();
else field_service__E__UTRAN__CCO__Value.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
}

void Service__UTRAN__CCO::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_service__UTRAN__CCO__Value.clean_up();
field_service__E__UTRAN__CCO__Value.clean_up();
field_spare.clean_up();
}

const TTCN_Typedescriptor_t* Service__UTRAN__CCO::get_descriptor() const { return &Service__UTRAN__CCO_descr_; }
Service__UTRAN__CCO& Service__UTRAN__CCO::operator=(const Service__UTRAN__CCO& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.Service_UTRAN_CCO.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.service__UTRAN__CCO__Value().is_bound()) field_service__UTRAN__CCO__Value = other_value.service__UTRAN__CCO__Value();
  else field_service__UTRAN__CCO__Value.clean_up();
  if (other_value.service__E__UTRAN__CCO__Value().is_bound()) field_service__E__UTRAN__CCO__Value = other_value.service__E__UTRAN__CCO__Value();
  else field_service__E__UTRAN__CCO__Value.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
}
return *this;
}

boolean Service__UTRAN__CCO::operator==(const Service__UTRAN__CCO& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_service__UTRAN__CCO__Value==other_value.field_service__UTRAN__CCO__Value
  && field_service__E__UTRAN__CCO__Value==other_value.field_service__E__UTRAN__CCO__Value
  && field_spare==other_value.field_spare;
}

boolean Service__UTRAN__CCO::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_service__UTRAN__CCO__Value.is_bound())
  || (field_service__E__UTRAN__CCO__Value.is_bound())
  || (field_spare.is_bound());
}
boolean Service__UTRAN__CCO::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_service__UTRAN__CCO__Value.is_value()
  && field_service__E__UTRAN__CCO__Value.is_value()
  && field_spare.is_value();
}
void Service__UTRAN__CCO::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", service_UTRAN_CCO_Value := ");
field_service__UTRAN__CCO__Value.log();
TTCN_Logger::log_event_str(", service_E_UTRAN_CCO_Value := ");
field_service__E__UTRAN__CCO__Value.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(" }");
}

void Service__UTRAN__CCO::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (service__UTRAN__CCO__Value().is_bound()) service__UTRAN__CCO__Value().set_implicit_omit();
if (service__E__UTRAN__CCO__Value().is_bound()) service__E__UTRAN__CCO__Value().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void Service__UTRAN__CCO::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 @BSSGP_Types.Service_UTRAN_CCO 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) service__UTRAN__CCO__Value().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) service__E__UTRAN__CCO__Value().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));
    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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "service_UTRAN_CCO_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          service__UTRAN__CCO__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(), "service_E_UTRAN_CCO_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          service__E__UTRAN__CCO__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(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @BSSGP_Types.Service_UTRAN_CCO: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.Service_UTRAN_CCO");
  }
}

void Service__UTRAN__CCO::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_service__UTRAN__CCO__Value.encode_text(text_buf);
field_service__E__UTRAN__CCO__Value.encode_text(text_buf);
field_spare.encode_text(text_buf);
}

void Service__UTRAN__CCO::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_service__UTRAN__CCO__Value.decode_text(text_buf);
field_service__E__UTRAN__CCO__Value.decode_text(text_buf);
field_spare.decode_text(text_buf);
}

void Service__UTRAN__CCO::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 Service__UTRAN__CCO::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 Service__UTRAN__CCO::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, Service__UTRAN__CCO_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(Service__UTRAN__CCO_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, Service__UTRAN__CCO_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(Service__UTRAN__CCO_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT3_descr_.raw->forceomit);
  decoded_field_length = field_service__UTRAN__CCO__Value.RAW_decode(General__Types::BIT3_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::BIT2_descr_.raw->forceomit);
  decoded_field_length = field_service__E__UTRAN__CCO__Value.RAW_decode(General__Types::BIT2_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::BIT3_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(General__Types::BIT3_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, no_err, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_8) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Service__UTRAN__CCO::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Service__UTRAN__CCO_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Service__UTRAN__CCO_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT3_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::BIT2_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::BIT3_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(Service__UTRAN__CCO_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(Service__UTRAN__CCO_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_service__UTRAN__CCO__Value.RAW_encode(General__Types::BIT3_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_service__E__UTRAN__CCO__Value.RAW_encode(General__Types::BIT2_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_spare.RAW_encode(General__Types::BIT3_descr_, *myleaf.body.node.nodes[5]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 3;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(3);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[4]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[4]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[5]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[5]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Service__UTRAN__CCO_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Service__UTRAN__CCO_ext_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_iEI !=  os_8) {
  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){
   os_8.RAW_encode(General__Types::OCT1_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 Service__UTRAN__CCO_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
BITSTRING_template field_service__UTRAN__CCO__Value;
BITSTRING_template field_service__E__UTRAN__CCO__Value;
BITSTRING_template field_spare;
};

void Service__UTRAN__CCO_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_service__UTRAN__CCO__Value = ANY_VALUE;
single_value->field_service__E__UTRAN__CCO__Value = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
}
}
}

void Service__UTRAN__CCO_template::copy_value(const Service__UTRAN__CCO& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.service__UTRAN__CCO__Value().is_bound()) {
  single_value->field_service__UTRAN__CCO__Value = other_value.service__UTRAN__CCO__Value();
} else {
  single_value->field_service__UTRAN__CCO__Value.clean_up();
}
if (other_value.service__E__UTRAN__CCO__Value().is_bound()) {
  single_value->field_service__E__UTRAN__CCO__Value = other_value.service__E__UTRAN__CCO__Value();
} else {
  single_value->field_service__E__UTRAN__CCO__Value.clean_up();
}
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Service__UTRAN__CCO_template::copy_template(const Service__UTRAN__CCO_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.service__UTRAN__CCO__Value().get_selection()) {
single_value->field_service__UTRAN__CCO__Value = other_value.service__UTRAN__CCO__Value();
} else {
single_value->field_service__UTRAN__CCO__Value.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.service__E__UTRAN__CCO__Value().get_selection()) {
single_value->field_service__E__UTRAN__CCO__Value = other_value.service__E__UTRAN__CCO__Value();
} else {
single_value->field_service__E__UTRAN__CCO__Value.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new Service__UTRAN__CCO_template[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 Service__UTRAN__CCO_template(*other_value.implication_.precondition);
implication_.implied_template = new Service__UTRAN__CCO_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 @BSSGP_Types.Service_UTRAN_CCO.");
break;
}
set_selection(other_value);
}

Service__UTRAN__CCO_template::Service__UTRAN__CCO_template()
{
}

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

Service__UTRAN__CCO_template::Service__UTRAN__CCO_template(const Service__UTRAN__CCO& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean Service__UTRAN__CCO_template::match(const Service__UTRAN__CCO& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.service__UTRAN__CCO__Value().is_bound()) return FALSE;
if(!single_value->field_service__UTRAN__CCO__Value.match(other_value.service__UTRAN__CCO__Value(), legacy))return FALSE;
if(!other_value.service__E__UTRAN__CCO__Value().is_bound()) return FALSE;
if(!single_value->field_service__E__UTRAN__CCO__Value.match(other_value.service__E__UTRAN__CCO__Value(), legacy))return FALSE;
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @BSSGP_Types.Service_UTRAN_CCO.");
}
return FALSE;
}

boolean Service__UTRAN__CCO_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_service__UTRAN__CCO__Value.is_bound()
 || single_value->field_service__E__UTRAN__CCO__Value.is_bound()
 || single_value->field_spare.is_bound();
}

boolean Service__UTRAN__CCO_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_service__UTRAN__CCO__Value.is_value()
 && single_value->field_service__E__UTRAN__CCO__Value.is_value()
 && single_value->field_spare.is_value();
}

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

Service__UTRAN__CCO Service__UTRAN__CCO_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 @BSSGP_Types.Service_UTRAN_CCO.");
Service__UTRAN__CCO ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_service__UTRAN__CCO__Value.is_bound()) {
ret_val.service__UTRAN__CCO__Value() = single_value->field_service__UTRAN__CCO__Value.valueof();
}
if (single_value->field_service__E__UTRAN__CCO__Value.is_bound()) {
ret_val.service__E__UTRAN__CCO__Value() = single_value->field_service__E__UTRAN__CCO__Value.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
return ret_val;
}

void Service__UTRAN__CCO_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 @BSSGP_Types.Service_UTRAN_CCO.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Service__UTRAN__CCO_template[list_length];
}

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

OCTETSTRING_template& Service__UTRAN__CCO_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& Service__UTRAN__CCO_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.Service_UTRAN_CCO.");
return single_value->field_iEI;
}

BITSTRING_template& Service__UTRAN__CCO_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& Service__UTRAN__CCO_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.Service_UTRAN_CCO.");
return single_value->field_ext;
}

LIN2__2a_template& Service__UTRAN__CCO_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& Service__UTRAN__CCO_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.Service_UTRAN_CCO.");
return single_value->field_lengthIndicator;
}

BITSTRING_template& Service__UTRAN__CCO_template::service__UTRAN__CCO__Value()
{
set_specific();
return single_value->field_service__UTRAN__CCO__Value;
}

const BITSTRING_template& Service__UTRAN__CCO_template::service__UTRAN__CCO__Value() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field service_UTRAN_CCO_Value of a non-specific template of type @BSSGP_Types.Service_UTRAN_CCO.");
return single_value->field_service__UTRAN__CCO__Value;
}

BITSTRING_template& Service__UTRAN__CCO_template::service__E__UTRAN__CCO__Value()
{
set_specific();
return single_value->field_service__E__UTRAN__CCO__Value;
}

const BITSTRING_template& Service__UTRAN__CCO_template::service__E__UTRAN__CCO__Value() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field service_E_UTRAN_CCO_Value of a non-specific template of type @BSSGP_Types.Service_UTRAN_CCO.");
return single_value->field_service__E__UTRAN__CCO__Value;
}

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

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

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

void Service__UTRAN__CCO_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", service_UTRAN_CCO_Value := ");
single_value->field_service__UTRAN__CCO__Value.log();
TTCN_Logger::log_event_str(", service_E_UTRAN_CCO_Value := ");
single_value->field_service__E__UTRAN__CCO__Value.log();
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void Service__UTRAN__CCO_template::log_match(const Service__UTRAN__CCO& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_service__UTRAN__CCO__Value.match(match_value.service__UTRAN__CCO__Value(), legacy)){
TTCN_Logger::log_logmatch_info(".service_UTRAN_CCO_Value");
single_value->field_service__UTRAN__CCO__Value.log_match(match_value.service__UTRAN__CCO__Value(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_service__E__UTRAN__CCO__Value.match(match_value.service__E__UTRAN__CCO__Value(), legacy)){
TTCN_Logger::log_logmatch_info(".service_E_UTRAN_CCO_Value");
single_value->field_service__E__UTRAN__CCO__Value.log_match(match_value.service__E__UTRAN__CCO__Value(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", service_UTRAN_CCO_Value := ");
single_value->field_service__UTRAN__CCO__Value.log_match(match_value.service__UTRAN__CCO__Value(), legacy);
TTCN_Logger::log_event_str(", service_E_UTRAN_CCO_Value := ");
single_value->field_service__E__UTRAN__CCO__Value.log_match(match_value.service__E__UTRAN__CCO__Value(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void Service__UTRAN__CCO_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (service__UTRAN__CCO__Value().is_bound()) service__UTRAN__CCO__Value().set_implicit_omit();
if (service__E__UTRAN__CCO__Value().is_bound()) service__E__UTRAN__CCO__Value().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

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

void Service__UTRAN__CCO_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_service__UTRAN__CCO__Value.decode_text(text_buf);
single_value->field_service__E__UTRAN__CCO__Value.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new Service__UTRAN__CCO_template[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 @BSSGP_Types.Service_UTRAN_CCO.");
}
}

void Service__UTRAN__CCO_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: {
    Service__UTRAN__CCO_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 @BSSGP_Types.Service_UTRAN_CCO 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) service__UTRAN__CCO__Value().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) service__E__UTRAN__CCO__Value().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));
    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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "service_UTRAN_CCO_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          service__UTRAN__CCO__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(), "service_E_UTRAN_CCO_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          service__E__UTRAN__CCO__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(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @BSSGP_Types.Service_UTRAN_CCO: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Service__UTRAN__CCO_template* precondition = new Service__UTRAN__CCO_template;
    precondition->set_param(*param.get_elem(0));
    Service__UTRAN__CCO_template* implied_template = new Service__UTRAN__CCO_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Service__UTRAN__CCO_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.Service_UTRAN_CCO");
  }
  is_ifpresent = param.get_ifpresent();
}

void Service__UTRAN__CCO_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Service_UTRAN_CCO");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Service_UTRAN_CCO");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Service_UTRAN_CCO");
single_value->field_service__UTRAN__CCO__Value.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Service_UTRAN_CCO");
single_value->field_service__E__UTRAN__CCO__Value.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Service_UTRAN_CCO");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Service_UTRAN_CCO");
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 : "@BSSGP_Types.Service_UTRAN_CCO");
}

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

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

Service__Class__Indicator::Service__Class__Indicator()
{
}

Service__Class__Indicator::Service__Class__Indicator(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_serviceClassIndicator)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_serviceClassIndicator(par_serviceClassIndicator)
{
}

Service__Class__Indicator::Service__Class__Indicator(const Service__Class__Indicator& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.Service_Class_Indicator.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.serviceClassIndicator().is_bound()) field_serviceClassIndicator = other_value.serviceClassIndicator();
else field_serviceClassIndicator.clean_up();
}

void Service__Class__Indicator::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_serviceClassIndicator.clean_up();
}

const TTCN_Typedescriptor_t* Service__Class__Indicator::get_descriptor() const { return &Service__Class__Indicator_descr_; }
Service__Class__Indicator& Service__Class__Indicator::operator=(const Service__Class__Indicator& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.Service_Class_Indicator.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.serviceClassIndicator().is_bound()) field_serviceClassIndicator = other_value.serviceClassIndicator();
  else field_serviceClassIndicator.clean_up();
}
return *this;
}

boolean Service__Class__Indicator::operator==(const Service__Class__Indicator& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_serviceClassIndicator==other_value.field_serviceClassIndicator;
}

boolean Service__Class__Indicator::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_serviceClassIndicator.is_bound());
}
boolean Service__Class__Indicator::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_serviceClassIndicator.is_value();
}
void Service__Class__Indicator::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", serviceClassIndicator := ");
field_serviceClassIndicator.log();
TTCN_Logger::log_event_str(" }");
}

void Service__Class__Indicator::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (serviceClassIndicator().is_bound()) serviceClassIndicator().set_implicit_omit();
}

void Service__Class__Indicator::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 @BSSGP_Types.Service_Class_Indicator 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) serviceClassIndicator().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "serviceClassIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          serviceClassIndicator().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 @BSSGP_Types.Service_Class_Indicator: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.Service_Class_Indicator");
  }
}

void Service__Class__Indicator::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_serviceClassIndicator.encode_text(text_buf);
}

void Service__Class__Indicator::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_serviceClassIndicator.decode_text(text_buf);
}

void Service__Class__Indicator::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 Service__Class__Indicator::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 Service__Class__Indicator::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, Service__Class__Indicator_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(Service__Class__Indicator_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, Service__Class__Indicator_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(Service__Class__Indicator_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_serviceClassIndicator.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_9) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Service__Class__Indicator::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Service__Class__Indicator_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Service__Class__Indicator_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT1_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(Service__Class__Indicator_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(Service__Class__Indicator_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_serviceClassIndicator.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Service__Class__Indicator_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Service__Class__Indicator_ext_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_iEI !=  os_9) {
  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){
   os_9.RAW_encode(General__Types::OCT1_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 Service__Class__Indicator_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_serviceClassIndicator;
};

void Service__Class__Indicator_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_serviceClassIndicator = ANY_VALUE;
}
}
}

void Service__Class__Indicator_template::copy_value(const Service__Class__Indicator& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.serviceClassIndicator().is_bound()) {
  single_value->field_serviceClassIndicator = other_value.serviceClassIndicator();
} else {
  single_value->field_serviceClassIndicator.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Service__Class__Indicator_template::copy_template(const Service__Class__Indicator_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.serviceClassIndicator().get_selection()) {
single_value->field_serviceClassIndicator = other_value.serviceClassIndicator();
} else {
single_value->field_serviceClassIndicator.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 Service__Class__Indicator_template[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 Service__Class__Indicator_template(*other_value.implication_.precondition);
implication_.implied_template = new Service__Class__Indicator_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 @BSSGP_Types.Service_Class_Indicator.");
break;
}
set_selection(other_value);
}

Service__Class__Indicator_template::Service__Class__Indicator_template()
{
}

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

Service__Class__Indicator_template::Service__Class__Indicator_template(const Service__Class__Indicator& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean Service__Class__Indicator_template::match(const Service__Class__Indicator& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.serviceClassIndicator().is_bound()) return FALSE;
if(!single_value->field_serviceClassIndicator.match(other_value.serviceClassIndicator(), 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 @BSSGP_Types.Service_Class_Indicator.");
}
return FALSE;
}

boolean Service__Class__Indicator_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_serviceClassIndicator.is_bound();
}

boolean Service__Class__Indicator_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_serviceClassIndicator.is_value();
}

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

Service__Class__Indicator Service__Class__Indicator_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 @BSSGP_Types.Service_Class_Indicator.");
Service__Class__Indicator ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_serviceClassIndicator.is_bound()) {
ret_val.serviceClassIndicator() = single_value->field_serviceClassIndicator.valueof();
}
return ret_val;
}

void Service__Class__Indicator_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 @BSSGP_Types.Service_Class_Indicator.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Service__Class__Indicator_template[list_length];
}

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

OCTETSTRING_template& Service__Class__Indicator_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& Service__Class__Indicator_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.Service_Class_Indicator.");
return single_value->field_iEI;
}

BITSTRING_template& Service__Class__Indicator_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& Service__Class__Indicator_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.Service_Class_Indicator.");
return single_value->field_ext;
}

LIN2__2a_template& Service__Class__Indicator_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& Service__Class__Indicator_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.Service_Class_Indicator.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& Service__Class__Indicator_template::serviceClassIndicator()
{
set_specific();
return single_value->field_serviceClassIndicator;
}

const OCTETSTRING_template& Service__Class__Indicator_template::serviceClassIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field serviceClassIndicator of a non-specific template of type @BSSGP_Types.Service_Class_Indicator.");
return single_value->field_serviceClassIndicator;
}

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

void Service__Class__Indicator_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", serviceClassIndicator := ");
single_value->field_serviceClassIndicator.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 Service__Class__Indicator_template::log_match(const Service__Class__Indicator& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_serviceClassIndicator.match(match_value.serviceClassIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".serviceClassIndicator");
single_value->field_serviceClassIndicator.log_match(match_value.serviceClassIndicator(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", serviceClassIndicator := ");
single_value->field_serviceClassIndicator.log_match(match_value.serviceClassIndicator(), 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 Service__Class__Indicator_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (serviceClassIndicator().is_bound()) serviceClassIndicator().set_implicit_omit();
}

void Service__Class__Indicator_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_serviceClassIndicator.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 @BSSGP_Types.Service_Class_Indicator.");
}
}

void Service__Class__Indicator_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_serviceClassIndicator.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 Service__Class__Indicator_template[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 @BSSGP_Types.Service_Class_Indicator.");
}
}

void Service__Class__Indicator_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: {
    Service__Class__Indicator_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 @BSSGP_Types.Service_Class_Indicator 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) serviceClassIndicator().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "serviceClassIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          serviceClassIndicator().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 @BSSGP_Types.Service_Class_Indicator: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Service__Class__Indicator_template* precondition = new Service__Class__Indicator_template;
    precondition->set_param(*param.get_elem(0));
    Service__Class__Indicator_template* implied_template = new Service__Class__Indicator_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Service__Class__Indicator_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.Service_Class_Indicator");
  }
  is_ifpresent = param.get_ifpresent();
}

void Service__Class__Indicator_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Service_Class_Indicator");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Service_Class_Indicator");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Service_Class_Indicator");
single_value->field_serviceClassIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Service_Class_Indicator");
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 : "@BSSGP_Types.Service_Class_Indicator");
}

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

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

NSEI__BSSGP::NSEI__BSSGP()
{
}

NSEI__BSSGP::NSEI__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_nSEI)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_nSEI(par_nSEI)
{
}

NSEI__BSSGP::NSEI__BSSGP(const NSEI__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.NSEI_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.nSEI().is_bound()) field_nSEI = other_value.nSEI();
else field_nSEI.clean_up();
}

void NSEI__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_nSEI.clean_up();
}

const TTCN_Typedescriptor_t* NSEI__BSSGP::get_descriptor() const { return &NSEI__BSSGP_descr_; }
NSEI__BSSGP& NSEI__BSSGP::operator=(const NSEI__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.NSEI_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.nSEI().is_bound()) field_nSEI = other_value.nSEI();
  else field_nSEI.clean_up();
}
return *this;
}

boolean NSEI__BSSGP::operator==(const NSEI__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_nSEI==other_value.field_nSEI;
}

boolean NSEI__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_nSEI.is_bound());
}
boolean NSEI__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_nSEI.is_value();
}
void NSEI__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", nSEI := ");
field_nSEI.log();
TTCN_Logger::log_event_str(" }");
}

void NSEI__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (nSEI().is_bound()) nSEI().set_implicit_omit();
}

void NSEI__BSSGP::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 @BSSGP_Types.NSEI_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) nSEI().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nSEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nSEI().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 @BSSGP_Types.NSEI_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.NSEI_BSSGP");
  }
}

void NSEI__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_nSEI.encode_text(text_buf);
}

void NSEI__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_nSEI.decode_text(text_buf);
}

void NSEI__BSSGP::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 NSEI__BSSGP::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 NSEI__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, NSEI__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(NSEI__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, NSEI__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(NSEI__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT2_descr_.raw->forceomit);
  decoded_field_length = field_nSEI.RAW_decode(General__Types::OCT2_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_54) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int NSEI__BSSGP::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NSEI__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, NSEI__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT2_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(NSEI__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(NSEI__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_nSEI.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(NSEI__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(NSEI__BSSGP_ext_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_iEI !=  os_54) {
  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){
   os_54.RAW_encode(General__Types::OCT1_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 NSEI__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_nSEI;
};

void NSEI__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_nSEI = ANY_VALUE;
}
}
}

void NSEI__BSSGP_template::copy_value(const NSEI__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.nSEI().is_bound()) {
  single_value->field_nSEI = other_value.nSEI();
} else {
  single_value->field_nSEI.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void NSEI__BSSGP_template::copy_template(const NSEI__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nSEI().get_selection()) {
single_value->field_nSEI = other_value.nSEI();
} else {
single_value->field_nSEI.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 NSEI__BSSGP_template[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 NSEI__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new NSEI__BSSGP_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 @BSSGP_Types.NSEI_BSSGP.");
break;
}
set_selection(other_value);
}

NSEI__BSSGP_template::NSEI__BSSGP_template()
{
}

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

NSEI__BSSGP_template::NSEI__BSSGP_template(const NSEI__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean NSEI__BSSGP_template::match(const NSEI__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.nSEI().is_bound()) return FALSE;
if(!single_value->field_nSEI.match(other_value.nSEI(), 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 @BSSGP_Types.NSEI_BSSGP.");
}
return FALSE;
}

boolean NSEI__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_nSEI.is_bound();
}

boolean NSEI__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_nSEI.is_value();
}

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

NSEI__BSSGP NSEI__BSSGP_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 @BSSGP_Types.NSEI_BSSGP.");
NSEI__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_nSEI.is_bound()) {
ret_val.nSEI() = single_value->field_nSEI.valueof();
}
return ret_val;
}

void NSEI__BSSGP_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 @BSSGP_Types.NSEI_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new NSEI__BSSGP_template[list_length];
}

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

OCTETSTRING_template& NSEI__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& NSEI__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.NSEI_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& NSEI__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& NSEI__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.NSEI_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& NSEI__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& NSEI__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.NSEI_BSSGP.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& NSEI__BSSGP_template::nSEI()
{
set_specific();
return single_value->field_nSEI;
}

const OCTETSTRING_template& NSEI__BSSGP_template::nSEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nSEI of a non-specific template of type @BSSGP_Types.NSEI_BSSGP.");
return single_value->field_nSEI;
}

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

void NSEI__BSSGP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", nSEI := ");
single_value->field_nSEI.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 NSEI__BSSGP_template::log_match(const NSEI__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_nSEI.match(match_value.nSEI(), legacy)){
TTCN_Logger::log_logmatch_info(".nSEI");
single_value->field_nSEI.log_match(match_value.nSEI(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", nSEI := ");
single_value->field_nSEI.log_match(match_value.nSEI(), 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 NSEI__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (nSEI().is_bound()) nSEI().set_implicit_omit();
}

void NSEI__BSSGP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_nSEI.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 @BSSGP_Types.NSEI_BSSGP.");
}
}

void NSEI__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_nSEI.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 NSEI__BSSGP_template[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 @BSSGP_Types.NSEI_BSSGP.");
}
}

void NSEI__BSSGP_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: {
    NSEI__BSSGP_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 @BSSGP_Types.NSEI_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) nSEI().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nSEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nSEI().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 @BSSGP_Types.NSEI_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    NSEI__BSSGP_template* precondition = new NSEI__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    NSEI__BSSGP_template* implied_template = new NSEI__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = NSEI__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.NSEI_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void NSEI__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.NSEI_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.NSEI_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.NSEI_BSSGP");
single_value->field_nSEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.NSEI_BSSGP");
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 : "@BSSGP_Types.NSEI_BSSGP");
}

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

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

RRLP__APDU__BSSGP::RRLP__APDU__BSSGP()
{
}

RRLP__APDU__BSSGP::RRLP__APDU__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_rRLP__Message)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_rRLP__Message(par_rRLP__Message)
{
}

RRLP__APDU__BSSGP::RRLP__APDU__BSSGP(const RRLP__APDU__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.RRLP_APDU_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.rRLP__Message().is_bound()) field_rRLP__Message = other_value.rRLP__Message();
else field_rRLP__Message.clean_up();
}

void RRLP__APDU__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_rRLP__Message.clean_up();
}

const TTCN_Typedescriptor_t* RRLP__APDU__BSSGP::get_descriptor() const { return &RRLP__APDU__BSSGP_descr_; }
RRLP__APDU__BSSGP& RRLP__APDU__BSSGP::operator=(const RRLP__APDU__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.RRLP_APDU_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.rRLP__Message().is_bound()) field_rRLP__Message = other_value.rRLP__Message();
  else field_rRLP__Message.clean_up();
}
return *this;
}

boolean RRLP__APDU__BSSGP::operator==(const RRLP__APDU__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_rRLP__Message==other_value.field_rRLP__Message;
}

boolean RRLP__APDU__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_rRLP__Message.is_bound());
}
boolean RRLP__APDU__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_rRLP__Message.is_value();
}
void RRLP__APDU__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", rRLP_Message := ");
field_rRLP__Message.log();
TTCN_Logger::log_event_str(" }");
}

void RRLP__APDU__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (rRLP__Message().is_bound()) rRLP__Message().set_implicit_omit();
}

void RRLP__APDU__BSSGP::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 @BSSGP_Types.RRLP_APDU_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rRLP__Message().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rRLP_Message")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rRLP__Message().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 @BSSGP_Types.RRLP_APDU_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.RRLP_APDU_BSSGP");
  }
}

void RRLP__APDU__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_rRLP__Message.encode_text(text_buf);
}

void RRLP__APDU__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_rRLP__Message.decode_text(text_buf);
}

void RRLP__APDU__BSSGP::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 RRLP__APDU__BSSGP::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 RRLP__APDU__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, RRLP__APDU__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(RRLP__APDU__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, RRLP__APDU__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(RRLP__APDU__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, OCTETSTRING_descr_.raw->forceomit);
  decoded_field_length = field_rRLP__Message.RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_131) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int RRLP__APDU__BSSGP::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RRLP__APDU__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, RRLP__APDU__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, OCTETSTRING_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(RRLP__APDU__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(RRLP__APDU__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_rRLP__Message.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(RRLP__APDU__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(RRLP__APDU__BSSGP_ext_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_iEI !=  os_131) {
  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){
   os_131.RAW_encode(General__Types::OCT1_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 RRLP__APDU__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_rRLP__Message;
};

void RRLP__APDU__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_rRLP__Message = ANY_VALUE;
}
}
}

void RRLP__APDU__BSSGP_template::copy_value(const RRLP__APDU__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.rRLP__Message().is_bound()) {
  single_value->field_rRLP__Message = other_value.rRLP__Message();
} else {
  single_value->field_rRLP__Message.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RRLP__APDU__BSSGP_template::copy_template(const RRLP__APDU__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rRLP__Message().get_selection()) {
single_value->field_rRLP__Message = other_value.rRLP__Message();
} else {
single_value->field_rRLP__Message.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 RRLP__APDU__BSSGP_template[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 RRLP__APDU__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new RRLP__APDU__BSSGP_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 @BSSGP_Types.RRLP_APDU_BSSGP.");
break;
}
set_selection(other_value);
}

RRLP__APDU__BSSGP_template::RRLP__APDU__BSSGP_template()
{
}

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

RRLP__APDU__BSSGP_template::RRLP__APDU__BSSGP_template(const RRLP__APDU__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean RRLP__APDU__BSSGP_template::match(const RRLP__APDU__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.rRLP__Message().is_bound()) return FALSE;
if(!single_value->field_rRLP__Message.match(other_value.rRLP__Message(), 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 @BSSGP_Types.RRLP_APDU_BSSGP.");
}
return FALSE;
}

boolean RRLP__APDU__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_rRLP__Message.is_bound();
}

boolean RRLP__APDU__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_rRLP__Message.is_value();
}

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

RRLP__APDU__BSSGP RRLP__APDU__BSSGP_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 @BSSGP_Types.RRLP_APDU_BSSGP.");
RRLP__APDU__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_rRLP__Message.is_bound()) {
ret_val.rRLP__Message() = single_value->field_rRLP__Message.valueof();
}
return ret_val;
}

void RRLP__APDU__BSSGP_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 @BSSGP_Types.RRLP_APDU_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RRLP__APDU__BSSGP_template[list_length];
}

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

OCTETSTRING_template& RRLP__APDU__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& RRLP__APDU__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.RRLP_APDU_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& RRLP__APDU__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& RRLP__APDU__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.RRLP_APDU_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& RRLP__APDU__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& RRLP__APDU__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.RRLP_APDU_BSSGP.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& RRLP__APDU__BSSGP_template::rRLP__Message()
{
set_specific();
return single_value->field_rRLP__Message;
}

const OCTETSTRING_template& RRLP__APDU__BSSGP_template::rRLP__Message() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rRLP_Message of a non-specific template of type @BSSGP_Types.RRLP_APDU_BSSGP.");
return single_value->field_rRLP__Message;
}

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

void RRLP__APDU__BSSGP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", rRLP_Message := ");
single_value->field_rRLP__Message.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 RRLP__APDU__BSSGP_template::log_match(const RRLP__APDU__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rRLP__Message.match(match_value.rRLP__Message(), legacy)){
TTCN_Logger::log_logmatch_info(".rRLP_Message");
single_value->field_rRLP__Message.log_match(match_value.rRLP__Message(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", rRLP_Message := ");
single_value->field_rRLP__Message.log_match(match_value.rRLP__Message(), 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 RRLP__APDU__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (rRLP__Message().is_bound()) rRLP__Message().set_implicit_omit();
}

void RRLP__APDU__BSSGP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_rRLP__Message.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 @BSSGP_Types.RRLP_APDU_BSSGP.");
}
}

void RRLP__APDU__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_rRLP__Message.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 RRLP__APDU__BSSGP_template[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 @BSSGP_Types.RRLP_APDU_BSSGP.");
}
}

void RRLP__APDU__BSSGP_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: {
    RRLP__APDU__BSSGP_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 @BSSGP_Types.RRLP_APDU_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rRLP__Message().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rRLP_Message")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rRLP__Message().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 @BSSGP_Types.RRLP_APDU_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    RRLP__APDU__BSSGP_template* precondition = new RRLP__APDU__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    RRLP__APDU__BSSGP_template* implied_template = new RRLP__APDU__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = RRLP__APDU__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.RRLP_APDU_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void RRLP__APDU__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RRLP_APDU_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RRLP_APDU_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RRLP_APDU_BSSGP");
single_value->field_rRLP__Message.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RRLP_APDU_BSSGP");
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 : "@BSSGP_Types.RRLP_APDU_BSSGP");
}

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

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

LCS__QoS__BSSGP::LCS__QoS__BSSGP()
{
}

LCS__QoS__BSSGP::LCS__QoS__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const BITSTRING& par_vert,
    const BITSTRING& par_vel,
    const BITSTRING& par_spare1,
    const BITSTRING& par_horizontal__Accuracy,
    const BITSTRING& par_hA__Indicator,
    const BITSTRING& par_vertical__Accuracy,
    const BITSTRING& par_vA__Indicator,
    const BITSTRING& par_spare2,
    const BITSTRING& par_response__Time__Category)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_vert(par_vert),
  field_vel(par_vel),
  field_spare1(par_spare1),
  field_horizontal__Accuracy(par_horizontal__Accuracy),
  field_hA__Indicator(par_hA__Indicator),
  field_vertical__Accuracy(par_vertical__Accuracy),
  field_vA__Indicator(par_vA__Indicator),
  field_spare2(par_spare2),
  field_response__Time__Category(par_response__Time__Category)
{
}

LCS__QoS__BSSGP::LCS__QoS__BSSGP(const LCS__QoS__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.LCS_QoS_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.vert().is_bound()) field_vert = other_value.vert();
else field_vert.clean_up();
if (other_value.vel().is_bound()) field_vel = other_value.vel();
else field_vel.clean_up();
if (other_value.spare1().is_bound()) field_spare1 = other_value.spare1();
else field_spare1.clean_up();
if (other_value.horizontal__Accuracy().is_bound()) field_horizontal__Accuracy = other_value.horizontal__Accuracy();
else field_horizontal__Accuracy.clean_up();
if (other_value.hA__Indicator().is_bound()) field_hA__Indicator = other_value.hA__Indicator();
else field_hA__Indicator.clean_up();
if (other_value.vertical__Accuracy().is_bound()) field_vertical__Accuracy = other_value.vertical__Accuracy();
else field_vertical__Accuracy.clean_up();
if (other_value.vA__Indicator().is_bound()) field_vA__Indicator = other_value.vA__Indicator();
else field_vA__Indicator.clean_up();
if (other_value.spare2().is_bound()) field_spare2 = other_value.spare2();
else field_spare2.clean_up();
if (other_value.response__Time__Category().is_bound()) field_response__Time__Category = other_value.response__Time__Category();
else field_response__Time__Category.clean_up();
}

void LCS__QoS__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_vert.clean_up();
field_vel.clean_up();
field_spare1.clean_up();
field_horizontal__Accuracy.clean_up();
field_hA__Indicator.clean_up();
field_vertical__Accuracy.clean_up();
field_vA__Indicator.clean_up();
field_spare2.clean_up();
field_response__Time__Category.clean_up();
}

const TTCN_Typedescriptor_t* LCS__QoS__BSSGP::get_descriptor() const { return &LCS__QoS__BSSGP_descr_; }
LCS__QoS__BSSGP& LCS__QoS__BSSGP::operator=(const LCS__QoS__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.LCS_QoS_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.vert().is_bound()) field_vert = other_value.vert();
  else field_vert.clean_up();
  if (other_value.vel().is_bound()) field_vel = other_value.vel();
  else field_vel.clean_up();
  if (other_value.spare1().is_bound()) field_spare1 = other_value.spare1();
  else field_spare1.clean_up();
  if (other_value.horizontal__Accuracy().is_bound()) field_horizontal__Accuracy = other_value.horizontal__Accuracy();
  else field_horizontal__Accuracy.clean_up();
  if (other_value.hA__Indicator().is_bound()) field_hA__Indicator = other_value.hA__Indicator();
  else field_hA__Indicator.clean_up();
  if (other_value.vertical__Accuracy().is_bound()) field_vertical__Accuracy = other_value.vertical__Accuracy();
  else field_vertical__Accuracy.clean_up();
  if (other_value.vA__Indicator().is_bound()) field_vA__Indicator = other_value.vA__Indicator();
  else field_vA__Indicator.clean_up();
  if (other_value.spare2().is_bound()) field_spare2 = other_value.spare2();
  else field_spare2.clean_up();
  if (other_value.response__Time__Category().is_bound()) field_response__Time__Category = other_value.response__Time__Category();
  else field_response__Time__Category.clean_up();
}
return *this;
}

boolean LCS__QoS__BSSGP::operator==(const LCS__QoS__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_vert==other_value.field_vert
  && field_vel==other_value.field_vel
  && field_spare1==other_value.field_spare1
  && field_horizontal__Accuracy==other_value.field_horizontal__Accuracy
  && field_hA__Indicator==other_value.field_hA__Indicator
  && field_vertical__Accuracy==other_value.field_vertical__Accuracy
  && field_vA__Indicator==other_value.field_vA__Indicator
  && field_spare2==other_value.field_spare2
  && field_response__Time__Category==other_value.field_response__Time__Category;
}

boolean LCS__QoS__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_vert.is_bound())
  || (field_vel.is_bound())
  || (field_spare1.is_bound())
  || (field_horizontal__Accuracy.is_bound())
  || (field_hA__Indicator.is_bound())
  || (field_vertical__Accuracy.is_bound())
  || (field_vA__Indicator.is_bound())
  || (field_spare2.is_bound())
  || (field_response__Time__Category.is_bound());
}
boolean LCS__QoS__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_vert.is_value()
  && field_vel.is_value()
  && field_spare1.is_value()
  && field_horizontal__Accuracy.is_value()
  && field_hA__Indicator.is_value()
  && field_vertical__Accuracy.is_value()
  && field_vA__Indicator.is_value()
  && field_spare2.is_value()
  && field_response__Time__Category.is_value();
}
void LCS__QoS__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", vert := ");
field_vert.log();
TTCN_Logger::log_event_str(", vel := ");
field_vel.log();
TTCN_Logger::log_event_str(", spare1 := ");
field_spare1.log();
TTCN_Logger::log_event_str(", horizontal_Accuracy := ");
field_horizontal__Accuracy.log();
TTCN_Logger::log_event_str(", hA_Indicator := ");
field_hA__Indicator.log();
TTCN_Logger::log_event_str(", vertical_Accuracy := ");
field_vertical__Accuracy.log();
TTCN_Logger::log_event_str(", vA_Indicator := ");
field_vA__Indicator.log();
TTCN_Logger::log_event_str(", spare2 := ");
field_spare2.log();
TTCN_Logger::log_event_str(", response_Time_Category := ");
field_response__Time__Category.log();
TTCN_Logger::log_event_str(" }");
}

void LCS__QoS__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (vert().is_bound()) vert().set_implicit_omit();
if (vel().is_bound()) vel().set_implicit_omit();
if (spare1().is_bound()) spare1().set_implicit_omit();
if (horizontal__Accuracy().is_bound()) horizontal__Accuracy().set_implicit_omit();
if (hA__Indicator().is_bound()) hA__Indicator().set_implicit_omit();
if (vertical__Accuracy().is_bound()) vertical__Accuracy().set_implicit_omit();
if (vA__Indicator().is_bound()) vA__Indicator().set_implicit_omit();
if (spare2().is_bound()) spare2().set_implicit_omit();
if (response__Time__Category().is_bound()) response__Time__Category().set_implicit_omit();
}

void LCS__QoS__BSSGP::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 (12<param.get_size()) {
      param.error("record value of type @BSSGP_Types.LCS_QoS_BSSGP has 12 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) vert().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) vel().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) spare1().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) horizontal__Accuracy().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) hA__Indicator().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) vertical__Accuracy().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) vA__Indicator().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) spare2().set_param(*param.get_elem(10));
    if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) response__Time__Category().set_param(*param.get_elem(11));
    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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "vert")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          vert().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "vel")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          vel().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare1().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "horizontal_Accuracy")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          horizontal__Accuracy().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "hA_Indicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          hA__Indicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "vertical_Accuracy")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          vertical__Accuracy().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "vA_Indicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          vA__Indicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare2().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "response_Time_Category")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          response__Time__Category().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 @BSSGP_Types.LCS_QoS_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.LCS_QoS_BSSGP");
  }
}

void LCS__QoS__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_vert.encode_text(text_buf);
field_vel.encode_text(text_buf);
field_spare1.encode_text(text_buf);
field_horizontal__Accuracy.encode_text(text_buf);
field_hA__Indicator.encode_text(text_buf);
field_vertical__Accuracy.encode_text(text_buf);
field_vA__Indicator.encode_text(text_buf);
field_spare2.encode_text(text_buf);
field_response__Time__Category.encode_text(text_buf);
}

void LCS__QoS__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_vert.decode_text(text_buf);
field_vel.decode_text(text_buf);
field_spare1.decode_text(text_buf);
field_horizontal__Accuracy.decode_text(text_buf);
field_hA__Indicator.decode_text(text_buf);
field_vertical__Accuracy.decode_text(text_buf);
field_vA__Indicator.decode_text(text_buf);
field_spare2.decode_text(text_buf);
field_response__Time__Category.decode_text(text_buf);
}

void LCS__QoS__BSSGP::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 LCS__QoS__BSSGP::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 LCS__QoS__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, LCS__QoS__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(LCS__QoS__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, LCS__QoS__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(LCS__QoS__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_vert.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_vel.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::BIT6_descr_.raw->forceomit);
  decoded_field_length = field_spare1.RAW_decode(General__Types::BIT6_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, no_err, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_6_force_omit(6, force_omit, General__Types::BIT7_descr_.raw->forceomit);
  decoded_field_length = field_horizontal__Accuracy.RAW_decode(General__Types::BIT7_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_7_force_omit(7, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_hA__Indicator.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, no_err, -1, TRUE, &field_7_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_8_force_omit(8, force_omit, General__Types::BIT7_descr_.raw->forceomit);
  decoded_field_length = field_vertical__Accuracy.RAW_decode(General__Types::BIT7_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_9_force_omit(9, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_vA__Indicator.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_10_force_omit(10, force_omit, General__Types::BIT6_descr_.raw->forceomit);
  decoded_field_length = field_spare2.RAW_decode(General__Types::BIT6_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_11_force_omit(11, force_omit, General__Types::BIT2_descr_.raw->forceomit);
  decoded_field_length = field_response__Time__Category.RAW_decode(General__Types::BIT2_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_74) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int LCS__QoS__BSSGP::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 = 12;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(12);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, LCS__QoS__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, LCS__QoS__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::BIT6_descr_.raw);
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, General__Types::BIT7_descr_.raw);
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, General__Types::BIT7_descr_.raw);
  myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 10, General__Types::BIT6_descr_.raw);
  myleaf.body.node.nodes[11] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 11, General__Types::BIT2_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(LCS__QoS__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(LCS__QoS__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_vert.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_vel.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_spare1.RAW_encode(General__Types::BIT6_descr_, *myleaf.body.node.nodes[5]);
  encoded_length += field_horizontal__Accuracy.RAW_encode(General__Types::BIT7_descr_, *myleaf.body.node.nodes[6]);
  encoded_length += field_hA__Indicator.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[7]);
  encoded_length += field_vertical__Accuracy.RAW_encode(General__Types::BIT7_descr_, *myleaf.body.node.nodes[8]);
  encoded_length += field_vA__Indicator.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[9]);
  encoded_length += field_spare2.RAW_encode(General__Types::BIT6_descr_, *myleaf.body.node.nodes[10]);
  encoded_length += field_response__Time__Category.RAW_encode(General__Types::BIT2_descr_, *myleaf.body.node.nodes[11]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 9;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(9);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[4]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[4]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[5]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[5]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[6]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[6]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[4].level = myleaf.body.node.nodes[7]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[4].pos = myleaf.body.node.nodes[7]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[5].level = myleaf.body.node.nodes[8]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[5].pos = myleaf.body.node.nodes[8]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[6].level = myleaf.body.node.nodes[9]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[6].pos = myleaf.body.node.nodes[9]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[7].level = myleaf.body.node.nodes[10]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[7].pos = myleaf.body.node.nodes[10]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[8].level = myleaf.body.node.nodes[11]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[8].pos = myleaf.body.node.nodes[11]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(LCS__QoS__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(LCS__QoS__BSSGP_ext_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_iEI !=  os_74) {
  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){
   os_74.RAW_encode(General__Types::OCT1_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 LCS__QoS__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
BITSTRING_template field_vert;
BITSTRING_template field_vel;
BITSTRING_template field_spare1;
BITSTRING_template field_horizontal__Accuracy;
BITSTRING_template field_hA__Indicator;
BITSTRING_template field_vertical__Accuracy;
BITSTRING_template field_vA__Indicator;
BITSTRING_template field_spare2;
BITSTRING_template field_response__Time__Category;
};

void LCS__QoS__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_vert = ANY_VALUE;
single_value->field_vel = ANY_VALUE;
single_value->field_spare1 = ANY_VALUE;
single_value->field_horizontal__Accuracy = ANY_VALUE;
single_value->field_hA__Indicator = ANY_VALUE;
single_value->field_vertical__Accuracy = ANY_VALUE;
single_value->field_vA__Indicator = ANY_VALUE;
single_value->field_spare2 = ANY_VALUE;
single_value->field_response__Time__Category = ANY_VALUE;
}
}
}

void LCS__QoS__BSSGP_template::copy_value(const LCS__QoS__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.vert().is_bound()) {
  single_value->field_vert = other_value.vert();
} else {
  single_value->field_vert.clean_up();
}
if (other_value.vel().is_bound()) {
  single_value->field_vel = other_value.vel();
} else {
  single_value->field_vel.clean_up();
}
if (other_value.spare1().is_bound()) {
  single_value->field_spare1 = other_value.spare1();
} else {
  single_value->field_spare1.clean_up();
}
if (other_value.horizontal__Accuracy().is_bound()) {
  single_value->field_horizontal__Accuracy = other_value.horizontal__Accuracy();
} else {
  single_value->field_horizontal__Accuracy.clean_up();
}
if (other_value.hA__Indicator().is_bound()) {
  single_value->field_hA__Indicator = other_value.hA__Indicator();
} else {
  single_value->field_hA__Indicator.clean_up();
}
if (other_value.vertical__Accuracy().is_bound()) {
  single_value->field_vertical__Accuracy = other_value.vertical__Accuracy();
} else {
  single_value->field_vertical__Accuracy.clean_up();
}
if (other_value.vA__Indicator().is_bound()) {
  single_value->field_vA__Indicator = other_value.vA__Indicator();
} else {
  single_value->field_vA__Indicator.clean_up();
}
if (other_value.spare2().is_bound()) {
  single_value->field_spare2 = other_value.spare2();
} else {
  single_value->field_spare2.clean_up();
}
if (other_value.response__Time__Category().is_bound()) {
  single_value->field_response__Time__Category = other_value.response__Time__Category();
} else {
  single_value->field_response__Time__Category.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void LCS__QoS__BSSGP_template::copy_template(const LCS__QoS__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.vert().get_selection()) {
single_value->field_vert = other_value.vert();
} else {
single_value->field_vert.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.vel().get_selection()) {
single_value->field_vel = other_value.vel();
} else {
single_value->field_vel.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare1().get_selection()) {
single_value->field_spare1 = other_value.spare1();
} else {
single_value->field_spare1.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.horizontal__Accuracy().get_selection()) {
single_value->field_horizontal__Accuracy = other_value.horizontal__Accuracy();
} else {
single_value->field_horizontal__Accuracy.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.hA__Indicator().get_selection()) {
single_value->field_hA__Indicator = other_value.hA__Indicator();
} else {
single_value->field_hA__Indicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.vertical__Accuracy().get_selection()) {
single_value->field_vertical__Accuracy = other_value.vertical__Accuracy();
} else {
single_value->field_vertical__Accuracy.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.vA__Indicator().get_selection()) {
single_value->field_vA__Indicator = other_value.vA__Indicator();
} else {
single_value->field_vA__Indicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare2().get_selection()) {
single_value->field_spare2 = other_value.spare2();
} else {
single_value->field_spare2.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.response__Time__Category().get_selection()) {
single_value->field_response__Time__Category = other_value.response__Time__Category();
} else {
single_value->field_response__Time__Category.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 LCS__QoS__BSSGP_template[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 LCS__QoS__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new LCS__QoS__BSSGP_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 @BSSGP_Types.LCS_QoS_BSSGP.");
break;
}
set_selection(other_value);
}

LCS__QoS__BSSGP_template::LCS__QoS__BSSGP_template()
{
}

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

LCS__QoS__BSSGP_template::LCS__QoS__BSSGP_template(const LCS__QoS__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean LCS__QoS__BSSGP_template::match(const LCS__QoS__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.vert().is_bound()) return FALSE;
if(!single_value->field_vert.match(other_value.vert(), legacy))return FALSE;
if(!other_value.vel().is_bound()) return FALSE;
if(!single_value->field_vel.match(other_value.vel(), legacy))return FALSE;
if(!other_value.spare1().is_bound()) return FALSE;
if(!single_value->field_spare1.match(other_value.spare1(), legacy))return FALSE;
if(!other_value.horizontal__Accuracy().is_bound()) return FALSE;
if(!single_value->field_horizontal__Accuracy.match(other_value.horizontal__Accuracy(), legacy))return FALSE;
if(!other_value.hA__Indicator().is_bound()) return FALSE;
if(!single_value->field_hA__Indicator.match(other_value.hA__Indicator(), legacy))return FALSE;
if(!other_value.vertical__Accuracy().is_bound()) return FALSE;
if(!single_value->field_vertical__Accuracy.match(other_value.vertical__Accuracy(), legacy))return FALSE;
if(!other_value.vA__Indicator().is_bound()) return FALSE;
if(!single_value->field_vA__Indicator.match(other_value.vA__Indicator(), legacy))return FALSE;
if(!other_value.spare2().is_bound()) return FALSE;
if(!single_value->field_spare2.match(other_value.spare2(), legacy))return FALSE;
if(!other_value.response__Time__Category().is_bound()) return FALSE;
if(!single_value->field_response__Time__Category.match(other_value.response__Time__Category(), 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 @BSSGP_Types.LCS_QoS_BSSGP.");
}
return FALSE;
}

boolean LCS__QoS__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_vert.is_bound()
 || single_value->field_vel.is_bound()
 || single_value->field_spare1.is_bound()
 || single_value->field_horizontal__Accuracy.is_bound()
 || single_value->field_hA__Indicator.is_bound()
 || single_value->field_vertical__Accuracy.is_bound()
 || single_value->field_vA__Indicator.is_bound()
 || single_value->field_spare2.is_bound()
 || single_value->field_response__Time__Category.is_bound();
}

boolean LCS__QoS__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_vert.is_value()
 && single_value->field_vel.is_value()
 && single_value->field_spare1.is_value()
 && single_value->field_horizontal__Accuracy.is_value()
 && single_value->field_hA__Indicator.is_value()
 && single_value->field_vertical__Accuracy.is_value()
 && single_value->field_vA__Indicator.is_value()
 && single_value->field_spare2.is_value()
 && single_value->field_response__Time__Category.is_value();
}

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

LCS__QoS__BSSGP LCS__QoS__BSSGP_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 @BSSGP_Types.LCS_QoS_BSSGP.");
LCS__QoS__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_vert.is_bound()) {
ret_val.vert() = single_value->field_vert.valueof();
}
if (single_value->field_vel.is_bound()) {
ret_val.vel() = single_value->field_vel.valueof();
}
if (single_value->field_spare1.is_bound()) {
ret_val.spare1() = single_value->field_spare1.valueof();
}
if (single_value->field_horizontal__Accuracy.is_bound()) {
ret_val.horizontal__Accuracy() = single_value->field_horizontal__Accuracy.valueof();
}
if (single_value->field_hA__Indicator.is_bound()) {
ret_val.hA__Indicator() = single_value->field_hA__Indicator.valueof();
}
if (single_value->field_vertical__Accuracy.is_bound()) {
ret_val.vertical__Accuracy() = single_value->field_vertical__Accuracy.valueof();
}
if (single_value->field_vA__Indicator.is_bound()) {
ret_val.vA__Indicator() = single_value->field_vA__Indicator.valueof();
}
if (single_value->field_spare2.is_bound()) {
ret_val.spare2() = single_value->field_spare2.valueof();
}
if (single_value->field_response__Time__Category.is_bound()) {
ret_val.response__Time__Category() = single_value->field_response__Time__Category.valueof();
}
return ret_val;
}

void LCS__QoS__BSSGP_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 @BSSGP_Types.LCS_QoS_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new LCS__QoS__BSSGP_template[list_length];
}

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

OCTETSTRING_template& LCS__QoS__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& LCS__QoS__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.LCS_QoS_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& LCS__QoS__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& LCS__QoS__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.LCS_QoS_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& LCS__QoS__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& LCS__QoS__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.LCS_QoS_BSSGP.");
return single_value->field_lengthIndicator;
}

BITSTRING_template& LCS__QoS__BSSGP_template::vert()
{
set_specific();
return single_value->field_vert;
}

const BITSTRING_template& LCS__QoS__BSSGP_template::vert() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field vert of a non-specific template of type @BSSGP_Types.LCS_QoS_BSSGP.");
return single_value->field_vert;
}

BITSTRING_template& LCS__QoS__BSSGP_template::vel()
{
set_specific();
return single_value->field_vel;
}

const BITSTRING_template& LCS__QoS__BSSGP_template::vel() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field vel of a non-specific template of type @BSSGP_Types.LCS_QoS_BSSGP.");
return single_value->field_vel;
}

BITSTRING_template& LCS__QoS__BSSGP_template::spare1()
{
set_specific();
return single_value->field_spare1;
}

const BITSTRING_template& LCS__QoS__BSSGP_template::spare1() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare1 of a non-specific template of type @BSSGP_Types.LCS_QoS_BSSGP.");
return single_value->field_spare1;
}

BITSTRING_template& LCS__QoS__BSSGP_template::horizontal__Accuracy()
{
set_specific();
return single_value->field_horizontal__Accuracy;
}

const BITSTRING_template& LCS__QoS__BSSGP_template::horizontal__Accuracy() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field horizontal_Accuracy of a non-specific template of type @BSSGP_Types.LCS_QoS_BSSGP.");
return single_value->field_horizontal__Accuracy;
}

BITSTRING_template& LCS__QoS__BSSGP_template::hA__Indicator()
{
set_specific();
return single_value->field_hA__Indicator;
}

const BITSTRING_template& LCS__QoS__BSSGP_template::hA__Indicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field hA_Indicator of a non-specific template of type @BSSGP_Types.LCS_QoS_BSSGP.");
return single_value->field_hA__Indicator;
}

BITSTRING_template& LCS__QoS__BSSGP_template::vertical__Accuracy()
{
set_specific();
return single_value->field_vertical__Accuracy;
}

const BITSTRING_template& LCS__QoS__BSSGP_template::vertical__Accuracy() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field vertical_Accuracy of a non-specific template of type @BSSGP_Types.LCS_QoS_BSSGP.");
return single_value->field_vertical__Accuracy;
}

BITSTRING_template& LCS__QoS__BSSGP_template::vA__Indicator()
{
set_specific();
return single_value->field_vA__Indicator;
}

const BITSTRING_template& LCS__QoS__BSSGP_template::vA__Indicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field vA_Indicator of a non-specific template of type @BSSGP_Types.LCS_QoS_BSSGP.");
return single_value->field_vA__Indicator;
}

BITSTRING_template& LCS__QoS__BSSGP_template::spare2()
{
set_specific();
return single_value->field_spare2;
}

const BITSTRING_template& LCS__QoS__BSSGP_template::spare2() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field spare2 of a non-specific template of type @BSSGP_Types.LCS_QoS_BSSGP.");
return single_value->field_spare2;
}

BITSTRING_template& LCS__QoS__BSSGP_template::response__Time__Category()
{
set_specific();
return single_value->field_response__Time__Category;
}

const BITSTRING_template& LCS__QoS__BSSGP_template::response__Time__Category() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field response_Time_Category of a non-specific template of type @BSSGP_Types.LCS_QoS_BSSGP.");
return single_value->field_response__Time__Category;
}

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

void LCS__QoS__BSSGP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", vert := ");
single_value->field_vert.log();
TTCN_Logger::log_event_str(", vel := ");
single_value->field_vel.log();
TTCN_Logger::log_event_str(", spare1 := ");
single_value->field_spare1.log();
TTCN_Logger::log_event_str(", horizontal_Accuracy := ");
single_value->field_horizontal__Accuracy.log();
TTCN_Logger::log_event_str(", hA_Indicator := ");
single_value->field_hA__Indicator.log();
TTCN_Logger::log_event_str(", vertical_Accuracy := ");
single_value->field_vertical__Accuracy.log();
TTCN_Logger::log_event_str(", vA_Indicator := ");
single_value->field_vA__Indicator.log();
TTCN_Logger::log_event_str(", spare2 := ");
single_value->field_spare2.log();
TTCN_Logger::log_event_str(", response_Time_Category := ");
single_value->field_response__Time__Category.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 LCS__QoS__BSSGP_template::log_match(const LCS__QoS__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_vert.match(match_value.vert(), legacy)){
TTCN_Logger::log_logmatch_info(".vert");
single_value->field_vert.log_match(match_value.vert(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_vel.match(match_value.vel(), legacy)){
TTCN_Logger::log_logmatch_info(".vel");
single_value->field_vel.log_match(match_value.vel(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare1.match(match_value.spare1(), legacy)){
TTCN_Logger::log_logmatch_info(".spare1");
single_value->field_spare1.log_match(match_value.spare1(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_horizontal__Accuracy.match(match_value.horizontal__Accuracy(), legacy)){
TTCN_Logger::log_logmatch_info(".horizontal_Accuracy");
single_value->field_horizontal__Accuracy.log_match(match_value.horizontal__Accuracy(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_hA__Indicator.match(match_value.hA__Indicator(), legacy)){
TTCN_Logger::log_logmatch_info(".hA_Indicator");
single_value->field_hA__Indicator.log_match(match_value.hA__Indicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_vertical__Accuracy.match(match_value.vertical__Accuracy(), legacy)){
TTCN_Logger::log_logmatch_info(".vertical_Accuracy");
single_value->field_vertical__Accuracy.log_match(match_value.vertical__Accuracy(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_vA__Indicator.match(match_value.vA__Indicator(), legacy)){
TTCN_Logger::log_logmatch_info(".vA_Indicator");
single_value->field_vA__Indicator.log_match(match_value.vA__Indicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare2.match(match_value.spare2(), legacy)){
TTCN_Logger::log_logmatch_info(".spare2");
single_value->field_spare2.log_match(match_value.spare2(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_response__Time__Category.match(match_value.response__Time__Category(), legacy)){
TTCN_Logger::log_logmatch_info(".response_Time_Category");
single_value->field_response__Time__Category.log_match(match_value.response__Time__Category(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", vert := ");
single_value->field_vert.log_match(match_value.vert(), legacy);
TTCN_Logger::log_event_str(", vel := ");
single_value->field_vel.log_match(match_value.vel(), legacy);
TTCN_Logger::log_event_str(", spare1 := ");
single_value->field_spare1.log_match(match_value.spare1(), legacy);
TTCN_Logger::log_event_str(", horizontal_Accuracy := ");
single_value->field_horizontal__Accuracy.log_match(match_value.horizontal__Accuracy(), legacy);
TTCN_Logger::log_event_str(", hA_Indicator := ");
single_value->field_hA__Indicator.log_match(match_value.hA__Indicator(), legacy);
TTCN_Logger::log_event_str(", vertical_Accuracy := ");
single_value->field_vertical__Accuracy.log_match(match_value.vertical__Accuracy(), legacy);
TTCN_Logger::log_event_str(", vA_Indicator := ");
single_value->field_vA__Indicator.log_match(match_value.vA__Indicator(), legacy);
TTCN_Logger::log_event_str(", spare2 := ");
single_value->field_spare2.log_match(match_value.spare2(), legacy);
TTCN_Logger::log_event_str(", response_Time_Category := ");
single_value->field_response__Time__Category.log_match(match_value.response__Time__Category(), 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 LCS__QoS__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (vert().is_bound()) vert().set_implicit_omit();
if (vel().is_bound()) vel().set_implicit_omit();
if (spare1().is_bound()) spare1().set_implicit_omit();
if (horizontal__Accuracy().is_bound()) horizontal__Accuracy().set_implicit_omit();
if (hA__Indicator().is_bound()) hA__Indicator().set_implicit_omit();
if (vertical__Accuracy().is_bound()) vertical__Accuracy().set_implicit_omit();
if (vA__Indicator().is_bound()) vA__Indicator().set_implicit_omit();
if (spare2().is_bound()) spare2().set_implicit_omit();
if (response__Time__Category().is_bound()) response__Time__Category().set_implicit_omit();
}

void LCS__QoS__BSSGP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_vert.encode_text(text_buf);
single_value->field_vel.encode_text(text_buf);
single_value->field_spare1.encode_text(text_buf);
single_value->field_horizontal__Accuracy.encode_text(text_buf);
single_value->field_hA__Indicator.encode_text(text_buf);
single_value->field_vertical__Accuracy.encode_text(text_buf);
single_value->field_vA__Indicator.encode_text(text_buf);
single_value->field_spare2.encode_text(text_buf);
single_value->field_response__Time__Category.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 @BSSGP_Types.LCS_QoS_BSSGP.");
}
}

void LCS__QoS__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_vert.decode_text(text_buf);
single_value->field_vel.decode_text(text_buf);
single_value->field_spare1.decode_text(text_buf);
single_value->field_horizontal__Accuracy.decode_text(text_buf);
single_value->field_hA__Indicator.decode_text(text_buf);
single_value->field_vertical__Accuracy.decode_text(text_buf);
single_value->field_vA__Indicator.decode_text(text_buf);
single_value->field_spare2.decode_text(text_buf);
single_value->field_response__Time__Category.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 LCS__QoS__BSSGP_template[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 @BSSGP_Types.LCS_QoS_BSSGP.");
}
}

void LCS__QoS__BSSGP_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: {
    LCS__QoS__BSSGP_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 (12<param.get_size()) {
      param.error("record template of type @BSSGP_Types.LCS_QoS_BSSGP has 12 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) vert().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) vel().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) spare1().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) horizontal__Accuracy().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) hA__Indicator().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) vertical__Accuracy().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) vA__Indicator().set_param(*param.get_elem(9));
    if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) spare2().set_param(*param.get_elem(10));
    if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) response__Time__Category().set_param(*param.get_elem(11));
    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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "vert")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          vert().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "vel")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          vel().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare1().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "horizontal_Accuracy")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          horizontal__Accuracy().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "hA_Indicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          hA__Indicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "vertical_Accuracy")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          vertical__Accuracy().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "vA_Indicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          vA__Indicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare2().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "response_Time_Category")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          response__Time__Category().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 @BSSGP_Types.LCS_QoS_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    LCS__QoS__BSSGP_template* precondition = new LCS__QoS__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    LCS__QoS__BSSGP_template* implied_template = new LCS__QoS__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = LCS__QoS__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.LCS_QoS_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void LCS__QoS__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_QoS_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_QoS_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_QoS_BSSGP");
single_value->field_vert.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_QoS_BSSGP");
single_value->field_vel.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_QoS_BSSGP");
single_value->field_spare1.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_QoS_BSSGP");
single_value->field_horizontal__Accuracy.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_QoS_BSSGP");
single_value->field_hA__Indicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_QoS_BSSGP");
single_value->field_vertical__Accuracy.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_QoS_BSSGP");
single_value->field_vA__Indicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_QoS_BSSGP");
single_value->field_spare2.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_QoS_BSSGP");
single_value->field_response__Time__Category.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_QoS_BSSGP");
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 : "@BSSGP_Types.LCS_QoS_BSSGP");
}

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

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

LCS__Client__Type__BSSGP::LCS__Client__Type__BSSGP()
{
}

LCS__Client__Type__BSSGP::LCS__Client__Type__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const BITSTRING& par_client__Subtype,
    const BITSTRING& par_client__Category)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_client__Subtype(par_client__Subtype),
  field_client__Category(par_client__Category)
{
}

LCS__Client__Type__BSSGP::LCS__Client__Type__BSSGP(const LCS__Client__Type__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.LCS_Client_Type_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.client__Subtype().is_bound()) field_client__Subtype = other_value.client__Subtype();
else field_client__Subtype.clean_up();
if (other_value.client__Category().is_bound()) field_client__Category = other_value.client__Category();
else field_client__Category.clean_up();
}

void LCS__Client__Type__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_client__Subtype.clean_up();
field_client__Category.clean_up();
}

const TTCN_Typedescriptor_t* LCS__Client__Type__BSSGP::get_descriptor() const { return &LCS__Client__Type__BSSGP_descr_; }
LCS__Client__Type__BSSGP& LCS__Client__Type__BSSGP::operator=(const LCS__Client__Type__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.LCS_Client_Type_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.client__Subtype().is_bound()) field_client__Subtype = other_value.client__Subtype();
  else field_client__Subtype.clean_up();
  if (other_value.client__Category().is_bound()) field_client__Category = other_value.client__Category();
  else field_client__Category.clean_up();
}
return *this;
}

boolean LCS__Client__Type__BSSGP::operator==(const LCS__Client__Type__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_client__Subtype==other_value.field_client__Subtype
  && field_client__Category==other_value.field_client__Category;
}

boolean LCS__Client__Type__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_client__Subtype.is_bound())
  || (field_client__Category.is_bound());
}
boolean LCS__Client__Type__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_client__Subtype.is_value()
  && field_client__Category.is_value();
}
void LCS__Client__Type__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", client_Subtype := ");
field_client__Subtype.log();
TTCN_Logger::log_event_str(", client_Category := ");
field_client__Category.log();
TTCN_Logger::log_event_str(" }");
}

void LCS__Client__Type__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (client__Subtype().is_bound()) client__Subtype().set_implicit_omit();
if (client__Category().is_bound()) client__Category().set_implicit_omit();
}

void LCS__Client__Type__BSSGP::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 @BSSGP_Types.LCS_Client_Type_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) client__Subtype().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) client__Category().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "client_Subtype")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          client__Subtype().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "client_Category")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          client__Category().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 @BSSGP_Types.LCS_Client_Type_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.LCS_Client_Type_BSSGP");
  }
}

void LCS__Client__Type__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_client__Subtype.encode_text(text_buf);
field_client__Category.encode_text(text_buf);
}

void LCS__Client__Type__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_client__Subtype.decode_text(text_buf);
field_client__Category.decode_text(text_buf);
}

void LCS__Client__Type__BSSGP::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 LCS__Client__Type__BSSGP::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 LCS__Client__Type__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, LCS__Client__Type__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(LCS__Client__Type__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, LCS__Client__Type__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(LCS__Client__Type__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT4_descr_.raw->forceomit);
  decoded_field_length = field_client__Subtype.RAW_decode(General__Types::BIT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::BIT4_descr_.raw->forceomit);
  decoded_field_length = field_client__Category.RAW_decode(General__Types::BIT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_67) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int LCS__Client__Type__BSSGP::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 5;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(5);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, LCS__Client__Type__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, LCS__Client__Type__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT4_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::BIT4_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(LCS__Client__Type__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(LCS__Client__Type__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_client__Subtype.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_client__Category.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[4]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 2;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(2);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[4]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[4]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(LCS__Client__Type__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(LCS__Client__Type__BSSGP_ext_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_iEI !=  os_67) {
  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){
   os_67.RAW_encode(General__Types::OCT1_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 LCS__Client__Type__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
BITSTRING_template field_client__Subtype;
BITSTRING_template field_client__Category;
};

void LCS__Client__Type__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_client__Subtype = ANY_VALUE;
single_value->field_client__Category = ANY_VALUE;
}
}
}

void LCS__Client__Type__BSSGP_template::copy_value(const LCS__Client__Type__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.client__Subtype().is_bound()) {
  single_value->field_client__Subtype = other_value.client__Subtype();
} else {
  single_value->field_client__Subtype.clean_up();
}
if (other_value.client__Category().is_bound()) {
  single_value->field_client__Category = other_value.client__Category();
} else {
  single_value->field_client__Category.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void LCS__Client__Type__BSSGP_template::copy_template(const LCS__Client__Type__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.client__Subtype().get_selection()) {
single_value->field_client__Subtype = other_value.client__Subtype();
} else {
single_value->field_client__Subtype.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.client__Category().get_selection()) {
single_value->field_client__Category = other_value.client__Category();
} else {
single_value->field_client__Category.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 LCS__Client__Type__BSSGP_template[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 LCS__Client__Type__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new LCS__Client__Type__BSSGP_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 @BSSGP_Types.LCS_Client_Type_BSSGP.");
break;
}
set_selection(other_value);
}

LCS__Client__Type__BSSGP_template::LCS__Client__Type__BSSGP_template()
{
}

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

LCS__Client__Type__BSSGP_template::LCS__Client__Type__BSSGP_template(const LCS__Client__Type__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean LCS__Client__Type__BSSGP_template::match(const LCS__Client__Type__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.client__Subtype().is_bound()) return FALSE;
if(!single_value->field_client__Subtype.match(other_value.client__Subtype(), legacy))return FALSE;
if(!other_value.client__Category().is_bound()) return FALSE;
if(!single_value->field_client__Category.match(other_value.client__Category(), 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 @BSSGP_Types.LCS_Client_Type_BSSGP.");
}
return FALSE;
}

boolean LCS__Client__Type__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_client__Subtype.is_bound()
 || single_value->field_client__Category.is_bound();
}

boolean LCS__Client__Type__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_client__Subtype.is_value()
 && single_value->field_client__Category.is_value();
}

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

LCS__Client__Type__BSSGP LCS__Client__Type__BSSGP_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 @BSSGP_Types.LCS_Client_Type_BSSGP.");
LCS__Client__Type__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_client__Subtype.is_bound()) {
ret_val.client__Subtype() = single_value->field_client__Subtype.valueof();
}
if (single_value->field_client__Category.is_bound()) {
ret_val.client__Category() = single_value->field_client__Category.valueof();
}
return ret_val;
}

void LCS__Client__Type__BSSGP_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 @BSSGP_Types.LCS_Client_Type_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new LCS__Client__Type__BSSGP_template[list_length];
}

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

OCTETSTRING_template& LCS__Client__Type__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& LCS__Client__Type__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.LCS_Client_Type_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& LCS__Client__Type__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& LCS__Client__Type__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.LCS_Client_Type_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& LCS__Client__Type__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& LCS__Client__Type__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.LCS_Client_Type_BSSGP.");
return single_value->field_lengthIndicator;
}

BITSTRING_template& LCS__Client__Type__BSSGP_template::client__Subtype()
{
set_specific();
return single_value->field_client__Subtype;
}

const BITSTRING_template& LCS__Client__Type__BSSGP_template::client__Subtype() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field client_Subtype of a non-specific template of type @BSSGP_Types.LCS_Client_Type_BSSGP.");
return single_value->field_client__Subtype;
}

BITSTRING_template& LCS__Client__Type__BSSGP_template::client__Category()
{
set_specific();
return single_value->field_client__Category;
}

const BITSTRING_template& LCS__Client__Type__BSSGP_template::client__Category() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field client_Category of a non-specific template of type @BSSGP_Types.LCS_Client_Type_BSSGP.");
return single_value->field_client__Category;
}

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

void LCS__Client__Type__BSSGP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", client_Subtype := ");
single_value->field_client__Subtype.log();
TTCN_Logger::log_event_str(", client_Category := ");
single_value->field_client__Category.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 LCS__Client__Type__BSSGP_template::log_match(const LCS__Client__Type__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_client__Subtype.match(match_value.client__Subtype(), legacy)){
TTCN_Logger::log_logmatch_info(".client_Subtype");
single_value->field_client__Subtype.log_match(match_value.client__Subtype(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_client__Category.match(match_value.client__Category(), legacy)){
TTCN_Logger::log_logmatch_info(".client_Category");
single_value->field_client__Category.log_match(match_value.client__Category(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", client_Subtype := ");
single_value->field_client__Subtype.log_match(match_value.client__Subtype(), legacy);
TTCN_Logger::log_event_str(", client_Category := ");
single_value->field_client__Category.log_match(match_value.client__Category(), 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 LCS__Client__Type__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (client__Subtype().is_bound()) client__Subtype().set_implicit_omit();
if (client__Category().is_bound()) client__Category().set_implicit_omit();
}

void LCS__Client__Type__BSSGP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_client__Subtype.encode_text(text_buf);
single_value->field_client__Category.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 @BSSGP_Types.LCS_Client_Type_BSSGP.");
}
}

void LCS__Client__Type__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_client__Subtype.decode_text(text_buf);
single_value->field_client__Category.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 LCS__Client__Type__BSSGP_template[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 @BSSGP_Types.LCS_Client_Type_BSSGP.");
}
}

void LCS__Client__Type__BSSGP_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: {
    LCS__Client__Type__BSSGP_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 @BSSGP_Types.LCS_Client_Type_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) client__Subtype().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) client__Category().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "client_Subtype")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          client__Subtype().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "client_Category")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          client__Category().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 @BSSGP_Types.LCS_Client_Type_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    LCS__Client__Type__BSSGP_template* precondition = new LCS__Client__Type__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    LCS__Client__Type__BSSGP_template* implied_template = new LCS__Client__Type__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = LCS__Client__Type__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.LCS_Client_Type_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void LCS__Client__Type__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Client_Type_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Client_Type_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Client_Type_BSSGP");
single_value->field_client__Subtype.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Client_Type_BSSGP");
single_value->field_client__Category.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Client_Type_BSSGP");
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 : "@BSSGP_Types.LCS_Client_Type_BSSGP");
}

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

boolean LCS__Client__Type__BSSGP_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 SatID__and__IODE SatID__and__IODE__List::UNBOUND_ELEM;
SatID__and__IODE__List::SatID__and__IODE__List()
{
val_ptr = NULL;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

void SatID__and__IODE__List_template::copy_template(const SatID__and__IODE__List_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 = (SatID__and__IODE_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 SatID__and__IODE_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new SatID__and__IODE_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 SatID__and__IODE__List_template[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 SatID__and__IODE__List_template(*other_value.implication_.precondition);
implication_.implied_template = new SatID__and__IODE__List_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 @BSSGP_Types.SatID_and_IODE_List.");
break;
}
set_selection(other_value);
}

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

SatID__and__IODE__List_template::SatID__and__IODE__List_template()
{
}

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

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

SatID__and__IODE__List_template::SatID__and__IODE__List_template(const SatID__and__IODE__List& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

boolean SatID__and__IODE__List_template::match(const SatID__and__IODE__List& 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 @BSSGP_Types.SatID_and_IODE_List.");
}
return FALSE;
}

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

SatID__and__IODE__List SatID__and__IODE__List_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 @BSSGP_Types.SatID_and_IODE_List.");
SatID__and__IODE__List 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;
}

SatID__and__IODE__List SatID__and__IODE__List_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);
}

SatID__and__IODE__List SatID__and__IODE__List_template::replace(int index, int len, const SatID__and__IODE__List_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());
}

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

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

void SatID__and__IODE__List_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 SatID__and__IODE__List_template::log_match(const SatID__and__IODE__List& 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 SatID__and__IODE__List_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 @BSSGP_Types.SatID_and_IODE_List.");
}
}

void SatID__and__IODE__List_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 @BSSGP_Types.SatID_and_IODE_List.");
single_value.value_elements = (SatID__and__IODE_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 SatID__and__IODE_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 SatID__and__IODE__List_template[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 @BSSGP_Types.SatID_and_IODE_List.");
}
}

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

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

void SatID__and__IODE__List_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 : "@BSSGP_Types.SatID_and_IODE_List");
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 : "@BSSGP_Types.SatID_and_IODE_List");
}

boolean SatID__and__IODE__List_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);
}
}
SatID__and__IODE::SatID__and__IODE()
{
}

SatID__and__IODE::SatID__and__IODE(const BITSTRING& par_satID,
    const BITSTRING& par_spare,
    const OCTETSTRING& par_iODE)
  :   field_satID(par_satID),
  field_spare(par_spare),
  field_iODE(par_iODE)
{
}

SatID__and__IODE::SatID__and__IODE(const SatID__and__IODE& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.SatID_and_IODE.");
if (other_value.satID().is_bound()) field_satID = other_value.satID();
else field_satID.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.iODE().is_bound()) field_iODE = other_value.iODE();
else field_iODE.clean_up();
}

void SatID__and__IODE::clean_up()
{
field_satID.clean_up();
field_spare.clean_up();
field_iODE.clean_up();
}

const TTCN_Typedescriptor_t* SatID__and__IODE::get_descriptor() const { return &SatID__and__IODE_descr_; }
SatID__and__IODE& SatID__and__IODE::operator=(const SatID__and__IODE& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.SatID_and_IODE.");
  if (other_value.satID().is_bound()) field_satID = other_value.satID();
  else field_satID.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.iODE().is_bound()) field_iODE = other_value.iODE();
  else field_iODE.clean_up();
}
return *this;
}

boolean SatID__and__IODE::operator==(const SatID__and__IODE& other_value) const
{
return field_satID==other_value.field_satID
  && field_spare==other_value.field_spare
  && field_iODE==other_value.field_iODE;
}

boolean SatID__and__IODE::is_bound() const
{
return (field_satID.is_bound())
  || (field_spare.is_bound())
  || (field_iODE.is_bound());
}
boolean SatID__and__IODE::is_value() const
{
return field_satID.is_value()
  && field_spare.is_value()
  && field_iODE.is_value();
}
void SatID__and__IODE::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ satID := ");
field_satID.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(", iODE := ");
field_iODE.log();
TTCN_Logger::log_event_str(" }");
}

void SatID__and__IODE::set_implicit_omit()
{
if (satID().is_bound()) satID().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (iODE().is_bound()) iODE().set_implicit_omit();
}

void SatID__and__IODE::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 @BSSGP_Types.SatID_and_IODE 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) satID().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) iODE().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(), "satID")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          satID().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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(), "iODE")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iODE().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 @BSSGP_Types.SatID_and_IODE: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.SatID_and_IODE");
  }
}

void SatID__and__IODE::encode_text(Text_Buf& text_buf) const
{
field_satID.encode_text(text_buf);
field_spare.encode_text(text_buf);
field_iODE.encode_text(text_buf);
}

void SatID__and__IODE::decode_text(Text_Buf& text_buf)
{
field_satID.decode_text(text_buf);
field_spare.decode_text(text_buf);
field_iODE.decode_text(text_buf);
}

void SatID__and__IODE::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 SatID__and__IODE::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 SatID__and__IODE::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::BIT6_descr_.raw->forceomit);
  decoded_field_length = field_satID.RAW_decode(General__Types::BIT6_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::BIT2_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(General__Types::BIT2_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iODE.RAW_decode(General__Types::OCT1_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 SatID__and__IODE::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, General__Types::BIT6_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::BIT2_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::OCT1_descr_.raw);
  encoded_length += field_satID.RAW_encode(General__Types::BIT6_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_spare.RAW_encode(General__Types::BIT2_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_iODE.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct SatID__and__IODE_template::single_value_struct {
BITSTRING_template field_satID;
BITSTRING_template field_spare;
OCTETSTRING_template field_iODE;
};

void SatID__and__IODE_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_satID = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
single_value->field_iODE = ANY_VALUE;
}
}
}

void SatID__and__IODE_template::copy_value(const SatID__and__IODE& other_value)
{
single_value = new single_value_struct;
if (other_value.satID().is_bound()) {
  single_value->field_satID = other_value.satID();
} else {
  single_value->field_satID.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.iODE().is_bound()) {
  single_value->field_iODE = other_value.iODE();
} else {
  single_value->field_iODE.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void SatID__and__IODE_template::copy_template(const SatID__and__IODE_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.satID().get_selection()) {
single_value->field_satID = other_value.satID();
} else {
single_value->field_satID.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.iODE().get_selection()) {
single_value->field_iODE = other_value.iODE();
} else {
single_value->field_iODE.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 SatID__and__IODE_template[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 SatID__and__IODE_template(*other_value.implication_.precondition);
implication_.implied_template = new SatID__and__IODE_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 @BSSGP_Types.SatID_and_IODE.");
break;
}
set_selection(other_value);
}

SatID__and__IODE_template::SatID__and__IODE_template()
{
}

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

SatID__and__IODE_template::SatID__and__IODE_template(const SatID__and__IODE& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean SatID__and__IODE_template::match(const SatID__and__IODE& 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.satID().is_bound()) return FALSE;
if(!single_value->field_satID.match(other_value.satID(), 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.iODE().is_bound()) return FALSE;
if(!single_value->field_iODE.match(other_value.iODE(), 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 @BSSGP_Types.SatID_and_IODE.");
}
return FALSE;
}

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

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

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

SatID__and__IODE SatID__and__IODE_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 @BSSGP_Types.SatID_and_IODE.");
SatID__and__IODE ret_val;
if (single_value->field_satID.is_bound()) {
ret_val.satID() = single_value->field_satID.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_iODE.is_bound()) {
ret_val.iODE() = single_value->field_iODE.valueof();
}
return ret_val;
}

void SatID__and__IODE_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 @BSSGP_Types.SatID_and_IODE.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new SatID__and__IODE_template[list_length];
}

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

BITSTRING_template& SatID__and__IODE_template::satID()
{
set_specific();
return single_value->field_satID;
}

const BITSTRING_template& SatID__and__IODE_template::satID() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field satID of a non-specific template of type @BSSGP_Types.SatID_and_IODE.");
return single_value->field_satID;
}

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

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

OCTETSTRING_template& SatID__and__IODE_template::iODE()
{
set_specific();
return single_value->field_iODE;
}

const OCTETSTRING_template& SatID__and__IODE_template::iODE() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iODE of a non-specific template of type @BSSGP_Types.SatID_and_IODE.");
return single_value->field_iODE;
}

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

void SatID__and__IODE_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ satID := ");
single_value->field_satID.log();
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(", iODE := ");
single_value->field_iODE.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 SatID__and__IODE_template::log_match(const SatID__and__IODE& 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_satID.match(match_value.satID(), legacy)){
TTCN_Logger::log_logmatch_info(".satID");
single_value->field_satID.log_match(match_value.satID(), 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_iODE.match(match_value.iODE(), legacy)){
TTCN_Logger::log_logmatch_info(".iODE");
single_value->field_iODE.log_match(match_value.iODE(), 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("{ satID := ");
single_value->field_satID.log_match(match_value.satID(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(", iODE := ");
single_value->field_iODE.log_match(match_value.iODE(), 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 SatID__and__IODE_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (satID().is_bound()) satID().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (iODE().is_bound()) iODE().set_implicit_omit();
}

void SatID__and__IODE_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_satID.encode_text(text_buf);
single_value->field_spare.encode_text(text_buf);
single_value->field_iODE.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 @BSSGP_Types.SatID_and_IODE.");
}
}

void SatID__and__IODE_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_satID.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
single_value->field_iODE.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 SatID__and__IODE_template[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 @BSSGP_Types.SatID_and_IODE.");
}
}

void SatID__and__IODE_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: {
    SatID__and__IODE_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 @BSSGP_Types.SatID_and_IODE 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) satID().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) iODE().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(), "satID")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          satID().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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(), "iODE")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iODE().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 @BSSGP_Types.SatID_and_IODE: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    SatID__and__IODE_template* precondition = new SatID__and__IODE_template;
    precondition->set_param(*param.get_elem(0));
    SatID__and__IODE_template* implied_template = new SatID__and__IODE_template;
    implied_template->set_param(*param.get_elem(1));
    *this = SatID__and__IODE_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.SatID_and_IODE");
  }
  is_ifpresent = param.get_ifpresent();
}

void SatID__and__IODE_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_satID.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.SatID_and_IODE");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.SatID_and_IODE");
single_value->field_iODE.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.SatID_and_IODE");
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 : "@BSSGP_Types.SatID_and_IODE");
}

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

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

SatelliteRelatedData::SatelliteRelatedData()
{
}

SatelliteRelatedData::SatelliteRelatedData(const BITSTRING& par_spare,
    const BITSTRING& par_gPS__Week,
    const OCTETSTRING& par_gPS__Toe,
    const BITSTRING& par_t__Toe__Limit,
    const INTEGER& par_nSAT,
    const SatID__and__IODE__List& par_satID__and__IODE__List)
  :   field_spare(par_spare),
  field_gPS__Week(par_gPS__Week),
  field_gPS__Toe(par_gPS__Toe),
  field_t__Toe__Limit(par_t__Toe__Limit),
  field_nSAT(par_nSAT),
  field_satID__and__IODE__List(par_satID__and__IODE__List)
{
}

SatelliteRelatedData::SatelliteRelatedData(const SatelliteRelatedData& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.SatelliteRelatedData.");
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.gPS__Week().is_bound()) field_gPS__Week = other_value.gPS__Week();
else field_gPS__Week.clean_up();
if (other_value.gPS__Toe().is_bound()) field_gPS__Toe = other_value.gPS__Toe();
else field_gPS__Toe.clean_up();
if (other_value.t__Toe__Limit().is_bound()) field_t__Toe__Limit = other_value.t__Toe__Limit();
else field_t__Toe__Limit.clean_up();
if (other_value.nSAT().is_bound()) field_nSAT = other_value.nSAT();
else field_nSAT.clean_up();
if (other_value.satID__and__IODE__List().is_bound()) field_satID__and__IODE__List = other_value.satID__and__IODE__List();
else field_satID__and__IODE__List.clean_up();
}

void SatelliteRelatedData::clean_up()
{
field_spare.clean_up();
field_gPS__Week.clean_up();
field_gPS__Toe.clean_up();
field_t__Toe__Limit.clean_up();
field_nSAT.clean_up();
field_satID__and__IODE__List.clean_up();
}

const TTCN_Typedescriptor_t* SatelliteRelatedData::get_descriptor() const { return &SatelliteRelatedData_descr_; }
SatelliteRelatedData& SatelliteRelatedData::operator=(const SatelliteRelatedData& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.SatelliteRelatedData.");
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.gPS__Week().is_bound()) field_gPS__Week = other_value.gPS__Week();
  else field_gPS__Week.clean_up();
  if (other_value.gPS__Toe().is_bound()) field_gPS__Toe = other_value.gPS__Toe();
  else field_gPS__Toe.clean_up();
  if (other_value.t__Toe__Limit().is_bound()) field_t__Toe__Limit = other_value.t__Toe__Limit();
  else field_t__Toe__Limit.clean_up();
  if (other_value.nSAT().is_bound()) field_nSAT = other_value.nSAT();
  else field_nSAT.clean_up();
  if (other_value.satID__and__IODE__List().is_bound()) field_satID__and__IODE__List = other_value.satID__and__IODE__List();
  else field_satID__and__IODE__List.clean_up();
}
return *this;
}

boolean SatelliteRelatedData::operator==(const SatelliteRelatedData& other_value) const
{
return field_spare==other_value.field_spare
  && field_gPS__Week==other_value.field_gPS__Week
  && field_gPS__Toe==other_value.field_gPS__Toe
  && field_t__Toe__Limit==other_value.field_t__Toe__Limit
  && field_nSAT==other_value.field_nSAT
  && field_satID__and__IODE__List==other_value.field_satID__and__IODE__List;
}

boolean SatelliteRelatedData::is_bound() const
{
return (field_spare.is_bound())
  || (field_gPS__Week.is_bound())
  || (field_gPS__Toe.is_bound())
  || (field_t__Toe__Limit.is_bound())
  || (field_nSAT.is_bound())
  || (field_satID__and__IODE__List.is_bound());
}
boolean SatelliteRelatedData::is_value() const
{
return field_spare.is_value()
  && field_gPS__Week.is_value()
  && field_gPS__Toe.is_value()
  && field_t__Toe__Limit.is_value()
  && field_nSAT.is_value()
  && field_satID__and__IODE__List.is_value();
}
void SatelliteRelatedData::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ spare := ");
field_spare.log();
TTCN_Logger::log_event_str(", gPS_Week := ");
field_gPS__Week.log();
TTCN_Logger::log_event_str(", gPS_Toe := ");
field_gPS__Toe.log();
TTCN_Logger::log_event_str(", t_Toe_Limit := ");
field_t__Toe__Limit.log();
TTCN_Logger::log_event_str(", nSAT := ");
field_nSAT.log();
TTCN_Logger::log_event_str(", satID_and_IODE_List := ");
field_satID__and__IODE__List.log();
TTCN_Logger::log_event_str(" }");
}

void SatelliteRelatedData::set_implicit_omit()
{
if (spare().is_bound()) spare().set_implicit_omit();
if (gPS__Week().is_bound()) gPS__Week().set_implicit_omit();
if (gPS__Toe().is_bound()) gPS__Toe().set_implicit_omit();
if (t__Toe__Limit().is_bound()) t__Toe__Limit().set_implicit_omit();
if (nSAT().is_bound()) nSAT().set_implicit_omit();
if (satID__and__IODE__List().is_bound()) satID__and__IODE__List().set_implicit_omit();
}

void SatelliteRelatedData::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 @BSSGP_Types.SatelliteRelatedData 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) spare().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) gPS__Week().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) gPS__Toe().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) t__Toe__Limit().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) nSAT().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) satID__and__IODE__List().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(), "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(), "gPS_Week")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gPS__Week().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gPS_Toe")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gPS__Toe().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_Toe_Limit")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          t__Toe__Limit().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nSAT")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nSAT().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "satID_and_IODE_List")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          satID__and__IODE__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 @BSSGP_Types.SatelliteRelatedData: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.SatelliteRelatedData");
  }
}

void SatelliteRelatedData::encode_text(Text_Buf& text_buf) const
{
field_spare.encode_text(text_buf);
field_gPS__Week.encode_text(text_buf);
field_gPS__Toe.encode_text(text_buf);
field_t__Toe__Limit.encode_text(text_buf);
field_nSAT.encode_text(text_buf);
field_satID__and__IODE__List.encode_text(text_buf);
}

void SatelliteRelatedData::decode_text(Text_Buf& text_buf)
{
field_spare.decode_text(text_buf);
field_gPS__Week.decode_text(text_buf);
field_gPS__Toe.decode_text(text_buf);
field_t__Toe__Limit.decode_text(text_buf);
field_nSAT.decode_text(text_buf);
field_satID__and__IODE__List.decode_text(text_buf);
}

void SatelliteRelatedData::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 SatelliteRelatedData::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 SatelliteRelatedData::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_field4 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::BIT6_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(General__Types::BIT6_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::BIT10_descr_.raw->forceomit);
  decoded_field_length = field_gPS__Week.RAW_decode(General__Types::BIT10_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_gPS__Toe.RAW_decode(General__Types::OCT1_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, General__Types::BIT4_descr_.raw->forceomit);
  decoded_field_length = field_t__Toe__Limit.RAW_decode(General__Types::BIT4_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, SatelliteRelatedData_nSAT_descr_.raw->forceomit);
  decoded_field_length = field_nSAT.RAW_decode(SatelliteRelatedData_nSAT_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());
  INTEGER tmp4 = field_nSAT.convert_to_Integer(SatelliteRelatedData_nSAT_descr_);
  field_nSAT = tmp4;
  value_of_length_field4 += tmp4.get_long_long_val() * 1;
  RAW_Force_Omit field_5_force_omit(5, force_omit, SatID__and__IODE__List_descr_.raw->forceomit);
  decoded_field_length = field_satID__and__IODE__List.RAW_decode(SatID__and__IODE__List_descr_, p_buf, limit, local_top_order, no_err, value_of_length_field4, TRUE, &field_5_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field4 -= 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 SatelliteRelatedData::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, General__Types::BIT6_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::BIT10_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT4_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, SatelliteRelatedData_nSAT_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, SatID__and__IODE__List_descr_.raw);
  encoded_length += field_spare.RAW_encode(General__Types::BIT6_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_gPS__Week.RAW_encode(General__Types::BIT10_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_gPS__Toe.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_t__Toe__Limit.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += 4;
  myleaf.body.node.nodes[4]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[4]->coding_descr = &SatelliteRelatedData_nSAT_descr_;
  myleaf.body.node.nodes[4]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[4]->calcof.lengthto.unit = -1;
  myleaf.body.node.nodes[4]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[4]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[4]->length = 4;
  myleaf.body.node.nodes[4]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[5]->curr_pos.level;
  myleaf.body.node.nodes[4]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[5]->curr_pos.pos;
  encoded_length += field_satID__and__IODE__List.RAW_encode(SatID__and__IODE__List_descr_, *myleaf.body.node.nodes[5]);
  return myleaf.length = encoded_length;
}

struct SatelliteRelatedData_template::single_value_struct {
BITSTRING_template field_spare;
BITSTRING_template field_gPS__Week;
OCTETSTRING_template field_gPS__Toe;
BITSTRING_template field_t__Toe__Limit;
INTEGER_template field_nSAT;
SatID__and__IODE__List_template field_satID__and__IODE__List;
};

void SatelliteRelatedData_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_spare = ANY_VALUE;
single_value->field_gPS__Week = ANY_VALUE;
single_value->field_gPS__Toe = ANY_VALUE;
single_value->field_t__Toe__Limit = ANY_VALUE;
single_value->field_nSAT = ANY_VALUE;
single_value->field_satID__and__IODE__List = ANY_VALUE;
}
}
}

void SatelliteRelatedData_template::copy_value(const SatelliteRelatedData& other_value)
{
single_value = new single_value_struct;
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
if (other_value.gPS__Week().is_bound()) {
  single_value->field_gPS__Week = other_value.gPS__Week();
} else {
  single_value->field_gPS__Week.clean_up();
}
if (other_value.gPS__Toe().is_bound()) {
  single_value->field_gPS__Toe = other_value.gPS__Toe();
} else {
  single_value->field_gPS__Toe.clean_up();
}
if (other_value.t__Toe__Limit().is_bound()) {
  single_value->field_t__Toe__Limit = other_value.t__Toe__Limit();
} else {
  single_value->field_t__Toe__Limit.clean_up();
}
if (other_value.nSAT().is_bound()) {
  single_value->field_nSAT = other_value.nSAT();
} else {
  single_value->field_nSAT.clean_up();
}
if (other_value.satID__and__IODE__List().is_bound()) {
  single_value->field_satID__and__IODE__List = other_value.satID__and__IODE__List();
} else {
  single_value->field_satID__and__IODE__List.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void SatelliteRelatedData_template::copy_template(const SatelliteRelatedData_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.gPS__Week().get_selection()) {
single_value->field_gPS__Week = other_value.gPS__Week();
} else {
single_value->field_gPS__Week.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.gPS__Toe().get_selection()) {
single_value->field_gPS__Toe = other_value.gPS__Toe();
} else {
single_value->field_gPS__Toe.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.t__Toe__Limit().get_selection()) {
single_value->field_t__Toe__Limit = other_value.t__Toe__Limit();
} else {
single_value->field_t__Toe__Limit.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nSAT().get_selection()) {
single_value->field_nSAT = other_value.nSAT();
} else {
single_value->field_nSAT.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.satID__and__IODE__List().get_selection()) {
single_value->field_satID__and__IODE__List = other_value.satID__and__IODE__List();
} else {
single_value->field_satID__and__IODE__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 SatelliteRelatedData_template[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 SatelliteRelatedData_template(*other_value.implication_.precondition);
implication_.implied_template = new SatelliteRelatedData_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 @BSSGP_Types.SatelliteRelatedData.");
break;
}
set_selection(other_value);
}

SatelliteRelatedData_template::SatelliteRelatedData_template()
{
}

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

SatelliteRelatedData_template::SatelliteRelatedData_template(const SatelliteRelatedData& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean SatelliteRelatedData_template::match(const SatelliteRelatedData& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
if(!other_value.gPS__Week().is_bound()) return FALSE;
if(!single_value->field_gPS__Week.match(other_value.gPS__Week(), legacy))return FALSE;
if(!other_value.gPS__Toe().is_bound()) return FALSE;
if(!single_value->field_gPS__Toe.match(other_value.gPS__Toe(), legacy))return FALSE;
if(!other_value.t__Toe__Limit().is_bound()) return FALSE;
if(!single_value->field_t__Toe__Limit.match(other_value.t__Toe__Limit(), legacy))return FALSE;
if(!other_value.nSAT().is_bound()) return FALSE;
if(!single_value->field_nSAT.match(other_value.nSAT(), legacy))return FALSE;
if(!other_value.satID__and__IODE__List().is_bound()) return FALSE;
if(!single_value->field_satID__and__IODE__List.match(other_value.satID__and__IODE__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 @BSSGP_Types.SatelliteRelatedData.");
}
return FALSE;
}

boolean SatelliteRelatedData_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_spare.is_bound()
 || single_value->field_gPS__Week.is_bound()
 || single_value->field_gPS__Toe.is_bound()
 || single_value->field_t__Toe__Limit.is_bound()
 || single_value->field_nSAT.is_bound()
 || single_value->field_satID__and__IODE__List.is_bound();
}

boolean SatelliteRelatedData_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_spare.is_value()
 && single_value->field_gPS__Week.is_value()
 && single_value->field_gPS__Toe.is_value()
 && single_value->field_t__Toe__Limit.is_value()
 && single_value->field_nSAT.is_value()
 && single_value->field_satID__and__IODE__List.is_value();
}

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

SatelliteRelatedData SatelliteRelatedData_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 @BSSGP_Types.SatelliteRelatedData.");
SatelliteRelatedData ret_val;
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_gPS__Week.is_bound()) {
ret_val.gPS__Week() = single_value->field_gPS__Week.valueof();
}
if (single_value->field_gPS__Toe.is_bound()) {
ret_val.gPS__Toe() = single_value->field_gPS__Toe.valueof();
}
if (single_value->field_t__Toe__Limit.is_bound()) {
ret_val.t__Toe__Limit() = single_value->field_t__Toe__Limit.valueof();
}
if (single_value->field_nSAT.is_bound()) {
ret_val.nSAT() = single_value->field_nSAT.valueof();
}
if (single_value->field_satID__and__IODE__List.is_bound()) {
ret_val.satID__and__IODE__List() = single_value->field_satID__and__IODE__List.valueof();
}
return ret_val;
}

void SatelliteRelatedData_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 @BSSGP_Types.SatelliteRelatedData.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new SatelliteRelatedData_template[list_length];
}

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

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

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

BITSTRING_template& SatelliteRelatedData_template::gPS__Week()
{
set_specific();
return single_value->field_gPS__Week;
}

const BITSTRING_template& SatelliteRelatedData_template::gPS__Week() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field gPS_Week of a non-specific template of type @BSSGP_Types.SatelliteRelatedData.");
return single_value->field_gPS__Week;
}

OCTETSTRING_template& SatelliteRelatedData_template::gPS__Toe()
{
set_specific();
return single_value->field_gPS__Toe;
}

const OCTETSTRING_template& SatelliteRelatedData_template::gPS__Toe() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field gPS_Toe of a non-specific template of type @BSSGP_Types.SatelliteRelatedData.");
return single_value->field_gPS__Toe;
}

BITSTRING_template& SatelliteRelatedData_template::t__Toe__Limit()
{
set_specific();
return single_value->field_t__Toe__Limit;
}

const BITSTRING_template& SatelliteRelatedData_template::t__Toe__Limit() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field t_Toe_Limit of a non-specific template of type @BSSGP_Types.SatelliteRelatedData.");
return single_value->field_t__Toe__Limit;
}

INTEGER_template& SatelliteRelatedData_template::nSAT()
{
set_specific();
return single_value->field_nSAT;
}

const INTEGER_template& SatelliteRelatedData_template::nSAT() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nSAT of a non-specific template of type @BSSGP_Types.SatelliteRelatedData.");
return single_value->field_nSAT;
}

SatID__and__IODE__List_template& SatelliteRelatedData_template::satID__and__IODE__List()
{
set_specific();
return single_value->field_satID__and__IODE__List;
}

const SatID__and__IODE__List_template& SatelliteRelatedData_template::satID__and__IODE__List() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field satID_and_IODE_List of a non-specific template of type @BSSGP_Types.SatelliteRelatedData.");
return single_value->field_satID__and__IODE__List;
}

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

void SatelliteRelatedData_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(", gPS_Week := ");
single_value->field_gPS__Week.log();
TTCN_Logger::log_event_str(", gPS_Toe := ");
single_value->field_gPS__Toe.log();
TTCN_Logger::log_event_str(", t_Toe_Limit := ");
single_value->field_t__Toe__Limit.log();
TTCN_Logger::log_event_str(", nSAT := ");
single_value->field_nSAT.log();
TTCN_Logger::log_event_str(", satID_and_IODE_List := ");
single_value->field_satID__and__IODE__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 SatelliteRelatedData_template::log_match(const SatelliteRelatedData& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_gPS__Week.match(match_value.gPS__Week(), legacy)){
TTCN_Logger::log_logmatch_info(".gPS_Week");
single_value->field_gPS__Week.log_match(match_value.gPS__Week(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_gPS__Toe.match(match_value.gPS__Toe(), legacy)){
TTCN_Logger::log_logmatch_info(".gPS_Toe");
single_value->field_gPS__Toe.log_match(match_value.gPS__Toe(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_t__Toe__Limit.match(match_value.t__Toe__Limit(), legacy)){
TTCN_Logger::log_logmatch_info(".t_Toe_Limit");
single_value->field_t__Toe__Limit.log_match(match_value.t__Toe__Limit(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_nSAT.match(match_value.nSAT(), legacy)){
TTCN_Logger::log_logmatch_info(".nSAT");
single_value->field_nSAT.log_match(match_value.nSAT(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_satID__and__IODE__List.match(match_value.satID__and__IODE__List(), legacy)){
TTCN_Logger::log_logmatch_info(".satID_and_IODE_List");
single_value->field_satID__and__IODE__List.log_match(match_value.satID__and__IODE__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("{ spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(", gPS_Week := ");
single_value->field_gPS__Week.log_match(match_value.gPS__Week(), legacy);
TTCN_Logger::log_event_str(", gPS_Toe := ");
single_value->field_gPS__Toe.log_match(match_value.gPS__Toe(), legacy);
TTCN_Logger::log_event_str(", t_Toe_Limit := ");
single_value->field_t__Toe__Limit.log_match(match_value.t__Toe__Limit(), legacy);
TTCN_Logger::log_event_str(", nSAT := ");
single_value->field_nSAT.log_match(match_value.nSAT(), legacy);
TTCN_Logger::log_event_str(", satID_and_IODE_List := ");
single_value->field_satID__and__IODE__List.log_match(match_value.satID__and__IODE__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 SatelliteRelatedData_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (spare().is_bound()) spare().set_implicit_omit();
if (gPS__Week().is_bound()) gPS__Week().set_implicit_omit();
if (gPS__Toe().is_bound()) gPS__Toe().set_implicit_omit();
if (t__Toe__Limit().is_bound()) t__Toe__Limit().set_implicit_omit();
if (nSAT().is_bound()) nSAT().set_implicit_omit();
if (satID__and__IODE__List().is_bound()) satID__and__IODE__List().set_implicit_omit();
}

void SatelliteRelatedData_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_spare.encode_text(text_buf);
single_value->field_gPS__Week.encode_text(text_buf);
single_value->field_gPS__Toe.encode_text(text_buf);
single_value->field_t__Toe__Limit.encode_text(text_buf);
single_value->field_nSAT.encode_text(text_buf);
single_value->field_satID__and__IODE__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 @BSSGP_Types.SatelliteRelatedData.");
}
}

void SatelliteRelatedData_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_spare.decode_text(text_buf);
single_value->field_gPS__Week.decode_text(text_buf);
single_value->field_gPS__Toe.decode_text(text_buf);
single_value->field_t__Toe__Limit.decode_text(text_buf);
single_value->field_nSAT.decode_text(text_buf);
single_value->field_satID__and__IODE__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 SatelliteRelatedData_template[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 @BSSGP_Types.SatelliteRelatedData.");
}
}

void SatelliteRelatedData_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: {
    SatelliteRelatedData_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 @BSSGP_Types.SatelliteRelatedData 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) spare().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) gPS__Week().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) gPS__Toe().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) t__Toe__Limit().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) nSAT().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) satID__and__IODE__List().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(), "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(), "gPS_Week")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gPS__Week().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gPS_Toe")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gPS__Toe().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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_Toe_Limit")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          t__Toe__Limit().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nSAT")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nSAT().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "satID_and_IODE_List")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          satID__and__IODE__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 @BSSGP_Types.SatelliteRelatedData: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    SatelliteRelatedData_template* precondition = new SatelliteRelatedData_template;
    precondition->set_param(*param.get_elem(0));
    SatelliteRelatedData_template* implied_template = new SatelliteRelatedData_template;
    implied_template->set_param(*param.get_elem(1));
    *this = SatelliteRelatedData_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.SatelliteRelatedData");
  }
  is_ifpresent = param.get_ifpresent();
}

void SatelliteRelatedData_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.SatelliteRelatedData");
single_value->field_gPS__Week.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.SatelliteRelatedData");
single_value->field_gPS__Toe.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.SatelliteRelatedData");
single_value->field_t__Toe__Limit.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.SatelliteRelatedData");
single_value->field_nSAT.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.SatelliteRelatedData");
single_value->field_satID__and__IODE__List.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.SatelliteRelatedData");
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 : "@BSSGP_Types.SatelliteRelatedData");
}

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

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

Requested__GPS__Assistance__Data__Value::Requested__GPS__Assistance__Data__Value()
{
}

Requested__GPS__Assistance__Data__Value::Requested__GPS__Assistance__Data__Value(const OCTETSTRING& par_bits__H__to__A,
    const OCTETSTRING& par_bits__P__to__I,
    const SatelliteRelatedData& par_satelliteRelatedData)
  :   field_bits__H__to__A(par_bits__H__to__A),
  field_bits__P__to__I(par_bits__P__to__I),
  field_satelliteRelatedData(par_satelliteRelatedData)
{
}

Requested__GPS__Assistance__Data__Value::Requested__GPS__Assistance__Data__Value(const Requested__GPS__Assistance__Data__Value& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.Requested_GPS_Assistance_Data_Value.");
if (other_value.bits__H__to__A().is_bound()) field_bits__H__to__A = other_value.bits__H__to__A();
else field_bits__H__to__A.clean_up();
if (other_value.bits__P__to__I().is_bound()) field_bits__P__to__I = other_value.bits__P__to__I();
else field_bits__P__to__I.clean_up();
if (other_value.satelliteRelatedData().is_bound()) field_satelliteRelatedData = other_value.satelliteRelatedData();
else field_satelliteRelatedData.clean_up();
}

void Requested__GPS__Assistance__Data__Value::clean_up()
{
field_bits__H__to__A.clean_up();
field_bits__P__to__I.clean_up();
field_satelliteRelatedData.clean_up();
}

const TTCN_Typedescriptor_t* Requested__GPS__Assistance__Data__Value::get_descriptor() const { return &Requested__GPS__Assistance__Data__Value_descr_; }
Requested__GPS__Assistance__Data__Value& Requested__GPS__Assistance__Data__Value::operator=(const Requested__GPS__Assistance__Data__Value& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.Requested_GPS_Assistance_Data_Value.");
  if (other_value.bits__H__to__A().is_bound()) field_bits__H__to__A = other_value.bits__H__to__A();
  else field_bits__H__to__A.clean_up();
  if (other_value.bits__P__to__I().is_bound()) field_bits__P__to__I = other_value.bits__P__to__I();
  else field_bits__P__to__I.clean_up();
  if (other_value.satelliteRelatedData().is_bound()) field_satelliteRelatedData = other_value.satelliteRelatedData();
  else field_satelliteRelatedData.clean_up();
}
return *this;
}

boolean Requested__GPS__Assistance__Data__Value::operator==(const Requested__GPS__Assistance__Data__Value& other_value) const
{
return field_bits__H__to__A==other_value.field_bits__H__to__A
  && field_bits__P__to__I==other_value.field_bits__P__to__I
  && field_satelliteRelatedData==other_value.field_satelliteRelatedData;
}

boolean Requested__GPS__Assistance__Data__Value::is_bound() const
{
return (field_bits__H__to__A.is_bound())
  || (field_bits__P__to__I.is_bound())
  || (field_satelliteRelatedData.is_bound());
}
boolean Requested__GPS__Assistance__Data__Value::is_value() const
{
return field_bits__H__to__A.is_value()
  && field_bits__P__to__I.is_value()
  && field_satelliteRelatedData.is_value();
}
void Requested__GPS__Assistance__Data__Value::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ bits_H_to_A := ");
field_bits__H__to__A.log();
TTCN_Logger::log_event_str(", bits_P_to_I := ");
field_bits__P__to__I.log();
TTCN_Logger::log_event_str(", satelliteRelatedData := ");
field_satelliteRelatedData.log();
TTCN_Logger::log_event_str(" }");
}

void Requested__GPS__Assistance__Data__Value::set_implicit_omit()
{
if (bits__H__to__A().is_bound()) bits__H__to__A().set_implicit_omit();
if (bits__P__to__I().is_bound()) bits__P__to__I().set_implicit_omit();
if (satelliteRelatedData().is_bound()) satelliteRelatedData().set_implicit_omit();
}

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

void Requested__GPS__Assistance__Data__Value::encode_text(Text_Buf& text_buf) const
{
field_bits__H__to__A.encode_text(text_buf);
field_bits__P__to__I.encode_text(text_buf);
field_satelliteRelatedData.encode_text(text_buf);
}

void Requested__GPS__Assistance__Data__Value::decode_text(Text_Buf& text_buf)
{
field_bits__H__to__A.decode_text(text_buf);
field_bits__P__to__I.decode_text(text_buf);
field_satelliteRelatedData.decode_text(text_buf);
}

void Requested__GPS__Assistance__Data__Value::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 Requested__GPS__Assistance__Data__Value::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 Requested__GPS__Assistance__Data__Value::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_bits__H__to__A.RAW_decode(General__Types::OCT1_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_bits__P__to__I.RAW_decode(General__Types::OCT1_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, SatelliteRelatedData_descr_.raw->forceomit);
  decoded_field_length = field_satelliteRelatedData.RAW_decode(SatelliteRelatedData_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 Requested__GPS__Assistance__Data__Value::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SatelliteRelatedData_descr_.raw);
  encoded_length += field_bits__H__to__A.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_bits__P__to__I.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_satelliteRelatedData.RAW_encode(SatelliteRelatedData_descr_, *myleaf.body.node.nodes[2]);
  return myleaf.length = encoded_length;
}

struct Requested__GPS__Assistance__Data__Value_template::single_value_struct {
OCTETSTRING_template field_bits__H__to__A;
OCTETSTRING_template field_bits__P__to__I;
SatelliteRelatedData_template field_satelliteRelatedData;
};

void Requested__GPS__Assistance__Data__Value_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_bits__H__to__A = ANY_VALUE;
single_value->field_bits__P__to__I = ANY_VALUE;
single_value->field_satelliteRelatedData = ANY_VALUE;
}
}
}

void Requested__GPS__Assistance__Data__Value_template::copy_value(const Requested__GPS__Assistance__Data__Value& other_value)
{
single_value = new single_value_struct;
if (other_value.bits__H__to__A().is_bound()) {
  single_value->field_bits__H__to__A = other_value.bits__H__to__A();
} else {
  single_value->field_bits__H__to__A.clean_up();
}
if (other_value.bits__P__to__I().is_bound()) {
  single_value->field_bits__P__to__I = other_value.bits__P__to__I();
} else {
  single_value->field_bits__P__to__I.clean_up();
}
if (other_value.satelliteRelatedData().is_bound()) {
  single_value->field_satelliteRelatedData = other_value.satelliteRelatedData();
} else {
  single_value->field_satelliteRelatedData.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Requested__GPS__Assistance__Data__Value_template::copy_template(const Requested__GPS__Assistance__Data__Value_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.bits__H__to__A().get_selection()) {
single_value->field_bits__H__to__A = other_value.bits__H__to__A();
} else {
single_value->field_bits__H__to__A.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.bits__P__to__I().get_selection()) {
single_value->field_bits__P__to__I = other_value.bits__P__to__I();
} else {
single_value->field_bits__P__to__I.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.satelliteRelatedData().get_selection()) {
single_value->field_satelliteRelatedData = other_value.satelliteRelatedData();
} else {
single_value->field_satelliteRelatedData.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 Requested__GPS__Assistance__Data__Value_template[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 Requested__GPS__Assistance__Data__Value_template(*other_value.implication_.precondition);
implication_.implied_template = new Requested__GPS__Assistance__Data__Value_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 @BSSGP_Types.Requested_GPS_Assistance_Data_Value.");
break;
}
set_selection(other_value);
}

Requested__GPS__Assistance__Data__Value_template::Requested__GPS__Assistance__Data__Value_template()
{
}

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

Requested__GPS__Assistance__Data__Value_template::Requested__GPS__Assistance__Data__Value_template(const Requested__GPS__Assistance__Data__Value& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean Requested__GPS__Assistance__Data__Value_template::match(const Requested__GPS__Assistance__Data__Value& 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.bits__H__to__A().is_bound()) return FALSE;
if(!single_value->field_bits__H__to__A.match(other_value.bits__H__to__A(), legacy))return FALSE;
if(!other_value.bits__P__to__I().is_bound()) return FALSE;
if(!single_value->field_bits__P__to__I.match(other_value.bits__P__to__I(), legacy))return FALSE;
if(!other_value.satelliteRelatedData().is_bound()) return FALSE;
if(!single_value->field_satelliteRelatedData.match(other_value.satelliteRelatedData(), 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 @BSSGP_Types.Requested_GPS_Assistance_Data_Value.");
}
return FALSE;
}

boolean Requested__GPS__Assistance__Data__Value_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_bits__H__to__A.is_bound()
 || single_value->field_bits__P__to__I.is_bound()
 || single_value->field_satelliteRelatedData.is_bound();
}

boolean Requested__GPS__Assistance__Data__Value_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_bits__H__to__A.is_value()
 && single_value->field_bits__P__to__I.is_value()
 && single_value->field_satelliteRelatedData.is_value();
}

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

Requested__GPS__Assistance__Data__Value Requested__GPS__Assistance__Data__Value_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 @BSSGP_Types.Requested_GPS_Assistance_Data_Value.");
Requested__GPS__Assistance__Data__Value ret_val;
if (single_value->field_bits__H__to__A.is_bound()) {
ret_val.bits__H__to__A() = single_value->field_bits__H__to__A.valueof();
}
if (single_value->field_bits__P__to__I.is_bound()) {
ret_val.bits__P__to__I() = single_value->field_bits__P__to__I.valueof();
}
if (single_value->field_satelliteRelatedData.is_bound()) {
ret_val.satelliteRelatedData() = single_value->field_satelliteRelatedData.valueof();
}
return ret_val;
}

void Requested__GPS__Assistance__Data__Value_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 @BSSGP_Types.Requested_GPS_Assistance_Data_Value.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Requested__GPS__Assistance__Data__Value_template[list_length];
}

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

OCTETSTRING_template& Requested__GPS__Assistance__Data__Value_template::bits__H__to__A()
{
set_specific();
return single_value->field_bits__H__to__A;
}

const OCTETSTRING_template& Requested__GPS__Assistance__Data__Value_template::bits__H__to__A() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field bits_H_to_A of a non-specific template of type @BSSGP_Types.Requested_GPS_Assistance_Data_Value.");
return single_value->field_bits__H__to__A;
}

OCTETSTRING_template& Requested__GPS__Assistance__Data__Value_template::bits__P__to__I()
{
set_specific();
return single_value->field_bits__P__to__I;
}

const OCTETSTRING_template& Requested__GPS__Assistance__Data__Value_template::bits__P__to__I() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field bits_P_to_I of a non-specific template of type @BSSGP_Types.Requested_GPS_Assistance_Data_Value.");
return single_value->field_bits__P__to__I;
}

SatelliteRelatedData_template& Requested__GPS__Assistance__Data__Value_template::satelliteRelatedData()
{
set_specific();
return single_value->field_satelliteRelatedData;
}

const SatelliteRelatedData_template& Requested__GPS__Assistance__Data__Value_template::satelliteRelatedData() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field satelliteRelatedData of a non-specific template of type @BSSGP_Types.Requested_GPS_Assistance_Data_Value.");
return single_value->field_satelliteRelatedData;
}

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

void Requested__GPS__Assistance__Data__Value_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ bits_H_to_A := ");
single_value->field_bits__H__to__A.log();
TTCN_Logger::log_event_str(", bits_P_to_I := ");
single_value->field_bits__P__to__I.log();
TTCN_Logger::log_event_str(", satelliteRelatedData := ");
single_value->field_satelliteRelatedData.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 Requested__GPS__Assistance__Data__Value_template::log_match(const Requested__GPS__Assistance__Data__Value& 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_bits__H__to__A.match(match_value.bits__H__to__A(), legacy)){
TTCN_Logger::log_logmatch_info(".bits_H_to_A");
single_value->field_bits__H__to__A.log_match(match_value.bits__H__to__A(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_bits__P__to__I.match(match_value.bits__P__to__I(), legacy)){
TTCN_Logger::log_logmatch_info(".bits_P_to_I");
single_value->field_bits__P__to__I.log_match(match_value.bits__P__to__I(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_satelliteRelatedData.match(match_value.satelliteRelatedData(), legacy)){
TTCN_Logger::log_logmatch_info(".satelliteRelatedData");
single_value->field_satelliteRelatedData.log_match(match_value.satelliteRelatedData(), 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("{ bits_H_to_A := ");
single_value->field_bits__H__to__A.log_match(match_value.bits__H__to__A(), legacy);
TTCN_Logger::log_event_str(", bits_P_to_I := ");
single_value->field_bits__P__to__I.log_match(match_value.bits__P__to__I(), legacy);
TTCN_Logger::log_event_str(", satelliteRelatedData := ");
single_value->field_satelliteRelatedData.log_match(match_value.satelliteRelatedData(), 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 Requested__GPS__Assistance__Data__Value_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (bits__H__to__A().is_bound()) bits__H__to__A().set_implicit_omit();
if (bits__P__to__I().is_bound()) bits__P__to__I().set_implicit_omit();
if (satelliteRelatedData().is_bound()) satelliteRelatedData().set_implicit_omit();
}

void Requested__GPS__Assistance__Data__Value_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_bits__H__to__A.encode_text(text_buf);
single_value->field_bits__P__to__I.encode_text(text_buf);
single_value->field_satelliteRelatedData.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 @BSSGP_Types.Requested_GPS_Assistance_Data_Value.");
}
}

void Requested__GPS__Assistance__Data__Value_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_bits__H__to__A.decode_text(text_buf);
single_value->field_bits__P__to__I.decode_text(text_buf);
single_value->field_satelliteRelatedData.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 Requested__GPS__Assistance__Data__Value_template[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 @BSSGP_Types.Requested_GPS_Assistance_Data_Value.");
}
}

void Requested__GPS__Assistance__Data__Value_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: {
    Requested__GPS__Assistance__Data__Value_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 @BSSGP_Types.Requested_GPS_Assistance_Data_Value 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) bits__H__to__A().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) bits__P__to__I().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) satelliteRelatedData().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(), "bits_H_to_A")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bits__H__to__A().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "bits_P_to_I")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          bits__P__to__I().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "satelliteRelatedData")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          satelliteRelatedData().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 @BSSGP_Types.Requested_GPS_Assistance_Data_Value: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Requested__GPS__Assistance__Data__Value_template* precondition = new Requested__GPS__Assistance__Data__Value_template;
    precondition->set_param(*param.get_elem(0));
    Requested__GPS__Assistance__Data__Value_template* implied_template = new Requested__GPS__Assistance__Data__Value_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Requested__GPS__Assistance__Data__Value_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.Requested_GPS_Assistance_Data_Value");
  }
  is_ifpresent = param.get_ifpresent();
}

void Requested__GPS__Assistance__Data__Value_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_bits__H__to__A.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Requested_GPS_Assistance_Data_Value");
single_value->field_bits__P__to__I.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Requested_GPS_Assistance_Data_Value");
single_value->field_satelliteRelatedData.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Requested_GPS_Assistance_Data_Value");
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 : "@BSSGP_Types.Requested_GPS_Assistance_Data_Value");
}

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

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

Requested__GPS__Assistance__Data__BSSGP::Requested__GPS__Assistance__Data__BSSGP()
{
}

Requested__GPS__Assistance__Data__BSSGP::Requested__GPS__Assistance__Data__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const Requested__GPS__Assistance__Data__Value& par_requested__GPS__Assistance__Data)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_requested__GPS__Assistance__Data(par_requested__GPS__Assistance__Data)
{
}

Requested__GPS__Assistance__Data__BSSGP::Requested__GPS__Assistance__Data__BSSGP(const Requested__GPS__Assistance__Data__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.requested__GPS__Assistance__Data().is_bound()) field_requested__GPS__Assistance__Data = other_value.requested__GPS__Assistance__Data();
else field_requested__GPS__Assistance__Data.clean_up();
}

void Requested__GPS__Assistance__Data__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_requested__GPS__Assistance__Data.clean_up();
}

const TTCN_Typedescriptor_t* Requested__GPS__Assistance__Data__BSSGP::get_descriptor() const { return &Requested__GPS__Assistance__Data__BSSGP_descr_; }
Requested__GPS__Assistance__Data__BSSGP& Requested__GPS__Assistance__Data__BSSGP::operator=(const Requested__GPS__Assistance__Data__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.requested__GPS__Assistance__Data().is_bound()) field_requested__GPS__Assistance__Data = other_value.requested__GPS__Assistance__Data();
  else field_requested__GPS__Assistance__Data.clean_up();
}
return *this;
}

boolean Requested__GPS__Assistance__Data__BSSGP::operator==(const Requested__GPS__Assistance__Data__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_requested__GPS__Assistance__Data==other_value.field_requested__GPS__Assistance__Data;
}

boolean Requested__GPS__Assistance__Data__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_requested__GPS__Assistance__Data.is_bound());
}
boolean Requested__GPS__Assistance__Data__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_requested__GPS__Assistance__Data.is_value();
}
void Requested__GPS__Assistance__Data__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", requested_GPS_Assistance_Data := ");
field_requested__GPS__Assistance__Data.log();
TTCN_Logger::log_event_str(" }");
}

void Requested__GPS__Assistance__Data__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (requested__GPS__Assistance__Data().is_bound()) requested__GPS__Assistance__Data().set_implicit_omit();
}

void Requested__GPS__Assistance__Data__BSSGP::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 @BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) requested__GPS__Assistance__Data().set_param(*param.get_elem(3));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "requested_GPS_Assistance_Data")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          requested__GPS__Assistance__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 @BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP");
  }
}

void Requested__GPS__Assistance__Data__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_requested__GPS__Assistance__Data.encode_text(text_buf);
}

void Requested__GPS__Assistance__Data__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_requested__GPS__Assistance__Data.decode_text(text_buf);
}

void Requested__GPS__Assistance__Data__BSSGP::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 Requested__GPS__Assistance__Data__BSSGP::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 Requested__GPS__Assistance__Data__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, Requested__GPS__Assistance__Data__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(Requested__GPS__Assistance__Data__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, Requested__GPS__Assistance__Data__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(Requested__GPS__Assistance__Data__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, Requested__GPS__Assistance__Data__Value_descr_.raw->forceomit);
  decoded_field_length = field_requested__GPS__Assistance__Data.RAW_decode(Requested__GPS__Assistance__Data__Value_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_114) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Requested__GPS__Assistance__Data__BSSGP::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Requested__GPS__Assistance__Data__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Requested__GPS__Assistance__Data__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, Requested__GPS__Assistance__Data__Value_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(Requested__GPS__Assistance__Data__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(Requested__GPS__Assistance__Data__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_requested__GPS__Assistance__Data.RAW_encode(Requested__GPS__Assistance__Data__Value_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Requested__GPS__Assistance__Data__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Requested__GPS__Assistance__Data__BSSGP_ext_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_iEI !=  os_114) {
  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){
   os_114.RAW_encode(General__Types::OCT1_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 Requested__GPS__Assistance__Data__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
Requested__GPS__Assistance__Data__Value_template field_requested__GPS__Assistance__Data;
};

void Requested__GPS__Assistance__Data__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_requested__GPS__Assistance__Data = ANY_VALUE;
}
}
}

void Requested__GPS__Assistance__Data__BSSGP_template::copy_value(const Requested__GPS__Assistance__Data__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.requested__GPS__Assistance__Data().is_bound()) {
  single_value->field_requested__GPS__Assistance__Data = other_value.requested__GPS__Assistance__Data();
} else {
  single_value->field_requested__GPS__Assistance__Data.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Requested__GPS__Assistance__Data__BSSGP_template::copy_template(const Requested__GPS__Assistance__Data__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.requested__GPS__Assistance__Data().get_selection()) {
single_value->field_requested__GPS__Assistance__Data = other_value.requested__GPS__Assistance__Data();
} else {
single_value->field_requested__GPS__Assistance__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 Requested__GPS__Assistance__Data__BSSGP_template[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 Requested__GPS__Assistance__Data__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new Requested__GPS__Assistance__Data__BSSGP_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 @BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP.");
break;
}
set_selection(other_value);
}

Requested__GPS__Assistance__Data__BSSGP_template::Requested__GPS__Assistance__Data__BSSGP_template()
{
}

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

Requested__GPS__Assistance__Data__BSSGP_template::Requested__GPS__Assistance__Data__BSSGP_template(const Requested__GPS__Assistance__Data__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean Requested__GPS__Assistance__Data__BSSGP_template::match(const Requested__GPS__Assistance__Data__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.requested__GPS__Assistance__Data().is_bound()) return FALSE;
if(!single_value->field_requested__GPS__Assistance__Data.match(other_value.requested__GPS__Assistance__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 @BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP.");
}
return FALSE;
}

boolean Requested__GPS__Assistance__Data__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_requested__GPS__Assistance__Data.is_bound();
}

boolean Requested__GPS__Assistance__Data__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_requested__GPS__Assistance__Data.is_value();
}

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

Requested__GPS__Assistance__Data__BSSGP Requested__GPS__Assistance__Data__BSSGP_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 @BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP.");
Requested__GPS__Assistance__Data__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_requested__GPS__Assistance__Data.is_bound()) {
ret_val.requested__GPS__Assistance__Data() = single_value->field_requested__GPS__Assistance__Data.valueof();
}
return ret_val;
}

void Requested__GPS__Assistance__Data__BSSGP_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 @BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Requested__GPS__Assistance__Data__BSSGP_template[list_length];
}

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

OCTETSTRING_template& Requested__GPS__Assistance__Data__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& Requested__GPS__Assistance__Data__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& Requested__GPS__Assistance__Data__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& Requested__GPS__Assistance__Data__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& Requested__GPS__Assistance__Data__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& Requested__GPS__Assistance__Data__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP.");
return single_value->field_lengthIndicator;
}

Requested__GPS__Assistance__Data__Value_template& Requested__GPS__Assistance__Data__BSSGP_template::requested__GPS__Assistance__Data()
{
set_specific();
return single_value->field_requested__GPS__Assistance__Data;
}

const Requested__GPS__Assistance__Data__Value_template& Requested__GPS__Assistance__Data__BSSGP_template::requested__GPS__Assistance__Data() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field requested_GPS_Assistance_Data of a non-specific template of type @BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP.");
return single_value->field_requested__GPS__Assistance__Data;
}

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

void Requested__GPS__Assistance__Data__BSSGP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", requested_GPS_Assistance_Data := ");
single_value->field_requested__GPS__Assistance__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 Requested__GPS__Assistance__Data__BSSGP_template::log_match(const Requested__GPS__Assistance__Data__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_requested__GPS__Assistance__Data.match(match_value.requested__GPS__Assistance__Data(), legacy)){
TTCN_Logger::log_logmatch_info(".requested_GPS_Assistance_Data");
single_value->field_requested__GPS__Assistance__Data.log_match(match_value.requested__GPS__Assistance__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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", requested_GPS_Assistance_Data := ");
single_value->field_requested__GPS__Assistance__Data.log_match(match_value.requested__GPS__Assistance__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 Requested__GPS__Assistance__Data__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (requested__GPS__Assistance__Data().is_bound()) requested__GPS__Assistance__Data().set_implicit_omit();
}

void Requested__GPS__Assistance__Data__BSSGP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_requested__GPS__Assistance__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 @BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP.");
}
}

void Requested__GPS__Assistance__Data__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_requested__GPS__Assistance__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 Requested__GPS__Assistance__Data__BSSGP_template[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 @BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP.");
}
}

void Requested__GPS__Assistance__Data__BSSGP_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: {
    Requested__GPS__Assistance__Data__BSSGP_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 @BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) requested__GPS__Assistance__Data().set_param(*param.get_elem(3));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "requested_GPS_Assistance_Data")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          requested__GPS__Assistance__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 @BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Requested__GPS__Assistance__Data__BSSGP_template* precondition = new Requested__GPS__Assistance__Data__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    Requested__GPS__Assistance__Data__BSSGP_template* implied_template = new Requested__GPS__Assistance__Data__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Requested__GPS__Assistance__Data__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void Requested__GPS__Assistance__Data__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP");
single_value->field_requested__GPS__Assistance__Data.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP");
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 : "@BSSGP_Types.Requested_GPS_Assistance_Data_BSSGP");
}

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

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

Location__Type__BSSGP::Location__Type__BSSGP()
{
}

Location__Type__BSSGP::Location__Type__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_location__Information,
    const OPTIONAL< OCTETSTRING >& par_positioning__Method)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_location__Information(par_location__Information),
  field_positioning__Method(par_positioning__Method)
{
}

Location__Type__BSSGP::Location__Type__BSSGP(const Location__Type__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.Location_Type_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.location__Information().is_bound()) field_location__Information = other_value.location__Information();
else field_location__Information.clean_up();
if (other_value.positioning__Method().is_bound()) field_positioning__Method = other_value.positioning__Method();
else field_positioning__Method.clean_up();
}

void Location__Type__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_location__Information.clean_up();
field_positioning__Method.clean_up();
}

const TTCN_Typedescriptor_t* Location__Type__BSSGP::get_descriptor() const { return &Location__Type__BSSGP_descr_; }
Location__Type__BSSGP& Location__Type__BSSGP::operator=(const Location__Type__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.Location_Type_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.location__Information().is_bound()) field_location__Information = other_value.location__Information();
  else field_location__Information.clean_up();
  if (other_value.positioning__Method().is_bound()) field_positioning__Method = other_value.positioning__Method();
  else field_positioning__Method.clean_up();
}
return *this;
}

boolean Location__Type__BSSGP::operator==(const Location__Type__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_location__Information==other_value.field_location__Information
  && field_positioning__Method==other_value.field_positioning__Method;
}

boolean Location__Type__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_location__Information.is_bound())
  || (OPTIONAL_OMIT == field_positioning__Method.get_selection() || field_positioning__Method.is_bound());
}
boolean Location__Type__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_location__Information.is_value()
  && (OPTIONAL_OMIT == field_positioning__Method.get_selection() || field_positioning__Method.is_value());
}
int Location__Type__BSSGP::size_of() const
{
  int ret_val = 4;
  if (field_positioning__Method.ispresent()) ret_val++;
  return ret_val;
}

void Location__Type__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", location_Information := ");
field_location__Information.log();
TTCN_Logger::log_event_str(", positioning_Method := ");
field_positioning__Method.log();
TTCN_Logger::log_event_str(" }");
}

void Location__Type__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (location__Information().is_bound()) location__Information().set_implicit_omit();
if (!positioning__Method().is_bound()) positioning__Method() = OMIT_VALUE;
else positioning__Method().set_implicit_omit();
}

void Location__Type__BSSGP::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 @BSSGP_Types.Location_Type_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) location__Information().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) positioning__Method().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "location_Information")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          location__Information().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "positioning_Method")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          positioning__Method().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 @BSSGP_Types.Location_Type_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.Location_Type_BSSGP");
  }
}

void Location__Type__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_location__Information.encode_text(text_buf);
field_positioning__Method.encode_text(text_buf);
}

void Location__Type__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_location__Information.decode_text(text_buf);
field_positioning__Method.decode_text(text_buf);
}

void Location__Type__BSSGP::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 Location__Type__BSSGP::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 Location__Type__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, Location__Type__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(Location__Type__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, Location__Type__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(Location__Type__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_location__Information.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(4)) {
    field_positioning__Method = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_positioning__Method().RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_4_force_omit);
  if (decoded_field_length < 1) {
  field_positioning__Method = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_positioning__Method=OMIT_VALUE;
  if (field_iEI !=  os_115) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Location__Type__BSSGP::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 5;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(5);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Location__Type__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Location__Type__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT1_descr_.raw);
  if (field_positioning__Method.ispresent()) {
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::OCT1_descr_.raw);
  }
  else myleaf.body.node.nodes[4] = NULL;
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(Location__Type__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(Location__Type__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_location__Information.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[3]);
  if (field_positioning__Method.ispresent()) {
  encoded_length += field_positioning__Method().RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[4]);
  }
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 2;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(2);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  if (field_positioning__Method.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[4]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[4]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].pos = 0;
  }
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Location__Type__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Location__Type__BSSGP_ext_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_iEI !=  os_115) {
  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){
   os_115.RAW_encode(General__Types::OCT1_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 Location__Type__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_location__Information;
OCTETSTRING_template field_positioning__Method;
};

void Location__Type__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_location__Information = ANY_VALUE;
single_value->field_positioning__Method = ANY_OR_OMIT;
}
}
}

void Location__Type__BSSGP_template::copy_value(const Location__Type__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.location__Information().is_bound()) {
  single_value->field_location__Information = other_value.location__Information();
} else {
  single_value->field_location__Information.clean_up();
}
if (other_value.positioning__Method().is_bound()) {
  if (other_value.positioning__Method().ispresent()) single_value->field_positioning__Method = other_value.positioning__Method()();
  else single_value->field_positioning__Method = OMIT_VALUE;
} else {
  single_value->field_positioning__Method.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Location__Type__BSSGP_template::copy_template(const Location__Type__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.location__Information().get_selection()) {
single_value->field_location__Information = other_value.location__Information();
} else {
single_value->field_location__Information.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.positioning__Method().get_selection()) {
single_value->field_positioning__Method = other_value.positioning__Method();
} else {
single_value->field_positioning__Method.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 Location__Type__BSSGP_template[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 Location__Type__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new Location__Type__BSSGP_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 @BSSGP_Types.Location_Type_BSSGP.");
break;
}
set_selection(other_value);
}

Location__Type__BSSGP_template::Location__Type__BSSGP_template()
{
}

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

Location__Type__BSSGP_template::Location__Type__BSSGP_template(const Location__Type__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean Location__Type__BSSGP_template::match(const Location__Type__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.location__Information().is_bound()) return FALSE;
if(!single_value->field_location__Information.match(other_value.location__Information(), legacy))return FALSE;
if(!other_value.positioning__Method().is_bound()) return FALSE;
if((other_value.positioning__Method().ispresent() ? !single_value->field_positioning__Method.match((const OCTETSTRING&)other_value.positioning__Method(), legacy) : !single_value->field_positioning__Method.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 @BSSGP_Types.Location_Type_BSSGP.");
}
return FALSE;
}

boolean Location__Type__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_location__Information.is_bound()
 || (single_value->field_positioning__Method.is_omit() || single_value->field_positioning__Method.is_bound());
}

boolean Location__Type__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_location__Information.is_value()
 && (single_value->field_positioning__Method.is_omit() || single_value->field_positioning__Method.is_value());
}

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

Location__Type__BSSGP Location__Type__BSSGP_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 @BSSGP_Types.Location_Type_BSSGP.");
Location__Type__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_location__Information.is_bound()) {
ret_val.location__Information() = single_value->field_location__Information.valueof();
}
if (single_value->field_positioning__Method.is_omit()) ret_val.positioning__Method() = OMIT_VALUE;
else if (single_value->field_positioning__Method.is_bound()) {
ret_val.positioning__Method() = single_value->field_positioning__Method.valueof();
}
return ret_val;
}

void Location__Type__BSSGP_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 @BSSGP_Types.Location_Type_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Location__Type__BSSGP_template[list_length];
}

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

OCTETSTRING_template& Location__Type__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& Location__Type__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.Location_Type_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& Location__Type__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& Location__Type__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.Location_Type_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& Location__Type__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& Location__Type__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.Location_Type_BSSGP.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& Location__Type__BSSGP_template::location__Information()
{
set_specific();
return single_value->field_location__Information;
}

const OCTETSTRING_template& Location__Type__BSSGP_template::location__Information() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field location_Information of a non-specific template of type @BSSGP_Types.Location_Type_BSSGP.");
return single_value->field_location__Information;
}

OCTETSTRING_template& Location__Type__BSSGP_template::positioning__Method()
{
set_specific();
return single_value->field_positioning__Method;
}

const OCTETSTRING_template& Location__Type__BSSGP_template::positioning__Method() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field positioning_Method of a non-specific template of type @BSSGP_Types.Location_Type_BSSGP.");
return single_value->field_positioning__Method;
}

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

void Location__Type__BSSGP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", location_Information := ");
single_value->field_location__Information.log();
TTCN_Logger::log_event_str(", positioning_Method := ");
single_value->field_positioning__Method.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 Location__Type__BSSGP_template::log_match(const Location__Type__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_location__Information.match(match_value.location__Information(), legacy)){
TTCN_Logger::log_logmatch_info(".location_Information");
single_value->field_location__Information.log_match(match_value.location__Information(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.positioning__Method().ispresent()){
if(!single_value->field_positioning__Method.match(match_value.positioning__Method(), legacy)){
TTCN_Logger::log_logmatch_info(".positioning_Method");
single_value->field_positioning__Method.log_match(match_value.positioning__Method(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_positioning__Method.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".positioning_Method := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_positioning__Method.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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", location_Information := ");
single_value->field_location__Information.log_match(match_value.location__Information(), legacy);
TTCN_Logger::log_event_str(", positioning_Method := ");
if (match_value.positioning__Method().ispresent()) {
single_value->field_positioning__Method.log_match(match_value.positioning__Method(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_positioning__Method.log();
if (single_value->field_positioning__Method.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 Location__Type__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (location__Information().is_bound()) location__Information().set_implicit_omit();
if (!positioning__Method().is_bound()) positioning__Method() = OMIT_VALUE;
else positioning__Method().set_implicit_omit();
}

void Location__Type__BSSGP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_location__Information.encode_text(text_buf);
single_value->field_positioning__Method.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 @BSSGP_Types.Location_Type_BSSGP.");
}
}

void Location__Type__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_location__Information.decode_text(text_buf);
single_value->field_positioning__Method.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 Location__Type__BSSGP_template[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 @BSSGP_Types.Location_Type_BSSGP.");
}
}

void Location__Type__BSSGP_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: {
    Location__Type__BSSGP_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 @BSSGP_Types.Location_Type_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) location__Information().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) positioning__Method().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "location_Information")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          location__Information().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "positioning_Method")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          positioning__Method().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 @BSSGP_Types.Location_Type_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Location__Type__BSSGP_template* precondition = new Location__Type__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    Location__Type__BSSGP_template* implied_template = new Location__Type__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Location__Type__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.Location_Type_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void Location__Type__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Location_Type_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Location_Type_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Location_Type_BSSGP");
single_value->field_location__Information.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Location_Type_BSSGP");
single_value->field_positioning__Method.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Location_Type_BSSGP");
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 : "@BSSGP_Types.Location_Type_BSSGP");
}

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

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

Location__Estimate__BSSGP::Location__Estimate__BSSGP()
{
}

Location__Estimate__BSSGP::Location__Estimate__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_location)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_location(par_location)
{
}

Location__Estimate__BSSGP::Location__Estimate__BSSGP(const Location__Estimate__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.Location_Estimate_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.location().is_bound()) field_location = other_value.location();
else field_location.clean_up();
}

void Location__Estimate__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_location.clean_up();
}

const TTCN_Typedescriptor_t* Location__Estimate__BSSGP::get_descriptor() const { return &Location__Estimate__BSSGP_descr_; }
Location__Estimate__BSSGP& Location__Estimate__BSSGP::operator=(const Location__Estimate__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.Location_Estimate_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.location().is_bound()) field_location = other_value.location();
  else field_location.clean_up();
}
return *this;
}

boolean Location__Estimate__BSSGP::operator==(const Location__Estimate__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_location==other_value.field_location;
}

boolean Location__Estimate__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_location.is_bound());
}
boolean Location__Estimate__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_location.is_value();
}
void Location__Estimate__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", location := ");
field_location.log();
TTCN_Logger::log_event_str(" }");
}

void Location__Estimate__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (location().is_bound()) location().set_implicit_omit();
}

void Location__Estimate__BSSGP::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 @BSSGP_Types.Location_Estimate_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) location().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "location")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          location().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 @BSSGP_Types.Location_Estimate_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.Location_Estimate_BSSGP");
  }
}

void Location__Estimate__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_location.encode_text(text_buf);
}

void Location__Estimate__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_location.decode_text(text_buf);
}

void Location__Estimate__BSSGP::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 Location__Estimate__BSSGP::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 Location__Estimate__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, Location__Estimate__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(Location__Estimate__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, Location__Estimate__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(Location__Estimate__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, OCTETSTRING_descr_.raw->forceomit);
  decoded_field_length = field_location.RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_122) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Location__Estimate__BSSGP::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Location__Estimate__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Location__Estimate__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, OCTETSTRING_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(Location__Estimate__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(Location__Estimate__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_location.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Location__Estimate__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Location__Estimate__BSSGP_ext_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_iEI !=  os_122) {
  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){
   os_122.RAW_encode(General__Types::OCT1_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 Location__Estimate__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_location;
};

void Location__Estimate__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_location = ANY_VALUE;
}
}
}

void Location__Estimate__BSSGP_template::copy_value(const Location__Estimate__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.location().is_bound()) {
  single_value->field_location = other_value.location();
} else {
  single_value->field_location.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Location__Estimate__BSSGP_template::copy_template(const Location__Estimate__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.location().get_selection()) {
single_value->field_location = other_value.location();
} else {
single_value->field_location.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 Location__Estimate__BSSGP_template[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 Location__Estimate__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new Location__Estimate__BSSGP_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 @BSSGP_Types.Location_Estimate_BSSGP.");
break;
}
set_selection(other_value);
}

Location__Estimate__BSSGP_template::Location__Estimate__BSSGP_template()
{
}

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

Location__Estimate__BSSGP_template::Location__Estimate__BSSGP_template(const Location__Estimate__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean Location__Estimate__BSSGP_template::match(const Location__Estimate__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.location().is_bound()) return FALSE;
if(!single_value->field_location.match(other_value.location(), 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 @BSSGP_Types.Location_Estimate_BSSGP.");
}
return FALSE;
}

boolean Location__Estimate__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_location.is_bound();
}

boolean Location__Estimate__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_location.is_value();
}

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

Location__Estimate__BSSGP Location__Estimate__BSSGP_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 @BSSGP_Types.Location_Estimate_BSSGP.");
Location__Estimate__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_location.is_bound()) {
ret_val.location() = single_value->field_location.valueof();
}
return ret_val;
}

void Location__Estimate__BSSGP_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 @BSSGP_Types.Location_Estimate_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Location__Estimate__BSSGP_template[list_length];
}

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

OCTETSTRING_template& Location__Estimate__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& Location__Estimate__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.Location_Estimate_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& Location__Estimate__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& Location__Estimate__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.Location_Estimate_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& Location__Estimate__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& Location__Estimate__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.Location_Estimate_BSSGP.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& Location__Estimate__BSSGP_template::location()
{
set_specific();
return single_value->field_location;
}

const OCTETSTRING_template& Location__Estimate__BSSGP_template::location() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field location of a non-specific template of type @BSSGP_Types.Location_Estimate_BSSGP.");
return single_value->field_location;
}

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

void Location__Estimate__BSSGP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", location := ");
single_value->field_location.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 Location__Estimate__BSSGP_template::log_match(const Location__Estimate__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_location.match(match_value.location(), legacy)){
TTCN_Logger::log_logmatch_info(".location");
single_value->field_location.log_match(match_value.location(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", location := ");
single_value->field_location.log_match(match_value.location(), 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 Location__Estimate__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (location().is_bound()) location().set_implicit_omit();
}

void Location__Estimate__BSSGP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_location.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 @BSSGP_Types.Location_Estimate_BSSGP.");
}
}

void Location__Estimate__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_location.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 Location__Estimate__BSSGP_template[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 @BSSGP_Types.Location_Estimate_BSSGP.");
}
}

void Location__Estimate__BSSGP_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: {
    Location__Estimate__BSSGP_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 @BSSGP_Types.Location_Estimate_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) location().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "location")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          location().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 @BSSGP_Types.Location_Estimate_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Location__Estimate__BSSGP_template* precondition = new Location__Estimate__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    Location__Estimate__BSSGP_template* implied_template = new Location__Estimate__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Location__Estimate__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.Location_Estimate_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void Location__Estimate__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Location_Estimate_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Location_Estimate_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Location_Estimate_BSSGP");
single_value->field_location.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Location_Estimate_BSSGP");
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 : "@BSSGP_Types.Location_Estimate_BSSGP");
}

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

boolean Location__Estimate__BSSGP_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 PositioningMethodValue PositioningMethod__List::UNBOUND_ELEM;
PositioningMethod__List::PositioningMethod__List()
{
val_ptr = NULL;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

void PositioningMethod__List_template::copy_template(const PositioningMethod__List_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 = (PositioningMethodValue_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 PositioningMethodValue_template(*other_value.single_value.value_elements[elem_count]);
} else {
single_value.value_elements[elem_count] = new PositioningMethodValue_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 PositioningMethod__List_template[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 PositioningMethod__List_template(*other_value.implication_.precondition);
implication_.implied_template = new PositioningMethod__List_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 @BSSGP_Types.PositioningMethod_List.");
break;
}
set_selection(other_value);
}

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

PositioningMethod__List_template::PositioningMethod__List_template()
{
}

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

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

PositioningMethod__List_template::PositioningMethod__List_template(const PositioningMethod__List& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

boolean PositioningMethod__List_template::match(const PositioningMethod__List& 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 @BSSGP_Types.PositioningMethod_List.");
}
return FALSE;
}

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

PositioningMethod__List PositioningMethod__List_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 @BSSGP_Types.PositioningMethod_List.");
PositioningMethod__List 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;
}

PositioningMethod__List PositioningMethod__List_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);
}

PositioningMethod__List PositioningMethod__List_template::replace(int index, int len, const PositioningMethod__List_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());
}

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

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

void PositioningMethod__List_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 PositioningMethod__List_template::log_match(const PositioningMethod__List& 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 PositioningMethod__List_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 @BSSGP_Types.PositioningMethod_List.");
}
}

void PositioningMethod__List_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 @BSSGP_Types.PositioningMethod_List.");
single_value.value_elements = (PositioningMethodValue_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 PositioningMethodValue_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 PositioningMethod__List_template[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 @BSSGP_Types.PositioningMethod_List.");
}
}

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

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

void PositioningMethod__List_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 : "@BSSGP_Types.PositioningMethod_List");
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 : "@BSSGP_Types.PositioningMethod_List");
}

boolean PositioningMethod__List_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);
}
}
PositioningMethodValue::PositioningMethodValue()
{
}

PositioningMethodValue::PositioningMethodValue(const BITSTRING& par_usage,
    const BITSTRING& par_positioningMethod)
  :   field_usage(par_usage),
  field_positioningMethod(par_positioningMethod)
{
}

PositioningMethodValue::PositioningMethodValue(const PositioningMethodValue& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.PositioningMethodValue.");
if (other_value.usage().is_bound()) field_usage = other_value.usage();
else field_usage.clean_up();
if (other_value.positioningMethod().is_bound()) field_positioningMethod = other_value.positioningMethod();
else field_positioningMethod.clean_up();
}

void PositioningMethodValue::clean_up()
{
field_usage.clean_up();
field_positioningMethod.clean_up();
}

const TTCN_Typedescriptor_t* PositioningMethodValue::get_descriptor() const { return &PositioningMethodValue_descr_; }
PositioningMethodValue& PositioningMethodValue::operator=(const PositioningMethodValue& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.PositioningMethodValue.");
  if (other_value.usage().is_bound()) field_usage = other_value.usage();
  else field_usage.clean_up();
  if (other_value.positioningMethod().is_bound()) field_positioningMethod = other_value.positioningMethod();
  else field_positioningMethod.clean_up();
}
return *this;
}

boolean PositioningMethodValue::operator==(const PositioningMethodValue& other_value) const
{
return field_usage==other_value.field_usage
  && field_positioningMethod==other_value.field_positioningMethod;
}

boolean PositioningMethodValue::is_bound() const
{
return (field_usage.is_bound())
  || (field_positioningMethod.is_bound());
}
boolean PositioningMethodValue::is_value() const
{
return field_usage.is_value()
  && field_positioningMethod.is_value();
}
void PositioningMethodValue::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ usage := ");
field_usage.log();
TTCN_Logger::log_event_str(", positioningMethod := ");
field_positioningMethod.log();
TTCN_Logger::log_event_str(" }");
}

void PositioningMethodValue::set_implicit_omit()
{
if (usage().is_bound()) usage().set_implicit_omit();
if (positioningMethod().is_bound()) positioningMethod().set_implicit_omit();
}

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

void PositioningMethodValue::encode_text(Text_Buf& text_buf) const
{
field_usage.encode_text(text_buf);
field_positioningMethod.encode_text(text_buf);
}

void PositioningMethodValue::decode_text(Text_Buf& text_buf)
{
field_usage.decode_text(text_buf);
field_positioningMethod.decode_text(text_buf);
}

void PositioningMethodValue::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 PositioningMethodValue::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 PositioningMethodValue::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::BIT3_descr_.raw->forceomit);
  decoded_field_length = field_usage.RAW_decode(General__Types::BIT3_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::BIT5_descr_.raw->forceomit);
  decoded_field_length = field_positioningMethod.RAW_decode(General__Types::BIT5_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 PositioningMethodValue::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 2;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(2);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::BIT3_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::BIT5_descr_.raw);
  encoded_length += field_usage.RAW_encode(General__Types::BIT3_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_positioningMethod.RAW_encode(General__Types::BIT5_descr_, *myleaf.body.node.nodes[1]);
  return myleaf.length = encoded_length;
}

struct PositioningMethodValue_template::single_value_struct {
BITSTRING_template field_usage;
BITSTRING_template field_positioningMethod;
};

void PositioningMethodValue_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_usage = ANY_VALUE;
single_value->field_positioningMethod = ANY_VALUE;
}
}
}

void PositioningMethodValue_template::copy_value(const PositioningMethodValue& other_value)
{
single_value = new single_value_struct;
if (other_value.usage().is_bound()) {
  single_value->field_usage = other_value.usage();
} else {
  single_value->field_usage.clean_up();
}
if (other_value.positioningMethod().is_bound()) {
  single_value->field_positioningMethod = other_value.positioningMethod();
} else {
  single_value->field_positioningMethod.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PositioningMethodValue_template::copy_template(const PositioningMethodValue_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.usage().get_selection()) {
single_value->field_usage = other_value.usage();
} else {
single_value->field_usage.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.positioningMethod().get_selection()) {
single_value->field_positioningMethod = other_value.positioningMethod();
} else {
single_value->field_positioningMethod.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 PositioningMethodValue_template[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 PositioningMethodValue_template(*other_value.implication_.precondition);
implication_.implied_template = new PositioningMethodValue_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 @BSSGP_Types.PositioningMethodValue.");
break;
}
set_selection(other_value);
}

PositioningMethodValue_template::PositioningMethodValue_template()
{
}

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

PositioningMethodValue_template::PositioningMethodValue_template(const PositioningMethodValue& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PositioningMethodValue_template::match(const PositioningMethodValue& 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.usage().is_bound()) return FALSE;
if(!single_value->field_usage.match(other_value.usage(), legacy))return FALSE;
if(!other_value.positioningMethod().is_bound()) return FALSE;
if(!single_value->field_positioningMethod.match(other_value.positioningMethod(), 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 @BSSGP_Types.PositioningMethodValue.");
}
return FALSE;
}

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

boolean PositioningMethodValue_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_usage.is_value()
 && single_value->field_positioningMethod.is_value();
}

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

PositioningMethodValue PositioningMethodValue_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 @BSSGP_Types.PositioningMethodValue.");
PositioningMethodValue ret_val;
if (single_value->field_usage.is_bound()) {
ret_val.usage() = single_value->field_usage.valueof();
}
if (single_value->field_positioningMethod.is_bound()) {
ret_val.positioningMethod() = single_value->field_positioningMethod.valueof();
}
return ret_val;
}

void PositioningMethodValue_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 @BSSGP_Types.PositioningMethodValue.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PositioningMethodValue_template[list_length];
}

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

BITSTRING_template& PositioningMethodValue_template::usage()
{
set_specific();
return single_value->field_usage;
}

const BITSTRING_template& PositioningMethodValue_template::usage() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field usage of a non-specific template of type @BSSGP_Types.PositioningMethodValue.");
return single_value->field_usage;
}

BITSTRING_template& PositioningMethodValue_template::positioningMethod()
{
set_specific();
return single_value->field_positioningMethod;
}

const BITSTRING_template& PositioningMethodValue_template::positioningMethod() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field positioningMethod of a non-specific template of type @BSSGP_Types.PositioningMethodValue.");
return single_value->field_positioningMethod;
}

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

void PositioningMethodValue_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ usage := ");
single_value->field_usage.log();
TTCN_Logger::log_event_str(", positioningMethod := ");
single_value->field_positioningMethod.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 PositioningMethodValue_template::log_match(const PositioningMethodValue& 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_usage.match(match_value.usage(), legacy)){
TTCN_Logger::log_logmatch_info(".usage");
single_value->field_usage.log_match(match_value.usage(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_positioningMethod.match(match_value.positioningMethod(), legacy)){
TTCN_Logger::log_logmatch_info(".positioningMethod");
single_value->field_positioningMethod.log_match(match_value.positioningMethod(), 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("{ usage := ");
single_value->field_usage.log_match(match_value.usage(), legacy);
TTCN_Logger::log_event_str(", positioningMethod := ");
single_value->field_positioningMethod.log_match(match_value.positioningMethod(), 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 PositioningMethodValue_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (usage().is_bound()) usage().set_implicit_omit();
if (positioningMethod().is_bound()) positioningMethod().set_implicit_omit();
}

void PositioningMethodValue_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_usage.encode_text(text_buf);
single_value->field_positioningMethod.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 @BSSGP_Types.PositioningMethodValue.");
}
}

void PositioningMethodValue_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_usage.decode_text(text_buf);
single_value->field_positioningMethod.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 PositioningMethodValue_template[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 @BSSGP_Types.PositioningMethodValue.");
}
}

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

void PositioningMethodValue_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_usage.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.PositioningMethodValue");
single_value->field_positioningMethod.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.PositioningMethodValue");
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 : "@BSSGP_Types.PositioningMethodValue");
}

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

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

PositioningDataValue::PositioningDataValue()
{
}

PositioningDataValue::PositioningDataValue(const BITSTRING& par_positioningDataDiscriminator,
    const BITSTRING& par_spare,
    const PositioningMethod__List& par_positioningMethod__List)
  :   field_positioningDataDiscriminator(par_positioningDataDiscriminator),
  field_spare(par_spare),
  field_positioningMethod__List(par_positioningMethod__List)
{
}

PositioningDataValue::PositioningDataValue(const PositioningDataValue& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.PositioningDataValue.");
if (other_value.positioningDataDiscriminator().is_bound()) field_positioningDataDiscriminator = other_value.positioningDataDiscriminator();
else field_positioningDataDiscriminator.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.positioningMethod__List().is_bound()) field_positioningMethod__List = other_value.positioningMethod__List();
else field_positioningMethod__List.clean_up();
}

void PositioningDataValue::clean_up()
{
field_positioningDataDiscriminator.clean_up();
field_spare.clean_up();
field_positioningMethod__List.clean_up();
}

const TTCN_Typedescriptor_t* PositioningDataValue::get_descriptor() const { return &PositioningDataValue_descr_; }
PositioningDataValue& PositioningDataValue::operator=(const PositioningDataValue& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.PositioningDataValue.");
  if (other_value.positioningDataDiscriminator().is_bound()) field_positioningDataDiscriminator = other_value.positioningDataDiscriminator();
  else field_positioningDataDiscriminator.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.positioningMethod__List().is_bound()) field_positioningMethod__List = other_value.positioningMethod__List();
  else field_positioningMethod__List.clean_up();
}
return *this;
}

boolean PositioningDataValue::operator==(const PositioningDataValue& other_value) const
{
return field_positioningDataDiscriminator==other_value.field_positioningDataDiscriminator
  && field_spare==other_value.field_spare
  && field_positioningMethod__List==other_value.field_positioningMethod__List;
}

boolean PositioningDataValue::is_bound() const
{
return (field_positioningDataDiscriminator.is_bound())
  || (field_spare.is_bound())
  || (field_positioningMethod__List.is_bound());
}
boolean PositioningDataValue::is_value() const
{
return field_positioningDataDiscriminator.is_value()
  && field_spare.is_value()
  && field_positioningMethod__List.is_value();
}
void PositioningDataValue::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ positioningDataDiscriminator := ");
field_positioningDataDiscriminator.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(", positioningMethod_List := ");
field_positioningMethod__List.log();
TTCN_Logger::log_event_str(" }");
}

void PositioningDataValue::set_implicit_omit()
{
if (positioningDataDiscriminator().is_bound()) positioningDataDiscriminator().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (positioningMethod__List().is_bound()) positioningMethod__List().set_implicit_omit();
}

void PositioningDataValue::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 @BSSGP_Types.PositioningDataValue 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) positioningDataDiscriminator().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) positioningMethod__List().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(), "positioningDataDiscriminator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          positioningDataDiscriminator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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(), "positioningMethod_List")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          positioningMethod__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 @BSSGP_Types.PositioningDataValue: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.PositioningDataValue");
  }
}

void PositioningDataValue::encode_text(Text_Buf& text_buf) const
{
field_positioningDataDiscriminator.encode_text(text_buf);
field_spare.encode_text(text_buf);
field_positioningMethod__List.encode_text(text_buf);
}

void PositioningDataValue::decode_text(Text_Buf& text_buf)
{
field_positioningDataDiscriminator.decode_text(text_buf);
field_spare.decode_text(text_buf);
field_positioningMethod__List.decode_text(text_buf);
}

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

struct PositioningDataValue_template::single_value_struct {
BITSTRING_template field_positioningDataDiscriminator;
BITSTRING_template field_spare;
PositioningMethod__List_template field_positioningMethod__List;
};

void PositioningDataValue_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_positioningDataDiscriminator = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
single_value->field_positioningMethod__List = ANY_VALUE;
}
}
}

void PositioningDataValue_template::copy_value(const PositioningDataValue& other_value)
{
single_value = new single_value_struct;
if (other_value.positioningDataDiscriminator().is_bound()) {
  single_value->field_positioningDataDiscriminator = other_value.positioningDataDiscriminator();
} else {
  single_value->field_positioningDataDiscriminator.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.positioningMethod__List().is_bound()) {
  single_value->field_positioningMethod__List = other_value.positioningMethod__List();
} else {
  single_value->field_positioningMethod__List.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void PositioningDataValue_template::copy_template(const PositioningDataValue_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.positioningDataDiscriminator().get_selection()) {
single_value->field_positioningDataDiscriminator = other_value.positioningDataDiscriminator();
} else {
single_value->field_positioningDataDiscriminator.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.positioningMethod__List().get_selection()) {
single_value->field_positioningMethod__List = other_value.positioningMethod__List();
} else {
single_value->field_positioningMethod__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 PositioningDataValue_template[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 PositioningDataValue_template(*other_value.implication_.precondition);
implication_.implied_template = new PositioningDataValue_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 @BSSGP_Types.PositioningDataValue.");
break;
}
set_selection(other_value);
}

PositioningDataValue_template::PositioningDataValue_template()
{
}

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

PositioningDataValue_template::PositioningDataValue_template(const PositioningDataValue& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean PositioningDataValue_template::match(const PositioningDataValue& 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.positioningDataDiscriminator().is_bound()) return FALSE;
if(!single_value->field_positioningDataDiscriminator.match(other_value.positioningDataDiscriminator(), 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.positioningMethod__List().is_bound()) return FALSE;
if(!single_value->field_positioningMethod__List.match(other_value.positioningMethod__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 @BSSGP_Types.PositioningDataValue.");
}
return FALSE;
}

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

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

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

PositioningDataValue PositioningDataValue_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 @BSSGP_Types.PositioningDataValue.");
PositioningDataValue ret_val;
if (single_value->field_positioningDataDiscriminator.is_bound()) {
ret_val.positioningDataDiscriminator() = single_value->field_positioningDataDiscriminator.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_positioningMethod__List.is_bound()) {
ret_val.positioningMethod__List() = single_value->field_positioningMethod__List.valueof();
}
return ret_val;
}

void PositioningDataValue_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 @BSSGP_Types.PositioningDataValue.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new PositioningDataValue_template[list_length];
}

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

BITSTRING_template& PositioningDataValue_template::positioningDataDiscriminator()
{
set_specific();
return single_value->field_positioningDataDiscriminator;
}

const BITSTRING_template& PositioningDataValue_template::positioningDataDiscriminator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field positioningDataDiscriminator of a non-specific template of type @BSSGP_Types.PositioningDataValue.");
return single_value->field_positioningDataDiscriminator;
}

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

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

PositioningMethod__List_template& PositioningDataValue_template::positioningMethod__List()
{
set_specific();
return single_value->field_positioningMethod__List;
}

const PositioningMethod__List_template& PositioningDataValue_template::positioningMethod__List() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field positioningMethod_List of a non-specific template of type @BSSGP_Types.PositioningDataValue.");
return single_value->field_positioningMethod__List;
}

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

void PositioningDataValue_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ positioningDataDiscriminator := ");
single_value->field_positioningDataDiscriminator.log();
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(", positioningMethod_List := ");
single_value->field_positioningMethod__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 PositioningDataValue_template::log_match(const PositioningDataValue& 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_positioningDataDiscriminator.match(match_value.positioningDataDiscriminator(), legacy)){
TTCN_Logger::log_logmatch_info(".positioningDataDiscriminator");
single_value->field_positioningDataDiscriminator.log_match(match_value.positioningDataDiscriminator(), 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_positioningMethod__List.match(match_value.positioningMethod__List(), legacy)){
TTCN_Logger::log_logmatch_info(".positioningMethod_List");
single_value->field_positioningMethod__List.log_match(match_value.positioningMethod__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("{ positioningDataDiscriminator := ");
single_value->field_positioningDataDiscriminator.log_match(match_value.positioningDataDiscriminator(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(", positioningMethod_List := ");
single_value->field_positioningMethod__List.log_match(match_value.positioningMethod__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 PositioningDataValue_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (positioningDataDiscriminator().is_bound()) positioningDataDiscriminator().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (positioningMethod__List().is_bound()) positioningMethod__List().set_implicit_omit();
}

void PositioningDataValue_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_positioningDataDiscriminator.encode_text(text_buf);
single_value->field_spare.encode_text(text_buf);
single_value->field_positioningMethod__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 @BSSGP_Types.PositioningDataValue.");
}
}

void PositioningDataValue_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_positioningDataDiscriminator.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
single_value->field_positioningMethod__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 PositioningDataValue_template[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 @BSSGP_Types.PositioningDataValue.");
}
}

void PositioningDataValue_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: {
    PositioningDataValue_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 @BSSGP_Types.PositioningDataValue 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) positioningDataDiscriminator().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) positioningMethod__List().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(), "positioningDataDiscriminator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          positioningDataDiscriminator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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(), "positioningMethod_List")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          positioningMethod__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 @BSSGP_Types.PositioningDataValue: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    PositioningDataValue_template* precondition = new PositioningDataValue_template;
    precondition->set_param(*param.get_elem(0));
    PositioningDataValue_template* implied_template = new PositioningDataValue_template;
    implied_template->set_param(*param.get_elem(1));
    *this = PositioningDataValue_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.PositioningDataValue");
  }
  is_ifpresent = param.get_ifpresent();
}

void PositioningDataValue_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_positioningDataDiscriminator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.PositioningDataValue");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.PositioningDataValue");
single_value->field_positioningMethod__List.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.PositioningDataValue");
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 : "@BSSGP_Types.PositioningDataValue");
}

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

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

Positioning__Data__BSSGP::Positioning__Data__BSSGP()
{
}

Positioning__Data__BSSGP::Positioning__Data__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const PositioningDataValue& par_positioningDataValue)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_positioningDataValue(par_positioningDataValue)
{
}

Positioning__Data__BSSGP::Positioning__Data__BSSGP(const Positioning__Data__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.Positioning_Data_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.positioningDataValue().is_bound()) field_positioningDataValue = other_value.positioningDataValue();
else field_positioningDataValue.clean_up();
}

void Positioning__Data__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_positioningDataValue.clean_up();
}

const TTCN_Typedescriptor_t* Positioning__Data__BSSGP::get_descriptor() const { return &Positioning__Data__BSSGP_descr_; }
Positioning__Data__BSSGP& Positioning__Data__BSSGP::operator=(const Positioning__Data__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.Positioning_Data_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.positioningDataValue().is_bound()) field_positioningDataValue = other_value.positioningDataValue();
  else field_positioningDataValue.clean_up();
}
return *this;
}

boolean Positioning__Data__BSSGP::operator==(const Positioning__Data__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_positioningDataValue==other_value.field_positioningDataValue;
}

boolean Positioning__Data__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_positioningDataValue.is_bound());
}
boolean Positioning__Data__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_positioningDataValue.is_value();
}
void Positioning__Data__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", positioningDataValue := ");
field_positioningDataValue.log();
TTCN_Logger::log_event_str(" }");
}

void Positioning__Data__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (positioningDataValue().is_bound()) positioningDataValue().set_implicit_omit();
}

void Positioning__Data__BSSGP::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 @BSSGP_Types.Positioning_Data_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) positioningDataValue().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "positioningDataValue")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          positioningDataValue().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 @BSSGP_Types.Positioning_Data_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.Positioning_Data_BSSGP");
  }
}

void Positioning__Data__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_positioningDataValue.encode_text(text_buf);
}

void Positioning__Data__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_positioningDataValue.decode_text(text_buf);
}

void Positioning__Data__BSSGP::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 Positioning__Data__BSSGP::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 Positioning__Data__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, Positioning__Data__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(Positioning__Data__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, Positioning__Data__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(Positioning__Data__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, PositioningDataValue_descr_.raw->forceomit);
  decoded_field_length = field_positioningDataValue.RAW_decode(PositioningDataValue_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_123) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Positioning__Data__BSSGP::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Positioning__Data__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Positioning__Data__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, PositioningDataValue_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(Positioning__Data__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(Positioning__Data__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_positioningDataValue.RAW_encode(PositioningDataValue_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Positioning__Data__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Positioning__Data__BSSGP_ext_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_iEI !=  os_123) {
  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){
   os_123.RAW_encode(General__Types::OCT1_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 Positioning__Data__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
PositioningDataValue_template field_positioningDataValue;
};

void Positioning__Data__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_positioningDataValue = ANY_VALUE;
}
}
}

void Positioning__Data__BSSGP_template::copy_value(const Positioning__Data__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.positioningDataValue().is_bound()) {
  single_value->field_positioningDataValue = other_value.positioningDataValue();
} else {
  single_value->field_positioningDataValue.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Positioning__Data__BSSGP_template::copy_template(const Positioning__Data__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.positioningDataValue().get_selection()) {
single_value->field_positioningDataValue = other_value.positioningDataValue();
} else {
single_value->field_positioningDataValue.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 Positioning__Data__BSSGP_template[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 Positioning__Data__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new Positioning__Data__BSSGP_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 @BSSGP_Types.Positioning_Data_BSSGP.");
break;
}
set_selection(other_value);
}

Positioning__Data__BSSGP_template::Positioning__Data__BSSGP_template()
{
}

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

Positioning__Data__BSSGP_template::Positioning__Data__BSSGP_template(const Positioning__Data__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean Positioning__Data__BSSGP_template::match(const Positioning__Data__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.positioningDataValue().is_bound()) return FALSE;
if(!single_value->field_positioningDataValue.match(other_value.positioningDataValue(), 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 @BSSGP_Types.Positioning_Data_BSSGP.");
}
return FALSE;
}

boolean Positioning__Data__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_positioningDataValue.is_bound();
}

boolean Positioning__Data__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_positioningDataValue.is_value();
}

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

Positioning__Data__BSSGP Positioning__Data__BSSGP_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 @BSSGP_Types.Positioning_Data_BSSGP.");
Positioning__Data__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_positioningDataValue.is_bound()) {
ret_val.positioningDataValue() = single_value->field_positioningDataValue.valueof();
}
return ret_val;
}

void Positioning__Data__BSSGP_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 @BSSGP_Types.Positioning_Data_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Positioning__Data__BSSGP_template[list_length];
}

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

OCTETSTRING_template& Positioning__Data__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& Positioning__Data__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.Positioning_Data_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& Positioning__Data__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& Positioning__Data__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.Positioning_Data_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& Positioning__Data__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& Positioning__Data__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.Positioning_Data_BSSGP.");
return single_value->field_lengthIndicator;
}

PositioningDataValue_template& Positioning__Data__BSSGP_template::positioningDataValue()
{
set_specific();
return single_value->field_positioningDataValue;
}

const PositioningDataValue_template& Positioning__Data__BSSGP_template::positioningDataValue() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field positioningDataValue of a non-specific template of type @BSSGP_Types.Positioning_Data_BSSGP.");
return single_value->field_positioningDataValue;
}

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

void Positioning__Data__BSSGP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", positioningDataValue := ");
single_value->field_positioningDataValue.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 Positioning__Data__BSSGP_template::log_match(const Positioning__Data__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_positioningDataValue.match(match_value.positioningDataValue(), legacy)){
TTCN_Logger::log_logmatch_info(".positioningDataValue");
single_value->field_positioningDataValue.log_match(match_value.positioningDataValue(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", positioningDataValue := ");
single_value->field_positioningDataValue.log_match(match_value.positioningDataValue(), 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 Positioning__Data__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (positioningDataValue().is_bound()) positioningDataValue().set_implicit_omit();
}

void Positioning__Data__BSSGP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_positioningDataValue.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 @BSSGP_Types.Positioning_Data_BSSGP.");
}
}

void Positioning__Data__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_positioningDataValue.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 Positioning__Data__BSSGP_template[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 @BSSGP_Types.Positioning_Data_BSSGP.");
}
}

void Positioning__Data__BSSGP_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: {
    Positioning__Data__BSSGP_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 @BSSGP_Types.Positioning_Data_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) positioningDataValue().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "positioningDataValue")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          positioningDataValue().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 @BSSGP_Types.Positioning_Data_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Positioning__Data__BSSGP_template* precondition = new Positioning__Data__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    Positioning__Data__BSSGP_template* implied_template = new Positioning__Data__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Positioning__Data__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.Positioning_Data_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void Positioning__Data__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Positioning_Data_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Positioning_Data_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Positioning_Data_BSSGP");
single_value->field_positioningDataValue.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Positioning_Data_BSSGP");
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 : "@BSSGP_Types.Positioning_Data_BSSGP");
}

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

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

DecipheringKeysValue::DecipheringKeysValue()
{
}

DecipheringKeysValue::DecipheringKeysValue(const BITSTRING& par_cipheringkeyFlag,
    const BITSTRING& par_spare,
    const OCTETSTRING& par_currentDecipheringKeyValue,
    const OCTETSTRING& par_nextDecipheringKeyValue)
  :   field_cipheringkeyFlag(par_cipheringkeyFlag),
  field_spare(par_spare),
  field_currentDecipheringKeyValue(par_currentDecipheringKeyValue),
  field_nextDecipheringKeyValue(par_nextDecipheringKeyValue)
{
}

DecipheringKeysValue::DecipheringKeysValue(const DecipheringKeysValue& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.DecipheringKeysValue.");
if (other_value.cipheringkeyFlag().is_bound()) field_cipheringkeyFlag = other_value.cipheringkeyFlag();
else field_cipheringkeyFlag.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
if (other_value.currentDecipheringKeyValue().is_bound()) field_currentDecipheringKeyValue = other_value.currentDecipheringKeyValue();
else field_currentDecipheringKeyValue.clean_up();
if (other_value.nextDecipheringKeyValue().is_bound()) field_nextDecipheringKeyValue = other_value.nextDecipheringKeyValue();
else field_nextDecipheringKeyValue.clean_up();
}

void DecipheringKeysValue::clean_up()
{
field_cipheringkeyFlag.clean_up();
field_spare.clean_up();
field_currentDecipheringKeyValue.clean_up();
field_nextDecipheringKeyValue.clean_up();
}

const TTCN_Typedescriptor_t* DecipheringKeysValue::get_descriptor() const { return &DecipheringKeysValue_descr_; }
DecipheringKeysValue& DecipheringKeysValue::operator=(const DecipheringKeysValue& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.DecipheringKeysValue.");
  if (other_value.cipheringkeyFlag().is_bound()) field_cipheringkeyFlag = other_value.cipheringkeyFlag();
  else field_cipheringkeyFlag.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
  if (other_value.currentDecipheringKeyValue().is_bound()) field_currentDecipheringKeyValue = other_value.currentDecipheringKeyValue();
  else field_currentDecipheringKeyValue.clean_up();
  if (other_value.nextDecipheringKeyValue().is_bound()) field_nextDecipheringKeyValue = other_value.nextDecipheringKeyValue();
  else field_nextDecipheringKeyValue.clean_up();
}
return *this;
}

boolean DecipheringKeysValue::operator==(const DecipheringKeysValue& other_value) const
{
return field_cipheringkeyFlag==other_value.field_cipheringkeyFlag
  && field_spare==other_value.field_spare
  && field_currentDecipheringKeyValue==other_value.field_currentDecipheringKeyValue
  && field_nextDecipheringKeyValue==other_value.field_nextDecipheringKeyValue;
}

boolean DecipheringKeysValue::is_bound() const
{
return (field_cipheringkeyFlag.is_bound())
  || (field_spare.is_bound())
  || (field_currentDecipheringKeyValue.is_bound())
  || (field_nextDecipheringKeyValue.is_bound());
}
boolean DecipheringKeysValue::is_value() const
{
return field_cipheringkeyFlag.is_value()
  && field_spare.is_value()
  && field_currentDecipheringKeyValue.is_value()
  && field_nextDecipheringKeyValue.is_value();
}
void DecipheringKeysValue::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ cipheringkeyFlag := ");
field_cipheringkeyFlag.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(", currentDecipheringKeyValue := ");
field_currentDecipheringKeyValue.log();
TTCN_Logger::log_event_str(", nextDecipheringKeyValue := ");
field_nextDecipheringKeyValue.log();
TTCN_Logger::log_event_str(" }");
}

void DecipheringKeysValue::set_implicit_omit()
{
if (cipheringkeyFlag().is_bound()) cipheringkeyFlag().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (currentDecipheringKeyValue().is_bound()) currentDecipheringKeyValue().set_implicit_omit();
if (nextDecipheringKeyValue().is_bound()) nextDecipheringKeyValue().set_implicit_omit();
}

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

void DecipheringKeysValue::encode_text(Text_Buf& text_buf) const
{
field_cipheringkeyFlag.encode_text(text_buf);
field_spare.encode_text(text_buf);
field_currentDecipheringKeyValue.encode_text(text_buf);
field_nextDecipheringKeyValue.encode_text(text_buf);
}

void DecipheringKeysValue::decode_text(Text_Buf& text_buf)
{
field_cipheringkeyFlag.decode_text(text_buf);
field_spare.decode_text(text_buf);
field_currentDecipheringKeyValue.decode_text(text_buf);
field_nextDecipheringKeyValue.decode_text(text_buf);
}

void DecipheringKeysValue::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 DecipheringKeysValue::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 DecipheringKeysValue::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit)
{ (void)no_err;
  int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding);
  limit-=prepaddlength;
  size_t last_decoded_pos = p_buf.get_pos_bit();
  int decoded_length = 0;
  int decoded_field_length = 0;
  raw_order_t local_top_order;
  if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord;
  else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB;
  else local_top_order=ORDER_LSB;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_cipheringkeyFlag.RAW_decode(General__Types::BIT1_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::BIT7_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(General__Types::BIT7_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::OCT7_descr_.raw->forceomit);
  decoded_field_length = field_currentDecipheringKeyValue.RAW_decode(General__Types::OCT7_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, General__Types::OCT7_descr_.raw->forceomit);
  decoded_field_length = field_nextDecipheringKeyValue.RAW_decode(General__Types::OCT7_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 DecipheringKeysValue::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, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::BIT7_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::OCT7_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT7_descr_.raw);
  encoded_length += field_cipheringkeyFlag.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_spare.RAW_encode(General__Types::BIT7_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_currentDecipheringKeyValue.RAW_encode(General__Types::OCT7_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_nextDecipheringKeyValue.RAW_encode(General__Types::OCT7_descr_, *myleaf.body.node.nodes[3]);
  return myleaf.length = encoded_length;
}

struct DecipheringKeysValue_template::single_value_struct {
BITSTRING_template field_cipheringkeyFlag;
BITSTRING_template field_spare;
OCTETSTRING_template field_currentDecipheringKeyValue;
OCTETSTRING_template field_nextDecipheringKeyValue;
};

void DecipheringKeysValue_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_cipheringkeyFlag = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
single_value->field_currentDecipheringKeyValue = ANY_VALUE;
single_value->field_nextDecipheringKeyValue = ANY_VALUE;
}
}
}

void DecipheringKeysValue_template::copy_value(const DecipheringKeysValue& other_value)
{
single_value = new single_value_struct;
if (other_value.cipheringkeyFlag().is_bound()) {
  single_value->field_cipheringkeyFlag = other_value.cipheringkeyFlag();
} else {
  single_value->field_cipheringkeyFlag.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.currentDecipheringKeyValue().is_bound()) {
  single_value->field_currentDecipheringKeyValue = other_value.currentDecipheringKeyValue();
} else {
  single_value->field_currentDecipheringKeyValue.clean_up();
}
if (other_value.nextDecipheringKeyValue().is_bound()) {
  single_value->field_nextDecipheringKeyValue = other_value.nextDecipheringKeyValue();
} else {
  single_value->field_nextDecipheringKeyValue.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void DecipheringKeysValue_template::copy_template(const DecipheringKeysValue_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.cipheringkeyFlag().get_selection()) {
single_value->field_cipheringkeyFlag = other_value.cipheringkeyFlag();
} else {
single_value->field_cipheringkeyFlag.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.currentDecipheringKeyValue().get_selection()) {
single_value->field_currentDecipheringKeyValue = other_value.currentDecipheringKeyValue();
} else {
single_value->field_currentDecipheringKeyValue.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.nextDecipheringKeyValue().get_selection()) {
single_value->field_nextDecipheringKeyValue = other_value.nextDecipheringKeyValue();
} else {
single_value->field_nextDecipheringKeyValue.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 DecipheringKeysValue_template[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 DecipheringKeysValue_template(*other_value.implication_.precondition);
implication_.implied_template = new DecipheringKeysValue_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 @BSSGP_Types.DecipheringKeysValue.");
break;
}
set_selection(other_value);
}

DecipheringKeysValue_template::DecipheringKeysValue_template()
{
}

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

DecipheringKeysValue_template::DecipheringKeysValue_template(const DecipheringKeysValue& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean DecipheringKeysValue_template::match(const DecipheringKeysValue& 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.cipheringkeyFlag().is_bound()) return FALSE;
if(!single_value->field_cipheringkeyFlag.match(other_value.cipheringkeyFlag(), 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.currentDecipheringKeyValue().is_bound()) return FALSE;
if(!single_value->field_currentDecipheringKeyValue.match(other_value.currentDecipheringKeyValue(), legacy))return FALSE;
if(!other_value.nextDecipheringKeyValue().is_bound()) return FALSE;
if(!single_value->field_nextDecipheringKeyValue.match(other_value.nextDecipheringKeyValue(), 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 @BSSGP_Types.DecipheringKeysValue.");
}
return FALSE;
}

boolean DecipheringKeysValue_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_cipheringkeyFlag.is_bound()
 || single_value->field_spare.is_bound()
 || single_value->field_currentDecipheringKeyValue.is_bound()
 || single_value->field_nextDecipheringKeyValue.is_bound();
}

boolean DecipheringKeysValue_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_cipheringkeyFlag.is_value()
 && single_value->field_spare.is_value()
 && single_value->field_currentDecipheringKeyValue.is_value()
 && single_value->field_nextDecipheringKeyValue.is_value();
}

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

DecipheringKeysValue DecipheringKeysValue_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 @BSSGP_Types.DecipheringKeysValue.");
DecipheringKeysValue ret_val;
if (single_value->field_cipheringkeyFlag.is_bound()) {
ret_val.cipheringkeyFlag() = single_value->field_cipheringkeyFlag.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
if (single_value->field_currentDecipheringKeyValue.is_bound()) {
ret_val.currentDecipheringKeyValue() = single_value->field_currentDecipheringKeyValue.valueof();
}
if (single_value->field_nextDecipheringKeyValue.is_bound()) {
ret_val.nextDecipheringKeyValue() = single_value->field_nextDecipheringKeyValue.valueof();
}
return ret_val;
}

void DecipheringKeysValue_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 @BSSGP_Types.DecipheringKeysValue.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new DecipheringKeysValue_template[list_length];
}

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

BITSTRING_template& DecipheringKeysValue_template::cipheringkeyFlag()
{
set_specific();
return single_value->field_cipheringkeyFlag;
}

const BITSTRING_template& DecipheringKeysValue_template::cipheringkeyFlag() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field cipheringkeyFlag of a non-specific template of type @BSSGP_Types.DecipheringKeysValue.");
return single_value->field_cipheringkeyFlag;
}

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

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

OCTETSTRING_template& DecipheringKeysValue_template::currentDecipheringKeyValue()
{
set_specific();
return single_value->field_currentDecipheringKeyValue;
}

const OCTETSTRING_template& DecipheringKeysValue_template::currentDecipheringKeyValue() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field currentDecipheringKeyValue of a non-specific template of type @BSSGP_Types.DecipheringKeysValue.");
return single_value->field_currentDecipheringKeyValue;
}

OCTETSTRING_template& DecipheringKeysValue_template::nextDecipheringKeyValue()
{
set_specific();
return single_value->field_nextDecipheringKeyValue;
}

const OCTETSTRING_template& DecipheringKeysValue_template::nextDecipheringKeyValue() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field nextDecipheringKeyValue of a non-specific template of type @BSSGP_Types.DecipheringKeysValue.");
return single_value->field_nextDecipheringKeyValue;
}

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

void DecipheringKeysValue_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ cipheringkeyFlag := ");
single_value->field_cipheringkeyFlag.log();
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(", currentDecipheringKeyValue := ");
single_value->field_currentDecipheringKeyValue.log();
TTCN_Logger::log_event_str(", nextDecipheringKeyValue := ");
single_value->field_nextDecipheringKeyValue.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 DecipheringKeysValue_template::log_match(const DecipheringKeysValue& 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_cipheringkeyFlag.match(match_value.cipheringkeyFlag(), legacy)){
TTCN_Logger::log_logmatch_info(".cipheringkeyFlag");
single_value->field_cipheringkeyFlag.log_match(match_value.cipheringkeyFlag(), 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_currentDecipheringKeyValue.match(match_value.currentDecipheringKeyValue(), legacy)){
TTCN_Logger::log_logmatch_info(".currentDecipheringKeyValue");
single_value->field_currentDecipheringKeyValue.log_match(match_value.currentDecipheringKeyValue(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_nextDecipheringKeyValue.match(match_value.nextDecipheringKeyValue(), legacy)){
TTCN_Logger::log_logmatch_info(".nextDecipheringKeyValue");
single_value->field_nextDecipheringKeyValue.log_match(match_value.nextDecipheringKeyValue(), 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("{ cipheringkeyFlag := ");
single_value->field_cipheringkeyFlag.log_match(match_value.cipheringkeyFlag(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(", currentDecipheringKeyValue := ");
single_value->field_currentDecipheringKeyValue.log_match(match_value.currentDecipheringKeyValue(), legacy);
TTCN_Logger::log_event_str(", nextDecipheringKeyValue := ");
single_value->field_nextDecipheringKeyValue.log_match(match_value.nextDecipheringKeyValue(), 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 DecipheringKeysValue_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (cipheringkeyFlag().is_bound()) cipheringkeyFlag().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
if (currentDecipheringKeyValue().is_bound()) currentDecipheringKeyValue().set_implicit_omit();
if (nextDecipheringKeyValue().is_bound()) nextDecipheringKeyValue().set_implicit_omit();
}

void DecipheringKeysValue_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_cipheringkeyFlag.encode_text(text_buf);
single_value->field_spare.encode_text(text_buf);
single_value->field_currentDecipheringKeyValue.encode_text(text_buf);
single_value->field_nextDecipheringKeyValue.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 @BSSGP_Types.DecipheringKeysValue.");
}
}

void DecipheringKeysValue_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_cipheringkeyFlag.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
single_value->field_currentDecipheringKeyValue.decode_text(text_buf);
single_value->field_nextDecipheringKeyValue.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 DecipheringKeysValue_template[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 @BSSGP_Types.DecipheringKeysValue.");
}
}

void DecipheringKeysValue_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: {
    DecipheringKeysValue_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 @BSSGP_Types.DecipheringKeysValue 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) cipheringkeyFlag().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) currentDecipheringKeyValue().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) nextDecipheringKeyValue().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(), "cipheringkeyFlag")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cipheringkeyFlag().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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(), "currentDecipheringKeyValue")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          currentDecipheringKeyValue().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "nextDecipheringKeyValue")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          nextDecipheringKeyValue().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 @BSSGP_Types.DecipheringKeysValue: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    DecipheringKeysValue_template* precondition = new DecipheringKeysValue_template;
    precondition->set_param(*param.get_elem(0));
    DecipheringKeysValue_template* implied_template = new DecipheringKeysValue_template;
    implied_template->set_param(*param.get_elem(1));
    *this = DecipheringKeysValue_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.DecipheringKeysValue");
  }
  is_ifpresent = param.get_ifpresent();
}

void DecipheringKeysValue_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_cipheringkeyFlag.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.DecipheringKeysValue");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.DecipheringKeysValue");
single_value->field_currentDecipheringKeyValue.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.DecipheringKeysValue");
single_value->field_nextDecipheringKeyValue.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.DecipheringKeysValue");
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 : "@BSSGP_Types.DecipheringKeysValue");
}

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

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

Deciphering__Keys__BSSGP::Deciphering__Keys__BSSGP()
{
}

Deciphering__Keys__BSSGP::Deciphering__Keys__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const DecipheringKeysValue& par_decipheringKeysValue)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_decipheringKeysValue(par_decipheringKeysValue)
{
}

Deciphering__Keys__BSSGP::Deciphering__Keys__BSSGP(const Deciphering__Keys__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.Deciphering_Keys_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.decipheringKeysValue().is_bound()) field_decipheringKeysValue = other_value.decipheringKeysValue();
else field_decipheringKeysValue.clean_up();
}

void Deciphering__Keys__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_decipheringKeysValue.clean_up();
}

const TTCN_Typedescriptor_t* Deciphering__Keys__BSSGP::get_descriptor() const { return &Deciphering__Keys__BSSGP_descr_; }
Deciphering__Keys__BSSGP& Deciphering__Keys__BSSGP::operator=(const Deciphering__Keys__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.Deciphering_Keys_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.decipheringKeysValue().is_bound()) field_decipheringKeysValue = other_value.decipheringKeysValue();
  else field_decipheringKeysValue.clean_up();
}
return *this;
}

boolean Deciphering__Keys__BSSGP::operator==(const Deciphering__Keys__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_decipheringKeysValue==other_value.field_decipheringKeysValue;
}

boolean Deciphering__Keys__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_decipheringKeysValue.is_bound());
}
boolean Deciphering__Keys__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_decipheringKeysValue.is_value();
}
void Deciphering__Keys__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", decipheringKeysValue := ");
field_decipheringKeysValue.log();
TTCN_Logger::log_event_str(" }");
}

void Deciphering__Keys__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (decipheringKeysValue().is_bound()) decipheringKeysValue().set_implicit_omit();
}

void Deciphering__Keys__BSSGP::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 @BSSGP_Types.Deciphering_Keys_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) decipheringKeysValue().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "decipheringKeysValue")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          decipheringKeysValue().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 @BSSGP_Types.Deciphering_Keys_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.Deciphering_Keys_BSSGP");
  }
}

void Deciphering__Keys__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_decipheringKeysValue.encode_text(text_buf);
}

void Deciphering__Keys__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_decipheringKeysValue.decode_text(text_buf);
}

void Deciphering__Keys__BSSGP::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 Deciphering__Keys__BSSGP::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 Deciphering__Keys__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, Deciphering__Keys__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(Deciphering__Keys__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, Deciphering__Keys__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(Deciphering__Keys__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, DecipheringKeysValue_descr_.raw->forceomit);
  decoded_field_length = field_decipheringKeysValue.RAW_decode(DecipheringKeysValue_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_124) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int Deciphering__Keys__BSSGP::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Deciphering__Keys__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Deciphering__Keys__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, DecipheringKeysValue_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(Deciphering__Keys__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(Deciphering__Keys__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_decipheringKeysValue.RAW_encode(DecipheringKeysValue_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Deciphering__Keys__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(Deciphering__Keys__BSSGP_ext_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_iEI !=  os_124) {
  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){
   os_124.RAW_encode(General__Types::OCT1_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 Deciphering__Keys__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
DecipheringKeysValue_template field_decipheringKeysValue;
};

void Deciphering__Keys__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_decipheringKeysValue = ANY_VALUE;
}
}
}

void Deciphering__Keys__BSSGP_template::copy_value(const Deciphering__Keys__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.decipheringKeysValue().is_bound()) {
  single_value->field_decipheringKeysValue = other_value.decipheringKeysValue();
} else {
  single_value->field_decipheringKeysValue.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void Deciphering__Keys__BSSGP_template::copy_template(const Deciphering__Keys__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.decipheringKeysValue().get_selection()) {
single_value->field_decipheringKeysValue = other_value.decipheringKeysValue();
} else {
single_value->field_decipheringKeysValue.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 Deciphering__Keys__BSSGP_template[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 Deciphering__Keys__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new Deciphering__Keys__BSSGP_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 @BSSGP_Types.Deciphering_Keys_BSSGP.");
break;
}
set_selection(other_value);
}

Deciphering__Keys__BSSGP_template::Deciphering__Keys__BSSGP_template()
{
}

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

Deciphering__Keys__BSSGP_template::Deciphering__Keys__BSSGP_template(const Deciphering__Keys__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean Deciphering__Keys__BSSGP_template::match(const Deciphering__Keys__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.decipheringKeysValue().is_bound()) return FALSE;
if(!single_value->field_decipheringKeysValue.match(other_value.decipheringKeysValue(), 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 @BSSGP_Types.Deciphering_Keys_BSSGP.");
}
return FALSE;
}

boolean Deciphering__Keys__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_decipheringKeysValue.is_bound();
}

boolean Deciphering__Keys__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_decipheringKeysValue.is_value();
}

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

Deciphering__Keys__BSSGP Deciphering__Keys__BSSGP_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 @BSSGP_Types.Deciphering_Keys_BSSGP.");
Deciphering__Keys__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_decipheringKeysValue.is_bound()) {
ret_val.decipheringKeysValue() = single_value->field_decipheringKeysValue.valueof();
}
return ret_val;
}

void Deciphering__Keys__BSSGP_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 @BSSGP_Types.Deciphering_Keys_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new Deciphering__Keys__BSSGP_template[list_length];
}

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

OCTETSTRING_template& Deciphering__Keys__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& Deciphering__Keys__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.Deciphering_Keys_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& Deciphering__Keys__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& Deciphering__Keys__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.Deciphering_Keys_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& Deciphering__Keys__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& Deciphering__Keys__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.Deciphering_Keys_BSSGP.");
return single_value->field_lengthIndicator;
}

DecipheringKeysValue_template& Deciphering__Keys__BSSGP_template::decipheringKeysValue()
{
set_specific();
return single_value->field_decipheringKeysValue;
}

const DecipheringKeysValue_template& Deciphering__Keys__BSSGP_template::decipheringKeysValue() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field decipheringKeysValue of a non-specific template of type @BSSGP_Types.Deciphering_Keys_BSSGP.");
return single_value->field_decipheringKeysValue;
}

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

void Deciphering__Keys__BSSGP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", decipheringKeysValue := ");
single_value->field_decipheringKeysValue.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 Deciphering__Keys__BSSGP_template::log_match(const Deciphering__Keys__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_decipheringKeysValue.match(match_value.decipheringKeysValue(), legacy)){
TTCN_Logger::log_logmatch_info(".decipheringKeysValue");
single_value->field_decipheringKeysValue.log_match(match_value.decipheringKeysValue(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", decipheringKeysValue := ");
single_value->field_decipheringKeysValue.log_match(match_value.decipheringKeysValue(), 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 Deciphering__Keys__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (decipheringKeysValue().is_bound()) decipheringKeysValue().set_implicit_omit();
}

void Deciphering__Keys__BSSGP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_decipheringKeysValue.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 @BSSGP_Types.Deciphering_Keys_BSSGP.");
}
}

void Deciphering__Keys__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_decipheringKeysValue.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 Deciphering__Keys__BSSGP_template[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 @BSSGP_Types.Deciphering_Keys_BSSGP.");
}
}

void Deciphering__Keys__BSSGP_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: {
    Deciphering__Keys__BSSGP_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 @BSSGP_Types.Deciphering_Keys_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) decipheringKeysValue().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "decipheringKeysValue")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          decipheringKeysValue().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 @BSSGP_Types.Deciphering_Keys_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    Deciphering__Keys__BSSGP_template* precondition = new Deciphering__Keys__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    Deciphering__Keys__BSSGP_template* implied_template = new Deciphering__Keys__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = Deciphering__Keys__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.Deciphering_Keys_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void Deciphering__Keys__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Deciphering_Keys_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Deciphering_Keys_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Deciphering_Keys_BSSGP");
single_value->field_decipheringKeysValue.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.Deciphering_Keys_BSSGP");
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 : "@BSSGP_Types.Deciphering_Keys_BSSGP");
}

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

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

LCS__Priority__BSSGP::LCS__Priority__BSSGP()
{
}

LCS__Priority__BSSGP::LCS__Priority__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_priority__Value)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_priority__Value(par_priority__Value)
{
}

LCS__Priority__BSSGP::LCS__Priority__BSSGP(const LCS__Priority__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.LCS_Priority_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.priority__Value().is_bound()) field_priority__Value = other_value.priority__Value();
else field_priority__Value.clean_up();
}

void LCS__Priority__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_priority__Value.clean_up();
}

const TTCN_Typedescriptor_t* LCS__Priority__BSSGP::get_descriptor() const { return &LCS__Priority__BSSGP_descr_; }
LCS__Priority__BSSGP& LCS__Priority__BSSGP::operator=(const LCS__Priority__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.LCS_Priority_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.priority__Value().is_bound()) field_priority__Value = other_value.priority__Value();
  else field_priority__Value.clean_up();
}
return *this;
}

boolean LCS__Priority__BSSGP::operator==(const LCS__Priority__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_priority__Value==other_value.field_priority__Value;
}

boolean LCS__Priority__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_priority__Value.is_bound());
}
boolean LCS__Priority__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_priority__Value.is_value();
}
void LCS__Priority__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", priority_Value := ");
field_priority__Value.log();
TTCN_Logger::log_event_str(" }");
}

void LCS__Priority__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (priority__Value().is_bound()) priority__Value().set_implicit_omit();
}

void LCS__Priority__BSSGP::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 @BSSGP_Types.LCS_Priority_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) priority__Value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "priority_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          priority__Value().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 @BSSGP_Types.LCS_Priority_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.LCS_Priority_BSSGP");
  }
}

void LCS__Priority__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_priority__Value.encode_text(text_buf);
}

void LCS__Priority__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_priority__Value.decode_text(text_buf);
}

void LCS__Priority__BSSGP::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 LCS__Priority__BSSGP::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 LCS__Priority__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, LCS__Priority__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(LCS__Priority__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, LCS__Priority__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(LCS__Priority__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_priority__Value.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_117) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int LCS__Priority__BSSGP::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, LCS__Priority__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, LCS__Priority__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT1_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(LCS__Priority__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(LCS__Priority__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_priority__Value.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(LCS__Priority__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(LCS__Priority__BSSGP_ext_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_iEI !=  os_117) {
  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){
   os_117.RAW_encode(General__Types::OCT1_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 LCS__Priority__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_priority__Value;
};

void LCS__Priority__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_priority__Value = ANY_VALUE;
}
}
}

void LCS__Priority__BSSGP_template::copy_value(const LCS__Priority__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.priority__Value().is_bound()) {
  single_value->field_priority__Value = other_value.priority__Value();
} else {
  single_value->field_priority__Value.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void LCS__Priority__BSSGP_template::copy_template(const LCS__Priority__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.priority__Value().get_selection()) {
single_value->field_priority__Value = other_value.priority__Value();
} else {
single_value->field_priority__Value.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 LCS__Priority__BSSGP_template[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 LCS__Priority__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new LCS__Priority__BSSGP_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 @BSSGP_Types.LCS_Priority_BSSGP.");
break;
}
set_selection(other_value);
}

LCS__Priority__BSSGP_template::LCS__Priority__BSSGP_template()
{
}

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

LCS__Priority__BSSGP_template::LCS__Priority__BSSGP_template(const LCS__Priority__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean LCS__Priority__BSSGP_template::match(const LCS__Priority__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.priority__Value().is_bound()) return FALSE;
if(!single_value->field_priority__Value.match(other_value.priority__Value(), 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 @BSSGP_Types.LCS_Priority_BSSGP.");
}
return FALSE;
}

boolean LCS__Priority__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_priority__Value.is_bound();
}

boolean LCS__Priority__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_priority__Value.is_value();
}

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

LCS__Priority__BSSGP LCS__Priority__BSSGP_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 @BSSGP_Types.LCS_Priority_BSSGP.");
LCS__Priority__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_priority__Value.is_bound()) {
ret_val.priority__Value() = single_value->field_priority__Value.valueof();
}
return ret_val;
}

void LCS__Priority__BSSGP_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 @BSSGP_Types.LCS_Priority_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new LCS__Priority__BSSGP_template[list_length];
}

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

OCTETSTRING_template& LCS__Priority__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& LCS__Priority__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.LCS_Priority_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& LCS__Priority__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& LCS__Priority__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.LCS_Priority_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& LCS__Priority__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& LCS__Priority__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.LCS_Priority_BSSGP.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& LCS__Priority__BSSGP_template::priority__Value()
{
set_specific();
return single_value->field_priority__Value;
}

const OCTETSTRING_template& LCS__Priority__BSSGP_template::priority__Value() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field priority_Value of a non-specific template of type @BSSGP_Types.LCS_Priority_BSSGP.");
return single_value->field_priority__Value;
}

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

void LCS__Priority__BSSGP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", priority_Value := ");
single_value->field_priority__Value.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 LCS__Priority__BSSGP_template::log_match(const LCS__Priority__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_priority__Value.match(match_value.priority__Value(), legacy)){
TTCN_Logger::log_logmatch_info(".priority_Value");
single_value->field_priority__Value.log_match(match_value.priority__Value(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", priority_Value := ");
single_value->field_priority__Value.log_match(match_value.priority__Value(), 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 LCS__Priority__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (priority__Value().is_bound()) priority__Value().set_implicit_omit();
}

void LCS__Priority__BSSGP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_priority__Value.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 @BSSGP_Types.LCS_Priority_BSSGP.");
}
}

void LCS__Priority__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_priority__Value.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 LCS__Priority__BSSGP_template[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 @BSSGP_Types.LCS_Priority_BSSGP.");
}
}

void LCS__Priority__BSSGP_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: {
    LCS__Priority__BSSGP_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 @BSSGP_Types.LCS_Priority_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) priority__Value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "priority_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          priority__Value().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 @BSSGP_Types.LCS_Priority_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    LCS__Priority__BSSGP_template* precondition = new LCS__Priority__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    LCS__Priority__BSSGP_template* implied_template = new LCS__Priority__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = LCS__Priority__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.LCS_Priority_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void LCS__Priority__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Priority_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Priority_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Priority_BSSGP");
single_value->field_priority__Value.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Priority_BSSGP");
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 : "@BSSGP_Types.LCS_Priority_BSSGP");
}

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

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

LCS__Cause__BSSGP::LCS__Cause__BSSGP()
{
}

LCS__Cause__BSSGP::LCS__Cause__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_cause__Value,
    const OPTIONAL< OCTETSTRING >& par_diagnostic__Value)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_cause__Value(par_cause__Value),
  field_diagnostic__Value(par_diagnostic__Value)
{
}

LCS__Cause__BSSGP::LCS__Cause__BSSGP(const LCS__Cause__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.LCS_Cause_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.cause__Value().is_bound()) field_cause__Value = other_value.cause__Value();
else field_cause__Value.clean_up();
if (other_value.diagnostic__Value().is_bound()) field_diagnostic__Value = other_value.diagnostic__Value();
else field_diagnostic__Value.clean_up();
}

void LCS__Cause__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_cause__Value.clean_up();
field_diagnostic__Value.clean_up();
}

const TTCN_Typedescriptor_t* LCS__Cause__BSSGP::get_descriptor() const { return &LCS__Cause__BSSGP_descr_; }
LCS__Cause__BSSGP& LCS__Cause__BSSGP::operator=(const LCS__Cause__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.LCS_Cause_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.cause__Value().is_bound()) field_cause__Value = other_value.cause__Value();
  else field_cause__Value.clean_up();
  if (other_value.diagnostic__Value().is_bound()) field_diagnostic__Value = other_value.diagnostic__Value();
  else field_diagnostic__Value.clean_up();
}
return *this;
}

boolean LCS__Cause__BSSGP::operator==(const LCS__Cause__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_cause__Value==other_value.field_cause__Value
  && field_diagnostic__Value==other_value.field_diagnostic__Value;
}

boolean LCS__Cause__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_cause__Value.is_bound())
  || (OPTIONAL_OMIT == field_diagnostic__Value.get_selection() || field_diagnostic__Value.is_bound());
}
boolean LCS__Cause__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_cause__Value.is_value()
  && (OPTIONAL_OMIT == field_diagnostic__Value.get_selection() || field_diagnostic__Value.is_value());
}
int LCS__Cause__BSSGP::size_of() const
{
  int ret_val = 4;
  if (field_diagnostic__Value.ispresent()) ret_val++;
  return ret_val;
}

void LCS__Cause__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", cause_Value := ");
field_cause__Value.log();
TTCN_Logger::log_event_str(", diagnostic_Value := ");
field_diagnostic__Value.log();
TTCN_Logger::log_event_str(" }");
}

void LCS__Cause__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (cause__Value().is_bound()) cause__Value().set_implicit_omit();
if (!diagnostic__Value().is_bound()) diagnostic__Value() = OMIT_VALUE;
else diagnostic__Value().set_implicit_omit();
}

void LCS__Cause__BSSGP::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 @BSSGP_Types.LCS_Cause_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) cause__Value().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) diagnostic__Value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cause_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cause__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(), "diagnostic_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          diagnostic__Value().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 @BSSGP_Types.LCS_Cause_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.LCS_Cause_BSSGP");
  }
}

void LCS__Cause__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_cause__Value.encode_text(text_buf);
field_diagnostic__Value.encode_text(text_buf);
}

void LCS__Cause__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_cause__Value.decode_text(text_buf);
field_diagnostic__Value.decode_text(text_buf);
}

void LCS__Cause__BSSGP::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 LCS__Cause__BSSGP::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 LCS__Cause__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, LCS__Cause__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(LCS__Cause__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, LCS__Cause__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(LCS__Cause__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_cause__Value.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(4)) {
    field_diagnostic__Value = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_diagnostic__Value().RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_4_force_omit);
  if (decoded_field_length < 1) {
  field_diagnostic__Value = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_diagnostic__Value=OMIT_VALUE;
  if (field_iEI !=  os_125) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int LCS__Cause__BSSGP::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 5;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(5);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, LCS__Cause__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, LCS__Cause__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT1_descr_.raw);
  if (field_diagnostic__Value.ispresent()) {
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::OCT1_descr_.raw);
  }
  else myleaf.body.node.nodes[4] = NULL;
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(LCS__Cause__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(LCS__Cause__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_cause__Value.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[3]);
  if (field_diagnostic__Value.ispresent()) {
  encoded_length += field_diagnostic__Value().RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[4]);
  }
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 2;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(2);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  if (field_diagnostic__Value.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[4]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[4]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].pos = 0;
  }
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(LCS__Cause__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(LCS__Cause__BSSGP_ext_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_iEI !=  os_125) {
  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){
   os_125.RAW_encode(General__Types::OCT1_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 LCS__Cause__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_cause__Value;
OCTETSTRING_template field_diagnostic__Value;
};

void LCS__Cause__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_cause__Value = ANY_VALUE;
single_value->field_diagnostic__Value = ANY_OR_OMIT;
}
}
}

void LCS__Cause__BSSGP_template::copy_value(const LCS__Cause__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.cause__Value().is_bound()) {
  single_value->field_cause__Value = other_value.cause__Value();
} else {
  single_value->field_cause__Value.clean_up();
}
if (other_value.diagnostic__Value().is_bound()) {
  if (other_value.diagnostic__Value().ispresent()) single_value->field_diagnostic__Value = other_value.diagnostic__Value()();
  else single_value->field_diagnostic__Value = OMIT_VALUE;
} else {
  single_value->field_diagnostic__Value.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void LCS__Cause__BSSGP_template::copy_template(const LCS__Cause__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.cause__Value().get_selection()) {
single_value->field_cause__Value = other_value.cause__Value();
} else {
single_value->field_cause__Value.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.diagnostic__Value().get_selection()) {
single_value->field_diagnostic__Value = other_value.diagnostic__Value();
} else {
single_value->field_diagnostic__Value.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 LCS__Cause__BSSGP_template[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 LCS__Cause__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new LCS__Cause__BSSGP_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 @BSSGP_Types.LCS_Cause_BSSGP.");
break;
}
set_selection(other_value);
}

LCS__Cause__BSSGP_template::LCS__Cause__BSSGP_template()
{
}

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

LCS__Cause__BSSGP_template::LCS__Cause__BSSGP_template(const LCS__Cause__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean LCS__Cause__BSSGP_template::match(const LCS__Cause__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.cause__Value().is_bound()) return FALSE;
if(!single_value->field_cause__Value.match(other_value.cause__Value(), legacy))return FALSE;
if(!other_value.diagnostic__Value().is_bound()) return FALSE;
if((other_value.diagnostic__Value().ispresent() ? !single_value->field_diagnostic__Value.match((const OCTETSTRING&)other_value.diagnostic__Value(), legacy) : !single_value->field_diagnostic__Value.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 @BSSGP_Types.LCS_Cause_BSSGP.");
}
return FALSE;
}

boolean LCS__Cause__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_cause__Value.is_bound()
 || (single_value->field_diagnostic__Value.is_omit() || single_value->field_diagnostic__Value.is_bound());
}

boolean LCS__Cause__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_cause__Value.is_value()
 && (single_value->field_diagnostic__Value.is_omit() || single_value->field_diagnostic__Value.is_value());
}

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

LCS__Cause__BSSGP LCS__Cause__BSSGP_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 @BSSGP_Types.LCS_Cause_BSSGP.");
LCS__Cause__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_cause__Value.is_bound()) {
ret_val.cause__Value() = single_value->field_cause__Value.valueof();
}
if (single_value->field_diagnostic__Value.is_omit()) ret_val.diagnostic__Value() = OMIT_VALUE;
else if (single_value->field_diagnostic__Value.is_bound()) {
ret_val.diagnostic__Value() = single_value->field_diagnostic__Value.valueof();
}
return ret_val;
}

void LCS__Cause__BSSGP_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 @BSSGP_Types.LCS_Cause_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new LCS__Cause__BSSGP_template[list_length];
}

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

OCTETSTRING_template& LCS__Cause__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& LCS__Cause__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.LCS_Cause_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& LCS__Cause__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& LCS__Cause__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.LCS_Cause_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& LCS__Cause__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& LCS__Cause__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.LCS_Cause_BSSGP.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& LCS__Cause__BSSGP_template::cause__Value()
{
set_specific();
return single_value->field_cause__Value;
}

const OCTETSTRING_template& LCS__Cause__BSSGP_template::cause__Value() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field cause_Value of a non-specific template of type @BSSGP_Types.LCS_Cause_BSSGP.");
return single_value->field_cause__Value;
}

OCTETSTRING_template& LCS__Cause__BSSGP_template::diagnostic__Value()
{
set_specific();
return single_value->field_diagnostic__Value;
}

const OCTETSTRING_template& LCS__Cause__BSSGP_template::diagnostic__Value() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field diagnostic_Value of a non-specific template of type @BSSGP_Types.LCS_Cause_BSSGP.");
return single_value->field_diagnostic__Value;
}

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

void LCS__Cause__BSSGP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", cause_Value := ");
single_value->field_cause__Value.log();
TTCN_Logger::log_event_str(", diagnostic_Value := ");
single_value->field_diagnostic__Value.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 LCS__Cause__BSSGP_template::log_match(const LCS__Cause__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_cause__Value.match(match_value.cause__Value(), legacy)){
TTCN_Logger::log_logmatch_info(".cause_Value");
single_value->field_cause__Value.log_match(match_value.cause__Value(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.diagnostic__Value().ispresent()){
if(!single_value->field_diagnostic__Value.match(match_value.diagnostic__Value(), legacy)){
TTCN_Logger::log_logmatch_info(".diagnostic_Value");
single_value->field_diagnostic__Value.log_match(match_value.diagnostic__Value(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_diagnostic__Value.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".diagnostic_Value := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_diagnostic__Value.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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", cause_Value := ");
single_value->field_cause__Value.log_match(match_value.cause__Value(), legacy);
TTCN_Logger::log_event_str(", diagnostic_Value := ");
if (match_value.diagnostic__Value().ispresent()) {
single_value->field_diagnostic__Value.log_match(match_value.diagnostic__Value(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_diagnostic__Value.log();
if (single_value->field_diagnostic__Value.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 LCS__Cause__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (cause__Value().is_bound()) cause__Value().set_implicit_omit();
if (!diagnostic__Value().is_bound()) diagnostic__Value() = OMIT_VALUE;
else diagnostic__Value().set_implicit_omit();
}

void LCS__Cause__BSSGP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_cause__Value.encode_text(text_buf);
single_value->field_diagnostic__Value.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 @BSSGP_Types.LCS_Cause_BSSGP.");
}
}

void LCS__Cause__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_cause__Value.decode_text(text_buf);
single_value->field_diagnostic__Value.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 LCS__Cause__BSSGP_template[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 @BSSGP_Types.LCS_Cause_BSSGP.");
}
}

void LCS__Cause__BSSGP_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: {
    LCS__Cause__BSSGP_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 @BSSGP_Types.LCS_Cause_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) cause__Value().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) diagnostic__Value().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "cause_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          cause__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(), "diagnostic_Value")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          diagnostic__Value().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 @BSSGP_Types.LCS_Cause_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    LCS__Cause__BSSGP_template* precondition = new LCS__Cause__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    LCS__Cause__BSSGP_template* implied_template = new LCS__Cause__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = LCS__Cause__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.LCS_Cause_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void LCS__Cause__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Cause_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Cause_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Cause_BSSGP");
single_value->field_cause__Value.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Cause_BSSGP");
single_value->field_diagnostic__Value.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Cause_BSSGP");
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 : "@BSSGP_Types.LCS_Cause_BSSGP");
}

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

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

LCS__Capability__BSSGP::LCS__Capability__BSSGP()
{
}

LCS__Capability__BSSGP::LCS__Capability__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const BITSTRING& par_gPS__C,
    const BITSTRING& par_gPS__B,
    const BITSTRING& par_gPS__A,
    const BITSTRING& par_oTD__B,
    const BITSTRING& par_oTD__A,
    const BITSTRING& par_spare)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_gPS__C(par_gPS__C),
  field_gPS__B(par_gPS__B),
  field_gPS__A(par_gPS__A),
  field_oTD__B(par_oTD__B),
  field_oTD__A(par_oTD__A),
  field_spare(par_spare)
{
}

LCS__Capability__BSSGP::LCS__Capability__BSSGP(const LCS__Capability__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.LCS_Capability_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.gPS__C().is_bound()) field_gPS__C = other_value.gPS__C();
else field_gPS__C.clean_up();
if (other_value.gPS__B().is_bound()) field_gPS__B = other_value.gPS__B();
else field_gPS__B.clean_up();
if (other_value.gPS__A().is_bound()) field_gPS__A = other_value.gPS__A();
else field_gPS__A.clean_up();
if (other_value.oTD__B().is_bound()) field_oTD__B = other_value.oTD__B();
else field_oTD__B.clean_up();
if (other_value.oTD__A().is_bound()) field_oTD__A = other_value.oTD__A();
else field_oTD__A.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
}

void LCS__Capability__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_gPS__C.clean_up();
field_gPS__B.clean_up();
field_gPS__A.clean_up();
field_oTD__B.clean_up();
field_oTD__A.clean_up();
field_spare.clean_up();
}

const TTCN_Typedescriptor_t* LCS__Capability__BSSGP::get_descriptor() const { return &LCS__Capability__BSSGP_descr_; }
LCS__Capability__BSSGP& LCS__Capability__BSSGP::operator=(const LCS__Capability__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.LCS_Capability_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.gPS__C().is_bound()) field_gPS__C = other_value.gPS__C();
  else field_gPS__C.clean_up();
  if (other_value.gPS__B().is_bound()) field_gPS__B = other_value.gPS__B();
  else field_gPS__B.clean_up();
  if (other_value.gPS__A().is_bound()) field_gPS__A = other_value.gPS__A();
  else field_gPS__A.clean_up();
  if (other_value.oTD__B().is_bound()) field_oTD__B = other_value.oTD__B();
  else field_oTD__B.clean_up();
  if (other_value.oTD__A().is_bound()) field_oTD__A = other_value.oTD__A();
  else field_oTD__A.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
}
return *this;
}

boolean LCS__Capability__BSSGP::operator==(const LCS__Capability__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_gPS__C==other_value.field_gPS__C
  && field_gPS__B==other_value.field_gPS__B
  && field_gPS__A==other_value.field_gPS__A
  && field_oTD__B==other_value.field_oTD__B
  && field_oTD__A==other_value.field_oTD__A
  && field_spare==other_value.field_spare;
}

boolean LCS__Capability__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_gPS__C.is_bound())
  || (field_gPS__B.is_bound())
  || (field_gPS__A.is_bound())
  || (field_oTD__B.is_bound())
  || (field_oTD__A.is_bound())
  || (field_spare.is_bound());
}
boolean LCS__Capability__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_gPS__C.is_value()
  && field_gPS__B.is_value()
  && field_gPS__A.is_value()
  && field_oTD__B.is_value()
  && field_oTD__A.is_value()
  && field_spare.is_value();
}
void LCS__Capability__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", gPS_C := ");
field_gPS__C.log();
TTCN_Logger::log_event_str(", gPS_B := ");
field_gPS__B.log();
TTCN_Logger::log_event_str(", gPS_A := ");
field_gPS__A.log();
TTCN_Logger::log_event_str(", oTD_B := ");
field_oTD__B.log();
TTCN_Logger::log_event_str(", oTD_A := ");
field_oTD__A.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(" }");
}

void LCS__Capability__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (gPS__C().is_bound()) gPS__C().set_implicit_omit();
if (gPS__B().is_bound()) gPS__B().set_implicit_omit();
if (gPS__A().is_bound()) gPS__A().set_implicit_omit();
if (oTD__B().is_bound()) oTD__B().set_implicit_omit();
if (oTD__A().is_bound()) oTD__A().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void LCS__Capability__BSSGP::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (9<param.get_size()) {
      param.error("record value of type @BSSGP_Types.LCS_Capability_BSSGP has 9 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) gPS__C().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) gPS__B().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) gPS__A().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) oTD__B().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) oTD__A().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(8));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gPS_C")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gPS__C().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gPS_B")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gPS__B().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gPS_A")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gPS__A().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "oTD_B")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          oTD__B().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "oTD_A")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          oTD__A().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @BSSGP_Types.LCS_Capability_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.LCS_Capability_BSSGP");
  }
}

void LCS__Capability__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_gPS__C.encode_text(text_buf);
field_gPS__B.encode_text(text_buf);
field_gPS__A.encode_text(text_buf);
field_oTD__B.encode_text(text_buf);
field_oTD__A.encode_text(text_buf);
field_spare.encode_text(text_buf);
}

void LCS__Capability__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_gPS__C.decode_text(text_buf);
field_gPS__B.decode_text(text_buf);
field_gPS__A.decode_text(text_buf);
field_oTD__B.decode_text(text_buf);
field_oTD__A.decode_text(text_buf);
field_spare.decode_text(text_buf);
}

void LCS__Capability__BSSGP::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 LCS__Capability__BSSGP::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 LCS__Capability__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, LCS__Capability__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(LCS__Capability__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, LCS__Capability__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(LCS__Capability__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_gPS__C.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_gPS__B.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_gPS__A.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, no_err, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_6_force_omit(6, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_oTD__B.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_7_force_omit(7, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_oTD__A.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, no_err, -1, TRUE, &field_7_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_8_force_omit(8, force_omit, General__Types::BIT3_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(General__Types::BIT3_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_116) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int LCS__Capability__BSSGP::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 9;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(9);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, LCS__Capability__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, LCS__Capability__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, General__Types::BIT3_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(LCS__Capability__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(LCS__Capability__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_gPS__C.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_gPS__B.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_gPS__A.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[5]);
  encoded_length += field_oTD__B.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[6]);
  encoded_length += field_oTD__A.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[7]);
  encoded_length += field_spare.RAW_encode(General__Types::BIT3_descr_, *myleaf.body.node.nodes[8]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 6;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(6);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[4]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[4]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[5]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[5]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[6]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[6]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[4].level = myleaf.body.node.nodes[7]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[4].pos = myleaf.body.node.nodes[7]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[5].level = myleaf.body.node.nodes[8]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[5].pos = myleaf.body.node.nodes[8]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(LCS__Capability__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(LCS__Capability__BSSGP_ext_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_iEI !=  os_116) {
  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){
   os_116.RAW_encode(General__Types::OCT1_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 LCS__Capability__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
BITSTRING_template field_gPS__C;
BITSTRING_template field_gPS__B;
BITSTRING_template field_gPS__A;
BITSTRING_template field_oTD__B;
BITSTRING_template field_oTD__A;
BITSTRING_template field_spare;
};

void LCS__Capability__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_gPS__C = ANY_VALUE;
single_value->field_gPS__B = ANY_VALUE;
single_value->field_gPS__A = ANY_VALUE;
single_value->field_oTD__B = ANY_VALUE;
single_value->field_oTD__A = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
}
}
}

void LCS__Capability__BSSGP_template::copy_value(const LCS__Capability__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.gPS__C().is_bound()) {
  single_value->field_gPS__C = other_value.gPS__C();
} else {
  single_value->field_gPS__C.clean_up();
}
if (other_value.gPS__B().is_bound()) {
  single_value->field_gPS__B = other_value.gPS__B();
} else {
  single_value->field_gPS__B.clean_up();
}
if (other_value.gPS__A().is_bound()) {
  single_value->field_gPS__A = other_value.gPS__A();
} else {
  single_value->field_gPS__A.clean_up();
}
if (other_value.oTD__B().is_bound()) {
  single_value->field_oTD__B = other_value.oTD__B();
} else {
  single_value->field_oTD__B.clean_up();
}
if (other_value.oTD__A().is_bound()) {
  single_value->field_oTD__A = other_value.oTD__A();
} else {
  single_value->field_oTD__A.clean_up();
}
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void LCS__Capability__BSSGP_template::copy_template(const LCS__Capability__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.gPS__C().get_selection()) {
single_value->field_gPS__C = other_value.gPS__C();
} else {
single_value->field_gPS__C.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.gPS__B().get_selection()) {
single_value->field_gPS__B = other_value.gPS__B();
} else {
single_value->field_gPS__B.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.gPS__A().get_selection()) {
single_value->field_gPS__A = other_value.gPS__A();
} else {
single_value->field_gPS__A.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.oTD__B().get_selection()) {
single_value->field_oTD__B = other_value.oTD__B();
} else {
single_value->field_oTD__B.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.oTD__A().get_selection()) {
single_value->field_oTD__A = other_value.oTD__A();
} else {
single_value->field_oTD__A.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new LCS__Capability__BSSGP_template[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 LCS__Capability__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new LCS__Capability__BSSGP_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 @BSSGP_Types.LCS_Capability_BSSGP.");
break;
}
set_selection(other_value);
}

LCS__Capability__BSSGP_template::LCS__Capability__BSSGP_template()
{
}

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

LCS__Capability__BSSGP_template::LCS__Capability__BSSGP_template(const LCS__Capability__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean LCS__Capability__BSSGP_template::match(const LCS__Capability__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.gPS__C().is_bound()) return FALSE;
if(!single_value->field_gPS__C.match(other_value.gPS__C(), legacy))return FALSE;
if(!other_value.gPS__B().is_bound()) return FALSE;
if(!single_value->field_gPS__B.match(other_value.gPS__B(), legacy))return FALSE;
if(!other_value.gPS__A().is_bound()) return FALSE;
if(!single_value->field_gPS__A.match(other_value.gPS__A(), legacy))return FALSE;
if(!other_value.oTD__B().is_bound()) return FALSE;
if(!single_value->field_oTD__B.match(other_value.oTD__B(), legacy))return FALSE;
if(!other_value.oTD__A().is_bound()) return FALSE;
if(!single_value->field_oTD__A.match(other_value.oTD__A(), legacy))return FALSE;
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @BSSGP_Types.LCS_Capability_BSSGP.");
}
return FALSE;
}

boolean LCS__Capability__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_gPS__C.is_bound()
 || single_value->field_gPS__B.is_bound()
 || single_value->field_gPS__A.is_bound()
 || single_value->field_oTD__B.is_bound()
 || single_value->field_oTD__A.is_bound()
 || single_value->field_spare.is_bound();
}

boolean LCS__Capability__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_gPS__C.is_value()
 && single_value->field_gPS__B.is_value()
 && single_value->field_gPS__A.is_value()
 && single_value->field_oTD__B.is_value()
 && single_value->field_oTD__A.is_value()
 && single_value->field_spare.is_value();
}

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

LCS__Capability__BSSGP LCS__Capability__BSSGP_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 @BSSGP_Types.LCS_Capability_BSSGP.");
LCS__Capability__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_gPS__C.is_bound()) {
ret_val.gPS__C() = single_value->field_gPS__C.valueof();
}
if (single_value->field_gPS__B.is_bound()) {
ret_val.gPS__B() = single_value->field_gPS__B.valueof();
}
if (single_value->field_gPS__A.is_bound()) {
ret_val.gPS__A() = single_value->field_gPS__A.valueof();
}
if (single_value->field_oTD__B.is_bound()) {
ret_val.oTD__B() = single_value->field_oTD__B.valueof();
}
if (single_value->field_oTD__A.is_bound()) {
ret_val.oTD__A() = single_value->field_oTD__A.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
return ret_val;
}

void LCS__Capability__BSSGP_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 @BSSGP_Types.LCS_Capability_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new LCS__Capability__BSSGP_template[list_length];
}

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

OCTETSTRING_template& LCS__Capability__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& LCS__Capability__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.LCS_Capability_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& LCS__Capability__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& LCS__Capability__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.LCS_Capability_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& LCS__Capability__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& LCS__Capability__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.LCS_Capability_BSSGP.");
return single_value->field_lengthIndicator;
}

BITSTRING_template& LCS__Capability__BSSGP_template::gPS__C()
{
set_specific();
return single_value->field_gPS__C;
}

const BITSTRING_template& LCS__Capability__BSSGP_template::gPS__C() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field gPS_C of a non-specific template of type @BSSGP_Types.LCS_Capability_BSSGP.");
return single_value->field_gPS__C;
}

BITSTRING_template& LCS__Capability__BSSGP_template::gPS__B()
{
set_specific();
return single_value->field_gPS__B;
}

const BITSTRING_template& LCS__Capability__BSSGP_template::gPS__B() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field gPS_B of a non-specific template of type @BSSGP_Types.LCS_Capability_BSSGP.");
return single_value->field_gPS__B;
}

BITSTRING_template& LCS__Capability__BSSGP_template::gPS__A()
{
set_specific();
return single_value->field_gPS__A;
}

const BITSTRING_template& LCS__Capability__BSSGP_template::gPS__A() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field gPS_A of a non-specific template of type @BSSGP_Types.LCS_Capability_BSSGP.");
return single_value->field_gPS__A;
}

BITSTRING_template& LCS__Capability__BSSGP_template::oTD__B()
{
set_specific();
return single_value->field_oTD__B;
}

const BITSTRING_template& LCS__Capability__BSSGP_template::oTD__B() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field oTD_B of a non-specific template of type @BSSGP_Types.LCS_Capability_BSSGP.");
return single_value->field_oTD__B;
}

BITSTRING_template& LCS__Capability__BSSGP_template::oTD__A()
{
set_specific();
return single_value->field_oTD__A;
}

const BITSTRING_template& LCS__Capability__BSSGP_template::oTD__A() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field oTD_A of a non-specific template of type @BSSGP_Types.LCS_Capability_BSSGP.");
return single_value->field_oTD__A;
}

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

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

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

void LCS__Capability__BSSGP_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", gPS_C := ");
single_value->field_gPS__C.log();
TTCN_Logger::log_event_str(", gPS_B := ");
single_value->field_gPS__B.log();
TTCN_Logger::log_event_str(", gPS_A := ");
single_value->field_gPS__A.log();
TTCN_Logger::log_event_str(", oTD_B := ");
single_value->field_oTD__B.log();
TTCN_Logger::log_event_str(", oTD_A := ");
single_value->field_oTD__A.log();
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void LCS__Capability__BSSGP_template::log_match(const LCS__Capability__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_gPS__C.match(match_value.gPS__C(), legacy)){
TTCN_Logger::log_logmatch_info(".gPS_C");
single_value->field_gPS__C.log_match(match_value.gPS__C(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_gPS__B.match(match_value.gPS__B(), legacy)){
TTCN_Logger::log_logmatch_info(".gPS_B");
single_value->field_gPS__B.log_match(match_value.gPS__B(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_gPS__A.match(match_value.gPS__A(), legacy)){
TTCN_Logger::log_logmatch_info(".gPS_A");
single_value->field_gPS__A.log_match(match_value.gPS__A(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_oTD__B.match(match_value.oTD__B(), legacy)){
TTCN_Logger::log_logmatch_info(".oTD_B");
single_value->field_oTD__B.log_match(match_value.oTD__B(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_oTD__A.match(match_value.oTD__A(), legacy)){
TTCN_Logger::log_logmatch_info(".oTD_A");
single_value->field_oTD__A.log_match(match_value.oTD__A(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", gPS_C := ");
single_value->field_gPS__C.log_match(match_value.gPS__C(), legacy);
TTCN_Logger::log_event_str(", gPS_B := ");
single_value->field_gPS__B.log_match(match_value.gPS__B(), legacy);
TTCN_Logger::log_event_str(", gPS_A := ");
single_value->field_gPS__A.log_match(match_value.gPS__A(), legacy);
TTCN_Logger::log_event_str(", oTD_B := ");
single_value->field_oTD__B.log_match(match_value.oTD__B(), legacy);
TTCN_Logger::log_event_str(", oTD_A := ");
single_value->field_oTD__A.log_match(match_value.oTD__A(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void LCS__Capability__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (gPS__C().is_bound()) gPS__C().set_implicit_omit();
if (gPS__B().is_bound()) gPS__B().set_implicit_omit();
if (gPS__A().is_bound()) gPS__A().set_implicit_omit();
if (oTD__B().is_bound()) oTD__B().set_implicit_omit();
if (oTD__A().is_bound()) oTD__A().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

void LCS__Capability__BSSGP_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_gPS__C.encode_text(text_buf);
single_value->field_gPS__B.encode_text(text_buf);
single_value->field_gPS__A.encode_text(text_buf);
single_value->field_oTD__B.encode_text(text_buf);
single_value->field_oTD__A.encode_text(text_buf);
single_value->field_spare.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @BSSGP_Types.LCS_Capability_BSSGP.");
}
}

void LCS__Capability__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_gPS__C.decode_text(text_buf);
single_value->field_gPS__B.decode_text(text_buf);
single_value->field_gPS__A.decode_text(text_buf);
single_value->field_oTD__B.decode_text(text_buf);
single_value->field_oTD__A.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new LCS__Capability__BSSGP_template[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 @BSSGP_Types.LCS_Capability_BSSGP.");
}
}

void LCS__Capability__BSSGP_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: {
    LCS__Capability__BSSGP_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (9<param.get_size()) {
      param.error("record template of type @BSSGP_Types.LCS_Capability_BSSGP has 9 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) gPS__C().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) gPS__B().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) gPS__A().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) oTD__B().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) oTD__A().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(8));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gPS_C")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gPS__C().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gPS_B")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gPS__B().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "gPS_A")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          gPS__A().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "oTD_B")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          oTD__B().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "oTD_A")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          oTD__A().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @BSSGP_Types.LCS_Capability_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    LCS__Capability__BSSGP_template* precondition = new LCS__Capability__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    LCS__Capability__BSSGP_template* implied_template = new LCS__Capability__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = LCS__Capability__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.LCS_Capability_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void LCS__Capability__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Capability_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Capability_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Capability_BSSGP");
single_value->field_gPS__C.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Capability_BSSGP");
single_value->field_gPS__B.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Capability_BSSGP");
single_value->field_gPS__A.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Capability_BSSGP");
single_value->field_oTD__B.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Capability_BSSGP");
single_value->field_oTD__A.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Capability_BSSGP");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.LCS_Capability_BSSGP");
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 : "@BSSGP_Types.LCS_Capability_BSSGP");
}

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

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

RRLP__Flags__BSSGP::RRLP__Flags__BSSGP()
{
}

RRLP__Flags__BSSGP::RRLP__Flags__BSSGP(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const BITSTRING& par_flag1,
    const BITSTRING& par_spare)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_flag1(par_flag1),
  field_spare(par_spare)
{
}

RRLP__Flags__BSSGP::RRLP__Flags__BSSGP(const RRLP__Flags__BSSGP& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.RRLP_Flags_BSSGP.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.flag1().is_bound()) field_flag1 = other_value.flag1();
else field_flag1.clean_up();
if (other_value.spare().is_bound()) field_spare = other_value.spare();
else field_spare.clean_up();
}

void RRLP__Flags__BSSGP::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_flag1.clean_up();
field_spare.clean_up();
}

const TTCN_Typedescriptor_t* RRLP__Flags__BSSGP::get_descriptor() const { return &RRLP__Flags__BSSGP_descr_; }
RRLP__Flags__BSSGP& RRLP__Flags__BSSGP::operator=(const RRLP__Flags__BSSGP& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.RRLP_Flags_BSSGP.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.flag1().is_bound()) field_flag1 = other_value.flag1();
  else field_flag1.clean_up();
  if (other_value.spare().is_bound()) field_spare = other_value.spare();
  else field_spare.clean_up();
}
return *this;
}

boolean RRLP__Flags__BSSGP::operator==(const RRLP__Flags__BSSGP& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_flag1==other_value.field_flag1
  && field_spare==other_value.field_spare;
}

boolean RRLP__Flags__BSSGP::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_flag1.is_bound())
  || (field_spare.is_bound());
}
boolean RRLP__Flags__BSSGP::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_flag1.is_value()
  && field_spare.is_value();
}
void RRLP__Flags__BSSGP::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", flag1 := ");
field_flag1.log();
TTCN_Logger::log_event_str(", spare := ");
field_spare.log();
TTCN_Logger::log_event_str(" }");
}

void RRLP__Flags__BSSGP::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (flag1().is_bound()) flag1().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

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

void RRLP__Flags__BSSGP::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_flag1.encode_text(text_buf);
field_spare.encode_text(text_buf);
}

void RRLP__Flags__BSSGP::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_flag1.decode_text(text_buf);
field_spare.decode_text(text_buf);
}

void RRLP__Flags__BSSGP::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 RRLP__Flags__BSSGP::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 RRLP__Flags__BSSGP::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, RRLP__Flags__BSSGP_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(RRLP__Flags__BSSGP_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, RRLP__Flags__BSSGP_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(RRLP__Flags__BSSGP_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_flag1.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::BIT7_descr_.raw->forceomit);
  decoded_field_length = field_spare.RAW_decode(General__Types::BIT7_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_130) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int RRLP__Flags__BSSGP::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 5;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(5);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RRLP__Flags__BSSGP_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, RRLP__Flags__BSSGP_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::BIT7_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(RRLP__Flags__BSSGP_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(RRLP__Flags__BSSGP_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_flag1.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_spare.RAW_encode(General__Types::BIT7_descr_, *myleaf.body.node.nodes[4]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 2;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(2);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[4]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[4]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(RRLP__Flags__BSSGP_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(RRLP__Flags__BSSGP_ext_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_iEI !=  os_130) {
  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){
   os_130.RAW_encode(General__Types::OCT1_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 RRLP__Flags__BSSGP_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
BITSTRING_template field_flag1;
BITSTRING_template field_spare;
};

void RRLP__Flags__BSSGP_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_flag1 = ANY_VALUE;
single_value->field_spare = ANY_VALUE;
}
}
}

void RRLP__Flags__BSSGP_template::copy_value(const RRLP__Flags__BSSGP& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.flag1().is_bound()) {
  single_value->field_flag1 = other_value.flag1();
} else {
  single_value->field_flag1.clean_up();
}
if (other_value.spare().is_bound()) {
  single_value->field_spare = other_value.spare();
} else {
  single_value->field_spare.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RRLP__Flags__BSSGP_template::copy_template(const RRLP__Flags__BSSGP_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.flag1().get_selection()) {
single_value->field_flag1 = other_value.flag1();
} else {
single_value->field_flag1.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) {
single_value->field_spare = other_value.spare();
} else {
single_value->field_spare.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new RRLP__Flags__BSSGP_template[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 RRLP__Flags__BSSGP_template(*other_value.implication_.precondition);
implication_.implied_template = new RRLP__Flags__BSSGP_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 @BSSGP_Types.RRLP_Flags_BSSGP.");
break;
}
set_selection(other_value);
}

RRLP__Flags__BSSGP_template::RRLP__Flags__BSSGP_template()
{
}

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

RRLP__Flags__BSSGP_template::RRLP__Flags__BSSGP_template(const RRLP__Flags__BSSGP& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean RRLP__Flags__BSSGP_template::match(const RRLP__Flags__BSSGP& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.flag1().is_bound()) return FALSE;
if(!single_value->field_flag1.match(other_value.flag1(), legacy))return FALSE;
if(!other_value.spare().is_bound()) return FALSE;
if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @BSSGP_Types.RRLP_Flags_BSSGP.");
}
return FALSE;
}

boolean RRLP__Flags__BSSGP_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_flag1.is_bound()
 || single_value->field_spare.is_bound();
}

boolean RRLP__Flags__BSSGP_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_flag1.is_value()
 && single_value->field_spare.is_value();
}

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

RRLP__Flags__BSSGP RRLP__Flags__BSSGP_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 @BSSGP_Types.RRLP_Flags_BSSGP.");
RRLP__Flags__BSSGP ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_flag1.is_bound()) {
ret_val.flag1() = single_value->field_flag1.valueof();
}
if (single_value->field_spare.is_bound()) {
ret_val.spare() = single_value->field_spare.valueof();
}
return ret_val;
}

void RRLP__Flags__BSSGP_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 @BSSGP_Types.RRLP_Flags_BSSGP.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RRLP__Flags__BSSGP_template[list_length];
}

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

OCTETSTRING_template& RRLP__Flags__BSSGP_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& RRLP__Flags__BSSGP_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.RRLP_Flags_BSSGP.");
return single_value->field_iEI;
}

BITSTRING_template& RRLP__Flags__BSSGP_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& RRLP__Flags__BSSGP_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.RRLP_Flags_BSSGP.");
return single_value->field_ext;
}

LIN2__2a_template& RRLP__Flags__BSSGP_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& RRLP__Flags__BSSGP_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.RRLP_Flags_BSSGP.");
return single_value->field_lengthIndicator;
}

BITSTRING_template& RRLP__Flags__BSSGP_template::flag1()
{
set_specific();
return single_value->field_flag1;
}

const BITSTRING_template& RRLP__Flags__BSSGP_template::flag1() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field flag1 of a non-specific template of type @BSSGP_Types.RRLP_Flags_BSSGP.");
return single_value->field_flag1;
}

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

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

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

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

void RRLP__Flags__BSSGP_template::log_match(const RRLP__Flags__BSSGP& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_flag1.match(match_value.flag1(), legacy)){
TTCN_Logger::log_logmatch_info(".flag1");
single_value->field_flag1.log_match(match_value.flag1(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_spare.match(match_value.spare(), legacy)){
TTCN_Logger::log_logmatch_info(".spare");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", flag1 := ");
single_value->field_flag1.log_match(match_value.flag1(), legacy);
TTCN_Logger::log_event_str(", spare := ");
single_value->field_spare.log_match(match_value.spare(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void RRLP__Flags__BSSGP_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (flag1().is_bound()) flag1().set_implicit_omit();
if (spare().is_bound()) spare().set_implicit_omit();
}

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

void RRLP__Flags__BSSGP_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_flag1.decode_text(text_buf);
single_value->field_spare.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new RRLP__Flags__BSSGP_template[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 @BSSGP_Types.RRLP_Flags_BSSGP.");
}
}

void RRLP__Flags__BSSGP_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: {
    RRLP__Flags__BSSGP_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 @BSSGP_Types.RRLP_Flags_BSSGP 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) flag1().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));
    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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "flag1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          flag1().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "spare")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          spare().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @BSSGP_Types.RRLP_Flags_BSSGP: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    RRLP__Flags__BSSGP_template* precondition = new RRLP__Flags__BSSGP_template;
    precondition->set_param(*param.get_elem(0));
    RRLP__Flags__BSSGP_template* implied_template = new RRLP__Flags__BSSGP_template;
    implied_template->set_param(*param.get_elem(1));
    *this = RRLP__Flags__BSSGP_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.RRLP_Flags_BSSGP");
  }
  is_ifpresent = param.get_ifpresent();
}

void RRLP__Flags__BSSGP_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RRLP_Flags_BSSGP");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RRLP_Flags_BSSGP");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RRLP_Flags_BSSGP");
single_value->field_flag1.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RRLP_Flags_BSSGP");
single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RRLP_Flags_BSSGP");
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 : "@BSSGP_Types.RRLP_Flags_BSSGP");
}

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

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

RIM__Application__Identity::RIM__Application__Identity()
{
}

RIM__Application__Identity::RIM__Application__Identity(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_rIMApplicationIdentity)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_rIMApplicationIdentity(par_rIMApplicationIdentity)
{
}

RIM__Application__Identity::RIM__Application__Identity(const RIM__Application__Identity& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.RIM_Application_Identity.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.rIMApplicationIdentity().is_bound()) field_rIMApplicationIdentity = other_value.rIMApplicationIdentity();
else field_rIMApplicationIdentity.clean_up();
}

void RIM__Application__Identity::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_rIMApplicationIdentity.clean_up();
}

const TTCN_Typedescriptor_t* RIM__Application__Identity::get_descriptor() const { return &RIM__Application__Identity_descr_; }
RIM__Application__Identity& RIM__Application__Identity::operator=(const RIM__Application__Identity& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.RIM_Application_Identity.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.rIMApplicationIdentity().is_bound()) field_rIMApplicationIdentity = other_value.rIMApplicationIdentity();
  else field_rIMApplicationIdentity.clean_up();
}
return *this;
}

boolean RIM__Application__Identity::operator==(const RIM__Application__Identity& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_rIMApplicationIdentity==other_value.field_rIMApplicationIdentity;
}

boolean RIM__Application__Identity::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_rIMApplicationIdentity.is_bound());
}
boolean RIM__Application__Identity::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_rIMApplicationIdentity.is_value();
}
void RIM__Application__Identity::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", rIMApplicationIdentity := ");
field_rIMApplicationIdentity.log();
TTCN_Logger::log_event_str(" }");
}

void RIM__Application__Identity::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (rIMApplicationIdentity().is_bound()) rIMApplicationIdentity().set_implicit_omit();
}

void RIM__Application__Identity::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 @BSSGP_Types.RIM_Application_Identity 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rIMApplicationIdentity().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rIMApplicationIdentity")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rIMApplicationIdentity().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 @BSSGP_Types.RIM_Application_Identity: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.RIM_Application_Identity");
  }
}

void RIM__Application__Identity::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_rIMApplicationIdentity.encode_text(text_buf);
}

void RIM__Application__Identity::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_rIMApplicationIdentity.decode_text(text_buf);
}

void RIM__Application__Identity::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 RIM__Application__Identity::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 RIM__Application__Identity::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, RIM__Application__Identity_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(RIM__Application__Identity_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, RIM__Application__Identity_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(RIM__Application__Identity_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_rIMApplicationIdentity.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_133) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int RIM__Application__Identity::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RIM__Application__Identity_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, RIM__Application__Identity_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT1_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(RIM__Application__Identity_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(RIM__Application__Identity_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_rIMApplicationIdentity.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(RIM__Application__Identity_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(RIM__Application__Identity_ext_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_iEI !=  os_133) {
  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){
   os_133.RAW_encode(General__Types::OCT1_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 RIM__Application__Identity_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_rIMApplicationIdentity;
};

void RIM__Application__Identity_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_rIMApplicationIdentity = ANY_VALUE;
}
}
}

void RIM__Application__Identity_template::copy_value(const RIM__Application__Identity& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.rIMApplicationIdentity().is_bound()) {
  single_value->field_rIMApplicationIdentity = other_value.rIMApplicationIdentity();
} else {
  single_value->field_rIMApplicationIdentity.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RIM__Application__Identity_template::copy_template(const RIM__Application__Identity_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rIMApplicationIdentity().get_selection()) {
single_value->field_rIMApplicationIdentity = other_value.rIMApplicationIdentity();
} else {
single_value->field_rIMApplicationIdentity.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 RIM__Application__Identity_template[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 RIM__Application__Identity_template(*other_value.implication_.precondition);
implication_.implied_template = new RIM__Application__Identity_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 @BSSGP_Types.RIM_Application_Identity.");
break;
}
set_selection(other_value);
}

RIM__Application__Identity_template::RIM__Application__Identity_template()
{
}

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

RIM__Application__Identity_template::RIM__Application__Identity_template(const RIM__Application__Identity& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean RIM__Application__Identity_template::match(const RIM__Application__Identity& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.rIMApplicationIdentity().is_bound()) return FALSE;
if(!single_value->field_rIMApplicationIdentity.match(other_value.rIMApplicationIdentity(), 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 @BSSGP_Types.RIM_Application_Identity.");
}
return FALSE;
}

boolean RIM__Application__Identity_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_rIMApplicationIdentity.is_bound();
}

boolean RIM__Application__Identity_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_rIMApplicationIdentity.is_value();
}

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

RIM__Application__Identity RIM__Application__Identity_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 @BSSGP_Types.RIM_Application_Identity.");
RIM__Application__Identity ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_rIMApplicationIdentity.is_bound()) {
ret_val.rIMApplicationIdentity() = single_value->field_rIMApplicationIdentity.valueof();
}
return ret_val;
}

void RIM__Application__Identity_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 @BSSGP_Types.RIM_Application_Identity.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RIM__Application__Identity_template[list_length];
}

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

OCTETSTRING_template& RIM__Application__Identity_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& RIM__Application__Identity_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.RIM_Application_Identity.");
return single_value->field_iEI;
}

BITSTRING_template& RIM__Application__Identity_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& RIM__Application__Identity_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.RIM_Application_Identity.");
return single_value->field_ext;
}

LIN2__2a_template& RIM__Application__Identity_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& RIM__Application__Identity_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.RIM_Application_Identity.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& RIM__Application__Identity_template::rIMApplicationIdentity()
{
set_specific();
return single_value->field_rIMApplicationIdentity;
}

const OCTETSTRING_template& RIM__Application__Identity_template::rIMApplicationIdentity() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rIMApplicationIdentity of a non-specific template of type @BSSGP_Types.RIM_Application_Identity.");
return single_value->field_rIMApplicationIdentity;
}

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

void RIM__Application__Identity_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", rIMApplicationIdentity := ");
single_value->field_rIMApplicationIdentity.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 RIM__Application__Identity_template::log_match(const RIM__Application__Identity& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rIMApplicationIdentity.match(match_value.rIMApplicationIdentity(), legacy)){
TTCN_Logger::log_logmatch_info(".rIMApplicationIdentity");
single_value->field_rIMApplicationIdentity.log_match(match_value.rIMApplicationIdentity(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", rIMApplicationIdentity := ");
single_value->field_rIMApplicationIdentity.log_match(match_value.rIMApplicationIdentity(), 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 RIM__Application__Identity_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (rIMApplicationIdentity().is_bound()) rIMApplicationIdentity().set_implicit_omit();
}

void RIM__Application__Identity_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_rIMApplicationIdentity.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 @BSSGP_Types.RIM_Application_Identity.");
}
}

void RIM__Application__Identity_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_rIMApplicationIdentity.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 RIM__Application__Identity_template[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 @BSSGP_Types.RIM_Application_Identity.");
}
}

void RIM__Application__Identity_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: {
    RIM__Application__Identity_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 @BSSGP_Types.RIM_Application_Identity 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rIMApplicationIdentity().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rIMApplicationIdentity")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rIMApplicationIdentity().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 @BSSGP_Types.RIM_Application_Identity: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    RIM__Application__Identity_template* precondition = new RIM__Application__Identity_template;
    precondition->set_param(*param.get_elem(0));
    RIM__Application__Identity_template* implied_template = new RIM__Application__Identity_template;
    implied_template->set_param(*param.get_elem(1));
    *this = RIM__Application__Identity_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.RIM_Application_Identity");
  }
  is_ifpresent = param.get_ifpresent();
}

void RIM__Application__Identity_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RIM_Application_Identity");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RIM_Application_Identity");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RIM_Application_Identity");
single_value->field_rIMApplicationIdentity.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RIM_Application_Identity");
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 : "@BSSGP_Types.RIM_Application_Identity");
}

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

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

RIM__Sequence__Number::RIM__Sequence__Number()
{
}

RIM__Sequence__Number::RIM__Sequence__Number(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_rIMSequenceNumber)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_rIMSequenceNumber(par_rIMSequenceNumber)
{
}

RIM__Sequence__Number::RIM__Sequence__Number(const RIM__Sequence__Number& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.RIM_Sequence_Number.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.rIMSequenceNumber().is_bound()) field_rIMSequenceNumber = other_value.rIMSequenceNumber();
else field_rIMSequenceNumber.clean_up();
}

void RIM__Sequence__Number::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_rIMSequenceNumber.clean_up();
}

const TTCN_Typedescriptor_t* RIM__Sequence__Number::get_descriptor() const { return &RIM__Sequence__Number_descr_; }
RIM__Sequence__Number& RIM__Sequence__Number::operator=(const RIM__Sequence__Number& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.RIM_Sequence_Number.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.rIMSequenceNumber().is_bound()) field_rIMSequenceNumber = other_value.rIMSequenceNumber();
  else field_rIMSequenceNumber.clean_up();
}
return *this;
}

boolean RIM__Sequence__Number::operator==(const RIM__Sequence__Number& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_rIMSequenceNumber==other_value.field_rIMSequenceNumber;
}

boolean RIM__Sequence__Number::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_rIMSequenceNumber.is_bound());
}
boolean RIM__Sequence__Number::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_rIMSequenceNumber.is_value();
}
void RIM__Sequence__Number::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", rIMSequenceNumber := ");
field_rIMSequenceNumber.log();
TTCN_Logger::log_event_str(" }");
}

void RIM__Sequence__Number::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (rIMSequenceNumber().is_bound()) rIMSequenceNumber().set_implicit_omit();
}

void RIM__Sequence__Number::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 @BSSGP_Types.RIM_Sequence_Number 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rIMSequenceNumber().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rIMSequenceNumber")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rIMSequenceNumber().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 @BSSGP_Types.RIM_Sequence_Number: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.RIM_Sequence_Number");
  }
}

void RIM__Sequence__Number::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_rIMSequenceNumber.encode_text(text_buf);
}

void RIM__Sequence__Number::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_rIMSequenceNumber.decode_text(text_buf);
}

void RIM__Sequence__Number::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 RIM__Sequence__Number::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 RIM__Sequence__Number::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, RIM__Sequence__Number_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(RIM__Sequence__Number_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, RIM__Sequence__Number_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(RIM__Sequence__Number_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT4_descr_.raw->forceomit);
  decoded_field_length = field_rIMSequenceNumber.RAW_decode(General__Types::OCT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_134) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int RIM__Sequence__Number::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RIM__Sequence__Number_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, RIM__Sequence__Number_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT4_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(RIM__Sequence__Number_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(RIM__Sequence__Number_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_rIMSequenceNumber.RAW_encode(General__Types::OCT4_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(RIM__Sequence__Number_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(RIM__Sequence__Number_ext_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_iEI !=  os_134) {
  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){
   os_134.RAW_encode(General__Types::OCT1_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 RIM__Sequence__Number_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_rIMSequenceNumber;
};

void RIM__Sequence__Number_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_rIMSequenceNumber = ANY_VALUE;
}
}
}

void RIM__Sequence__Number_template::copy_value(const RIM__Sequence__Number& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.rIMSequenceNumber().is_bound()) {
  single_value->field_rIMSequenceNumber = other_value.rIMSequenceNumber();
} else {
  single_value->field_rIMSequenceNumber.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RIM__Sequence__Number_template::copy_template(const RIM__Sequence__Number_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rIMSequenceNumber().get_selection()) {
single_value->field_rIMSequenceNumber = other_value.rIMSequenceNumber();
} else {
single_value->field_rIMSequenceNumber.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 RIM__Sequence__Number_template[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 RIM__Sequence__Number_template(*other_value.implication_.precondition);
implication_.implied_template = new RIM__Sequence__Number_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 @BSSGP_Types.RIM_Sequence_Number.");
break;
}
set_selection(other_value);
}

RIM__Sequence__Number_template::RIM__Sequence__Number_template()
{
}

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

RIM__Sequence__Number_template::RIM__Sequence__Number_template(const RIM__Sequence__Number& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean RIM__Sequence__Number_template::match(const RIM__Sequence__Number& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.rIMSequenceNumber().is_bound()) return FALSE;
if(!single_value->field_rIMSequenceNumber.match(other_value.rIMSequenceNumber(), 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 @BSSGP_Types.RIM_Sequence_Number.");
}
return FALSE;
}

boolean RIM__Sequence__Number_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_rIMSequenceNumber.is_bound();
}

boolean RIM__Sequence__Number_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_rIMSequenceNumber.is_value();
}

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

RIM__Sequence__Number RIM__Sequence__Number_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 @BSSGP_Types.RIM_Sequence_Number.");
RIM__Sequence__Number ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_rIMSequenceNumber.is_bound()) {
ret_val.rIMSequenceNumber() = single_value->field_rIMSequenceNumber.valueof();
}
return ret_val;
}

void RIM__Sequence__Number_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 @BSSGP_Types.RIM_Sequence_Number.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RIM__Sequence__Number_template[list_length];
}

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

OCTETSTRING_template& RIM__Sequence__Number_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& RIM__Sequence__Number_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.RIM_Sequence_Number.");
return single_value->field_iEI;
}

BITSTRING_template& RIM__Sequence__Number_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& RIM__Sequence__Number_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.RIM_Sequence_Number.");
return single_value->field_ext;
}

LIN2__2a_template& RIM__Sequence__Number_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& RIM__Sequence__Number_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.RIM_Sequence_Number.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& RIM__Sequence__Number_template::rIMSequenceNumber()
{
set_specific();
return single_value->field_rIMSequenceNumber;
}

const OCTETSTRING_template& RIM__Sequence__Number_template::rIMSequenceNumber() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rIMSequenceNumber of a non-specific template of type @BSSGP_Types.RIM_Sequence_Number.");
return single_value->field_rIMSequenceNumber;
}

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

void RIM__Sequence__Number_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", rIMSequenceNumber := ");
single_value->field_rIMSequenceNumber.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 RIM__Sequence__Number_template::log_match(const RIM__Sequence__Number& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rIMSequenceNumber.match(match_value.rIMSequenceNumber(), legacy)){
TTCN_Logger::log_logmatch_info(".rIMSequenceNumber");
single_value->field_rIMSequenceNumber.log_match(match_value.rIMSequenceNumber(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", rIMSequenceNumber := ");
single_value->field_rIMSequenceNumber.log_match(match_value.rIMSequenceNumber(), 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 RIM__Sequence__Number_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (rIMSequenceNumber().is_bound()) rIMSequenceNumber().set_implicit_omit();
}

void RIM__Sequence__Number_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_rIMSequenceNumber.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 @BSSGP_Types.RIM_Sequence_Number.");
}
}

void RIM__Sequence__Number_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_rIMSequenceNumber.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 RIM__Sequence__Number_template[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 @BSSGP_Types.RIM_Sequence_Number.");
}
}

void RIM__Sequence__Number_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: {
    RIM__Sequence__Number_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 @BSSGP_Types.RIM_Sequence_Number 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rIMSequenceNumber().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rIMSequenceNumber")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rIMSequenceNumber().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 @BSSGP_Types.RIM_Sequence_Number: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    RIM__Sequence__Number_template* precondition = new RIM__Sequence__Number_template;
    precondition->set_param(*param.get_elem(0));
    RIM__Sequence__Number_template* implied_template = new RIM__Sequence__Number_template;
    implied_template->set_param(*param.get_elem(1));
    *this = RIM__Sequence__Number_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.RIM_Sequence_Number");
  }
  is_ifpresent = param.get_ifpresent();
}

void RIM__Sequence__Number_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RIM_Sequence_Number");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RIM_Sequence_Number");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RIM_Sequence_Number");
single_value->field_rIMSequenceNumber.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RIM_Sequence_Number");
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 : "@BSSGP_Types.RIM_Sequence_Number");
}

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

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

RIM__PDU__Indications::RIM__PDU__Indications()
{
}

RIM__PDU__Indications::RIM__PDU__Indications(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const BITSTRING& par_ack,
    const BITSTRING& par_pDU__Type__Extension,
    const BITSTRING& par_reserved)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_ack(par_ack),
  field_pDU__Type__Extension(par_pDU__Type__Extension),
  field_reserved(par_reserved)
{
}

RIM__PDU__Indications::RIM__PDU__Indications(const RIM__PDU__Indications& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.RIM_PDU_Indications.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.ack().is_bound()) field_ack = other_value.ack();
else field_ack.clean_up();
if (other_value.pDU__Type__Extension().is_bound()) field_pDU__Type__Extension = other_value.pDU__Type__Extension();
else field_pDU__Type__Extension.clean_up();
if (other_value.reserved().is_bound()) field_reserved = other_value.reserved();
else field_reserved.clean_up();
}

void RIM__PDU__Indications::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_ack.clean_up();
field_pDU__Type__Extension.clean_up();
field_reserved.clean_up();
}

const TTCN_Typedescriptor_t* RIM__PDU__Indications::get_descriptor() const { return &RIM__PDU__Indications_descr_; }
RIM__PDU__Indications& RIM__PDU__Indications::operator=(const RIM__PDU__Indications& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.RIM_PDU_Indications.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.ack().is_bound()) field_ack = other_value.ack();
  else field_ack.clean_up();
  if (other_value.pDU__Type__Extension().is_bound()) field_pDU__Type__Extension = other_value.pDU__Type__Extension();
  else field_pDU__Type__Extension.clean_up();
  if (other_value.reserved().is_bound()) field_reserved = other_value.reserved();
  else field_reserved.clean_up();
}
return *this;
}

boolean RIM__PDU__Indications::operator==(const RIM__PDU__Indications& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_ack==other_value.field_ack
  && field_pDU__Type__Extension==other_value.field_pDU__Type__Extension
  && field_reserved==other_value.field_reserved;
}

boolean RIM__PDU__Indications::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_ack.is_bound())
  || (field_pDU__Type__Extension.is_bound())
  || (field_reserved.is_bound());
}
boolean RIM__PDU__Indications::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_ack.is_value()
  && field_pDU__Type__Extension.is_value()
  && field_reserved.is_value();
}
void RIM__PDU__Indications::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", ack := ");
field_ack.log();
TTCN_Logger::log_event_str(", pDU_Type_Extension := ");
field_pDU__Type__Extension.log();
TTCN_Logger::log_event_str(", reserved := ");
field_reserved.log();
TTCN_Logger::log_event_str(" }");
}

void RIM__PDU__Indications::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (ack().is_bound()) ack().set_implicit_omit();
if (pDU__Type__Extension().is_bound()) pDU__Type__Extension().set_implicit_omit();
if (reserved().is_bound()) reserved().set_implicit_omit();
}

void RIM__PDU__Indications::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 @BSSGP_Types.RIM_PDU_Indications 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) ack().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) pDU__Type__Extension().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) reserved().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          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(), "pDU_Type_Extension")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pDU__Type__Extension().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "reserved")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          reserved().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @BSSGP_Types.RIM_PDU_Indications: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.RIM_PDU_Indications");
  }
}

void RIM__PDU__Indications::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_ack.encode_text(text_buf);
field_pDU__Type__Extension.encode_text(text_buf);
field_reserved.encode_text(text_buf);
}

void RIM__PDU__Indications::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_ack.decode_text(text_buf);
field_pDU__Type__Extension.decode_text(text_buf);
field_reserved.decode_text(text_buf);
}

void RIM__PDU__Indications::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 RIM__PDU__Indications::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 RIM__PDU__Indications::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, RIM__PDU__Indications_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(RIM__PDU__Indications_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, RIM__PDU__Indications_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(RIM__PDU__Indications_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT1_descr_.raw->forceomit);
  decoded_field_length = field_ack.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::BIT3_descr_.raw->forceomit);
  decoded_field_length = field_pDU__Type__Extension.RAW_decode(General__Types::BIT3_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::BIT4_descr_.raw->forceomit);
  decoded_field_length = field_reserved.RAW_decode(General__Types::BIT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, no_err, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_135) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int RIM__PDU__Indications::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RIM__PDU__Indications_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, RIM__PDU__Indications_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT1_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::BIT3_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::BIT4_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(RIM__PDU__Indications_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(RIM__PDU__Indications_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_ack.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_pDU__Type__Extension.RAW_encode(General__Types::BIT3_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_reserved.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[5]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 3;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(3);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[4]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[4]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[5]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[5]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(RIM__PDU__Indications_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(RIM__PDU__Indications_ext_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_iEI !=  os_135) {
  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){
   os_135.RAW_encode(General__Types::OCT1_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 RIM__PDU__Indications_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
BITSTRING_template field_ack;
BITSTRING_template field_pDU__Type__Extension;
BITSTRING_template field_reserved;
};

void RIM__PDU__Indications_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_ack = ANY_VALUE;
single_value->field_pDU__Type__Extension = ANY_VALUE;
single_value->field_reserved = ANY_VALUE;
}
}
}

void RIM__PDU__Indications_template::copy_value(const RIM__PDU__Indications& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.ack().is_bound()) {
  single_value->field_ack = other_value.ack();
} else {
  single_value->field_ack.clean_up();
}
if (other_value.pDU__Type__Extension().is_bound()) {
  single_value->field_pDU__Type__Extension = other_value.pDU__Type__Extension();
} else {
  single_value->field_pDU__Type__Extension.clean_up();
}
if (other_value.reserved().is_bound()) {
  single_value->field_reserved = other_value.reserved();
} else {
  single_value->field_reserved.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RIM__PDU__Indications_template::copy_template(const RIM__PDU__Indications_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ack().get_selection()) {
single_value->field_ack = other_value.ack();
} else {
single_value->field_ack.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.pDU__Type__Extension().get_selection()) {
single_value->field_pDU__Type__Extension = other_value.pDU__Type__Extension();
} else {
single_value->field_pDU__Type__Extension.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.reserved().get_selection()) {
single_value->field_reserved = other_value.reserved();
} else {
single_value->field_reserved.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 RIM__PDU__Indications_template[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 RIM__PDU__Indications_template(*other_value.implication_.precondition);
implication_.implied_template = new RIM__PDU__Indications_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 @BSSGP_Types.RIM_PDU_Indications.");
break;
}
set_selection(other_value);
}

RIM__PDU__Indications_template::RIM__PDU__Indications_template()
{
}

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

RIM__PDU__Indications_template::RIM__PDU__Indications_template(const RIM__PDU__Indications& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean RIM__PDU__Indications_template::match(const RIM__PDU__Indications& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.ack().is_bound()) return FALSE;
if(!single_value->field_ack.match(other_value.ack(), legacy))return FALSE;
if(!other_value.pDU__Type__Extension().is_bound()) return FALSE;
if(!single_value->field_pDU__Type__Extension.match(other_value.pDU__Type__Extension(), legacy))return FALSE;
if(!other_value.reserved().is_bound()) return FALSE;
if(!single_value->field_reserved.match(other_value.reserved(), 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 @BSSGP_Types.RIM_PDU_Indications.");
}
return FALSE;
}

boolean RIM__PDU__Indications_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_ack.is_bound()
 || single_value->field_pDU__Type__Extension.is_bound()
 || single_value->field_reserved.is_bound();
}

boolean RIM__PDU__Indications_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_ack.is_value()
 && single_value->field_pDU__Type__Extension.is_value()
 && single_value->field_reserved.is_value();
}

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

RIM__PDU__Indications RIM__PDU__Indications_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 @BSSGP_Types.RIM_PDU_Indications.");
RIM__PDU__Indications ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_ack.is_bound()) {
ret_val.ack() = single_value->field_ack.valueof();
}
if (single_value->field_pDU__Type__Extension.is_bound()) {
ret_val.pDU__Type__Extension() = single_value->field_pDU__Type__Extension.valueof();
}
if (single_value->field_reserved.is_bound()) {
ret_val.reserved() = single_value->field_reserved.valueof();
}
return ret_val;
}

void RIM__PDU__Indications_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 @BSSGP_Types.RIM_PDU_Indications.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RIM__PDU__Indications_template[list_length];
}

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

OCTETSTRING_template& RIM__PDU__Indications_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& RIM__PDU__Indications_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.RIM_PDU_Indications.");
return single_value->field_iEI;
}

BITSTRING_template& RIM__PDU__Indications_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& RIM__PDU__Indications_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.RIM_PDU_Indications.");
return single_value->field_ext;
}

LIN2__2a_template& RIM__PDU__Indications_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& RIM__PDU__Indications_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.RIM_PDU_Indications.");
return single_value->field_lengthIndicator;
}

BITSTRING_template& RIM__PDU__Indications_template::ack()
{
set_specific();
return single_value->field_ack;
}

const BITSTRING_template& RIM__PDU__Indications_template::ack() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ack of a non-specific template of type @BSSGP_Types.RIM_PDU_Indications.");
return single_value->field_ack;
}

BITSTRING_template& RIM__PDU__Indications_template::pDU__Type__Extension()
{
set_specific();
return single_value->field_pDU__Type__Extension;
}

const BITSTRING_template& RIM__PDU__Indications_template::pDU__Type__Extension() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field pDU_Type_Extension of a non-specific template of type @BSSGP_Types.RIM_PDU_Indications.");
return single_value->field_pDU__Type__Extension;
}

BITSTRING_template& RIM__PDU__Indications_template::reserved()
{
set_specific();
return single_value->field_reserved;
}

const BITSTRING_template& RIM__PDU__Indications_template::reserved() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field reserved of a non-specific template of type @BSSGP_Types.RIM_PDU_Indications.");
return single_value->field_reserved;
}

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

void RIM__PDU__Indications_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", ack := ");
single_value->field_ack.log();
TTCN_Logger::log_event_str(", pDU_Type_Extension := ");
single_value->field_pDU__Type__Extension.log();
TTCN_Logger::log_event_str(", reserved := ");
single_value->field_reserved.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 RIM__PDU__Indications_template::log_match(const RIM__PDU__Indications& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ack.match(match_value.ack(), legacy)){
TTCN_Logger::log_logmatch_info(".ack");
single_value->field_ack.log_match(match_value.ack(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_pDU__Type__Extension.match(match_value.pDU__Type__Extension(), legacy)){
TTCN_Logger::log_logmatch_info(".pDU_Type_Extension");
single_value->field_pDU__Type__Extension.log_match(match_value.pDU__Type__Extension(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_reserved.match(match_value.reserved(), legacy)){
TTCN_Logger::log_logmatch_info(".reserved");
single_value->field_reserved.log_match(match_value.reserved(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", ack := ");
single_value->field_ack.log_match(match_value.ack(), legacy);
TTCN_Logger::log_event_str(", pDU_Type_Extension := ");
single_value->field_pDU__Type__Extension.log_match(match_value.pDU__Type__Extension(), legacy);
TTCN_Logger::log_event_str(", reserved := ");
single_value->field_reserved.log_match(match_value.reserved(), 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 RIM__PDU__Indications_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (ack().is_bound()) ack().set_implicit_omit();
if (pDU__Type__Extension().is_bound()) pDU__Type__Extension().set_implicit_omit();
if (reserved().is_bound()) reserved().set_implicit_omit();
}

void RIM__PDU__Indications_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_ack.encode_text(text_buf);
single_value->field_pDU__Type__Extension.encode_text(text_buf);
single_value->field_reserved.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 @BSSGP_Types.RIM_PDU_Indications.");
}
}

void RIM__PDU__Indications_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_ack.decode_text(text_buf);
single_value->field_pDU__Type__Extension.decode_text(text_buf);
single_value->field_reserved.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 RIM__PDU__Indications_template[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 @BSSGP_Types.RIM_PDU_Indications.");
}
}

void RIM__PDU__Indications_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: {
    RIM__PDU__Indications_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 @BSSGP_Types.RIM_PDU_Indications 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) ack().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) pDU__Type__Extension().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) reserved().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          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(), "pDU_Type_Extension")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          pDU__Type__Extension().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "reserved")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          reserved().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @BSSGP_Types.RIM_PDU_Indications: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    RIM__PDU__Indications_template* precondition = new RIM__PDU__Indications_template;
    precondition->set_param(*param.get_elem(0));
    RIM__PDU__Indications_template* implied_template = new RIM__PDU__Indications_template;
    implied_template->set_param(*param.get_elem(1));
    *this = RIM__PDU__Indications_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.RIM_PDU_Indications");
  }
  is_ifpresent = param.get_ifpresent();
}

void RIM__PDU__Indications_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RIM_PDU_Indications");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RIM_PDU_Indications");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RIM_PDU_Indications");
single_value->field_ack.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RIM_PDU_Indications");
single_value->field_pDU__Type__Extension.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RIM_PDU_Indications");
single_value->field_reserved.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RIM_PDU_Indications");
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 : "@BSSGP_Types.RIM_PDU_Indications");
}

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

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

RAN__Information__Request__RIM__Container::RAN__Information__Request__RIM__Container()
{
}

RAN__Information__Request__RIM__Container::RAN__Information__Request__RIM__Container(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const RIM__Application__Identity& par_rIM__Application__Identity,
    const RIM__Sequence__Number& par_rIM__Sequence__Number,
    const RIM__PDU__Indications& par_rIM__PDU__Indications,
    const OPTIONAL< RIM__Protocol__Version__Number >& par_rIM__Protocol__Version__Number,
    const OPTIONAL< RAN__Information__Request__Application__Container >& par_application__Container,
    const OPTIONAL< SON__Transfer__Application__Identity__TLV >& par_sON__Transfer__Application__Identity__TLV)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_rIM__Application__Identity(par_rIM__Application__Identity),
  field_rIM__Sequence__Number(par_rIM__Sequence__Number),
  field_rIM__PDU__Indications(par_rIM__PDU__Indications),
  field_rIM__Protocol__Version__Number(par_rIM__Protocol__Version__Number),
  field_application__Container(par_application__Container),
  field_sON__Transfer__Application__Identity__TLV(par_sON__Transfer__Application__Identity__TLV)
{
}

RAN__Information__Request__RIM__Container::RAN__Information__Request__RIM__Container(const RAN__Information__Request__RIM__Container& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.RAN_Information_Request_RIM_Container.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.rIM__Application__Identity().is_bound()) field_rIM__Application__Identity = other_value.rIM__Application__Identity();
else field_rIM__Application__Identity.clean_up();
if (other_value.rIM__Sequence__Number().is_bound()) field_rIM__Sequence__Number = other_value.rIM__Sequence__Number();
else field_rIM__Sequence__Number.clean_up();
if (other_value.rIM__PDU__Indications().is_bound()) field_rIM__PDU__Indications = other_value.rIM__PDU__Indications();
else field_rIM__PDU__Indications.clean_up();
if (other_value.rIM__Protocol__Version__Number().is_bound()) field_rIM__Protocol__Version__Number = other_value.rIM__Protocol__Version__Number();
else field_rIM__Protocol__Version__Number.clean_up();
if (other_value.application__Container().is_bound()) field_application__Container = other_value.application__Container();
else field_application__Container.clean_up();
if (other_value.sON__Transfer__Application__Identity__TLV().is_bound()) field_sON__Transfer__Application__Identity__TLV = other_value.sON__Transfer__Application__Identity__TLV();
else field_sON__Transfer__Application__Identity__TLV.clean_up();
}

void RAN__Information__Request__RIM__Container::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_rIM__Application__Identity.clean_up();
field_rIM__Sequence__Number.clean_up();
field_rIM__PDU__Indications.clean_up();
field_rIM__Protocol__Version__Number.clean_up();
field_application__Container.clean_up();
field_sON__Transfer__Application__Identity__TLV.clean_up();
}

const TTCN_Typedescriptor_t* RAN__Information__Request__RIM__Container::get_descriptor() const { return &RAN__Information__Request__RIM__Container_descr_; }
RAN__Information__Request__RIM__Container& RAN__Information__Request__RIM__Container::operator=(const RAN__Information__Request__RIM__Container& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.RAN_Information_Request_RIM_Container.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.rIM__Application__Identity().is_bound()) field_rIM__Application__Identity = other_value.rIM__Application__Identity();
  else field_rIM__Application__Identity.clean_up();
  if (other_value.rIM__Sequence__Number().is_bound()) field_rIM__Sequence__Number = other_value.rIM__Sequence__Number();
  else field_rIM__Sequence__Number.clean_up();
  if (other_value.rIM__PDU__Indications().is_bound()) field_rIM__PDU__Indications = other_value.rIM__PDU__Indications();
  else field_rIM__PDU__Indications.clean_up();
  if (other_value.rIM__Protocol__Version__Number().is_bound()) field_rIM__Protocol__Version__Number = other_value.rIM__Protocol__Version__Number();
  else field_rIM__Protocol__Version__Number.clean_up();
  if (other_value.application__Container().is_bound()) field_application__Container = other_value.application__Container();
  else field_application__Container.clean_up();
  if (other_value.sON__Transfer__Application__Identity__TLV().is_bound()) field_sON__Transfer__Application__Identity__TLV = other_value.sON__Transfer__Application__Identity__TLV();
  else field_sON__Transfer__Application__Identity__TLV.clean_up();
}
return *this;
}

boolean RAN__Information__Request__RIM__Container::operator==(const RAN__Information__Request__RIM__Container& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_rIM__Application__Identity==other_value.field_rIM__Application__Identity
  && field_rIM__Sequence__Number==other_value.field_rIM__Sequence__Number
  && field_rIM__PDU__Indications==other_value.field_rIM__PDU__Indications
  && field_rIM__Protocol__Version__Number==other_value.field_rIM__Protocol__Version__Number
  && field_application__Container==other_value.field_application__Container
  && field_sON__Transfer__Application__Identity__TLV==other_value.field_sON__Transfer__Application__Identity__TLV;
}

boolean RAN__Information__Request__RIM__Container::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_rIM__Application__Identity.is_bound())
  || (field_rIM__Sequence__Number.is_bound())
  || (field_rIM__PDU__Indications.is_bound())
  || (OPTIONAL_OMIT == field_rIM__Protocol__Version__Number.get_selection() || field_rIM__Protocol__Version__Number.is_bound())
  || (OPTIONAL_OMIT == field_application__Container.get_selection() || field_application__Container.is_bound())
  || (OPTIONAL_OMIT == field_sON__Transfer__Application__Identity__TLV.get_selection() || field_sON__Transfer__Application__Identity__TLV.is_bound());
}
boolean RAN__Information__Request__RIM__Container::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_rIM__Application__Identity.is_value()
  && field_rIM__Sequence__Number.is_value()
  && field_rIM__PDU__Indications.is_value()
  && (OPTIONAL_OMIT == field_rIM__Protocol__Version__Number.get_selection() || field_rIM__Protocol__Version__Number.is_value())
  && (OPTIONAL_OMIT == field_application__Container.get_selection() || field_application__Container.is_value())
  && (OPTIONAL_OMIT == field_sON__Transfer__Application__Identity__TLV.get_selection() || field_sON__Transfer__Application__Identity__TLV.is_value());
}
int RAN__Information__Request__RIM__Container::size_of() const
{
  int ret_val = 6;
  if (field_rIM__Protocol__Version__Number.ispresent()) ret_val++;
  if (field_application__Container.ispresent()) ret_val++;
  if (field_sON__Transfer__Application__Identity__TLV.ispresent()) ret_val++;
  return ret_val;
}

void RAN__Information__Request__RIM__Container::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", rIM_Application_Identity := ");
field_rIM__Application__Identity.log();
TTCN_Logger::log_event_str(", rIM_Sequence_Number := ");
field_rIM__Sequence__Number.log();
TTCN_Logger::log_event_str(", rIM_PDU_Indications := ");
field_rIM__PDU__Indications.log();
TTCN_Logger::log_event_str(", rIM_Protocol_Version_Number := ");
field_rIM__Protocol__Version__Number.log();
TTCN_Logger::log_event_str(", application_Container := ");
field_application__Container.log();
TTCN_Logger::log_event_str(", sON_Transfer_Application_Identity_TLV := ");
field_sON__Transfer__Application__Identity__TLV.log();
TTCN_Logger::log_event_str(" }");
}

void RAN__Information__Request__RIM__Container::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (rIM__Application__Identity().is_bound()) rIM__Application__Identity().set_implicit_omit();
if (rIM__Sequence__Number().is_bound()) rIM__Sequence__Number().set_implicit_omit();
if (rIM__PDU__Indications().is_bound()) rIM__PDU__Indications().set_implicit_omit();
if (!rIM__Protocol__Version__Number().is_bound()) rIM__Protocol__Version__Number() = OMIT_VALUE;
else rIM__Protocol__Version__Number().set_implicit_omit();
if (!application__Container().is_bound()) application__Container() = OMIT_VALUE;
else application__Container().set_implicit_omit();
if (!sON__Transfer__Application__Identity__TLV().is_bound()) sON__Transfer__Application__Identity__TLV() = OMIT_VALUE;
else sON__Transfer__Application__Identity__TLV().set_implicit_omit();
}

void RAN__Information__Request__RIM__Container::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (9<param.get_size()) {
      param.error("record value of type @BSSGP_Types.RAN_Information_Request_RIM_Container has 9 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rIM__Application__Identity().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) rIM__Sequence__Number().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) rIM__PDU__Indications().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) rIM__Protocol__Version__Number().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) application__Container().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) sON__Transfer__Application__Identity__TLV().set_param(*param.get_elem(8));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rIM_Application_Identity")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rIM__Application__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(), "rIM_Sequence_Number")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rIM__Sequence__Number().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rIM_PDU_Indications")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rIM__PDU__Indications().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rIM_Protocol_Version_Number")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rIM__Protocol__Version__Number().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "application_Container")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          application__Container().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "sON_Transfer_Application_Identity_TLV")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sON__Transfer__Application__Identity__TLV().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 @BSSGP_Types.RAN_Information_Request_RIM_Container: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.RAN_Information_Request_RIM_Container");
  }
}

void RAN__Information__Request__RIM__Container::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_rIM__Application__Identity.encode_text(text_buf);
field_rIM__Sequence__Number.encode_text(text_buf);
field_rIM__PDU__Indications.encode_text(text_buf);
field_rIM__Protocol__Version__Number.encode_text(text_buf);
field_application__Container.encode_text(text_buf);
field_sON__Transfer__Application__Identity__TLV.encode_text(text_buf);
}

void RAN__Information__Request__RIM__Container::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_rIM__Application__Identity.decode_text(text_buf);
field_rIM__Sequence__Number.decode_text(text_buf);
field_rIM__PDU__Indications.decode_text(text_buf);
field_rIM__Protocol__Version__Number.decode_text(text_buf);
field_application__Container.decode_text(text_buf);
field_sON__Transfer__Application__Identity__TLV.decode_text(text_buf);
}

void RAN__Information__Request__RIM__Container::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 RAN__Information__Request__RIM__Container::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 RAN__Information__Request__RIM__Container::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, RAN__Information__Request__RIM__Container_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(RAN__Information__Request__RIM__Container_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, RAN__Information__Request__RIM__Container_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(RAN__Information__Request__RIM__Container_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, RIM__Application__Identity_descr_.raw->forceomit);
  decoded_field_length = field_rIM__Application__Identity.RAW_decode(RIM__Application__Identity_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_4_force_omit(4, force_omit, RIM__Sequence__Number_descr_.raw->forceomit);
  decoded_field_length = field_rIM__Sequence__Number.RAW_decode(RIM__Sequence__Number_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  RAW_Force_Omit field_5_force_omit(5, force_omit, RIM__PDU__Indications_descr_.raw->forceomit);
  decoded_field_length = field_rIM__PDU__Indications.RAW_decode(RIM__PDU__Indications_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, no_err, -1, TRUE, &field_5_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(6)) {
    field_rIM__Protocol__Version__Number = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_6_force_omit(6, force_omit, RIM__Protocol__Version__Number_descr_.raw->forceomit);
  decoded_field_length = field_rIM__Protocol__Version__Number().RAW_decode(RIM__Protocol__Version__Number_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_6_force_omit);
  if (decoded_field_length < 1) {
  field_rIM__Protocol__Version__Number = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_rIM__Protocol__Version__Number=OMIT_VALUE;
  if (field_rIM__Application__Identity.rIMApplicationIdentity() ==  os_26) selected_field = 0;
  else if (field_rIM__Application__Identity.rIMApplicationIdentity() ==  os_27) selected_field = 1;
  else if (field_rIM__Application__Identity.rIMApplicationIdentity() ==  os_59) selected_field = 2;
  else selected_field = -1;
  if (limit > 0 && value_of_length_field2 > 0 && (field_rIM__Application__Identity.rIMApplicationIdentity() ==  os_26 || field_rIM__Application__Identity.rIMApplicationIdentity() ==  os_27 || field_rIM__Application__Identity.rIMApplicationIdentity() ==  os_59)&& selected_field!=-1){
  if (force_omit != NULL && (*force_omit)(7)) {
    field_application__Container = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_7_force_omit(7, force_omit, RAN__Information__Request__RIM__Container_application__Container_descr_.raw->forceomit);
  decoded_field_length = field_application__Container().RAW_decode(RAN__Information__Request__RIM__Container_application__Container_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, selected_field, TRUE, &field_7_force_omit);
  if (decoded_field_length < 1) {
  field_application__Container = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_application__Container=OMIT_VALUE;
  if (limit > 0 && value_of_length_field2 > 0){
  if (force_omit != NULL && (*force_omit)(8)) {
    field_sON__Transfer__Application__Identity__TLV = OMIT_VALUE;
  }
  else {
  size_t fl_start_pos = p_buf.get_pos_bit();
  RAW_Force_Omit field_8_force_omit(8, force_omit, SON__Transfer__Application__Identity__TLV_descr_.raw->forceomit);
  decoded_field_length = field_sON__Transfer__Application__Identity__TLV().RAW_decode(SON__Transfer__Application__Identity__TLV_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, TRUE, -1, TRUE, &field_8_force_omit);
  if (decoded_field_length < 1) {
  field_sON__Transfer__Application__Identity__TLV = OMIT_VALUE;
  p_buf.set_pos_bit(fl_start_pos);
  } else {
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  value_of_length_field2 -= decoded_field_length;
  }
  }
  }
  else field_sON__Transfer__Application__Identity__TLV=OMIT_VALUE;
  if (field_iEI !=  os_82) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int RAN__Information__Request__RIM__Container::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const {
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 9;
  myleaf.body.node.nodes = init_nodes_of_enc_tree(9);
  myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RAN__Information__Request__RIM__Container_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, RAN__Information__Request__RIM__Container_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, RIM__Application__Identity_descr_.raw);
  myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, RIM__Sequence__Number_descr_.raw);
  myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, RIM__PDU__Indications_descr_.raw);
  if (field_rIM__Protocol__Version__Number.ispresent()) {
  myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, RIM__Protocol__Version__Number_descr_.raw);
  }
  else myleaf.body.node.nodes[6] = NULL;
  if (field_application__Container.ispresent()) {
  myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, RAN__Information__Request__RIM__Container_application__Container_descr_.raw);
  }
  else myleaf.body.node.nodes[7] = NULL;
  if (field_sON__Transfer__Application__Identity__TLV.ispresent()) {
  myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, SON__Transfer__Application__Identity__TLV_descr_.raw);
  }
  else myleaf.body.node.nodes[8] = NULL;
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(RAN__Information__Request__RIM__Container_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(RAN__Information__Request__RIM__Container_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_rIM__Application__Identity.RAW_encode(RIM__Application__Identity_descr_, *myleaf.body.node.nodes[3]);
  encoded_length += field_rIM__Sequence__Number.RAW_encode(RIM__Sequence__Number_descr_, *myleaf.body.node.nodes[4]);
  encoded_length += field_rIM__PDU__Indications.RAW_encode(RIM__PDU__Indications_descr_, *myleaf.body.node.nodes[5]);
  if (field_rIM__Protocol__Version__Number.ispresent()) {
  encoded_length += field_rIM__Protocol__Version__Number().RAW_encode(RIM__Protocol__Version__Number_descr_, *myleaf.body.node.nodes[6]);
  }
  if (field_application__Container.ispresent()) {
  encoded_length += field_application__Container().RAW_encode(RAN__Information__Request__RIM__Container_application__Container_descr_, *myleaf.body.node.nodes[7]);
  }
  if (field_sON__Transfer__Application__Identity__TLV.ispresent()) {
  encoded_length += field_sON__Transfer__Application__Identity__TLV().RAW_encode(SON__Transfer__Application__Identity__TLV_descr_, *myleaf.body.node.nodes[8]);
  }
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 6;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(6);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[4]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[4]->curr_pos.pos;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[5]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[5]->curr_pos.pos;
  if (field_rIM__Protocol__Version__Number.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[6]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[6]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[3].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[3].pos = 0;
  }
  if (field_application__Container.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[4].level = myleaf.body.node.nodes[7]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[4].pos = myleaf.body.node.nodes[7]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[4].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[4].pos = 0;
  }
  if (field_sON__Transfer__Application__Identity__TLV.ispresent()) {
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[5].level = myleaf.body.node.nodes[8]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[5].pos = myleaf.body.node.nodes[8]->curr_pos.pos;
  }else{
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[5].level = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[5].pos = 0;
  }
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(RAN__Information__Request__RIM__Container_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(RAN__Information__Request__RIM__Container_ext_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_application__Container.ispresent() && (field_rIM__Application__Identity.rIMApplicationIdentity() !=  os_26 && field_rIM__Application__Identity.rIMApplicationIdentity() !=  os_27 && field_rIM__Application__Identity.rIMApplicationIdentity() !=  os_59)) {
  RAW_enc_tree* temp_leaf;
  {
  RAW_enc_tr_pos pr_pos0;
  pr_pos0.level=myleaf.curr_pos.level+2;
  int new_pos0[]={3,3};
  pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,2,new_pos0);
  temp_leaf = myleaf.get_node(pr_pos0);
  if(temp_leaf != NULL){
   os_26.RAW_encode(General__Types::OCT1_descr_,*temp_leaf);
  } else  {
  RAW_enc_tr_pos pr_pos1;
  pr_pos1.level=myleaf.curr_pos.level+2;
  int new_pos1[]={3,3};
  pr_pos1.pos=init_new_tree_pos(myleaf.curr_pos,2,new_pos1);
  temp_leaf = myleaf.get_node(pr_pos1);
  if(temp_leaf != NULL){
   os_27.RAW_encode(General__Types::OCT1_descr_,*temp_leaf);
  } else  {
  RAW_enc_tr_pos pr_pos2;
  pr_pos2.level=myleaf.curr_pos.level+2;
  int new_pos2[]={3,3};
  pr_pos2.pos=init_new_tree_pos(myleaf.curr_pos,2,new_pos2);
  temp_leaf = myleaf.get_node(pr_pos2);
  if(temp_leaf != NULL){
   os_59.RAW_encode(General__Types::OCT1_descr_,*temp_leaf);
  } else {
    TTCN_EncDec_ErrorContext::error
      (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value.");
  }
  free_tree_pos(pr_pos2.pos);
  }
  free_tree_pos(pr_pos1.pos);
  }
  free_tree_pos(pr_pos0.pos);
  }
  }
  if (field_application__Container.ispresent()) {
  switch (field_application__Container().get_selection()) {
  case RAN__Information__Request__Application__Container::ALT_nacc:
  if (field_rIM__Application__Identity.rIMApplicationIdentity() !=  os_26) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 2;
  int new_pos[] = { 3, 3 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 2, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     os_26.RAW_encode(General__Types::OCT1_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 RAN__Information__Request__Application__Container::ALT_si3:
  if (field_rIM__Application__Identity.rIMApplicationIdentity() !=  os_27) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 2;
  int new_pos[] = { 3, 3 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 2, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     os_27.RAW_encode(General__Types::OCT1_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 RAN__Information__Request__Application__Container::ALT_mBMS__data__channel:
  if (field_rIM__Application__Identity.rIMApplicationIdentity() !=  os_59) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 2;
  int new_pos[] = { 3, 3 };
  pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 2, new_pos);
  RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos);
  if (temp_leaf != NULL)
     os_59.RAW_encode(General__Types::OCT1_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_iEI !=  os_82) {
  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){
   os_82.RAW_encode(General__Types::OCT1_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 RAN__Information__Request__RIM__Container_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
RIM__Application__Identity_template field_rIM__Application__Identity;
RIM__Sequence__Number_template field_rIM__Sequence__Number;
RIM__PDU__Indications_template field_rIM__PDU__Indications;
RIM__Protocol__Version__Number_template field_rIM__Protocol__Version__Number;
RAN__Information__Request__Application__Container_template field_application__Container;
SON__Transfer__Application__Identity__TLV_template field_sON__Transfer__Application__Identity__TLV;
};

void RAN__Information__Request__RIM__Container_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_rIM__Application__Identity = ANY_VALUE;
single_value->field_rIM__Sequence__Number = ANY_VALUE;
single_value->field_rIM__PDU__Indications = ANY_VALUE;
single_value->field_rIM__Protocol__Version__Number = ANY_OR_OMIT;
single_value->field_application__Container = ANY_OR_OMIT;
single_value->field_sON__Transfer__Application__Identity__TLV = ANY_OR_OMIT;
}
}
}

void RAN__Information__Request__RIM__Container_template::copy_value(const RAN__Information__Request__RIM__Container& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.rIM__Application__Identity().is_bound()) {
  single_value->field_rIM__Application__Identity = other_value.rIM__Application__Identity();
} else {
  single_value->field_rIM__Application__Identity.clean_up();
}
if (other_value.rIM__Sequence__Number().is_bound()) {
  single_value->field_rIM__Sequence__Number = other_value.rIM__Sequence__Number();
} else {
  single_value->field_rIM__Sequence__Number.clean_up();
}
if (other_value.rIM__PDU__Indications().is_bound()) {
  single_value->field_rIM__PDU__Indications = other_value.rIM__PDU__Indications();
} else {
  single_value->field_rIM__PDU__Indications.clean_up();
}
if (other_value.rIM__Protocol__Version__Number().is_bound()) {
  if (other_value.rIM__Protocol__Version__Number().ispresent()) single_value->field_rIM__Protocol__Version__Number = other_value.rIM__Protocol__Version__Number()();
  else single_value->field_rIM__Protocol__Version__Number = OMIT_VALUE;
} else {
  single_value->field_rIM__Protocol__Version__Number.clean_up();
}
if (other_value.application__Container().is_bound()) {
  if (other_value.application__Container().ispresent()) single_value->field_application__Container = other_value.application__Container()();
  else single_value->field_application__Container = OMIT_VALUE;
} else {
  single_value->field_application__Container.clean_up();
}
if (other_value.sON__Transfer__Application__Identity__TLV().is_bound()) {
  if (other_value.sON__Transfer__Application__Identity__TLV().ispresent()) single_value->field_sON__Transfer__Application__Identity__TLV = other_value.sON__Transfer__Application__Identity__TLV()();
  else single_value->field_sON__Transfer__Application__Identity__TLV = OMIT_VALUE;
} else {
  single_value->field_sON__Transfer__Application__Identity__TLV.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RAN__Information__Request__RIM__Container_template::copy_template(const RAN__Information__Request__RIM__Container_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rIM__Application__Identity().get_selection()) {
single_value->field_rIM__Application__Identity = other_value.rIM__Application__Identity();
} else {
single_value->field_rIM__Application__Identity.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rIM__Sequence__Number().get_selection()) {
single_value->field_rIM__Sequence__Number = other_value.rIM__Sequence__Number();
} else {
single_value->field_rIM__Sequence__Number.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rIM__PDU__Indications().get_selection()) {
single_value->field_rIM__PDU__Indications = other_value.rIM__PDU__Indications();
} else {
single_value->field_rIM__PDU__Indications.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rIM__Protocol__Version__Number().get_selection()) {
single_value->field_rIM__Protocol__Version__Number = other_value.rIM__Protocol__Version__Number();
} else {
single_value->field_rIM__Protocol__Version__Number.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.application__Container().get_selection()) {
single_value->field_application__Container = other_value.application__Container();
} else {
single_value->field_application__Container.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.sON__Transfer__Application__Identity__TLV().get_selection()) {
single_value->field_sON__Transfer__Application__Identity__TLV = other_value.sON__Transfer__Application__Identity__TLV();
} else {
single_value->field_sON__Transfer__Application__Identity__TLV.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 RAN__Information__Request__RIM__Container_template[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 RAN__Information__Request__RIM__Container_template(*other_value.implication_.precondition);
implication_.implied_template = new RAN__Information__Request__RIM__Container_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 @BSSGP_Types.RAN_Information_Request_RIM_Container.");
break;
}
set_selection(other_value);
}

RAN__Information__Request__RIM__Container_template::RAN__Information__Request__RIM__Container_template()
{
}

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

RAN__Information__Request__RIM__Container_template::RAN__Information__Request__RIM__Container_template(const RAN__Information__Request__RIM__Container& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean RAN__Information__Request__RIM__Container_template::match(const RAN__Information__Request__RIM__Container& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.rIM__Application__Identity().is_bound()) return FALSE;
if(!single_value->field_rIM__Application__Identity.match(other_value.rIM__Application__Identity(), legacy))return FALSE;
if(!other_value.rIM__Sequence__Number().is_bound()) return FALSE;
if(!single_value->field_rIM__Sequence__Number.match(other_value.rIM__Sequence__Number(), legacy))return FALSE;
if(!other_value.rIM__PDU__Indications().is_bound()) return FALSE;
if(!single_value->field_rIM__PDU__Indications.match(other_value.rIM__PDU__Indications(), legacy))return FALSE;
if(!other_value.rIM__Protocol__Version__Number().is_bound()) return FALSE;
if((other_value.rIM__Protocol__Version__Number().ispresent() ? !single_value->field_rIM__Protocol__Version__Number.match((const RIM__Protocol__Version__Number&)other_value.rIM__Protocol__Version__Number(), legacy) : !single_value->field_rIM__Protocol__Version__Number.match_omit(legacy)))return FALSE;
if(!other_value.application__Container().is_bound()) return FALSE;
if((other_value.application__Container().ispresent() ? !single_value->field_application__Container.match((const RAN__Information__Request__Application__Container&)other_value.application__Container(), legacy) : !single_value->field_application__Container.match_omit(legacy)))return FALSE;
if(!other_value.sON__Transfer__Application__Identity__TLV().is_bound()) return FALSE;
if((other_value.sON__Transfer__Application__Identity__TLV().ispresent() ? !single_value->field_sON__Transfer__Application__Identity__TLV.match((const SON__Transfer__Application__Identity__TLV&)other_value.sON__Transfer__Application__Identity__TLV(), legacy) : !single_value->field_sON__Transfer__Application__Identity__TLV.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 @BSSGP_Types.RAN_Information_Request_RIM_Container.");
}
return FALSE;
}

boolean RAN__Information__Request__RIM__Container_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_rIM__Application__Identity.is_bound()
 || single_value->field_rIM__Sequence__Number.is_bound()
 || single_value->field_rIM__PDU__Indications.is_bound()
 || (single_value->field_rIM__Protocol__Version__Number.is_omit() || single_value->field_rIM__Protocol__Version__Number.is_bound())
 || (single_value->field_application__Container.is_omit() || single_value->field_application__Container.is_bound())
 || (single_value->field_sON__Transfer__Application__Identity__TLV.is_omit() || single_value->field_sON__Transfer__Application__Identity__TLV.is_bound());
}

boolean RAN__Information__Request__RIM__Container_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_rIM__Application__Identity.is_value()
 && single_value->field_rIM__Sequence__Number.is_value()
 && single_value->field_rIM__PDU__Indications.is_value()
 && (single_value->field_rIM__Protocol__Version__Number.is_omit() || single_value->field_rIM__Protocol__Version__Number.is_value())
 && (single_value->field_application__Container.is_omit() || single_value->field_application__Container.is_value())
 && (single_value->field_sON__Transfer__Application__Identity__TLV.is_omit() || single_value->field_sON__Transfer__Application__Identity__TLV.is_value());
}

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

RAN__Information__Request__RIM__Container RAN__Information__Request__RIM__Container_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 @BSSGP_Types.RAN_Information_Request_RIM_Container.");
RAN__Information__Request__RIM__Container ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_rIM__Application__Identity.is_bound()) {
ret_val.rIM__Application__Identity() = single_value->field_rIM__Application__Identity.valueof();
}
if (single_value->field_rIM__Sequence__Number.is_bound()) {
ret_val.rIM__Sequence__Number() = single_value->field_rIM__Sequence__Number.valueof();
}
if (single_value->field_rIM__PDU__Indications.is_bound()) {
ret_val.rIM__PDU__Indications() = single_value->field_rIM__PDU__Indications.valueof();
}
if (single_value->field_rIM__Protocol__Version__Number.is_omit()) ret_val.rIM__Protocol__Version__Number() = OMIT_VALUE;
else if (single_value->field_rIM__Protocol__Version__Number.is_bound()) {
ret_val.rIM__Protocol__Version__Number() = single_value->field_rIM__Protocol__Version__Number.valueof();
}
if (single_value->field_application__Container.is_omit()) ret_val.application__Container() = OMIT_VALUE;
else if (single_value->field_application__Container.is_bound()) {
ret_val.application__Container() = single_value->field_application__Container.valueof();
}
if (single_value->field_sON__Transfer__Application__Identity__TLV.is_omit()) ret_val.sON__Transfer__Application__Identity__TLV() = OMIT_VALUE;
else if (single_value->field_sON__Transfer__Application__Identity__TLV.is_bound()) {
ret_val.sON__Transfer__Application__Identity__TLV() = single_value->field_sON__Transfer__Application__Identity__TLV.valueof();
}
return ret_val;
}

void RAN__Information__Request__RIM__Container_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 @BSSGP_Types.RAN_Information_Request_RIM_Container.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RAN__Information__Request__RIM__Container_template[list_length];
}

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

OCTETSTRING_template& RAN__Information__Request__RIM__Container_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& RAN__Information__Request__RIM__Container_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.RAN_Information_Request_RIM_Container.");
return single_value->field_iEI;
}

BITSTRING_template& RAN__Information__Request__RIM__Container_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& RAN__Information__Request__RIM__Container_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.RAN_Information_Request_RIM_Container.");
return single_value->field_ext;
}

LIN2__2a_template& RAN__Information__Request__RIM__Container_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& RAN__Information__Request__RIM__Container_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.RAN_Information_Request_RIM_Container.");
return single_value->field_lengthIndicator;
}

RIM__Application__Identity_template& RAN__Information__Request__RIM__Container_template::rIM__Application__Identity()
{
set_specific();
return single_value->field_rIM__Application__Identity;
}

const RIM__Application__Identity_template& RAN__Information__Request__RIM__Container_template::rIM__Application__Identity() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rIM_Application_Identity of a non-specific template of type @BSSGP_Types.RAN_Information_Request_RIM_Container.");
return single_value->field_rIM__Application__Identity;
}

RIM__Sequence__Number_template& RAN__Information__Request__RIM__Container_template::rIM__Sequence__Number()
{
set_specific();
return single_value->field_rIM__Sequence__Number;
}

const RIM__Sequence__Number_template& RAN__Information__Request__RIM__Container_template::rIM__Sequence__Number() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rIM_Sequence_Number of a non-specific template of type @BSSGP_Types.RAN_Information_Request_RIM_Container.");
return single_value->field_rIM__Sequence__Number;
}

RIM__PDU__Indications_template& RAN__Information__Request__RIM__Container_template::rIM__PDU__Indications()
{
set_specific();
return single_value->field_rIM__PDU__Indications;
}

const RIM__PDU__Indications_template& RAN__Information__Request__RIM__Container_template::rIM__PDU__Indications() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rIM_PDU_Indications of a non-specific template of type @BSSGP_Types.RAN_Information_Request_RIM_Container.");
return single_value->field_rIM__PDU__Indications;
}

RIM__Protocol__Version__Number_template& RAN__Information__Request__RIM__Container_template::rIM__Protocol__Version__Number()
{
set_specific();
return single_value->field_rIM__Protocol__Version__Number;
}

const RIM__Protocol__Version__Number_template& RAN__Information__Request__RIM__Container_template::rIM__Protocol__Version__Number() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rIM_Protocol_Version_Number of a non-specific template of type @BSSGP_Types.RAN_Information_Request_RIM_Container.");
return single_value->field_rIM__Protocol__Version__Number;
}

RAN__Information__Request__Application__Container_template& RAN__Information__Request__RIM__Container_template::application__Container()
{
set_specific();
return single_value->field_application__Container;
}

const RAN__Information__Request__Application__Container_template& RAN__Information__Request__RIM__Container_template::application__Container() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field application_Container of a non-specific template of type @BSSGP_Types.RAN_Information_Request_RIM_Container.");
return single_value->field_application__Container;
}

SON__Transfer__Application__Identity__TLV_template& RAN__Information__Request__RIM__Container_template::sON__Transfer__Application__Identity__TLV()
{
set_specific();
return single_value->field_sON__Transfer__Application__Identity__TLV;
}

const SON__Transfer__Application__Identity__TLV_template& RAN__Information__Request__RIM__Container_template::sON__Transfer__Application__Identity__TLV() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field sON_Transfer_Application_Identity_TLV of a non-specific template of type @BSSGP_Types.RAN_Information_Request_RIM_Container.");
return single_value->field_sON__Transfer__Application__Identity__TLV;
}

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

void RAN__Information__Request__RIM__Container_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", rIM_Application_Identity := ");
single_value->field_rIM__Application__Identity.log();
TTCN_Logger::log_event_str(", rIM_Sequence_Number := ");
single_value->field_rIM__Sequence__Number.log();
TTCN_Logger::log_event_str(", rIM_PDU_Indications := ");
single_value->field_rIM__PDU__Indications.log();
TTCN_Logger::log_event_str(", rIM_Protocol_Version_Number := ");
single_value->field_rIM__Protocol__Version__Number.log();
TTCN_Logger::log_event_str(", application_Container := ");
single_value->field_application__Container.log();
TTCN_Logger::log_event_str(", sON_Transfer_Application_Identity_TLV := ");
single_value->field_sON__Transfer__Application__Identity__TLV.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 RAN__Information__Request__RIM__Container_template::log_match(const RAN__Information__Request__RIM__Container& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rIM__Application__Identity.match(match_value.rIM__Application__Identity(), legacy)){
TTCN_Logger::log_logmatch_info(".rIM_Application_Identity");
single_value->field_rIM__Application__Identity.log_match(match_value.rIM__Application__Identity(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rIM__Sequence__Number.match(match_value.rIM__Sequence__Number(), legacy)){
TTCN_Logger::log_logmatch_info(".rIM_Sequence_Number");
single_value->field_rIM__Sequence__Number.log_match(match_value.rIM__Sequence__Number(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rIM__PDU__Indications.match(match_value.rIM__PDU__Indications(), legacy)){
TTCN_Logger::log_logmatch_info(".rIM_PDU_Indications");
single_value->field_rIM__PDU__Indications.log_match(match_value.rIM__PDU__Indications(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.rIM__Protocol__Version__Number().ispresent()){
if(!single_value->field_rIM__Protocol__Version__Number.match(match_value.rIM__Protocol__Version__Number(), legacy)){
TTCN_Logger::log_logmatch_info(".rIM_Protocol_Version_Number");
single_value->field_rIM__Protocol__Version__Number.log_match(match_value.rIM__Protocol__Version__Number(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_rIM__Protocol__Version__Number.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".rIM_Protocol_Version_Number := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_rIM__Protocol__Version__Number.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.application__Container().ispresent()){
if(!single_value->field_application__Container.match(match_value.application__Container(), legacy)){
TTCN_Logger::log_logmatch_info(".application_Container");
single_value->field_application__Container.log_match(match_value.application__Container(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_application__Container.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".application_Container := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_application__Container.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.sON__Transfer__Application__Identity__TLV().ispresent()){
if(!single_value->field_sON__Transfer__Application__Identity__TLV.match(match_value.sON__Transfer__Application__Identity__TLV(), legacy)){
TTCN_Logger::log_logmatch_info(".sON_Transfer_Application_Identity_TLV");
single_value->field_sON__Transfer__Application__Identity__TLV.log_match(match_value.sON__Transfer__Application__Identity__TLV(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_sON__Transfer__Application__Identity__TLV.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".sON_Transfer_Application_Identity_TLV := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_sON__Transfer__Application__Identity__TLV.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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", rIM_Application_Identity := ");
single_value->field_rIM__Application__Identity.log_match(match_value.rIM__Application__Identity(), legacy);
TTCN_Logger::log_event_str(", rIM_Sequence_Number := ");
single_value->field_rIM__Sequence__Number.log_match(match_value.rIM__Sequence__Number(), legacy);
TTCN_Logger::log_event_str(", rIM_PDU_Indications := ");
single_value->field_rIM__PDU__Indications.log_match(match_value.rIM__PDU__Indications(), legacy);
TTCN_Logger::log_event_str(", rIM_Protocol_Version_Number := ");
if (match_value.rIM__Protocol__Version__Number().ispresent()) {
single_value->field_rIM__Protocol__Version__Number.log_match(match_value.rIM__Protocol__Version__Number(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_rIM__Protocol__Version__Number.log();
if (single_value->field_rIM__Protocol__Version__Number.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", application_Container := ");
if (match_value.application__Container().ispresent()) {
single_value->field_application__Container.log_match(match_value.application__Container(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_application__Container.log();
if (single_value->field_application__Container.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", sON_Transfer_Application_Identity_TLV := ");
if (match_value.sON__Transfer__Application__Identity__TLV().ispresent()) {
single_value->field_sON__Transfer__Application__Identity__TLV.log_match(match_value.sON__Transfer__Application__Identity__TLV(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_sON__Transfer__Application__Identity__TLV.log();
if (single_value->field_sON__Transfer__Application__Identity__TLV.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 RAN__Information__Request__RIM__Container_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (rIM__Application__Identity().is_bound()) rIM__Application__Identity().set_implicit_omit();
if (rIM__Sequence__Number().is_bound()) rIM__Sequence__Number().set_implicit_omit();
if (rIM__PDU__Indications().is_bound()) rIM__PDU__Indications().set_implicit_omit();
if (!rIM__Protocol__Version__Number().is_bound()) rIM__Protocol__Version__Number() = OMIT_VALUE;
else rIM__Protocol__Version__Number().set_implicit_omit();
if (!application__Container().is_bound()) application__Container() = OMIT_VALUE;
else application__Container().set_implicit_omit();
if (!sON__Transfer__Application__Identity__TLV().is_bound()) sON__Transfer__Application__Identity__TLV() = OMIT_VALUE;
else sON__Transfer__Application__Identity__TLV().set_implicit_omit();
}

void RAN__Information__Request__RIM__Container_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_rIM__Application__Identity.encode_text(text_buf);
single_value->field_rIM__Sequence__Number.encode_text(text_buf);
single_value->field_rIM__PDU__Indications.encode_text(text_buf);
single_value->field_rIM__Protocol__Version__Number.encode_text(text_buf);
single_value->field_application__Container.encode_text(text_buf);
single_value->field_sON__Transfer__Application__Identity__TLV.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 @BSSGP_Types.RAN_Information_Request_RIM_Container.");
}
}

void RAN__Information__Request__RIM__Container_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_rIM__Application__Identity.decode_text(text_buf);
single_value->field_rIM__Sequence__Number.decode_text(text_buf);
single_value->field_rIM__PDU__Indications.decode_text(text_buf);
single_value->field_rIM__Protocol__Version__Number.decode_text(text_buf);
single_value->field_application__Container.decode_text(text_buf);
single_value->field_sON__Transfer__Application__Identity__TLV.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 RAN__Information__Request__RIM__Container_template[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 @BSSGP_Types.RAN_Information_Request_RIM_Container.");
}
}

void RAN__Information__Request__RIM__Container_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: {
    RAN__Information__Request__RIM__Container_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (9<param.get_size()) {
      param.error("record template of type @BSSGP_Types.RAN_Information_Request_RIM_Container has 9 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rIM__Application__Identity().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) rIM__Sequence__Number().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) rIM__PDU__Indications().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) rIM__Protocol__Version__Number().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) application__Container().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) sON__Transfer__Application__Identity__TLV().set_param(*param.get_elem(8));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rIM_Application_Identity")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rIM__Application__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(), "rIM_Sequence_Number")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rIM__Sequence__Number().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rIM_PDU_Indications")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rIM__PDU__Indications().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rIM_Protocol_Version_Number")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rIM__Protocol__Version__Number().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "application_Container")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          application__Container().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "sON_Transfer_Application_Identity_TLV")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sON__Transfer__Application__Identity__TLV().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 @BSSGP_Types.RAN_Information_Request_RIM_Container: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    RAN__Information__Request__RIM__Container_template* precondition = new RAN__Information__Request__RIM__Container_template;
    precondition->set_param(*param.get_elem(0));
    RAN__Information__Request__RIM__Container_template* implied_template = new RAN__Information__Request__RIM__Container_template;
    implied_template->set_param(*param.get_elem(1));
    *this = RAN__Information__Request__RIM__Container_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.RAN_Information_Request_RIM_Container");
  }
  is_ifpresent = param.get_ifpresent();
}

void RAN__Information__Request__RIM__Container_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RAN_Information_Request_RIM_Container");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RAN_Information_Request_RIM_Container");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RAN_Information_Request_RIM_Container");
single_value->field_rIM__Application__Identity.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RAN_Information_Request_RIM_Container");
single_value->field_rIM__Sequence__Number.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RAN_Information_Request_RIM_Container");
single_value->field_rIM__PDU__Indications.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RAN_Information_Request_RIM_Container");
single_value->field_rIM__Protocol__Version__Number.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RAN_Information_Request_RIM_Container");
single_value->field_application__Container.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RAN_Information_Request_RIM_Container");
single_value->field_sON__Transfer__Application__Identity__TLV.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RAN_Information_Request_RIM_Container");
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 : "@BSSGP_Types.RAN_Information_Request_RIM_Container");
}

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

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

RIM__Protocol__Version__Number::RIM__Protocol__Version__Number()
{
}

RIM__Protocol__Version__Number::RIM__Protocol__Version__Number(const OCTETSTRING& par_iEI,
    const BITSTRING& par_ext,
    const LIN2__2a& par_lengthIndicator,
    const OCTETSTRING& par_rIMProtocolVersionNumber)
  :   field_iEI(par_iEI),
  field_ext(par_ext),
  field_lengthIndicator(par_lengthIndicator),
  field_rIMProtocolVersionNumber(par_rIMProtocolVersionNumber)
{
}

RIM__Protocol__Version__Number::RIM__Protocol__Version__Number(const RIM__Protocol__Version__Number& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @BSSGP_Types.RIM_Protocol_Version_Number.");
if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
else field_iEI.clean_up();
if (other_value.ext().is_bound()) field_ext = other_value.ext();
else field_ext.clean_up();
if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
else field_lengthIndicator.clean_up();
if (other_value.rIMProtocolVersionNumber().is_bound()) field_rIMProtocolVersionNumber = other_value.rIMProtocolVersionNumber();
else field_rIMProtocolVersionNumber.clean_up();
}

void RIM__Protocol__Version__Number::clean_up()
{
field_iEI.clean_up();
field_ext.clean_up();
field_lengthIndicator.clean_up();
field_rIMProtocolVersionNumber.clean_up();
}

const TTCN_Typedescriptor_t* RIM__Protocol__Version__Number::get_descriptor() const { return &RIM__Protocol__Version__Number_descr_; }
RIM__Protocol__Version__Number& RIM__Protocol__Version__Number::operator=(const RIM__Protocol__Version__Number& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @BSSGP_Types.RIM_Protocol_Version_Number.");
  if (other_value.iEI().is_bound()) field_iEI = other_value.iEI();
  else field_iEI.clean_up();
  if (other_value.ext().is_bound()) field_ext = other_value.ext();
  else field_ext.clean_up();
  if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator();
  else field_lengthIndicator.clean_up();
  if (other_value.rIMProtocolVersionNumber().is_bound()) field_rIMProtocolVersionNumber = other_value.rIMProtocolVersionNumber();
  else field_rIMProtocolVersionNumber.clean_up();
}
return *this;
}

boolean RIM__Protocol__Version__Number::operator==(const RIM__Protocol__Version__Number& other_value) const
{
return field_iEI==other_value.field_iEI
  && field_ext==other_value.field_ext
  && field_lengthIndicator==other_value.field_lengthIndicator
  && field_rIMProtocolVersionNumber==other_value.field_rIMProtocolVersionNumber;
}

boolean RIM__Protocol__Version__Number::is_bound() const
{
return (field_iEI.is_bound())
  || (field_ext.is_bound())
  || (field_lengthIndicator.is_bound())
  || (field_rIMProtocolVersionNumber.is_bound());
}
boolean RIM__Protocol__Version__Number::is_value() const
{
return field_iEI.is_value()
  && field_ext.is_value()
  && field_lengthIndicator.is_value()
  && field_rIMProtocolVersionNumber.is_value();
}
void RIM__Protocol__Version__Number::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ iEI := ");
field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
field_lengthIndicator.log();
TTCN_Logger::log_event_str(", rIMProtocolVersionNumber := ");
field_rIMProtocolVersionNumber.log();
TTCN_Logger::log_event_str(" }");
}

void RIM__Protocol__Version__Number::set_implicit_omit()
{
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (rIMProtocolVersionNumber().is_bound()) rIMProtocolVersionNumber().set_implicit_omit();
}

void RIM__Protocol__Version__Number::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 @BSSGP_Types.RIM_Protocol_Version_Number 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rIMProtocolVersionNumber().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rIMProtocolVersionNumber")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rIMProtocolVersionNumber().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 @BSSGP_Types.RIM_Protocol_Version_Number: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@BSSGP_Types.RIM_Protocol_Version_Number");
  }
}

void RIM__Protocol__Version__Number::encode_text(Text_Buf& text_buf) const
{
field_iEI.encode_text(text_buf);
field_ext.encode_text(text_buf);
field_lengthIndicator.encode_text(text_buf);
field_rIMProtocolVersionNumber.encode_text(text_buf);
}

void RIM__Protocol__Version__Number::decode_text(Text_Buf& text_buf)
{
field_iEI.decode_text(text_buf);
field_ext.decode_text(text_buf);
field_lengthIndicator.decode_text(text_buf);
field_rIMProtocolVersionNumber.decode_text(text_buf);
}

void RIM__Protocol__Version__Number::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 RIM__Protocol__Version__Number::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 RIM__Protocol__Version__Number::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;
  int value_of_length_field2 = 0;
  RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, RIM__Protocol__Version__Number_ext_descr_.raw->forceomit);
  decoded_field_length = field_ext.RAW_decode(RIM__Protocol__Version__Number_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit);
  if (decoded_field_length < 0) return decoded_field_length;
  decoded_length+=decoded_field_length;
  limit-=decoded_field_length;
  last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit());
  if (field_ext ==  bs_0) selected_field = 0;
  else if (field_ext ==  bs_1) selected_field = 1;
  else selected_field = -1;
  RAW_Force_Omit field_2_force_omit(2, force_omit, RIM__Protocol__Version__Number_lengthIndicator_descr_.raw->forceomit);
  decoded_field_length = field_lengthIndicator.RAW_decode(RIM__Protocol__Version__Number_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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());
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1: {
    INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN2__2a_length1_descr_);
    field_lengthIndicator.length1() = tmp1;
    value_of_length_field2 += tmp1.get_long_long_val() * 8;
    break; }
  case LIN2__2a::ALT_length2: {
    INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN2__2a_length2_descr_);
    field_lengthIndicator.length2() = tmp2;
    value_of_length_field2 += tmp2.get_long_long_val() * 8;
    break; }
  default:
    value_of_length_field2 = 0;
  }
  RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT1_descr_.raw->forceomit);
  decoded_field_length = field_rIMProtocolVersionNumber.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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());
  value_of_length_field2 -= decoded_field_length;
  if (field_iEI !=  os_80) return -1;
  p_buf.set_pos_bit(last_decoded_pos);
  return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding);
}

int RIM__Protocol__Version__Number::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, General__Types::OCT1_descr_.raw);
  myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RIM__Protocol__Version__Number_ext_descr_.raw);
  myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, RIM__Protocol__Version__Number_lengthIndicator_descr_.raw);
  myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT1_descr_.raw);
  encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]);
  encoded_length += field_ext.RAW_encode(RIM__Protocol__Version__Number_ext_descr_, *myleaf.body.node.nodes[1]);
  encoded_length += field_lengthIndicator.RAW_encode(RIM__Protocol__Version__Number_lengthIndicator_descr_, *myleaf.body.node.nodes[2]);
  encoded_length += field_rIMProtocolVersionNumber.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[3]);
  {
  int sel_field = 0;
  while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; }
  const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr;
  int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length;
  delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field];
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1);
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level;
  myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos;
  }
  switch (field_lengthIndicator.get_selection()) {
  case LIN2__2a::ALT_length1:
  if (field_ext !=  bs_0) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(RIM__Protocol__Version__Number_ext_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 LIN2__2a::ALT_length2:
  if (field_ext !=  bs_1) {
  RAW_enc_tr_pos pr_pos;
  pr_pos.level = myleaf.curr_pos.level + 1;
  int new_pos[] = { 1 };
  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(RIM__Protocol__Version__Number_ext_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_iEI !=  os_80) {
  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){
   os_80.RAW_encode(General__Types::OCT1_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 RIM__Protocol__Version__Number_template::single_value_struct {
OCTETSTRING_template field_iEI;
BITSTRING_template field_ext;
LIN2__2a_template field_lengthIndicator;
OCTETSTRING_template field_rIMProtocolVersionNumber;
};

void RIM__Protocol__Version__Number_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_iEI = ANY_VALUE;
single_value->field_ext = ANY_VALUE;
single_value->field_lengthIndicator = ANY_VALUE;
single_value->field_rIMProtocolVersionNumber = ANY_VALUE;
}
}
}

void RIM__Protocol__Version__Number_template::copy_value(const RIM__Protocol__Version__Number& other_value)
{
single_value = new single_value_struct;
if (other_value.iEI().is_bound()) {
  single_value->field_iEI = other_value.iEI();
} else {
  single_value->field_iEI.clean_up();
}
if (other_value.ext().is_bound()) {
  single_value->field_ext = other_value.ext();
} else {
  single_value->field_ext.clean_up();
}
if (other_value.lengthIndicator().is_bound()) {
  single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
  single_value->field_lengthIndicator.clean_up();
}
if (other_value.rIMProtocolVersionNumber().is_bound()) {
  single_value->field_rIMProtocolVersionNumber = other_value.rIMProtocolVersionNumber();
} else {
  single_value->field_rIMProtocolVersionNumber.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void RIM__Protocol__Version__Number_template::copy_template(const RIM__Protocol__Version__Number_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) {
single_value->field_iEI = other_value.iEI();
} else {
single_value->field_iEI.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) {
single_value->field_ext = other_value.ext();
} else {
single_value->field_ext.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) {
single_value->field_lengthIndicator = other_value.lengthIndicator();
} else {
single_value->field_lengthIndicator.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.rIMProtocolVersionNumber().get_selection()) {
single_value->field_rIMProtocolVersionNumber = other_value.rIMProtocolVersionNumber();
} else {
single_value->field_rIMProtocolVersionNumber.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 RIM__Protocol__Version__Number_template[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 RIM__Protocol__Version__Number_template(*other_value.implication_.precondition);
implication_.implied_template = new RIM__Protocol__Version__Number_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 @BSSGP_Types.RIM_Protocol_Version_Number.");
break;
}
set_selection(other_value);
}

RIM__Protocol__Version__Number_template::RIM__Protocol__Version__Number_template()
{
}

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

RIM__Protocol__Version__Number_template::RIM__Protocol__Version__Number_template(const RIM__Protocol__Version__Number& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean RIM__Protocol__Version__Number_template::match(const RIM__Protocol__Version__Number& 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.iEI().is_bound()) return FALSE;
if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE;
if(!other_value.ext().is_bound()) return FALSE;
if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE;
if(!other_value.lengthIndicator().is_bound()) return FALSE;
if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE;
if(!other_value.rIMProtocolVersionNumber().is_bound()) return FALSE;
if(!single_value->field_rIMProtocolVersionNumber.match(other_value.rIMProtocolVersionNumber(), 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 @BSSGP_Types.RIM_Protocol_Version_Number.");
}
return FALSE;
}

boolean RIM__Protocol__Version__Number_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_iEI.is_bound()
 || single_value->field_ext.is_bound()
 || single_value->field_lengthIndicator.is_bound()
 || single_value->field_rIMProtocolVersionNumber.is_bound();
}

boolean RIM__Protocol__Version__Number_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_iEI.is_value()
 && single_value->field_ext.is_value()
 && single_value->field_lengthIndicator.is_value()
 && single_value->field_rIMProtocolVersionNumber.is_value();
}

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

RIM__Protocol__Version__Number RIM__Protocol__Version__Number_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 @BSSGP_Types.RIM_Protocol_Version_Number.");
RIM__Protocol__Version__Number ret_val;
if (single_value->field_iEI.is_bound()) {
ret_val.iEI() = single_value->field_iEI.valueof();
}
if (single_value->field_ext.is_bound()) {
ret_val.ext() = single_value->field_ext.valueof();
}
if (single_value->field_lengthIndicator.is_bound()) {
ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof();
}
if (single_value->field_rIMProtocolVersionNumber.is_bound()) {
ret_val.rIMProtocolVersionNumber() = single_value->field_rIMProtocolVersionNumber.valueof();
}
return ret_val;
}

void RIM__Protocol__Version__Number_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 @BSSGP_Types.RIM_Protocol_Version_Number.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RIM__Protocol__Version__Number_template[list_length];
}

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

OCTETSTRING_template& RIM__Protocol__Version__Number_template::iEI()
{
set_specific();
return single_value->field_iEI;
}

const OCTETSTRING_template& RIM__Protocol__Version__Number_template::iEI() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field iEI of a non-specific template of type @BSSGP_Types.RIM_Protocol_Version_Number.");
return single_value->field_iEI;
}

BITSTRING_template& RIM__Protocol__Version__Number_template::ext()
{
set_specific();
return single_value->field_ext;
}

const BITSTRING_template& RIM__Protocol__Version__Number_template::ext() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ext of a non-specific template of type @BSSGP_Types.RIM_Protocol_Version_Number.");
return single_value->field_ext;
}

LIN2__2a_template& RIM__Protocol__Version__Number_template::lengthIndicator()
{
set_specific();
return single_value->field_lengthIndicator;
}

const LIN2__2a_template& RIM__Protocol__Version__Number_template::lengthIndicator() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field lengthIndicator of a non-specific template of type @BSSGP_Types.RIM_Protocol_Version_Number.");
return single_value->field_lengthIndicator;
}

OCTETSTRING_template& RIM__Protocol__Version__Number_template::rIMProtocolVersionNumber()
{
set_specific();
return single_value->field_rIMProtocolVersionNumber;
}

const OCTETSTRING_template& RIM__Protocol__Version__Number_template::rIMProtocolVersionNumber() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field rIMProtocolVersionNumber of a non-specific template of type @BSSGP_Types.RIM_Protocol_Version_Number.");
return single_value->field_rIMProtocolVersionNumber;
}

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

void RIM__Protocol__Version__Number_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ iEI := ");
single_value->field_iEI.log();
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log();
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log();
TTCN_Logger::log_event_str(", rIMProtocolVersionNumber := ");
single_value->field_rIMProtocolVersionNumber.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 RIM__Protocol__Version__Number_template::log_match(const RIM__Protocol__Version__Number& 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_iEI.match(match_value.iEI(), legacy)){
TTCN_Logger::log_logmatch_info(".iEI");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ext.match(match_value.ext(), legacy)){
TTCN_Logger::log_logmatch_info(".ext");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){
TTCN_Logger::log_logmatch_info(".lengthIndicator");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_rIMProtocolVersionNumber.match(match_value.rIMProtocolVersionNumber(), legacy)){
TTCN_Logger::log_logmatch_info(".rIMProtocolVersionNumber");
single_value->field_rIMProtocolVersionNumber.log_match(match_value.rIMProtocolVersionNumber(), 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("{ iEI := ");
single_value->field_iEI.log_match(match_value.iEI(), legacy);
TTCN_Logger::log_event_str(", ext := ");
single_value->field_ext.log_match(match_value.ext(), legacy);
TTCN_Logger::log_event_str(", lengthIndicator := ");
single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy);
TTCN_Logger::log_event_str(", rIMProtocolVersionNumber := ");
single_value->field_rIMProtocolVersionNumber.log_match(match_value.rIMProtocolVersionNumber(), 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 RIM__Protocol__Version__Number_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (iEI().is_bound()) iEI().set_implicit_omit();
if (ext().is_bound()) ext().set_implicit_omit();
if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit();
if (rIMProtocolVersionNumber().is_bound()) rIMProtocolVersionNumber().set_implicit_omit();
}

void RIM__Protocol__Version__Number_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_iEI.encode_text(text_buf);
single_value->field_ext.encode_text(text_buf);
single_value->field_lengthIndicator.encode_text(text_buf);
single_value->field_rIMProtocolVersionNumber.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 @BSSGP_Types.RIM_Protocol_Version_Number.");
}
}

void RIM__Protocol__Version__Number_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_iEI.decode_text(text_buf);
single_value->field_ext.decode_text(text_buf);
single_value->field_lengthIndicator.decode_text(text_buf);
single_value->field_rIMProtocolVersionNumber.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 RIM__Protocol__Version__Number_template[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 @BSSGP_Types.RIM_Protocol_Version_Number.");
}
}

void RIM__Protocol__Version__Number_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: {
    RIM__Protocol__Version__Number_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 @BSSGP_Types.RIM_Protocol_Version_Number 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) iEI().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rIMProtocolVersionNumber().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(), "iEI")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          iEI().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_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")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ext().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "lengthIndicator")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          lengthIndicator().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "rIMProtocolVersionNumber")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          rIMProtocolVersionNumber().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 @BSSGP_Types.RIM_Protocol_Version_Number: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    RIM__Protocol__Version__Number_template* precondition = new RIM__Protocol__Version__Number_template;
    precondition->set_param(*param.get_elem(0));
    RIM__Protocol__Version__Number_template* implied_template = new RIM__Protocol__Version__Number_template;
    implied_template->set_param(*param.get_elem(1));
    *this = RIM__Protocol__Version__Number_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@BSSGP_Types.RIM_Protocol_Version_Number");
  }
  is_ifpresent = param.get_ifpresent();
}

void RIM__Protocol__Version__Number_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_iEI.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RIM_Protocol_Version_Number");
single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RIM_Protocol_Version_Number");
single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RIM_Protocol_Version_Number");
single_value->field_rIMProtocolVersionNumber.check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RIM_Protocol_Version_Number");
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 : "@BSSGP_Types.RIM_Protocol_Version_Number");
}

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

boolean RIM__Protocol__Version__Number_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 RAN__Information__Request__Application__Container::copy_value(const RAN__Information__Request__Application__Container& other_value)
{
switch (other_value.union_selection) {
case ALT_nacc:
field_nacc = new RAN__Information__Request__Application__Container__NACC(*other_value.field_nacc);
break;
case ALT_si3:
field_si3 = new RAN__Information__Request__Application__Container__SI3(*other_value.field_si3);
break;
case ALT_mBMS__data__channel:
field_mBMS__data__channel = new RAN__Information__Request__Application__Container__MBMS__data__channel(*other_value.field_mBMS__data__channel);
break;
default:
TTCN_error("Assignment of an unbound union value of type @BSSGP_Types.RAN_Information_Request_Application_Container.");
}
union_selection = other_value.union_selection;
}

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

RAN__Information__Request__Application__Container::RAN__Information__Request__Application__Container(const RAN__Information__Request__Application__Container& other_value)
: Base_Type(){
copy_value(other_value);
}

RAN__Information__Request__Application__Container::~RAN__Information__Request__Application__Container()
{
clean_up();
}

RAN__Information__Request__Application__Container& RAN__Information__Request__Application__Container::operator=(const RAN__Information__Request__Application__Container& other_value)
{
if (this != &other_value) {
clean_up();
copy_value(other_value);
}
return *this;
}

boolean RAN__Information__Request__Application__Container::operator==(const RAN__Information__Request__Application__Container& other_value) const
{
if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
if (union_selection != other_value.union_selection) return FALSE;
switch (union_selection) {
case ALT_nacc:
return *field_nacc == *other_value.field_nacc;
case ALT_si3:
return *field_si3 == *other_value.field_si3;
case ALT_mBMS__data__channel:
return *field_mBMS__data__channel == *other_value.field_mBMS__data__channel;
default:
return FALSE;
}
}

RAN__Information__Request__Application__Container__NACC& RAN__Information__Request__Application__Container::nacc()
{
if (union_selection != ALT_nacc) {
clean_up();
field_nacc = new RAN__Information__Request__Application__Container__NACC;
union_selection = ALT_nacc;
}
return *field_nacc;
}

const RAN__Information__Request__Application__Container__NACC& RAN__Information__Request__Application__Container::nacc() const
{
if (union_selection != ALT_nacc) TTCN_error("Using non-selected field nacc in a value of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
return *field_nacc;
}

RAN__Information__Request__Application__Container__SI3& RAN__Information__Request__Application__Container::si3()
{
if (union_selection != ALT_si3) {
clean_up();
field_si3 = new RAN__Information__Request__Application__Container__SI3;
union_selection = ALT_si3;
}
return *field_si3;
}

const RAN__Information__Request__Application__Container__SI3& RAN__Information__Request__Application__Container::si3() const
{
if (union_selection != ALT_si3) TTCN_error("Using non-selected field si3 in a value of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
return *field_si3;
}

RAN__Information__Request__Application__Container__MBMS__data__channel& RAN__Information__Request__Application__Container::mBMS__data__channel()
{
if (union_selection != ALT_mBMS__data__channel) {
clean_up();
field_mBMS__data__channel = new RAN__Information__Request__Application__Container__MBMS__data__channel;
union_selection = ALT_mBMS__data__channel;
}
return *field_mBMS__data__channel;
}

const RAN__Information__Request__Application__Container__MBMS__data__channel& RAN__Information__Request__Application__Container::mBMS__data__channel() const
{
if (union_selection != ALT_mBMS__data__channel) TTCN_error("Using non-selected field mBMS_data_channel in a value of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
return *field_mBMS__data__channel;
}

boolean RAN__Information__Request__Application__Container::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 @BSSGP_Types.RAN_Information_Request_Application_Container.");
return union_selection == checked_selection;
}

boolean RAN__Information__Request__Application__Container::is_bound() const
{
  return union_selection != UNBOUND_VALUE;
}

boolean RAN__Information__Request__Application__Container::is_value() const
{
switch (union_selection) {
case UNBOUND_VALUE: return FALSE;
case ALT_nacc: return field_nacc->is_value();
case ALT_si3: return field_si3->is_value();
case ALT_mBMS__data__channel: return field_mBMS__data__channel->is_value();
default: TTCN_error("Invalid selection in union is_bound");}
}

void RAN__Information__Request__Application__Container::clean_up()
{
switch (union_selection) {
case ALT_nacc:
  delete field_nacc;
  break;
case ALT_si3:
  delete field_si3;
  break;
case ALT_mBMS__data__channel:
  delete field_mBMS__data__channel;
  break;
default:
  break;
}
union_selection = UNBOUND_VALUE;
}

void RAN__Information__Request__Application__Container::log() const
{
switch (union_selection) {
case ALT_nacc:
TTCN_Logger::log_event_str("{ nacc := ");
field_nacc->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_si3:
TTCN_Logger::log_event_str("{ si3 := ");
field_si3->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_mBMS__data__channel:
TTCN_Logger::log_event_str("{ mBMS_data_channel := ");
field_mBMS__data__channel->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_unbound();
}
}

void RAN__Information__Request__Application__Container::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, "nacc")) {
    nacc().set_param(*mp_last);
    if (!nacc().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "si3")) {
    si3().set_param(*mp_last);
    if (!si3().is_bound()) clean_up();
    return;
  }
  if (!strcmp(last_name, "mBMS_data_channel")) {
    mBMS__data__channel().set_param(*mp_last);
    if (!mBMS__data__channel().is_bound()) clean_up();
    return;
  }
  mp_last->error("Field %s does not exist in type @BSSGP_Types.RAN_Information_Request_Application_Container.", last_name);
}

void RAN__Information__Request__Application__Container::set_implicit_omit()
{
switch (union_selection) {
case ALT_nacc:
field_nacc->set_implicit_omit(); break;
case ALT_si3:
field_si3->set_implicit_omit(); break;
case ALT_mBMS__data__channel:
field_mBMS__data__channel->set_implicit_omit(); break;
default: break;
}
}

void RAN__Information__Request__Application__Container::encode_text(Text_Buf& text_buf) const
{
text_buf.push_int(union_selection);
switch (union_selection) {
case ALT_nacc:
field_nacc->encode_text(text_buf);
break;
case ALT_si3:
field_si3->encode_text(text_buf);
break;
case ALT_mBMS__data__channel:
field_mBMS__data__channel->encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an unbound value of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
}
}

void RAN__Information__Request__Application__Container::decode_text(Text_Buf& text_buf)
{
switch ((union_selection_type)text_buf.pull_int().get_val()) {
case ALT_nacc:
nacc().decode_text(text_buf);
break;
case ALT_si3:
si3().decode_text(text_buf);
break;
case ALT_mBMS__data__channel:
mBMS__data__channel().decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for type @BSSGP_Types.RAN_Information_Request_Application_Container.");
}
}

void RAN__Information__Request__Application__Container::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 RAN__Information__Request__Application__Container::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 RAN__Information__Request__Application__Container::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, RAN__Information__Request__Application__Container__NACC_descr_.raw->forceomit);
      decoded_length = nacc().RAW_decode(RAN__Information__Request__Application__Container__NACC_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, RAN__Information__Request__Application__Container__SI3_descr_.raw->forceomit);
      decoded_length = si3().RAW_decode(RAN__Information__Request__Application__Container__SI3_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, RAN__Information__Request__Application__Container__MBMS__data__channel_descr_.raw->forceomit);
      decoded_length = mBMS__data__channel().RAW_decode(RAN__Information__Request__Application__Container__MBMS__data__channel_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, RAN__Information__Request__Application__Container__NACC_descr_.raw->forceomit);
      decoded_length = nacc().RAW_decode(RAN__Information__Request__Application__Container__NACC_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, RAN__Information__Request__Application__Container__SI3_descr_.raw->forceomit);
      decoded_length = si3().RAW_decode(RAN__Information__Request__Application__Container__SI3_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, RAN__Information__Request__Application__Container__MBMS__data__channel_descr_.raw->forceomit);
      decoded_length = mBMS__data__channel().RAW_decode(RAN__Information__Request__Application__Container__MBMS__data__channel_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;
       }
 }
 clean_up();
 return -1;
}

int RAN__Information__Request__Application__Container::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const
{
  int encoded_length = 0;
  myleaf.isleaf = FALSE;
  myleaf.body.node.num_of_nodes = 3;  myleaf.body.node.nodes = init_nodes_of_enc_tree(3);
  memset(myleaf.body.node.nodes, 0, 3 * sizeof(RAW_enc_tree *));
  switch (union_selection) {
  case ALT_nacc:
    myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, RAN__Information__Request__Application__Container__NACC_descr_.raw);
    encoded_length = field_nacc->RAW_encode(RAN__Information__Request__Application__Container__NACC_descr_, *myleaf.body.node.nodes[0]);
    myleaf.body.node.nodes[0]->coding_descr = &RAN__Information__Request__Application__Container__NACC_descr_;
    break;
  case ALT_si3:
    myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, RAN__Information__Request__Application__Container__SI3_descr_.raw);
    encoded_length = field_si3->RAW_encode(RAN__Information__Request__Application__Container__SI3_descr_, *myleaf.body.node.nodes[1]);
    myleaf.body.node.nodes[1]->coding_descr = &RAN__Information__Request__Application__Container__SI3_descr_;
    break;
  case ALT_mBMS__data__channel:
    myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 2, RAN__Information__Request__Application__Container__MBMS__data__channel_descr_.raw);
    encoded_length = field_mBMS__data__channel->RAW_encode(RAN__Information__Request__Application__Container__MBMS__data__channel_descr_, *myleaf.body.node.nodes[2]);
    myleaf.body.node.nodes[2]->coding_descr = &RAN__Information__Request__Application__Container__MBMS__data__channel_descr_;
    break;
  default:
    TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  }
  return encoded_length;
}

void RAN__Information__Request__Application__Container_template::copy_value(const RAN__Information__Request__Application__Container& other_value)
{
single_value.union_selection = other_value.get_selection();
switch (single_value.union_selection) {
case RAN__Information__Request__Application__Container::ALT_nacc:
single_value.field_nacc = new RAN__Information__Request__Application__Container__NACC_template(other_value.nacc());
break;
case RAN__Information__Request__Application__Container::ALT_si3:
single_value.field_si3 = new RAN__Information__Request__Application__Container__SI3_template(other_value.si3());
break;
case RAN__Information__Request__Application__Container::ALT_mBMS__data__channel:
single_value.field_mBMS__data__channel = new RAN__Information__Request__Application__Container__MBMS__data__channel_template(other_value.mBMS__data__channel());
break;
default:
TTCN_error("Initializing a template with an unbound value of type @BSSGP_Types.RAN_Information_Request_Application_Container.");
}
set_selection(SPECIFIC_VALUE);
}

void RAN__Information__Request__Application__Container_template::copy_template(const RAN__Information__Request__Application__Container_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 RAN__Information__Request__Application__Container::ALT_nacc:
single_value.field_nacc = new RAN__Information__Request__Application__Container__NACC_template(*other_value.single_value.field_nacc);
break;
case RAN__Information__Request__Application__Container::ALT_si3:
single_value.field_si3 = new RAN__Information__Request__Application__Container__SI3_template(*other_value.single_value.field_si3);
break;
case RAN__Information__Request__Application__Container::ALT_mBMS__data__channel:
single_value.field_mBMS__data__channel = new RAN__Information__Request__Application__Container__MBMS__data__channel_template(*other_value.single_value.field_mBMS__data__channel);
break;
default:
TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @BSSGP_Types.RAN_Information_Request_Application_Container.");
}
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 RAN__Information__Request__Application__Container_template[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 RAN__Information__Request__Application__Container_template(*other_value.implication_.precondition);
implication_.implied_template = new RAN__Information__Request__Application__Container_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 @BSSGP_Types.RAN_Information_Request_Application_Container.");
}
set_selection(other_value);
}

RAN__Information__Request__Application__Container_template::RAN__Information__Request__Application__Container_template()
{
}

RAN__Information__Request__Application__Container_template::RAN__Information__Request__Application__Container_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

RAN__Information__Request__Application__Container_template::RAN__Information__Request__Application__Container_template(const RAN__Information__Request__Application__Container& other_value)
{
copy_value(other_value);
}

RAN__Information__Request__Application__Container_template::RAN__Information__Request__Application__Container_template(const OPTIONAL<RAN__Information__Request__Application__Container>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const RAN__Information__Request__Application__Container&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of union type @BSSGP_Types.RAN_Information_Request_Application_Container from an unbound optional field.");
}
}

RAN__Information__Request__Application__Container_template::RAN__Information__Request__Application__Container_template(RAN__Information__Request__Application__Container_template* p_precondition, RAN__Information__Request__Application__Container_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

RAN__Information__Request__Application__Container_template::RAN__Information__Request__Application__Container_template(Dynamic_Match_Interface<RAN__Information__Request__Application__Container>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<RAN__Information__Request__Application__Container>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

RAN__Information__Request__Application__Container_template::RAN__Information__Request__Application__Container_template(const RAN__Information__Request__Application__Container_template& other_value)
: Base_Template(){
copy_template(other_value);
}

RAN__Information__Request__Application__Container_template::~RAN__Information__Request__Application__Container_template()
{
clean_up();
}

void RAN__Information__Request__Application__Container_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case RAN__Information__Request__Application__Container::ALT_nacc:
delete single_value.field_nacc;
break;
case RAN__Information__Request__Application__Container::ALT_si3:
delete single_value.field_si3;
break;
case RAN__Information__Request__Application__Container::ALT_mBMS__data__channel:
delete single_value.field_mBMS__data__channel;
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;
}

RAN__Information__Request__Application__Container_template& RAN__Information__Request__Application__Container_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

RAN__Information__Request__Application__Container_template& RAN__Information__Request__Application__Container_template::operator=(const RAN__Information__Request__Application__Container& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

RAN__Information__Request__Application__Container_template& RAN__Information__Request__Application__Container_template::operator=(const OPTIONAL<RAN__Information__Request__Application__Container>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const RAN__Information__Request__Application__Container&)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 @BSSGP_Types.RAN_Information_Request_Application_Container.");
}
return *this;
}

RAN__Information__Request__Application__Container_template& RAN__Information__Request__Application__Container_template::operator=(const RAN__Information__Request__Application__Container_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean RAN__Information__Request__Application__Container_template::match(const RAN__Information__Request__Application__Container& 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:
{
RAN__Information__Request__Application__Container::union_selection_type value_selection = other_value.get_selection();
if (value_selection == RAN__Information__Request__Application__Container::UNBOUND_VALUE) return FALSE;
if (value_selection != single_value.union_selection) return FALSE;
switch (value_selection) {
case RAN__Information__Request__Application__Container::ALT_nacc:
return single_value.field_nacc->match(other_value.nacc(), legacy);
case RAN__Information__Request__Application__Container::ALT_si3:
return single_value.field_si3->match(other_value.si3(), legacy);
case RAN__Information__Request__Application__Container::ALT_mBMS__data__channel:
return single_value.field_mBMS__data__channel->match(other_value.mBMS__data__channel(), legacy);
default:
TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
}
}
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 @BSSGP_Types.RAN_Information_Request_Application_Container.");
}
return FALSE;
}

boolean RAN__Information__Request__Application__Container_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
switch (single_value.union_selection) {
case RAN__Information__Request__Application__Container::ALT_nacc:
return single_value.field_nacc->is_value();
case RAN__Information__Request__Application__Container::ALT_si3:
return single_value.field_si3->is_value();
case RAN__Information__Request__Application__Container::ALT_mBMS__data__channel:
return single_value.field_mBMS__data__channel->is_value();
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
}
}

RAN__Information__Request__Application__Container RAN__Information__Request__Application__Container_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 @BSSGP_Types.RAN_Information_Request_Application_Container.");
RAN__Information__Request__Application__Container ret_val;
switch (single_value.union_selection) {
case RAN__Information__Request__Application__Container::ALT_nacc:
ret_val.nacc() = single_value.field_nacc->valueof();
break;
case RAN__Information__Request__Application__Container::ALT_si3:
ret_val.si3() = single_value.field_si3->valueof();
break;
case RAN__Information__Request__Application__Container::ALT_mBMS__data__channel:
ret_val.mBMS__data__channel() = single_value.field_mBMS__data__channel->valueof();
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
}
return ret_val;
}

RAN__Information__Request__Application__Container_template& RAN__Information__Request__Application__Container_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 @BSSGP_Types.RAN_Information_Request_Application_Container.");
if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
return value_list.list_value[list_index];
}
void RAN__Information__Request__Application__Container_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 @BSSGP_Types.RAN_Information_Request_Application_Container.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new RAN__Information__Request__Application__Container_template[list_length];
}

RAN__Information__Request__Application__Container__NACC_template& RAN__Information__Request__Application__Container_template::nacc()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RAN__Information__Request__Application__Container::ALT_nacc) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_nacc = new RAN__Information__Request__Application__Container__NACC_template(ANY_VALUE);
else single_value.field_nacc = new RAN__Information__Request__Application__Container__NACC_template;
single_value.union_selection = RAN__Information__Request__Application__Container::ALT_nacc;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_nacc;
}

const RAN__Information__Request__Application__Container__NACC_template& RAN__Information__Request__Application__Container_template::nacc() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nacc in a non-specific template of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
if (single_value.union_selection != RAN__Information__Request__Application__Container::ALT_nacc) TTCN_error("Accessing non-selected field nacc in a template of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
return *single_value.field_nacc;
}

RAN__Information__Request__Application__Container__SI3_template& RAN__Information__Request__Application__Container_template::si3()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RAN__Information__Request__Application__Container::ALT_si3) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_si3 = new RAN__Information__Request__Application__Container__SI3_template(ANY_VALUE);
else single_value.field_si3 = new RAN__Information__Request__Application__Container__SI3_template;
single_value.union_selection = RAN__Information__Request__Application__Container::ALT_si3;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_si3;
}

const RAN__Information__Request__Application__Container__SI3_template& RAN__Information__Request__Application__Container_template::si3() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field si3 in a non-specific template of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
if (single_value.union_selection != RAN__Information__Request__Application__Container::ALT_si3) TTCN_error("Accessing non-selected field si3 in a template of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
return *single_value.field_si3;
}

RAN__Information__Request__Application__Container__MBMS__data__channel_template& RAN__Information__Request__Application__Container_template::mBMS__data__channel()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RAN__Information__Request__Application__Container::ALT_mBMS__data__channel) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_mBMS__data__channel = new RAN__Information__Request__Application__Container__MBMS__data__channel_template(ANY_VALUE);
else single_value.field_mBMS__data__channel = new RAN__Information__Request__Application__Container__MBMS__data__channel_template;
single_value.union_selection = RAN__Information__Request__Application__Container::ALT_mBMS__data__channel;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_mBMS__data__channel;
}

const RAN__Information__Request__Application__Container__MBMS__data__channel_template& RAN__Information__Request__Application__Container_template::mBMS__data__channel() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mBMS_data_channel in a non-specific template of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
if (single_value.union_selection != RAN__Information__Request__Application__Container::ALT_mBMS__data__channel) TTCN_error("Accessing non-selected field mBMS_data_channel in a template of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
return *single_value.field_mBMS__data__channel;
}

boolean RAN__Information__Request__Application__Container_template::ischosen(RAN__Information__Request__Application__Container::union_selection_type checked_selection) const
{
if (checked_selection == RAN__Information__Request__Application__Container::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.union_selection == RAN__Information__Request__Application__Container::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
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 @BSSGP_Types.RAN_Information_Request_Application_Container 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 RAN__Information__Request__Application__Container_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case RAN__Information__Request__Application__Container::ALT_nacc:
TTCN_Logger::log_event_str("{ nacc := ");
single_value.field_nacc->log();
TTCN_Logger::log_event_str(" }");
break;
case RAN__Information__Request__Application__Container::ALT_si3:
TTCN_Logger::log_event_str("{ si3 := ");
single_value.field_si3->log();
TTCN_Logger::log_event_str(" }");
break;
case RAN__Information__Request__Application__Container::ALT_mBMS__data__channel:
TTCN_Logger::log_event_str("{ mBMS_data_channel := ");
single_value.field_mBMS__data__channel->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 RAN__Information__Request__Application__Container_template::log_match(const RAN__Information__Request__Application__Container& 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 RAN__Information__Request__Application__Container::ALT_nacc:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".nacc");
single_value.field_nacc->log_match(match_value.nacc(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ nacc := ");
single_value.field_nacc->log_match(match_value.nacc(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case RAN__Information__Request__Application__Container::ALT_si3:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".si3");
single_value.field_si3->log_match(match_value.si3(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ si3 := ");
single_value.field_si3->log_match(match_value.si3(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case RAN__Information__Request__Application__Container::ALT_mBMS__data__channel:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".mBMS_data_channel");
single_value.field_mBMS__data__channel->log_match(match_value.mBMS__data__channel(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ mBMS_data_channel := ");
single_value.field_mBMS__data__channel->log_match(match_value.mBMS__data__channel(), 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 RAN__Information__Request__Application__Container_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
switch (single_value.union_selection) {
case RAN__Information__Request__Application__Container::ALT_nacc:
single_value.field_nacc->set_implicit_omit(); break;
case RAN__Information__Request__Application__Container::ALT_si3:
single_value.field_si3->set_implicit_omit(); break;
case RAN__Information__Request__Application__Container::ALT_mBMS__data__channel:
single_value.field_mBMS__data__channel->set_implicit_omit(); break;
default: break;
}
}

void RAN__Information__Request__Application__Container_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 RAN__Information__Request__Application__Container::ALT_nacc:
single_value.field_nacc->encode_text(text_buf);
break;
case RAN__Information__Request__Application__Container::ALT_si3:
single_value.field_si3->encode_text(text_buf);
break;
case RAN__Information__Request__Application__Container::ALT_mBMS__data__channel:
single_value.field_mBMS__data__channel->encode_text(text_buf);
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
}
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 @BSSGP_Types.RAN_Information_Request_Application_Container.");
}
}

void RAN__Information__Request__Application__Container_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
{
single_value.union_selection = RAN__Information__Request__Application__Container::UNBOUND_VALUE;
RAN__Information__Request__Application__Container::union_selection_type new_selection = (RAN__Information__Request__Application__Container::union_selection_type)text_buf.pull_int().get_val();
switch (new_selection) {
case RAN__Information__Request__Application__Container::ALT_nacc:
single_value.field_nacc = new RAN__Information__Request__Application__Container__NACC_template;
single_value.field_nacc->decode_text(text_buf);
break;
case RAN__Information__Request__Application__Container::ALT_si3:
single_value.field_si3 = new RAN__Information__Request__Application__Container__SI3_template;
single_value.field_si3->decode_text(text_buf);
break;
case RAN__Information__Request__Application__Container::ALT_mBMS__data__channel:
single_value.field_mBMS__data__channel = new RAN__Information__Request__Application__Container__MBMS__data__channel_template;
single_value.field_mBMS__data__channel->decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @BSSGP_Types.RAN_Information_Request_Application_Container.");
}
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 RAN__Information__Request__Application__Container_template[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 @BSSGP_Types.RAN_Information_Request_Application_Container.");
}
}

boolean RAN__Information__Request__Application__Container_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean RAN__Information__Request__Application__Container_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 RAN__Information__Request__Application__Container_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 `@BSSGP_Types.RAN_Information_Request_Application_Container'");
    }
    if (strcmp("nacc", param_field) == 0) {
      nacc().set_param(param);
      return;
    } else if (strcmp("si3", param_field) == 0) {
      si3().set_param(param);
      return;
    } else if (strcmp("mBMS_data_channel", param_field) == 0) {
      mBMS__data__channel().set_param(param);
      return;
    } else param.error("Field `%s' not found in union template type `@BSSGP_Types.RAN_Information_Request_Application_Container'", 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: {
    RAN__Information__Request__Application__Container_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", "@BSSGP_Types.RAN_Information_Request_Application_Container");
    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, "nacc")) {
      nacc().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "si3")) {
      si3().set_param(*mp_last);
      break;
    }
    if (!strcmp(last_name, "mBMS_data_channel")) {
      mBMS__data__channel().set_param(*mp_last);
      break;
    }
    mp_last->error("Field %s does not exist in type @BSSGP_Types.RAN_Information_Request_Application_Container.", last_name);
  } break;
  case Module_Param::MP_Implication_Template: {
    RAN__Information__Request__Application__Container_template* precondition = new RAN__Information__Request__Application__Container_template;
    precondition->set_param(*m_p->get_elem(0));
    RAN__Information__Request__Application__Container_template* implied_template = new RAN__Information__Request__Application__Container_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = RAN__Information__Request__Application__Container_template(precondition, implied_template);
  } break;
  default:
    param.type_error("union template", "@BSSGP_Types.RAN_Information_Request_Application_Container");
  }
  is_ifpresent = param.get_ifpresent();
}

void RAN__Information__Request__Application__Container_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 RAN__Information__Request__Application__Container::ALT_nacc:
single_value.field_nacc->check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RAN_Information_Request_Application_Container");
return;
case RAN__Information__Request__Application__Container::ALT_si3:
single_value.field_si3->check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RAN_Information_Request_Application_Container");
return;
case RAN__Information__Request__Application__Container::ALT_mBMS__data__channel:
single_value.field_mBMS__data__channel->check_restriction(t_res, t_name ? t_name : "@BSSGP_Types.RAN_Information_Request_Application_Container");
return;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @BSSGP_Types.RAN_Information_Request_Application_Container.");
}
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 : "@BSSGP_Types.RAN_Information_Request_Application_Container");
}


} /* end of namespace */
