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

namespace TRXC__Types {

/* Literal string constants */

extern const CHARSTRING cs_0(' '),
cs_1(4, "CMD "),
cs_6(7, "FAKE_CI"),
cs_4(9, "FAKE_RSSI"),
cs_5(8, "FAKE_TOA"),
cs_7(15, "FAKE_TRXC_DELAY"),
cs_3(4, "IND "),
cs_2(4, "RSP ");
const Token_Match mp_2(" ", TRUE, TRUE),
mp_3("CMD ", TRUE, TRUE),
mp_5("IND ", TRUE, TRUE),
mp_4("RSP ", TRUE, TRUE),
mp_0("^(((CMD)|(RSP)|(IND)))", FALSE),
mp_1("^(((POWERON)|(POWEROFF)|(CLOCK)|(RXTUNE)|(TXTUNE)|(SETSLOT)|(SETTSC)|(SETBSIC)|(SETPOWER)|(SETMAXDLY)|(SETMAXDLYNB)|(HANDOVER)|(NOHANDOVER)|(MEASURE)|(FAKE_RSSI)|(FAKE_TOA)|(FAKE_CI)|(FAKE_TRXC_DELAY)))", FALSE);
const unsigned char module_checksum[] = { 0x88, 0xbb, 0x90, 0x6d, 0xda, 0x67, 0x9d, 0x9c, 0x88, 0x7d, 0x45, 0x69, 0xcd, 0x48, 0xfb, 0xe9 };

/* Global variable definitions */

const TTCN_TEXTdescriptor_param_values TrxcType_par_ = {{FALSE,FALSE,-1,-1,0,1},{FALSE,FALSE,-1,-1,1,1}};
const TTCN_TEXTdescriptor_t TrxcType_text_ = {NULL,NULL,NULL,NULL,NULL,NULL,&mp_0,{&TrxcType_par_}};
const XERdescriptor_t       TrxcType_xer_ = { {"TrxcType>\n", "TrxcType>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t TrxcType_descr_ = { "@TRXC_Types.TrxcType", NULL, &CHARSTRING_raw_, &TrxcType_text_, &TrxcType_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TrxcType_default_coding("TEXT");
const TTCN_TEXTdescriptor_param_values TrxcVerb_par_ = {{FALSE,FALSE,-1,-1,0,1},{FALSE,FALSE,-1,-1,1,1}};
const TTCN_TEXTdescriptor_t TrxcVerb_text_ = {NULL,NULL,NULL,NULL,NULL,NULL,&mp_1,{&TrxcVerb_par_}};
const XERdescriptor_t       TrxcVerb_xer_ = { {"TrxcVerb>\n", "TrxcVerb>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t TrxcVerb_descr_ = { "@TRXC_Types.TrxcVerb", NULL, &CHARSTRING_raw_, &TrxcVerb_text_, &TrxcVerb_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TrxcVerb_default_coding("TEXT");
const XERdescriptor_t       TrxcStatus_xer_ = { {"TrxcStatus>\n", "TrxcStatus>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t TrxcStatus_descr_ = { "@TRXC_Types.TrxcStatus", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &TrxcStatus_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TrxcStatus_default_coding("TEXT");
const XERdescriptor_t       TrxcParam_xer_ = { {"TrxcParam>\n", "TrxcParam>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t TrxcParam_descr_ = { "@TRXC_Types.TrxcParam", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &TrxcParam_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TrxcParam_default_coding("TEXT");
const TTCN_TEXTdescriptor_param_values TrxcParams_par_ = {{FALSE,FALSE,-1,-1,0,1},{FALSE,FALSE,-1,-1,0,1}};
const TTCN_TEXTdescriptor_t TrxcParams_text_ = {NULL,NULL,NULL,NULL,&cs_0,&mp_2,NULL,{&TrxcParams_par_}};
// No XER for TrxcParams
const TTCN_Typedescriptor_t TrxcParams_descr_ = { "@TRXC_Types.TrxcParams", NULL, NULL, &TrxcParams_text_, NULL, NULL, NULL, NULL, &TrxcParam_descr_, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       TrxcParams_0_xer_ = { {"TrxcParam>\n", "TrxcParam>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t TrxcParams_0_descr_ = { "@TRXC_Types.TrxcParams.<oftype>", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &TrxcParams_0_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TrxcParams_0_default_coding("TEXT");
UNIVERSAL_CHARSTRING TrxcParams_default_coding("TEXT");
const XERdescriptor_t       TrxcCommand_verb_xer_ = { {"verb>\n", "verb>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t TrxcCommand_verb_descr_ = { "@TRXC_Types.TrxcCommand.verb", NULL, &CHARSTRING_raw_, &TrxcVerb_text_, &TrxcCommand_verb_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TrxcCommand_verb_default_coding("TEXT");
const TTCN_TEXTdescriptor_t TrxcCommand_text_ = {NULL,NULL,NULL,NULL,&cs_0,&mp_2,NULL,{NULL}};
// No XER for TrxcCommand
const TTCN_Typedescriptor_t TrxcCommand_descr_ = { "@TRXC_Types.TrxcCommand", NULL, NULL, &TrxcCommand_text_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TrxcCommand_params_default_coding("TEXT");
UNIVERSAL_CHARSTRING TrxcCommand_default_coding("TEXT");
const XERdescriptor_t       TrxcResponse_verb_xer_ = { {"verb>\n", "verb>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t TrxcResponse_verb_descr_ = { "@TRXC_Types.TrxcResponse.verb", NULL, &CHARSTRING_raw_, &TrxcVerb_text_, &TrxcResponse_verb_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TrxcResponse_verb_default_coding("TEXT");
const XERdescriptor_t       TrxcResponse_status_xer_ = { {"status>\n", "status>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t TrxcResponse_status_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t TrxcResponse_status_descr_ = { "@TRXC_Types.TrxcResponse.status", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &TrxcResponse_status_xer_, &INTEGER_json_, &TrxcResponse_status_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TrxcResponse_status_default_coding("TEXT");
const TTCN_TEXTdescriptor_t TrxcResponse_text_ = {NULL,NULL,NULL,NULL,&cs_0,&mp_2,NULL,{NULL}};
// No XER for TrxcResponse
const TTCN_Typedescriptor_t TrxcResponse_descr_ = { "@TRXC_Types.TrxcResponse", NULL, NULL, &TrxcResponse_text_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TrxcResponse_params_default_coding("TEXT");
UNIVERSAL_CHARSTRING TrxcResponse_default_coding("TEXT");
const XERdescriptor_t       TrxcIndication_verb_xer_ = { {"verb>\n", "verb>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t TrxcIndication_verb_descr_ = { "@TRXC_Types.TrxcIndication.verb", NULL, &CHARSTRING_raw_, &TrxcVerb_text_, &TrxcIndication_verb_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TrxcIndication_verb_default_coding("TEXT");
const TTCN_TEXTdescriptor_t TrxcIndication_text_ = {NULL,NULL,NULL,NULL,&cs_0,&mp_2,NULL,{NULL}};
// No XER for TrxcIndication
const TTCN_Typedescriptor_t TrxcIndication_descr_ = { "@TRXC_Types.TrxcIndication", NULL, NULL, &TrxcIndication_text_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TrxcIndication_params_default_coding("TEXT");
UNIVERSAL_CHARSTRING TrxcIndication_default_coding("TEXT");
const TTCN_TEXTdescriptor_t TrxcMessage_text_ = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,{NULL}};
// No XER for TrxcMessage
const TTCN_Typedescriptor_t TrxcMessage_descr_ = { "@TRXC_Types.TrxcMessage", NULL, NULL, &TrxcMessage_text_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const TTCN_TEXTdescriptor_t TrxcMessage_cmd_text_ = {&cs_1,&mp_3,NULL,NULL,&cs_0,&mp_2,NULL,{NULL}};
// No XER for TrxcMessage_cmd
const TTCN_Typedescriptor_t TrxcMessage_cmd_descr_ = { "@TRXC_Types.TrxcMessage.cmd", NULL, NULL, &TrxcMessage_cmd_text_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TrxcMessage_cmd_default_coding("TEXT");
const TTCN_TEXTdescriptor_t TrxcMessage_rsp_text_ = {&cs_2,&mp_4,NULL,NULL,&cs_0,&mp_2,NULL,{NULL}};
// No XER for TrxcMessage_rsp
const TTCN_Typedescriptor_t TrxcMessage_rsp_descr_ = { "@TRXC_Types.TrxcMessage.rsp", NULL, NULL, &TrxcMessage_rsp_text_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TrxcMessage_rsp_default_coding("TEXT");
const TTCN_TEXTdescriptor_t TrxcMessage_ind_text_ = {&cs_3,&mp_5,NULL,NULL,&cs_0,&mp_2,NULL,{NULL}};
// No XER for TrxcMessage_ind
const TTCN_Typedescriptor_t TrxcMessage_ind_descr_ = { "@TRXC_Types.TrxcMessage.ind", NULL, NULL, &TrxcMessage_ind_text_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TrxcMessage_ind_default_coding("TEXT");
UNIVERSAL_CHARSTRING TrxcMessage_default_coding("TEXT");
const XERdescriptor_t       TRXC__RSSI_xer_ = { {"TRXC_RSSI>\n", "TRXC_RSSI>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t TRXC__RSSI_descr_ = { "@TRXC_Types.TRXC_RSSI", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &TRXC__RSSI_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TRXC__RSSI_default_coding("TEXT");
const XERdescriptor_t       TRXC__RSSI__THRESH_xer_ = { {"TRXC_RSSI_THRESH>\n", "TRXC_RSSI_THRESH>\n"}, {18, 18}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t TRXC__RSSI__THRESH_descr_ = { "@TRXC_Types.TRXC_RSSI_THRESH", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &TRXC__RSSI__THRESH_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING TRXC__RSSI__THRESH_default_coding("TEXT");
INTEGER const_ts__TRXC__FAKE__RSSI_thresh_defval;
const INTEGER& ts__TRXC__FAKE__RSSI_thresh_defval = const_ts__TRXC__FAKE__RSSI_thresh_defval;
INTEGER const_ts__TRXC__FAKE__TIMING_thresh_defval;
const INTEGER& ts__TRXC__FAKE__TIMING_thresh_defval = const_ts__TRXC__FAKE__TIMING_thresh_defval;
INTEGER const_ts__TRXC__FAKE__CI_thresh_defval;
const INTEGER& ts__TRXC__FAKE__CI_thresh_defval = const_ts__TRXC__FAKE__CI_thresh_defval;
INTEGER const_ts__TRXC__FAKE__TRXC__DELAY_delay__ms_defval;
const INTEGER& ts__TRXC__FAKE__TRXC__DELAY_delay__ms_defval = const_ts__TRXC__FAKE__TRXC__DELAY_delay__ms_defval;
TTCN_Module module_object("TRXC_Types", __DATE__, __TIME__, module_checksum, pre_init_module, NULL, 0U, 4294967295U, 4294967295U, 4294967295U, NULL, 0LU, 0, post_init_module, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

const RuntimeVersionChecker ver_checker(  current_runtime_version.requires_major_version_11,
  current_runtime_version.requires_minor_version_1,
  current_runtime_version.requires_patch_level_0,  current_runtime_version.requires_runtime_1);

/* Member functions of C++ classes */

TrxcCommand::TrxcCommand()
{
}

TrxcCommand::TrxcCommand(const CHARSTRING& par_verb,
    const OPTIONAL< TrxcParams >& par_params)
  :   field_verb(par_verb),
  field_params(par_params)
{
}

TrxcCommand::TrxcCommand(const TrxcCommand& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @TRXC_Types.TrxcCommand.");
if (other_value.verb().is_bound()) field_verb = other_value.verb();
else field_verb.clean_up();
if (other_value.params().is_bound()) field_params = other_value.params();
else field_params.clean_up();
}

void TrxcCommand::clean_up()
{
field_verb.clean_up();
field_params.clean_up();
}

const TTCN_Typedescriptor_t* TrxcCommand::get_descriptor() const { return &TrxcCommand_descr_; }
TrxcCommand& TrxcCommand::operator=(const TrxcCommand& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @TRXC_Types.TrxcCommand.");
  if (other_value.verb().is_bound()) field_verb = other_value.verb();
  else field_verb.clean_up();
  if (other_value.params().is_bound()) field_params = other_value.params();
  else field_params.clean_up();
}
return *this;
}

boolean TrxcCommand::operator==(const TrxcCommand& other_value) const
{
return field_verb==other_value.field_verb
  && field_params==other_value.field_params;
}

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

void TrxcCommand::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ verb := ");
field_verb.log();
TTCN_Logger::log_event_str(", params := ");
field_params.log();
TTCN_Logger::log_event_str(" }");
}

void TrxcCommand::set_implicit_omit()
{
if (verb().is_bound()) verb().set_implicit_omit();
if (!params().is_bound()) params() = OMIT_VALUE;
else params().set_implicit_omit();
}

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

void TrxcCommand::encode_text(Text_Buf& text_buf) const
{
field_verb.encode_text(text_buf);
field_params.encode_text(text_buf);
}

void TrxcCommand::decode_text(Text_Buf& text_buf)
{
field_verb.decode_text(text_buf);
field_params.decode_text(text_buf);
}

void TrxcCommand::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 TrxcCommand::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 TrxcCommand::TEXT_encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf) const{
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  boolean need_separator=FALSE;
  int encoded_length=0;
  if(p_td.text->begin_encode){
    p_buf.put_cs(*p_td.text->begin_encode);
    encoded_length+=p_td.text->begin_encode->lengthof();
  }
 if(need_separator && p_td.text->separator_encode){
    p_buf.put_cs(*p_td.text->separator_encode);
    encoded_length+=p_td.text->separator_encode->lengthof();
 }
 encoded_length+=field_verb.TEXT_encode(TrxcVerb_descr_,p_buf);
 need_separator=TRUE;
  if(field_params.ispresent()){
 if(need_separator && p_td.text->separator_encode){
    p_buf.put_cs(*p_td.text->separator_encode);
    encoded_length+=p_td.text->separator_encode->lengthof();
 }
 encoded_length+=field_params().TEXT_encode(TrxcParams_descr_,p_buf);
 need_separator=TRUE;
  }
  if(p_td.text->end_encode){
    p_buf.put_cs(*p_td.text->end_encode);
    encoded_length+=p_td.text->end_encode->lengthof();
  }
  return encoded_length;
}
int TrxcCommand::TEXT_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, Limit_Token_List& limit, boolean no_err, boolean){
  int decoded_length=0;
  int decoded_field_length=0;
  size_t pos=p_buf.get_pos();
  boolean sep_found=FALSE;
  int sep_length=0;
  int ml=0;
  if(p_td.text->begin_decode){
    int tl;
    if((tl=p_td.text->begin_decode->match_begin(p_buf))<0){
          if(no_err)return -1;
          TTCN_EncDec_ErrorContext::error
              (TTCN_EncDec::ET_TOKEN_ERR, "The specified token '%s' not found for '%s': ",(const char*)*(p_td.text->begin_decode), p_td.name);
          return 0;
        }
    decoded_length+=tl;
    p_buf.increase_pos(tl);
  }
  if(p_td.text->end_decode){
    limit.add_token(p_td.text->end_decode);
    ml++;
  }
  if(p_td.text->separator_decode){
    limit.add_token(p_td.text->separator_decode);
    ml++;
  }
    field_params=OMIT_VALUE;
    while(TRUE){
    decoded_field_length=field_verb.TEXT_decode(TrxcVerb_descr_,p_buf,limit,TRUE);
    if(decoded_field_length<0){
     limit.remove_tokens(ml);
     if(no_err)return -1;
     TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_TOKEN_ERR, "Error during decoding field 'verb' for '%s': ", p_td.name);
     return decoded_length;
   } else {
  decoded_length+=decoded_field_length;
    if(p_td.text->separator_decode){
      int tl;
      if((tl=p_td.text->separator_decode->match_begin(p_buf))<0){
      sep_found=FALSE;
      break;
      } else {
      decoded_length+=tl;
      p_buf.increase_pos(tl);
      sep_length=tl;
      sep_found=TRUE;}
    } else {
      sep_found=FALSE;
      if(p_td.text->end_decode){
      int tl;
      if((tl=p_td.text->end_decode->match_begin(p_buf))!=-1){
        decoded_length+=tl;
        p_buf.increase_pos(tl);
        limit.remove_tokens(ml);
        return decoded_length;
      }
    } else if(limit.has_token(ml)){
      if(limit.match(p_buf,ml)==0){
        sep_found=FALSE;
        break;
      }
    }
    }
  }
    pos=p_buf.get_pos();
    decoded_field_length=field_params().TEXT_decode(TrxcParams_descr_,p_buf,limit,TRUE);
    if(decoded_field_length<0){
    field_params=OMIT_VALUE;
    p_buf.set_pos(pos);
    } else {
  decoded_length+=decoded_field_length;
    sep_found=FALSE;
  }
   break;
  }
  limit.remove_tokens(ml);
  if(sep_found){
      p_buf.set_pos(p_buf.get_pos()-sep_length);
      decoded_length-=sep_length;
  }
  if(p_td.text->end_decode){
    int tl;
    if((tl=p_td.text->end_decode->match_begin(p_buf))<0){
      if(no_err)return -1;
      TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_TOKEN_ERR, "The specified token '%s' not found for '%s': ",(const char*)*(p_td.text->end_decode),p_td.name);
      return decoded_length;
    }
    decoded_length+=tl;
    p_buf.increase_pos(tl);
  }
  return decoded_length;
}
struct TrxcCommand_template::single_value_struct {
CHARSTRING_template field_verb;
TrxcParams_template field_params;
};

void TrxcCommand_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_verb = ANY_VALUE;
single_value->field_params = ANY_OR_OMIT;
}
}
}

void TrxcCommand_template::copy_value(const TrxcCommand& other_value)
{
single_value = new single_value_struct;
if (other_value.verb().is_bound()) {
  single_value->field_verb = other_value.verb();
} else {
  single_value->field_verb.clean_up();
}
if (other_value.params().is_bound()) {
  if (other_value.params().ispresent()) single_value->field_params = other_value.params()();
  else single_value->field_params = OMIT_VALUE;
} else {
  single_value->field_params.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void TrxcCommand_template::copy_template(const TrxcCommand_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.verb().get_selection()) {
single_value->field_verb = other_value.verb();
} else {
single_value->field_verb.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.params().get_selection()) {
single_value->field_params = other_value.params();
} else {
single_value->field_params.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 TrxcCommand_template[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 TrxcCommand_template(*other_value.implication_.precondition);
implication_.implied_template = new TrxcCommand_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 @TRXC_Types.TrxcCommand.");
break;
}
set_selection(other_value);
}

TrxcCommand_template::TrxcCommand_template()
{
}

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

TrxcCommand_template::TrxcCommand_template(const TrxcCommand& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean TrxcCommand_template::match(const TrxcCommand& 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.verb().is_bound()) return FALSE;
if(!single_value->field_verb.match(other_value.verb(), legacy))return FALSE;
if(!other_value.params().is_bound()) return FALSE;
if((other_value.params().ispresent() ? !single_value->field_params.match((const TrxcParams&)other_value.params(), legacy) : !single_value->field_params.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 @TRXC_Types.TrxcCommand.");
}
return FALSE;
}

boolean TrxcCommand_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_verb.is_bound()
 || (single_value->field_params.is_omit() || single_value->field_params.is_bound());
}

boolean TrxcCommand_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_verb.is_value()
 && (single_value->field_params.is_omit() || single_value->field_params.is_value());
}

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

TrxcCommand TrxcCommand_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 @TRXC_Types.TrxcCommand.");
TrxcCommand ret_val;
if (single_value->field_verb.is_bound()) {
ret_val.verb() = single_value->field_verb.valueof();
}
if (single_value->field_params.is_omit()) ret_val.params() = OMIT_VALUE;
else if (single_value->field_params.is_bound()) {
ret_val.params() = single_value->field_params.valueof();
}
return ret_val;
}

void TrxcCommand_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 @TRXC_Types.TrxcCommand.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new TrxcCommand_template[list_length];
}

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

CHARSTRING_template& TrxcCommand_template::verb()
{
set_specific();
return single_value->field_verb;
}

const CHARSTRING_template& TrxcCommand_template::verb() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field verb of a non-specific template of type @TRXC_Types.TrxcCommand.");
return single_value->field_verb;
}

TrxcParams_template& TrxcCommand_template::params()
{
set_specific();
return single_value->field_params;
}

const TrxcParams_template& TrxcCommand_template::params() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field params of a non-specific template of type @TRXC_Types.TrxcCommand.");
return single_value->field_params;
}

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

void TrxcCommand_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ verb := ");
single_value->field_verb.log();
TTCN_Logger::log_event_str(", params := ");
single_value->field_params.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 TrxcCommand_template::log_match(const TrxcCommand& 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_verb.match(match_value.verb(), legacy)){
TTCN_Logger::log_logmatch_info(".verb");
single_value->field_verb.log_match(match_value.verb(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.params().ispresent()){
if(!single_value->field_params.match(match_value.params(), legacy)){
TTCN_Logger::log_logmatch_info(".params");
single_value->field_params.log_match(match_value.params(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_params.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".params := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_params.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("{ verb := ");
single_value->field_verb.log_match(match_value.verb(), legacy);
TTCN_Logger::log_event_str(", params := ");
if (match_value.params().ispresent()) {
single_value->field_params.log_match(match_value.params(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_params.log();
if (single_value->field_params.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 TrxcCommand_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (verb().is_bound()) verb().set_implicit_omit();
if (!params().is_bound()) params() = OMIT_VALUE;
else params().set_implicit_omit();
}

void TrxcCommand_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_verb.encode_text(text_buf);
single_value->field_params.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 @TRXC_Types.TrxcCommand.");
}
}

void TrxcCommand_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_verb.decode_text(text_buf);
single_value->field_params.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 TrxcCommand_template[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 @TRXC_Types.TrxcCommand.");
}
}

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

void TrxcCommand_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_verb.check_restriction(t_res, t_name ? t_name : "@TRXC_Types.TrxcCommand");
single_value->field_params.check_restriction(t_res, t_name ? t_name : "@TRXC_Types.TrxcCommand");
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 : "@TRXC_Types.TrxcCommand");
}

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

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

TrxcResponse::TrxcResponse()
{
}

TrxcResponse::TrxcResponse(const CHARSTRING& par_verb,
    const INTEGER& par_status,
    const OPTIONAL< TrxcParams >& par_params)
  :   field_verb(par_verb),
  field_status(par_status),
  field_params(par_params)
{
}

TrxcResponse::TrxcResponse(const TrxcResponse& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @TRXC_Types.TrxcResponse.");
if (other_value.verb().is_bound()) field_verb = other_value.verb();
else field_verb.clean_up();
if (other_value.status().is_bound()) field_status = other_value.status();
else field_status.clean_up();
if (other_value.params().is_bound()) field_params = other_value.params();
else field_params.clean_up();
}

void TrxcResponse::clean_up()
{
field_verb.clean_up();
field_status.clean_up();
field_params.clean_up();
}

const TTCN_Typedescriptor_t* TrxcResponse::get_descriptor() const { return &TrxcResponse_descr_; }
TrxcResponse& TrxcResponse::operator=(const TrxcResponse& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @TRXC_Types.TrxcResponse.");
  if (other_value.verb().is_bound()) field_verb = other_value.verb();
  else field_verb.clean_up();
  if (other_value.status().is_bound()) field_status = other_value.status();
  else field_status.clean_up();
  if (other_value.params().is_bound()) field_params = other_value.params();
  else field_params.clean_up();
}
return *this;
}

boolean TrxcResponse::operator==(const TrxcResponse& other_value) const
{
return field_verb==other_value.field_verb
  && field_status==other_value.field_status
  && field_params==other_value.field_params;
}

boolean TrxcResponse::is_bound() const
{
return (field_verb.is_bound())
  || (field_status.is_bound())
  || (OPTIONAL_OMIT == field_params.get_selection() || field_params.is_bound());
}
boolean TrxcResponse::is_value() const
{
return field_verb.is_value()
  && field_status.is_value()
  && (OPTIONAL_OMIT == field_params.get_selection() || field_params.is_value());
}
int TrxcResponse::size_of() const
{
  int ret_val = 2;
  if (field_params.ispresent()) ret_val++;
  return ret_val;
}

void TrxcResponse::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ verb := ");
field_verb.log();
TTCN_Logger::log_event_str(", status := ");
field_status.log();
TTCN_Logger::log_event_str(", params := ");
field_params.log();
TTCN_Logger::log_event_str(" }");
}

void TrxcResponse::set_implicit_omit()
{
if (verb().is_bound()) verb().set_implicit_omit();
if (status().is_bound()) status().set_implicit_omit();
if (!params().is_bound()) params() = OMIT_VALUE;
else params().set_implicit_omit();
}

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

void TrxcResponse::encode_text(Text_Buf& text_buf) const
{
field_verb.encode_text(text_buf);
field_status.encode_text(text_buf);
field_params.encode_text(text_buf);
}

void TrxcResponse::decode_text(Text_Buf& text_buf)
{
field_verb.decode_text(text_buf);
field_status.decode_text(text_buf);
field_params.decode_text(text_buf);
}

void TrxcResponse::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 TrxcResponse::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 TrxcResponse::TEXT_encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf) const{
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  boolean need_separator=FALSE;
  int encoded_length=0;
  if(p_td.text->begin_encode){
    p_buf.put_cs(*p_td.text->begin_encode);
    encoded_length+=p_td.text->begin_encode->lengthof();
  }
 if(need_separator && p_td.text->separator_encode){
    p_buf.put_cs(*p_td.text->separator_encode);
    encoded_length+=p_td.text->separator_encode->lengthof();
 }
 encoded_length+=field_verb.TEXT_encode(TrxcVerb_descr_,p_buf);
 need_separator=TRUE;
 if(need_separator && p_td.text->separator_encode){
    p_buf.put_cs(*p_td.text->separator_encode);
    encoded_length+=p_td.text->separator_encode->lengthof();
 }
 encoded_length+=field_status.TEXT_encode(TrxcStatus_descr_,p_buf);
 need_separator=TRUE;
  if(field_params.ispresent()){
 if(need_separator && p_td.text->separator_encode){
    p_buf.put_cs(*p_td.text->separator_encode);
    encoded_length+=p_td.text->separator_encode->lengthof();
 }
 encoded_length+=field_params().TEXT_encode(TrxcParams_descr_,p_buf);
 need_separator=TRUE;
  }
  if(p_td.text->end_encode){
    p_buf.put_cs(*p_td.text->end_encode);
    encoded_length+=p_td.text->end_encode->lengthof();
  }
  return encoded_length;
}
int TrxcResponse::TEXT_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, Limit_Token_List& limit, boolean no_err, boolean){
  int decoded_length=0;
  int decoded_field_length=0;
  size_t pos=p_buf.get_pos();
  boolean sep_found=FALSE;
  int sep_length=0;
  int ml=0;
  if(p_td.text->begin_decode){
    int tl;
    if((tl=p_td.text->begin_decode->match_begin(p_buf))<0){
          if(no_err)return -1;
          TTCN_EncDec_ErrorContext::error
              (TTCN_EncDec::ET_TOKEN_ERR, "The specified token '%s' not found for '%s': ",(const char*)*(p_td.text->begin_decode), p_td.name);
          return 0;
        }
    decoded_length+=tl;
    p_buf.increase_pos(tl);
  }
  if(p_td.text->end_decode){
    limit.add_token(p_td.text->end_decode);
    ml++;
  }
  if(p_td.text->separator_decode){
    limit.add_token(p_td.text->separator_decode);
    ml++;
  }
    field_params=OMIT_VALUE;
    while(TRUE){
    decoded_field_length=field_verb.TEXT_decode(TrxcVerb_descr_,p_buf,limit,TRUE);
    if(decoded_field_length<0){
     limit.remove_tokens(ml);
     if(no_err)return -1;
     TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_TOKEN_ERR, "Error during decoding field 'verb' for '%s': ", p_td.name);
     return decoded_length;
   } else {
  decoded_length+=decoded_field_length;
    if(p_td.text->separator_decode){
      int tl;
      if((tl=p_td.text->separator_decode->match_begin(p_buf))<0){
          limit.remove_tokens(ml);
          if(no_err)return -1;
          TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_TOKEN_ERR, "The specified token '%s' not found for '%s': ",(const char*)*(p_td.text->separator_decode),p_td.name);
          return decoded_length;
      } else {
      decoded_length+=tl;
      p_buf.increase_pos(tl);
      sep_length=tl;
      sep_found=TRUE;}
    } else sep_found=FALSE;
  }
    decoded_field_length=field_status.TEXT_decode(TrxcStatus_descr_,p_buf,limit,TRUE);
    if(decoded_field_length<0){
     limit.remove_tokens(ml);
     if(no_err)return -1;
     TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_TOKEN_ERR, "Error during decoding field 'status' for '%s': ", p_td.name);
     return decoded_length;
   } else {
  decoded_length+=decoded_field_length;
    if(p_td.text->separator_decode){
      int tl;
      if((tl=p_td.text->separator_decode->match_begin(p_buf))<0){
      sep_found=FALSE;
      break;
      } else {
      decoded_length+=tl;
      p_buf.increase_pos(tl);
      sep_length=tl;
      sep_found=TRUE;}
    } else {
      sep_found=FALSE;
      if(p_td.text->end_decode){
      int tl;
      if((tl=p_td.text->end_decode->match_begin(p_buf))!=-1){
        decoded_length+=tl;
        p_buf.increase_pos(tl);
        limit.remove_tokens(ml);
        return decoded_length;
      }
    } else if(limit.has_token(ml)){
      if(limit.match(p_buf,ml)==0){
        sep_found=FALSE;
        break;
      }
    }
    }
  }
    pos=p_buf.get_pos();
    decoded_field_length=field_params().TEXT_decode(TrxcParams_descr_,p_buf,limit,TRUE);
    if(decoded_field_length<0){
    field_params=OMIT_VALUE;
    p_buf.set_pos(pos);
    } else {
  decoded_length+=decoded_field_length;
    sep_found=FALSE;
  }
   break;
  }
  limit.remove_tokens(ml);
  if(sep_found){
      p_buf.set_pos(p_buf.get_pos()-sep_length);
      decoded_length-=sep_length;
  }
  if(p_td.text->end_decode){
    int tl;
    if((tl=p_td.text->end_decode->match_begin(p_buf))<0){
      if(no_err)return -1;
      TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_TOKEN_ERR, "The specified token '%s' not found for '%s': ",(const char*)*(p_td.text->end_decode),p_td.name);
      return decoded_length;
    }
    decoded_length+=tl;
    p_buf.increase_pos(tl);
  }
  return decoded_length;
}
struct TrxcResponse_template::single_value_struct {
CHARSTRING_template field_verb;
INTEGER_template field_status;
TrxcParams_template field_params;
};

void TrxcResponse_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_verb = ANY_VALUE;
single_value->field_status = ANY_VALUE;
single_value->field_params = ANY_OR_OMIT;
}
}
}

void TrxcResponse_template::copy_value(const TrxcResponse& other_value)
{
single_value = new single_value_struct;
if (other_value.verb().is_bound()) {
  single_value->field_verb = other_value.verb();
} else {
  single_value->field_verb.clean_up();
}
if (other_value.status().is_bound()) {
  single_value->field_status = other_value.status();
} else {
  single_value->field_status.clean_up();
}
if (other_value.params().is_bound()) {
  if (other_value.params().ispresent()) single_value->field_params = other_value.params()();
  else single_value->field_params = OMIT_VALUE;
} else {
  single_value->field_params.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void TrxcResponse_template::copy_template(const TrxcResponse_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.verb().get_selection()) {
single_value->field_verb = other_value.verb();
} else {
single_value->field_verb.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.status().get_selection()) {
single_value->field_status = other_value.status();
} else {
single_value->field_status.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.params().get_selection()) {
single_value->field_params = other_value.params();
} else {
single_value->field_params.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 TrxcResponse_template[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 TrxcResponse_template(*other_value.implication_.precondition);
implication_.implied_template = new TrxcResponse_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 @TRXC_Types.TrxcResponse.");
break;
}
set_selection(other_value);
}

TrxcResponse_template::TrxcResponse_template()
{
}

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

TrxcResponse_template::TrxcResponse_template(const TrxcResponse& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean TrxcResponse_template::match(const TrxcResponse& 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.verb().is_bound()) return FALSE;
if(!single_value->field_verb.match(other_value.verb(), legacy))return FALSE;
if(!other_value.status().is_bound()) return FALSE;
if(!single_value->field_status.match(other_value.status(), legacy))return FALSE;
if(!other_value.params().is_bound()) return FALSE;
if((other_value.params().ispresent() ? !single_value->field_params.match((const TrxcParams&)other_value.params(), legacy) : !single_value->field_params.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 @TRXC_Types.TrxcResponse.");
}
return FALSE;
}

boolean TrxcResponse_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_verb.is_bound()
 || single_value->field_status.is_bound()
 || (single_value->field_params.is_omit() || single_value->field_params.is_bound());
}

boolean TrxcResponse_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_verb.is_value()
 && single_value->field_status.is_value()
 && (single_value->field_params.is_omit() || single_value->field_params.is_value());
}

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

TrxcResponse TrxcResponse_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 @TRXC_Types.TrxcResponse.");
TrxcResponse ret_val;
if (single_value->field_verb.is_bound()) {
ret_val.verb() = single_value->field_verb.valueof();
}
if (single_value->field_status.is_bound()) {
ret_val.status() = single_value->field_status.valueof();
}
if (single_value->field_params.is_omit()) ret_val.params() = OMIT_VALUE;
else if (single_value->field_params.is_bound()) {
ret_val.params() = single_value->field_params.valueof();
}
return ret_val;
}

void TrxcResponse_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 @TRXC_Types.TrxcResponse.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new TrxcResponse_template[list_length];
}

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

CHARSTRING_template& TrxcResponse_template::verb()
{
set_specific();
return single_value->field_verb;
}

const CHARSTRING_template& TrxcResponse_template::verb() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field verb of a non-specific template of type @TRXC_Types.TrxcResponse.");
return single_value->field_verb;
}

INTEGER_template& TrxcResponse_template::status()
{
set_specific();
return single_value->field_status;
}

const INTEGER_template& TrxcResponse_template::status() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field status of a non-specific template of type @TRXC_Types.TrxcResponse.");
return single_value->field_status;
}

TrxcParams_template& TrxcResponse_template::params()
{
set_specific();
return single_value->field_params;
}

const TrxcParams_template& TrxcResponse_template::params() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field params of a non-specific template of type @TRXC_Types.TrxcResponse.");
return single_value->field_params;
}

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

void TrxcResponse_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ verb := ");
single_value->field_verb.log();
TTCN_Logger::log_event_str(", status := ");
single_value->field_status.log();
TTCN_Logger::log_event_str(", params := ");
single_value->field_params.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 TrxcResponse_template::log_match(const TrxcResponse& 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_verb.match(match_value.verb(), legacy)){
TTCN_Logger::log_logmatch_info(".verb");
single_value->field_verb.log_match(match_value.verb(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_status.match(match_value.status(), legacy)){
TTCN_Logger::log_logmatch_info(".status");
single_value->field_status.log_match(match_value.status(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.params().ispresent()){
if(!single_value->field_params.match(match_value.params(), legacy)){
TTCN_Logger::log_logmatch_info(".params");
single_value->field_params.log_match(match_value.params(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_params.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".params := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_params.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("{ verb := ");
single_value->field_verb.log_match(match_value.verb(), legacy);
TTCN_Logger::log_event_str(", status := ");
single_value->field_status.log_match(match_value.status(), legacy);
TTCN_Logger::log_event_str(", params := ");
if (match_value.params().ispresent()) {
single_value->field_params.log_match(match_value.params(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_params.log();
if (single_value->field_params.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 TrxcResponse_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (verb().is_bound()) verb().set_implicit_omit();
if (status().is_bound()) status().set_implicit_omit();
if (!params().is_bound()) params() = OMIT_VALUE;
else params().set_implicit_omit();
}

void TrxcResponse_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_verb.encode_text(text_buf);
single_value->field_status.encode_text(text_buf);
single_value->field_params.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 @TRXC_Types.TrxcResponse.");
}
}

void TrxcResponse_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_verb.decode_text(text_buf);
single_value->field_status.decode_text(text_buf);
single_value->field_params.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 TrxcResponse_template[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 @TRXC_Types.TrxcResponse.");
}
}

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

void TrxcResponse_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_verb.check_restriction(t_res, t_name ? t_name : "@TRXC_Types.TrxcResponse");
single_value->field_status.check_restriction(t_res, t_name ? t_name : "@TRXC_Types.TrxcResponse");
single_value->field_params.check_restriction(t_res, t_name ? t_name : "@TRXC_Types.TrxcResponse");
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 : "@TRXC_Types.TrxcResponse");
}

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

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

TrxcIndication::TrxcIndication()
{
}

TrxcIndication::TrxcIndication(const CHARSTRING& par_verb,
    const OPTIONAL< TrxcParams >& par_params)
  :   field_verb(par_verb),
  field_params(par_params)
{
}

TrxcIndication::TrxcIndication(const TrxcIndication& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @TRXC_Types.TrxcIndication.");
if (other_value.verb().is_bound()) field_verb = other_value.verb();
else field_verb.clean_up();
if (other_value.params().is_bound()) field_params = other_value.params();
else field_params.clean_up();
}

void TrxcIndication::clean_up()
{
field_verb.clean_up();
field_params.clean_up();
}

const TTCN_Typedescriptor_t* TrxcIndication::get_descriptor() const { return &TrxcIndication_descr_; }
TrxcIndication& TrxcIndication::operator=(const TrxcIndication& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @TRXC_Types.TrxcIndication.");
  if (other_value.verb().is_bound()) field_verb = other_value.verb();
  else field_verb.clean_up();
  if (other_value.params().is_bound()) field_params = other_value.params();
  else field_params.clean_up();
}
return *this;
}

boolean TrxcIndication::operator==(const TrxcIndication& other_value) const
{
return field_verb==other_value.field_verb
  && field_params==other_value.field_params;
}

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

void TrxcIndication::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ verb := ");
field_verb.log();
TTCN_Logger::log_event_str(", params := ");
field_params.log();
TTCN_Logger::log_event_str(" }");
}

void TrxcIndication::set_implicit_omit()
{
if (verb().is_bound()) verb().set_implicit_omit();
if (!params().is_bound()) params() = OMIT_VALUE;
else params().set_implicit_omit();
}

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

void TrxcIndication::encode_text(Text_Buf& text_buf) const
{
field_verb.encode_text(text_buf);
field_params.encode_text(text_buf);
}

void TrxcIndication::decode_text(Text_Buf& text_buf)
{
field_verb.decode_text(text_buf);
field_params.decode_text(text_buf);
}

void TrxcIndication::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 TrxcIndication::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 TrxcIndication::TEXT_encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf) const{
  if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
  boolean need_separator=FALSE;
  int encoded_length=0;
  if(p_td.text->begin_encode){
    p_buf.put_cs(*p_td.text->begin_encode);
    encoded_length+=p_td.text->begin_encode->lengthof();
  }
 if(need_separator && p_td.text->separator_encode){
    p_buf.put_cs(*p_td.text->separator_encode);
    encoded_length+=p_td.text->separator_encode->lengthof();
 }
 encoded_length+=field_verb.TEXT_encode(TrxcVerb_descr_,p_buf);
 need_separator=TRUE;
  if(field_params.ispresent()){
 if(need_separator && p_td.text->separator_encode){
    p_buf.put_cs(*p_td.text->separator_encode);
    encoded_length+=p_td.text->separator_encode->lengthof();
 }
 encoded_length+=field_params().TEXT_encode(TrxcParams_descr_,p_buf);
 need_separator=TRUE;
  }
  if(p_td.text->end_encode){
    p_buf.put_cs(*p_td.text->end_encode);
    encoded_length+=p_td.text->end_encode->lengthof();
  }
  return encoded_length;
}
int TrxcIndication::TEXT_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, Limit_Token_List& limit, boolean no_err, boolean){
  int decoded_length=0;
  int decoded_field_length=0;
  size_t pos=p_buf.get_pos();
  boolean sep_found=FALSE;
  int sep_length=0;
  int ml=0;
  if(p_td.text->begin_decode){
    int tl;
    if((tl=p_td.text->begin_decode->match_begin(p_buf))<0){
          if(no_err)return -1;
          TTCN_EncDec_ErrorContext::error
              (TTCN_EncDec::ET_TOKEN_ERR, "The specified token '%s' not found for '%s': ",(const char*)*(p_td.text->begin_decode), p_td.name);
          return 0;
        }
    decoded_length+=tl;
    p_buf.increase_pos(tl);
  }
  if(p_td.text->end_decode){
    limit.add_token(p_td.text->end_decode);
    ml++;
  }
  if(p_td.text->separator_decode){
    limit.add_token(p_td.text->separator_decode);
    ml++;
  }
    field_params=OMIT_VALUE;
    while(TRUE){
    decoded_field_length=field_verb.TEXT_decode(TrxcVerb_descr_,p_buf,limit,TRUE);
    if(decoded_field_length<0){
     limit.remove_tokens(ml);
     if(no_err)return -1;
     TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_TOKEN_ERR, "Error during decoding field 'verb' for '%s': ", p_td.name);
     return decoded_length;
   } else {
  decoded_length+=decoded_field_length;
    if(p_td.text->separator_decode){
      int tl;
      if((tl=p_td.text->separator_decode->match_begin(p_buf))<0){
      sep_found=FALSE;
      break;
      } else {
      decoded_length+=tl;
      p_buf.increase_pos(tl);
      sep_length=tl;
      sep_found=TRUE;}
    } else {
      sep_found=FALSE;
      if(p_td.text->end_decode){
      int tl;
      if((tl=p_td.text->end_decode->match_begin(p_buf))!=-1){
        decoded_length+=tl;
        p_buf.increase_pos(tl);
        limit.remove_tokens(ml);
        return decoded_length;
      }
    } else if(limit.has_token(ml)){
      if(limit.match(p_buf,ml)==0){
        sep_found=FALSE;
        break;
      }
    }
    }
  }
    pos=p_buf.get_pos();
    decoded_field_length=field_params().TEXT_decode(TrxcParams_descr_,p_buf,limit,TRUE);
    if(decoded_field_length<0){
    field_params=OMIT_VALUE;
    p_buf.set_pos(pos);
    } else {
  decoded_length+=decoded_field_length;
    sep_found=FALSE;
  }
   break;
  }
  limit.remove_tokens(ml);
  if(sep_found){
      p_buf.set_pos(p_buf.get_pos()-sep_length);
      decoded_length-=sep_length;
  }
  if(p_td.text->end_decode){
    int tl;
    if((tl=p_td.text->end_decode->match_begin(p_buf))<0){
      if(no_err)return -1;
      TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_TOKEN_ERR, "The specified token '%s' not found for '%s': ",(const char*)*(p_td.text->end_decode),p_td.name);
      return decoded_length;
    }
    decoded_length+=tl;
    p_buf.increase_pos(tl);
  }
  return decoded_length;
}
struct TrxcIndication_template::single_value_struct {
CHARSTRING_template field_verb;
TrxcParams_template field_params;
};

void TrxcIndication_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_verb = ANY_VALUE;
single_value->field_params = ANY_OR_OMIT;
}
}
}

void TrxcIndication_template::copy_value(const TrxcIndication& other_value)
{
single_value = new single_value_struct;
if (other_value.verb().is_bound()) {
  single_value->field_verb = other_value.verb();
} else {
  single_value->field_verb.clean_up();
}
if (other_value.params().is_bound()) {
  if (other_value.params().ispresent()) single_value->field_params = other_value.params()();
  else single_value->field_params = OMIT_VALUE;
} else {
  single_value->field_params.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void TrxcIndication_template::copy_template(const TrxcIndication_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.verb().get_selection()) {
single_value->field_verb = other_value.verb();
} else {
single_value->field_verb.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.params().get_selection()) {
single_value->field_params = other_value.params();
} else {
single_value->field_params.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 TrxcIndication_template[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 TrxcIndication_template(*other_value.implication_.precondition);
implication_.implied_template = new TrxcIndication_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 @TRXC_Types.TrxcIndication.");
break;
}
set_selection(other_value);
}

TrxcIndication_template::TrxcIndication_template()
{
}

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

TrxcIndication_template::TrxcIndication_template(const TrxcIndication& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean TrxcIndication_template::match(const TrxcIndication& 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.verb().is_bound()) return FALSE;
if(!single_value->field_verb.match(other_value.verb(), legacy))return FALSE;
if(!other_value.params().is_bound()) return FALSE;
if((other_value.params().ispresent() ? !single_value->field_params.match((const TrxcParams&)other_value.params(), legacy) : !single_value->field_params.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 @TRXC_Types.TrxcIndication.");
}
return FALSE;
}

boolean TrxcIndication_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_verb.is_bound()
 || (single_value->field_params.is_omit() || single_value->field_params.is_bound());
}

boolean TrxcIndication_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_verb.is_value()
 && (single_value->field_params.is_omit() || single_value->field_params.is_value());
}

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

TrxcIndication TrxcIndication_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 @TRXC_Types.TrxcIndication.");
TrxcIndication ret_val;
if (single_value->field_verb.is_bound()) {
ret_val.verb() = single_value->field_verb.valueof();
}
if (single_value->field_params.is_omit()) ret_val.params() = OMIT_VALUE;
else if (single_value->field_params.is_bound()) {
ret_val.params() = single_value->field_params.valueof();
}
return ret_val;
}

void TrxcIndication_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 @TRXC_Types.TrxcIndication.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new TrxcIndication_template[list_length];
}

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

CHARSTRING_template& TrxcIndication_template::verb()
{
set_specific();
return single_value->field_verb;
}

const CHARSTRING_template& TrxcIndication_template::verb() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field verb of a non-specific template of type @TRXC_Types.TrxcIndication.");
return single_value->field_verb;
}

TrxcParams_template& TrxcIndication_template::params()
{
set_specific();
return single_value->field_params;
}

const TrxcParams_template& TrxcIndication_template::params() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field params of a non-specific template of type @TRXC_Types.TrxcIndication.");
return single_value->field_params;
}

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

void TrxcIndication_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ verb := ");
single_value->field_verb.log();
TTCN_Logger::log_event_str(", params := ");
single_value->field_params.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 TrxcIndication_template::log_match(const TrxcIndication& 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_verb.match(match_value.verb(), legacy)){
TTCN_Logger::log_logmatch_info(".verb");
single_value->field_verb.log_match(match_value.verb(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.params().ispresent()){
if(!single_value->field_params.match(match_value.params(), legacy)){
TTCN_Logger::log_logmatch_info(".params");
single_value->field_params.log_match(match_value.params(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_params.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".params := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_params.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("{ verb := ");
single_value->field_verb.log_match(match_value.verb(), legacy);
TTCN_Logger::log_event_str(", params := ");
if (match_value.params().ispresent()) {
single_value->field_params.log_match(match_value.params(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_params.log();
if (single_value->field_params.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 TrxcIndication_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (verb().is_bound()) verb().set_implicit_omit();
if (!params().is_bound()) params() = OMIT_VALUE;
else params().set_implicit_omit();
}

void TrxcIndication_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_verb.encode_text(text_buf);
single_value->field_params.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 @TRXC_Types.TrxcIndication.");
}
}

void TrxcIndication_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_verb.decode_text(text_buf);
single_value->field_params.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 TrxcIndication_template[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 @TRXC_Types.TrxcIndication.");
}
}

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

void TrxcIndication_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_verb.check_restriction(t_res, t_name ? t_name : "@TRXC_Types.TrxcIndication");
single_value->field_params.check_restriction(t_res, t_name ? t_name : "@TRXC_Types.TrxcIndication");
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 : "@TRXC_Types.TrxcIndication");
}

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

boolean TrxcIndication_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 TrxcMessage::copy_value(const TrxcMessage& other_value)
{
switch (other_value.union_selection) {
case ALT_cmd:
field_cmd = new TrxcCommand(*other_value.field_cmd);
break;
case ALT_rsp:
field_rsp = new TrxcResponse(*other_value.field_rsp);
break;
case ALT_ind:
field_ind = new TrxcIndication(*other_value.field_ind);
break;
default:
TTCN_error("Assignment of an unbound union value of type @TRXC_Types.TrxcMessage.");
}
union_selection = other_value.union_selection;
}

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

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

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

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

boolean TrxcMessage::operator==(const TrxcMessage& other_value) const
{
if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @TRXC_Types.TrxcMessage.");
if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @TRXC_Types.TrxcMessage.");
if (union_selection != other_value.union_selection) return FALSE;
switch (union_selection) {
case ALT_cmd:
return *field_cmd == *other_value.field_cmd;
case ALT_rsp:
return *field_rsp == *other_value.field_rsp;
case ALT_ind:
return *field_ind == *other_value.field_ind;
default:
return FALSE;
}
}

TrxcCommand& TrxcMessage::cmd()
{
if (union_selection != ALT_cmd) {
clean_up();
field_cmd = new TrxcCommand;
union_selection = ALT_cmd;
}
return *field_cmd;
}

const TrxcCommand& TrxcMessage::cmd() const
{
if (union_selection != ALT_cmd) TTCN_error("Using non-selected field cmd in a value of union type @TRXC_Types.TrxcMessage.");
return *field_cmd;
}

TrxcResponse& TrxcMessage::rsp()
{
if (union_selection != ALT_rsp) {
clean_up();
field_rsp = new TrxcResponse;
union_selection = ALT_rsp;
}
return *field_rsp;
}

const TrxcResponse& TrxcMessage::rsp() const
{
if (union_selection != ALT_rsp) TTCN_error("Using non-selected field rsp in a value of union type @TRXC_Types.TrxcMessage.");
return *field_rsp;
}

TrxcIndication& TrxcMessage::ind()
{
if (union_selection != ALT_ind) {
clean_up();
field_ind = new TrxcIndication;
union_selection = ALT_ind;
}
return *field_ind;
}

const TrxcIndication& TrxcMessage::ind() const
{
if (union_selection != ALT_ind) TTCN_error("Using non-selected field ind in a value of union type @TRXC_Types.TrxcMessage.");
return *field_ind;
}

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

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

boolean TrxcMessage::is_value() const
{
switch (union_selection) {
case UNBOUND_VALUE: return FALSE;
case ALT_cmd: return field_cmd->is_value();
case ALT_rsp: return field_rsp->is_value();
case ALT_ind: return field_ind->is_value();
default: TTCN_error("Invalid selection in union is_bound");}
}

void TrxcMessage::clean_up()
{
switch (union_selection) {
case ALT_cmd:
  delete field_cmd;
  break;
case ALT_rsp:
  delete field_rsp;
  break;
case ALT_ind:
  delete field_ind;
  break;
default:
  break;
}
union_selection = UNBOUND_VALUE;
}

void TrxcMessage::log() const
{
switch (union_selection) {
case ALT_cmd:
TTCN_Logger::log_event_str("{ cmd := ");
field_cmd->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_rsp:
TTCN_Logger::log_event_str("{ rsp := ");
field_rsp->log();
TTCN_Logger::log_event_str(" }");
break;
case ALT_ind:
TTCN_Logger::log_event_str("{ ind := ");
field_ind->log();
TTCN_Logger::log_event_str(" }");
break;
default:
TTCN_Logger::log_event_unbound();
}
}

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

void TrxcMessage::set_implicit_omit()
{
switch (union_selection) {
case ALT_cmd:
field_cmd->set_implicit_omit(); break;
case ALT_rsp:
field_rsp->set_implicit_omit(); break;
case ALT_ind:
field_ind->set_implicit_omit(); break;
default: break;
}
}

void TrxcMessage::encode_text(Text_Buf& text_buf) const
{
text_buf.push_int(union_selection);
switch (union_selection) {
case ALT_cmd:
field_cmd->encode_text(text_buf);
break;
case ALT_rsp:
field_rsp->encode_text(text_buf);
break;
case ALT_ind:
field_ind->encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an unbound value of union type @TRXC_Types.TrxcMessage.");
}
}

void TrxcMessage::decode_text(Text_Buf& text_buf)
{
switch ((union_selection_type)text_buf.pull_int().get_val()) {
case ALT_cmd:
cmd().decode_text(text_buf);
break;
case ALT_rsp:
rsp().decode_text(text_buf);
break;
case ALT_ind:
ind().decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for type @TRXC_Types.TrxcMessage.");
}
}

void TrxcMessage::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 TrxcMessage::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 TrxcMessage::TEXT_encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf) const
{
  int encoded_length=0;
  if (p_td.text->begin_encode) {
    p_buf.put_cs(*p_td.text->begin_encode);
    encoded_length += p_td.text->begin_encode->lengthof();
  }
  switch(union_selection){
  case ALT_cmd:
   encoded_length += field_cmd->TEXT_encode(TrxcMessage_cmd_descr_,p_buf);
   break;
  case ALT_rsp:
   encoded_length += field_rsp->TEXT_encode(TrxcMessage_rsp_descr_,p_buf);
   break;
  case ALT_ind:
   encoded_length += field_ind->TEXT_encode(TrxcMessage_ind_descr_,p_buf);
   break;
  default:
    TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
    break;
  }
  if (p_td.text->end_encode) {
    p_buf.put_cs(*p_td.text->end_encode);
    encoded_length += p_td.text->end_encode->lengthof();
  }
  return encoded_length;
}

int TrxcMessage::TEXT_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, Limit_Token_List& limit, boolean no_err, boolean)
{
  int decoded_length = 0;
  if(p_td.text->begin_decode){
    int tl = p_td.text->begin_decode->match_begin(p_buf);
    if (tl >= 0) {
      decoded_length += tl;
      p_buf.increase_pos(tl);
    } else {
      if (no_err) return -1;
      TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_TOKEN_ERR, "The specified token '%s' not found for '%s': ", (const char*)(*p_td.text->begin_decode), p_td.name);
      return 0;
    }
  }
  if (p_buf.get_read_len() < 1 && no_err) return -1;
  size_t pos = p_buf.get_pos();
  int ml = 0;
  boolean found = FALSE;
  if (p_td.text->end_decode) {
    limit.add_token(p_td.text->end_decode);
    ml++;
  }
  int str_len = cmd().TEXT_decode(TrxcMessage_cmd_descr_, p_buf, limit, TRUE);
  if (str_len >= 0) found = TRUE;
  if (!found) {
    p_buf.set_pos(pos);
    str_len = rsp().TEXT_decode(TrxcMessage_rsp_descr_, p_buf, limit, TRUE);
    if (str_len >= 0) found = TRUE;
  }
  if (!found) {
    p_buf.set_pos(pos);
    str_len = ind().TEXT_decode(TrxcMessage_ind_descr_, p_buf, limit, TRUE);
    if (str_len >= 0) found = TRUE;
  }
  limit.remove_tokens(ml);
  if (found) {
    decoded_length += str_len;
    if (p_td.text->end_decode) {
      int tl = p_td.text->end_decode->match_begin(p_buf);
      if (tl >= 0){
        decoded_length += tl;
        p_buf.increase_pos(tl);
      } else {
        if (no_err) return -1;
        TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_TOKEN_ERR, "The specified token '%s' not found for '%s': ", (const char*)(*p_td.text->end_decode), p_td.name);
      }
    }
  } else {
    if (no_err) return -1;
    TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_TOKEN_ERR, "No union member found for '%s': ", p_td.name);
    clean_up();
  }
  return decoded_length;
}
void TrxcMessage_template::copy_value(const TrxcMessage& other_value)
{
single_value.union_selection = other_value.get_selection();
switch (single_value.union_selection) {
case TrxcMessage::ALT_cmd:
single_value.field_cmd = new TrxcCommand_template(other_value.cmd());
break;
case TrxcMessage::ALT_rsp:
single_value.field_rsp = new TrxcResponse_template(other_value.rsp());
break;
case TrxcMessage::ALT_ind:
single_value.field_ind = new TrxcIndication_template(other_value.ind());
break;
default:
TTCN_error("Initializing a template with an unbound value of type @TRXC_Types.TrxcMessage.");
}
set_selection(SPECIFIC_VALUE);
}

void TrxcMessage_template::copy_template(const TrxcMessage_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 TrxcMessage::ALT_cmd:
single_value.field_cmd = new TrxcCommand_template(*other_value.single_value.field_cmd);
break;
case TrxcMessage::ALT_rsp:
single_value.field_rsp = new TrxcResponse_template(*other_value.single_value.field_rsp);
break;
case TrxcMessage::ALT_ind:
single_value.field_ind = new TrxcIndication_template(*other_value.single_value.field_ind);
break;
default:
TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @TRXC_Types.TrxcMessage.");
}
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 TrxcMessage_template[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 TrxcMessage_template(*other_value.implication_.precondition);
implication_.implied_template = new TrxcMessage_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 @TRXC_Types.TrxcMessage.");
}
set_selection(other_value);
}

TrxcMessage_template::TrxcMessage_template()
{
}

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

TrxcMessage_template::TrxcMessage_template(const TrxcMessage& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

void TrxcMessage_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case TrxcMessage::ALT_cmd:
delete single_value.field_cmd;
break;
case TrxcMessage::ALT_rsp:
delete single_value.field_rsp;
break;
case TrxcMessage::ALT_ind:
delete single_value.field_ind;
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;
}

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

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

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

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

boolean TrxcMessage_template::match(const TrxcMessage& 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:
{
TrxcMessage::union_selection_type value_selection = other_value.get_selection();
if (value_selection == TrxcMessage::UNBOUND_VALUE) return FALSE;
if (value_selection != single_value.union_selection) return FALSE;
switch (value_selection) {
case TrxcMessage::ALT_cmd:
return single_value.field_cmd->match(other_value.cmd(), legacy);
case TrxcMessage::ALT_rsp:
return single_value.field_rsp->match(other_value.rsp(), legacy);
case TrxcMessage::ALT_ind:
return single_value.field_ind->match(other_value.ind(), legacy);
default:
TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @TRXC_Types.TrxcMessage.");
}
}
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 @TRXC_Types.TrxcMessage.");
}
return FALSE;
}

boolean TrxcMessage_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
switch (single_value.union_selection) {
case TrxcMessage::ALT_cmd:
return single_value.field_cmd->is_value();
case TrxcMessage::ALT_rsp:
return single_value.field_rsp->is_value();
case TrxcMessage::ALT_ind:
return single_value.field_ind->is_value();
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @TRXC_Types.TrxcMessage.");
}
}

TrxcMessage TrxcMessage_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 @TRXC_Types.TrxcMessage.");
TrxcMessage ret_val;
switch (single_value.union_selection) {
case TrxcMessage::ALT_cmd:
ret_val.cmd() = single_value.field_cmd->valueof();
break;
case TrxcMessage::ALT_rsp:
ret_val.rsp() = single_value.field_rsp->valueof();
break;
case TrxcMessage::ALT_ind:
ret_val.ind() = single_value.field_ind->valueof();
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @TRXC_Types.TrxcMessage.");
}
return ret_val;
}

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

TrxcCommand_template& TrxcMessage_template::cmd()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != TrxcMessage::ALT_cmd) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_cmd = new TrxcCommand_template(ANY_VALUE);
else single_value.field_cmd = new TrxcCommand_template;
single_value.union_selection = TrxcMessage::ALT_cmd;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_cmd;
}

const TrxcCommand_template& TrxcMessage_template::cmd() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cmd in a non-specific template of union type @TRXC_Types.TrxcMessage.");
if (single_value.union_selection != TrxcMessage::ALT_cmd) TTCN_error("Accessing non-selected field cmd in a template of union type @TRXC_Types.TrxcMessage.");
return *single_value.field_cmd;
}

TrxcResponse_template& TrxcMessage_template::rsp()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != TrxcMessage::ALT_rsp) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_rsp = new TrxcResponse_template(ANY_VALUE);
else single_value.field_rsp = new TrxcResponse_template;
single_value.union_selection = TrxcMessage::ALT_rsp;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_rsp;
}

const TrxcResponse_template& TrxcMessage_template::rsp() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rsp in a non-specific template of union type @TRXC_Types.TrxcMessage.");
if (single_value.union_selection != TrxcMessage::ALT_rsp) TTCN_error("Accessing non-selected field rsp in a template of union type @TRXC_Types.TrxcMessage.");
return *single_value.field_rsp;
}

TrxcIndication_template& TrxcMessage_template::ind()
{
if (template_selection != SPECIFIC_VALUE || single_value.union_selection != TrxcMessage::ALT_ind) {
template_sel old_selection = template_selection;
clean_up();
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_ind = new TrxcIndication_template(ANY_VALUE);
else single_value.field_ind = new TrxcIndication_template;
single_value.union_selection = TrxcMessage::ALT_ind;
set_selection(SPECIFIC_VALUE);
}
return *single_value.field_ind;
}

const TrxcIndication_template& TrxcMessage_template::ind() const
{
if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ind in a non-specific template of union type @TRXC_Types.TrxcMessage.");
if (single_value.union_selection != TrxcMessage::ALT_ind) TTCN_error("Accessing non-selected field ind in a template of union type @TRXC_Types.TrxcMessage.");
return *single_value.field_ind;
}

boolean TrxcMessage_template::ischosen(TrxcMessage::union_selection_type checked_selection) const
{
if (checked_selection == TrxcMessage::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @TRXC_Types.TrxcMessage.");
switch (template_selection) {
case SPECIFIC_VALUE:
if (single_value.union_selection == TrxcMessage::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @TRXC_Types.TrxcMessage.");
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 @TRXC_Types.TrxcMessage 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 TrxcMessage_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
switch (single_value.union_selection) {
case TrxcMessage::ALT_cmd:
TTCN_Logger::log_event_str("{ cmd := ");
single_value.field_cmd->log();
TTCN_Logger::log_event_str(" }");
break;
case TrxcMessage::ALT_rsp:
TTCN_Logger::log_event_str("{ rsp := ");
single_value.field_rsp->log();
TTCN_Logger::log_event_str(" }");
break;
case TrxcMessage::ALT_ind:
TTCN_Logger::log_event_str("{ ind := ");
single_value.field_ind->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 TrxcMessage_template::log_match(const TrxcMessage& 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 TrxcMessage::ALT_cmd:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".cmd");
single_value.field_cmd->log_match(match_value.cmd(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ cmd := ");
single_value.field_cmd->log_match(match_value.cmd(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case TrxcMessage::ALT_rsp:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".rsp");
single_value.field_rsp->log_match(match_value.rsp(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ rsp := ");
single_value.field_rsp->log_match(match_value.rsp(), legacy);
TTCN_Logger::log_event_str(" }");
}
break;
case TrxcMessage::ALT_ind:
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
TTCN_Logger::log_logmatch_info(".ind");
single_value.field_ind->log_match(match_value.ind(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
} else {
TTCN_Logger::log_event_str("{ ind := ");
single_value.field_ind->log_match(match_value.ind(), 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 TrxcMessage_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
switch (single_value.union_selection) {
case TrxcMessage::ALT_cmd:
single_value.field_cmd->set_implicit_omit(); break;
case TrxcMessage::ALT_rsp:
single_value.field_rsp->set_implicit_omit(); break;
case TrxcMessage::ALT_ind:
single_value.field_ind->set_implicit_omit(); break;
default: break;
}
}

void TrxcMessage_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 TrxcMessage::ALT_cmd:
single_value.field_cmd->encode_text(text_buf);
break;
case TrxcMessage::ALT_rsp:
single_value.field_rsp->encode_text(text_buf);
break;
case TrxcMessage::ALT_ind:
single_value.field_ind->encode_text(text_buf);
break;
default:
TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @TRXC_Types.TrxcMessage.");
}
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 @TRXC_Types.TrxcMessage.");
}
}

void TrxcMessage_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
{
single_value.union_selection = TrxcMessage::UNBOUND_VALUE;
TrxcMessage::union_selection_type new_selection = (TrxcMessage::union_selection_type)text_buf.pull_int().get_val();
switch (new_selection) {
case TrxcMessage::ALT_cmd:
single_value.field_cmd = new TrxcCommand_template;
single_value.field_cmd->decode_text(text_buf);
break;
case TrxcMessage::ALT_rsp:
single_value.field_rsp = new TrxcResponse_template;
single_value.field_rsp->decode_text(text_buf);
break;
case TrxcMessage::ALT_ind:
single_value.field_ind = new TrxcIndication_template;
single_value.field_ind->decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @TRXC_Types.TrxcMessage.");
}
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 TrxcMessage_template[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 @TRXC_Types.TrxcMessage.");
}
}

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

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

void TrxcMessage_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 TrxcMessage::ALT_cmd:
single_value.field_cmd->check_restriction(t_res, t_name ? t_name : "@TRXC_Types.TrxcMessage");
return;
case TrxcMessage::ALT_rsp:
single_value.field_rsp->check_restriction(t_res, t_name ? t_name : "@TRXC_Types.TrxcMessage");
return;
case TrxcMessage::ALT_ind:
single_value.field_ind->check_restriction(t_res, t_name ? t_name : "@TRXC_Types.TrxcMessage");
return;
default:
TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @TRXC_Types.TrxcMessage.");
}
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 : "@TRXC_Types.TrxcMessage");
}


/* Bodies of functions, altsteps and testcases */

void TrxcType_encoder(const CHARSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `charstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(TrxcType_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER TrxcType_decoder(OCTETSTRING& input_stream, CHARSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `charstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(TrxcType_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void TrxcVerb_encoder(const CHARSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `charstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(TrxcVerb_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER TrxcVerb_decoder(OCTETSTRING& input_stream, CHARSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `charstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(TrxcVerb_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void TrxcStatus_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(INTEGER_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER TrxcStatus_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(INTEGER_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void TrxcParam_encoder(const CHARSTRING& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `charstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(CHARSTRING_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER TrxcParam_decoder(OCTETSTRING& input_stream, CHARSTRING& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `charstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(CHARSTRING_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void TrxcParams_encoder(const TrxcParams& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@TRXC_Types.TrxcParams' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(TrxcParams_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER TrxcParams_decoder(OCTETSTRING& input_stream, TrxcParams& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@TRXC_Types.TrxcParams' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(TrxcParams_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void TrxcCommand_encoder(const TrxcCommand& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@TRXC_Types.TrxcCommand' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(TrxcCommand_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER TrxcCommand_decoder(OCTETSTRING& input_stream, TrxcCommand& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@TRXC_Types.TrxcCommand' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(TrxcCommand_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void TrxcResponse_encoder(const TrxcResponse& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@TRXC_Types.TrxcResponse' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(TrxcResponse_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER TrxcResponse_decoder(OCTETSTRING& input_stream, TrxcResponse& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@TRXC_Types.TrxcResponse' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(TrxcResponse_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void TrxcIndication_encoder(const TrxcIndication& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@TRXC_Types.TrxcIndication' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(TrxcIndication_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER TrxcIndication_decoder(OCTETSTRING& input_stream, TrxcIndication& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@TRXC_Types.TrxcIndication' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(TrxcIndication_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void TrxcMessage_cmd_encoder(const TrxcCommand& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@TRXC_Types.TrxcCommand' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(TrxcMessage_cmd_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER TrxcMessage_cmd_decoder(OCTETSTRING& input_stream, TrxcCommand& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@TRXC_Types.TrxcCommand' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(TrxcMessage_cmd_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void TrxcMessage_rsp_encoder(const TrxcResponse& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@TRXC_Types.TrxcResponse' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(TrxcMessage_rsp_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER TrxcMessage_rsp_decoder(OCTETSTRING& input_stream, TrxcResponse& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@TRXC_Types.TrxcResponse' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(TrxcMessage_rsp_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void TrxcMessage_ind_encoder(const TrxcIndication& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@TRXC_Types.TrxcIndication' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(TrxcMessage_ind_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER TrxcMessage_ind_decoder(OCTETSTRING& input_stream, TrxcIndication& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@TRXC_Types.TrxcIndication' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(TrxcMessage_ind_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void TrxcMessage_encoder(const TrxcMessage& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@TRXC_Types.TrxcMessage' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(TrxcMessage_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER TrxcMessage_decoder(OCTETSTRING& input_stream, TrxcMessage& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `@TRXC_Types.TrxcMessage' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(TrxcMessage_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

CHARSTRING enc__TrxcMessage(const TrxcMessage& id)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("enc_TrxcMessage(): Encoding @TRXC_Types.TrxcMessage: ");
id.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_Buffer ttcn_buffer;
id.encode(TrxcMessage_descr_, ttcn_buffer, TTCN_EncDec::CT_TEXT, 0);
CHARSTRING ret_val;
ttcn_buffer.get_string(ret_val);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("enc_TrxcMessage(): Stream after encoding: ");
ret_val.log();
TTCN_Logger::end_event();
}
return ret_val;
}

TrxcMessage dec__TrxcMessage(const CHARSTRING& id)
{
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("dec_TrxcMessage(): Stream before decoding: ");
id.log();
TTCN_Logger::end_event();
}
TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
TTCN_EncDec::clear_error();
TTCN_Buffer ttcn_buffer(id);
TrxcMessage ret_val;
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
  TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_LOG_MATCHING, TTCN_EncDec::EB_WARNING);
}
ret_val.decode(TrxcMessage_descr_, ttcn_buffer, TTCN_EncDec::CT_TEXT);
if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) {
TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC);
TTCN_Logger::log_event_str("dec_TrxcMessage(): Decoded @TRXC_Types.TrxcMessage: ");
ret_val.log();
TTCN_Logger::end_event();
}
if (TTCN_EncDec::get_last_error_type() == TTCN_EncDec::ET_NONE) {
if (ttcn_buffer.get_pos() < ttcn_buffer.get_len()) {
ttcn_buffer.cut();
OCTETSTRING tmp_os;
ttcn_buffer.get_string(tmp_os);
TTCN_Logger::begin_event_log2str();
tmp_os.log();
CHARSTRING remaining_stream = TTCN_Logger::end_event_log2str();
TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_EXTRA_DATA, "dec_TrxcMessage(): Data remained at the end of the stream after successful decoding: %s", (const char*) remaining_stream);
}
}
return ret_val;
}

void TRXC__RSSI_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(INTEGER_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER TRXC__RSSI_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(INTEGER_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

void TRXC__RSSI__THRESH_encoder(const INTEGER& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf;
input_value.encode(INTEGER_descr_, ttcn_buf, coding_type, extra_options);
ttcn_buf.get_string(output_stream);
}

INTEGER TRXC__RSSI__THRESH_decoder(OCTETSTRING& input_stream, INTEGER& output_value, const UNIVERSAL_CHARSTRING& coding_name)
{
TTCN_EncDec::coding_t coding_type;
unsigned int extra_options = 0;
TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE);
if (coding_type != TTCN_EncDec::CT_TEXT) {
TTCN_Logger::begin_event_log2str();
coding_name.log();
TTCN_error("Type `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str());
}
TTCN_Buffer ttcn_buf(input_stream);
output_value.decode(INTEGER_descr_, ttcn_buf, coding_type, extra_options);
switch (TTCN_EncDec::get_last_error_type()) {
case TTCN_EncDec::ET_NONE:
ttcn_buf.cut();
ttcn_buf.get_string(input_stream);
return 0;
case TTCN_EncDec::ET_INCOMPL_MSG:
case TTCN_EncDec::ET_LEN_ERR:
return 2;
default:
return 1;
}
}

TrxcMessage_template ts__TRXC__FAKE__RSSI(const INTEGER& rssi, const INTEGER& thresh)
{
TTCN_Location current_location("TRXC_Types.ttcn", 75, TTCN_Location::LOCATION_TEMPLATE, "ts_TRXC_FAKE_RSSI");
TrxcMessage_template ret_val;
{
TrxcCommand_template& tmp_0 = ret_val.cmd();
tmp_0.verb() = cs_4;
{
TrxcParams_template& tmp_1 = tmp_0.params();
tmp_1.set_size(2);
tmp_1[0] = int2str(rssi);
tmp_1[1] = int2str(thresh);
}
}
return ret_val;
}

TrxcMessage_template ts__TRXC__FAKE__TIMING(const INTEGER& timing, const INTEGER& thresh)
{
TTCN_Location current_location("TRXC_Types.ttcn", 82, TTCN_Location::LOCATION_TEMPLATE, "ts_TRXC_FAKE_TIMING");
TrxcMessage_template ret_val;
{
TrxcCommand_template& tmp_2 = ret_val.cmd();
tmp_2.verb() = cs_5;
{
TrxcParams_template& tmp_3 = tmp_2.params();
tmp_3.set_size(2);
tmp_3[0] = int2str(timing);
tmp_3[1] = int2str(thresh);
}
}
return ret_val;
}

TrxcMessage_template ts__TRXC__FAKE__CI(const INTEGER& ci, const INTEGER& thresh)
{
TTCN_Location current_location("TRXC_Types.ttcn", 89, TTCN_Location::LOCATION_TEMPLATE, "ts_TRXC_FAKE_CI");
TrxcMessage_template ret_val;
{
TrxcCommand_template& tmp_4 = ret_val.cmd();
tmp_4.verb() = cs_6;
{
TrxcParams_template& tmp_5 = tmp_4.params();
tmp_5.set_size(2);
tmp_5[0] = int2str(ci);
tmp_5[1] = int2str(thresh);
}
}
return ret_val;
}

TrxcMessage_template ts__TRXC__FAKE__TRXC__DELAY(const INTEGER& delay__ms)
{
TTCN_Location current_location("TRXC_Types.ttcn", 96, TTCN_Location::LOCATION_TEMPLATE, "ts_TRXC_FAKE_TRXC_DELAY");
TrxcMessage_template ret_val;
{
TrxcCommand_template& tmp_6 = ret_val.cmd();
tmp_6.verb() = cs_7;
{
TrxcParams_template& tmp_7 = tmp_6.params();
tmp_7.set_size(1);
tmp_7[0] = int2str(delay__ms);
}
}
return ret_val;
}


/* Bodies of static functions */

void pre_init_module()
{
TTCN_Location current_location("TRXC_Types.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "TRXC_Types");
Osmocom__Types::module_object.pre_init_module();
module_object.add_function("enc_TrxcMessage", (genericfunc_t)&enc__TrxcMessage, NULL);
module_object.add_function("dec_TrxcMessage", (genericfunc_t)&dec__TrxcMessage, NULL);
}

void post_init_module()
{
TTCN_Location current_location("TRXC_Types.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "TRXC_Types");
Osmocom__Types::module_object.post_init_module();
current_location.update_lineno(75);
/* TRXC_Types.ttcn, line 75 */
const_ts__TRXC__FAKE__RSSI_thresh_defval = 0;
current_location.update_lineno(82);
/* TRXC_Types.ttcn, line 82 */
const_ts__TRXC__FAKE__TIMING_thresh_defval = 0;
current_location.update_lineno(89);
/* TRXC_Types.ttcn, line 89 */
const_ts__TRXC__FAKE__CI_thresh_defval = 0;
current_location.update_lineno(96);
/* TRXC_Types.ttcn, line 96 */
const_ts__TRXC__FAKE__TRXC__DELAY_delay__ms_defval = 0;
}


} /* end of namespace */
