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

namespace FrameRelay__Types {

/* Literal string constants */

const unsigned char bs_1_bits[] = { 0 },
bs_0_bits[] = { 1 };
extern const BITSTRING bs_1(1, bs_1_bits),
bs_0(1, bs_0_bits);
const unsigned char module_checksum[] = { 0x3f, 0x1e, 0xdb, 0xa4, 0x87, 0x8e, 0x88, 0x9c, 0xab, 0xd1, 0xc1, 0xc1, 0x44, 0xfa, 0xf5, 0x03 };

/* Global variable definitions */

const XERdescriptor_t       FrameRelayHeader_dlci_xer_ = { {"dlci>\n", "dlci>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t FrameRelayHeader_dlci_descr_ = { "@FrameRelay_Types.FrameRelayHeader.dlci", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &FrameRelayHeader_dlci_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       FrameRelayHeader_c__r_xer_ = { {"c_r>\n", "c_r>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int FrameRelayHeader_c__r_oer_ext_arr_[0] = {};
const int FrameRelayHeader_c__r_oer_p_[0] = {};
const TTCN_OERdescriptor_t FrameRelayHeader_c__r_oer_ = { -1, TRUE, -1, FALSE, 0, 0, FrameRelayHeader_c__r_oer_ext_arr_, 0, FrameRelayHeader_c__r_oer_p_};
const TTCN_Typedescriptor_t FrameRelayHeader_c__r_descr_ = { "@FrameRelay_Types.FrameRelayHeader.c_r", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &FrameRelayHeader_c__r_xer_, &BOOLEAN_json_, &FrameRelayHeader_c__r_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       FrameRelayHeader_fecn_xer_ = { {"fecn>\n", "fecn>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int FrameRelayHeader_fecn_oer_ext_arr_[0] = {};
const int FrameRelayHeader_fecn_oer_p_[0] = {};
const TTCN_OERdescriptor_t FrameRelayHeader_fecn_oer_ = { -1, TRUE, -1, FALSE, 0, 0, FrameRelayHeader_fecn_oer_ext_arr_, 0, FrameRelayHeader_fecn_oer_p_};
const TTCN_Typedescriptor_t FrameRelayHeader_fecn_descr_ = { "@FrameRelay_Types.FrameRelayHeader.fecn", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &FrameRelayHeader_fecn_xer_, &BOOLEAN_json_, &FrameRelayHeader_fecn_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       FrameRelayHeader_becn_xer_ = { {"becn>\n", "becn>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int FrameRelayHeader_becn_oer_ext_arr_[0] = {};
const int FrameRelayHeader_becn_oer_p_[0] = {};
const TTCN_OERdescriptor_t FrameRelayHeader_becn_oer_ = { -1, TRUE, -1, FALSE, 0, 0, FrameRelayHeader_becn_oer_ext_arr_, 0, FrameRelayHeader_becn_oer_p_};
const TTCN_Typedescriptor_t FrameRelayHeader_becn_descr_ = { "@FrameRelay_Types.FrameRelayHeader.becn", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &FrameRelayHeader_becn_xer_, &BOOLEAN_json_, &FrameRelayHeader_becn_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       FrameRelayHeader_de_xer_ = { {"de>\n", "de>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int FrameRelayHeader_de_oer_ext_arr_[0] = {};
const int FrameRelayHeader_de_oer_p_[0] = {};
const TTCN_OERdescriptor_t FrameRelayHeader_de_oer_ = { -1, TRUE, -1, FALSE, 0, 0, FrameRelayHeader_de_oer_ext_arr_, 0, FrameRelayHeader_de_oer_p_};
const TTCN_Typedescriptor_t FrameRelayHeader_de_descr_ = { "@FrameRelay_Types.FrameRelayHeader.de", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &FrameRelayHeader_de_xer_, &BOOLEAN_json_, &FrameRelayHeader_de_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for FrameRelayHeader
const TTCN_Typedescriptor_t FrameRelayHeader_descr_ = { "@FrameRelay_Types.FrameRelayHeader", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       FrameRelayFrame_payload_xer_ = { {"payload>\n", "payload>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int FrameRelayFrame_payload_oer_ext_arr_[0] = {};
const int FrameRelayFrame_payload_oer_p_[0] = {};
const TTCN_OERdescriptor_t FrameRelayFrame_payload_oer_ = { -1, TRUE, -1, FALSE, 0, 0, FrameRelayFrame_payload_oer_ext_arr_, 0, FrameRelayFrame_payload_oer_p_};
const TTCN_Typedescriptor_t FrameRelayFrame_payload_descr_ = { "@FrameRelay_Types.FrameRelayFrame.payload", &OCTETSTRING_ber_, &OCTETSTRING_raw_, &OCTETSTRING_text_, &FrameRelayFrame_payload_xer_, &OCTETSTRING_json_, &FrameRelayFrame_payload_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for FrameRelayFrame
const TTCN_Typedescriptor_t FrameRelayFrame_descr_ = { "@FrameRelay_Types.FrameRelayFrame", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
BOOLEAN const_ts__FR_fecn_defval;
const BOOLEAN& ts__FR_fecn_defval = const_ts__FR_fecn_defval;
BOOLEAN const_ts__FR_becn_defval;
const BOOLEAN& ts__FR_becn_defval = const_ts__FR_becn_defval;
BOOLEAN const_ts__FR_de_defval;
const BOOLEAN& ts__FR_de_defval = const_ts__FR_de_defval;
OCTETSTRING_template template_tr__FR_payload_defval;
const OCTETSTRING_template& tr__FR_payload_defval = template_tr__FR_payload_defval;
BOOLEAN_template template_tr__FR_c__r_defval;
const BOOLEAN_template& tr__FR_c__r_defval = template_tr__FR_c__r_defval;
BOOLEAN_template template_tr__FR_fecn_defval;
const BOOLEAN_template& tr__FR_fecn_defval = template_tr__FR_fecn_defval;
BOOLEAN_template template_tr__FR_becn_defval;
const BOOLEAN_template& tr__FR_becn_defval = template_tr__FR_becn_defval;
BOOLEAN_template template_tr__FR_de_defval;
const BOOLEAN_template& tr__FR_de_defval = template_tr__FR_de_defval;
TTCN_Module module_object("FrameRelay_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 */

FrameRelayHeader::FrameRelayHeader()
{
}

FrameRelayHeader::FrameRelayHeader(const INTEGER& par_dlci,
    const BOOLEAN& par_c__r,
    const BOOLEAN& par_fecn,
    const BOOLEAN& par_becn,
    const BOOLEAN& par_de)
  :   field_dlci(par_dlci),
  field_c__r(par_c__r),
  field_fecn(par_fecn),
  field_becn(par_becn),
  field_de(par_de)
{
}

FrameRelayHeader::FrameRelayHeader(const FrameRelayHeader& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @FrameRelay_Types.FrameRelayHeader.");
if (other_value.dlci().is_bound()) field_dlci = other_value.dlci();
else field_dlci.clean_up();
if (other_value.c__r().is_bound()) field_c__r = other_value.c__r();
else field_c__r.clean_up();
if (other_value.fecn().is_bound()) field_fecn = other_value.fecn();
else field_fecn.clean_up();
if (other_value.becn().is_bound()) field_becn = other_value.becn();
else field_becn.clean_up();
if (other_value.de().is_bound()) field_de = other_value.de();
else field_de.clean_up();
}

void FrameRelayHeader::clean_up()
{
field_dlci.clean_up();
field_c__r.clean_up();
field_fecn.clean_up();
field_becn.clean_up();
field_de.clean_up();
}

const TTCN_Typedescriptor_t* FrameRelayHeader::get_descriptor() const { return &FrameRelayHeader_descr_; }
FrameRelayHeader& FrameRelayHeader::operator=(const FrameRelayHeader& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @FrameRelay_Types.FrameRelayHeader.");
  if (other_value.dlci().is_bound()) field_dlci = other_value.dlci();
  else field_dlci.clean_up();
  if (other_value.c__r().is_bound()) field_c__r = other_value.c__r();
  else field_c__r.clean_up();
  if (other_value.fecn().is_bound()) field_fecn = other_value.fecn();
  else field_fecn.clean_up();
  if (other_value.becn().is_bound()) field_becn = other_value.becn();
  else field_becn.clean_up();
  if (other_value.de().is_bound()) field_de = other_value.de();
  else field_de.clean_up();
}
return *this;
}

boolean FrameRelayHeader::operator==(const FrameRelayHeader& other_value) const
{
return field_dlci==other_value.field_dlci
  && field_c__r==other_value.field_c__r
  && field_fecn==other_value.field_fecn
  && field_becn==other_value.field_becn
  && field_de==other_value.field_de;
}

boolean FrameRelayHeader::is_bound() const
{
return (field_dlci.is_bound())
  || (field_c__r.is_bound())
  || (field_fecn.is_bound())
  || (field_becn.is_bound())
  || (field_de.is_bound());
}
boolean FrameRelayHeader::is_value() const
{
return field_dlci.is_value()
  && field_c__r.is_value()
  && field_fecn.is_value()
  && field_becn.is_value()
  && field_de.is_value();
}
void FrameRelayHeader::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ dlci := ");
field_dlci.log();
TTCN_Logger::log_event_str(", c_r := ");
field_c__r.log();
TTCN_Logger::log_event_str(", fecn := ");
field_fecn.log();
TTCN_Logger::log_event_str(", becn := ");
field_becn.log();
TTCN_Logger::log_event_str(", de := ");
field_de.log();
TTCN_Logger::log_event_str(" }");
}

void FrameRelayHeader::set_implicit_omit()
{
if (dlci().is_bound()) dlci().set_implicit_omit();
if (c__r().is_bound()) c__r().set_implicit_omit();
if (fecn().is_bound()) fecn().set_implicit_omit();
if (becn().is_bound()) becn().set_implicit_omit();
if (de().is_bound()) de().set_implicit_omit();
}

void FrameRelayHeader::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (5<param.get_size()) {
      param.error("record value of type @FrameRelay_Types.FrameRelayHeader has 5 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) dlci().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) c__r().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) fecn().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) becn().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) de().set_param(*param.get_elem(4));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "dlci")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          dlci().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "c_r")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          c__r().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "fecn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fecn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "becn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          becn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "de")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          de().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 @FrameRelay_Types.FrameRelayHeader: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@FrameRelay_Types.FrameRelayHeader");
  }
}

void FrameRelayHeader::encode_text(Text_Buf& text_buf) const
{
field_dlci.encode_text(text_buf);
field_c__r.encode_text(text_buf);
field_fecn.encode_text(text_buf);
field_becn.encode_text(text_buf);
field_de.encode_text(text_buf);
}

void FrameRelayHeader::decode_text(Text_Buf& text_buf)
{
field_dlci.decode_text(text_buf);
field_c__r.decode_text(text_buf);
field_fecn.decode_text(text_buf);
field_becn.decode_text(text_buf);
field_de.decode_text(text_buf);
}

struct FrameRelayHeader_template::single_value_struct {
INTEGER_template field_dlci;
BOOLEAN_template field_c__r;
BOOLEAN_template field_fecn;
BOOLEAN_template field_becn;
BOOLEAN_template field_de;
};

void FrameRelayHeader_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_dlci = ANY_VALUE;
single_value->field_c__r = ANY_VALUE;
single_value->field_fecn = ANY_VALUE;
single_value->field_becn = ANY_VALUE;
single_value->field_de = ANY_VALUE;
}
}
}

void FrameRelayHeader_template::copy_value(const FrameRelayHeader& other_value)
{
single_value = new single_value_struct;
if (other_value.dlci().is_bound()) {
  single_value->field_dlci = other_value.dlci();
} else {
  single_value->field_dlci.clean_up();
}
if (other_value.c__r().is_bound()) {
  single_value->field_c__r = other_value.c__r();
} else {
  single_value->field_c__r.clean_up();
}
if (other_value.fecn().is_bound()) {
  single_value->field_fecn = other_value.fecn();
} else {
  single_value->field_fecn.clean_up();
}
if (other_value.becn().is_bound()) {
  single_value->field_becn = other_value.becn();
} else {
  single_value->field_becn.clean_up();
}
if (other_value.de().is_bound()) {
  single_value->field_de = other_value.de();
} else {
  single_value->field_de.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void FrameRelayHeader_template::copy_template(const FrameRelayHeader_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.dlci().get_selection()) {
single_value->field_dlci = other_value.dlci();
} else {
single_value->field_dlci.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.c__r().get_selection()) {
single_value->field_c__r = other_value.c__r();
} else {
single_value->field_c__r.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.fecn().get_selection()) {
single_value->field_fecn = other_value.fecn();
} else {
single_value->field_fecn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.becn().get_selection()) {
single_value->field_becn = other_value.becn();
} else {
single_value->field_becn.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.de().get_selection()) {
single_value->field_de = other_value.de();
} else {
single_value->field_de.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 FrameRelayHeader_template[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 FrameRelayHeader_template(*other_value.implication_.precondition);
implication_.implied_template = new FrameRelayHeader_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 @FrameRelay_Types.FrameRelayHeader.");
break;
}
set_selection(other_value);
}

FrameRelayHeader_template::FrameRelayHeader_template()
{
}

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

FrameRelayHeader_template::FrameRelayHeader_template(const FrameRelayHeader& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean FrameRelayHeader_template::match(const FrameRelayHeader& 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.dlci().is_bound()) return FALSE;
if(!single_value->field_dlci.match(other_value.dlci(), legacy))return FALSE;
if(!other_value.c__r().is_bound()) return FALSE;
if(!single_value->field_c__r.match(other_value.c__r(), legacy))return FALSE;
if(!other_value.fecn().is_bound()) return FALSE;
if(!single_value->field_fecn.match(other_value.fecn(), legacy))return FALSE;
if(!other_value.becn().is_bound()) return FALSE;
if(!single_value->field_becn.match(other_value.becn(), legacy))return FALSE;
if(!other_value.de().is_bound()) return FALSE;
if(!single_value->field_de.match(other_value.de(), 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 @FrameRelay_Types.FrameRelayHeader.");
}
return FALSE;
}

boolean FrameRelayHeader_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_dlci.is_bound()
 || single_value->field_c__r.is_bound()
 || single_value->field_fecn.is_bound()
 || single_value->field_becn.is_bound()
 || single_value->field_de.is_bound();
}

boolean FrameRelayHeader_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_dlci.is_value()
 && single_value->field_c__r.is_value()
 && single_value->field_fecn.is_value()
 && single_value->field_becn.is_value()
 && single_value->field_de.is_value();
}

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

FrameRelayHeader FrameRelayHeader_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 @FrameRelay_Types.FrameRelayHeader.");
FrameRelayHeader ret_val;
if (single_value->field_dlci.is_bound()) {
ret_val.dlci() = single_value->field_dlci.valueof();
}
if (single_value->field_c__r.is_bound()) {
ret_val.c__r() = single_value->field_c__r.valueof();
}
if (single_value->field_fecn.is_bound()) {
ret_val.fecn() = single_value->field_fecn.valueof();
}
if (single_value->field_becn.is_bound()) {
ret_val.becn() = single_value->field_becn.valueof();
}
if (single_value->field_de.is_bound()) {
ret_val.de() = single_value->field_de.valueof();
}
return ret_val;
}

void FrameRelayHeader_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 @FrameRelay_Types.FrameRelayHeader.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new FrameRelayHeader_template[list_length];
}

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

INTEGER_template& FrameRelayHeader_template::dlci()
{
set_specific();
return single_value->field_dlci;
}

const INTEGER_template& FrameRelayHeader_template::dlci() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field dlci of a non-specific template of type @FrameRelay_Types.FrameRelayHeader.");
return single_value->field_dlci;
}

BOOLEAN_template& FrameRelayHeader_template::c__r()
{
set_specific();
return single_value->field_c__r;
}

const BOOLEAN_template& FrameRelayHeader_template::c__r() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field c_r of a non-specific template of type @FrameRelay_Types.FrameRelayHeader.");
return single_value->field_c__r;
}

BOOLEAN_template& FrameRelayHeader_template::fecn()
{
set_specific();
return single_value->field_fecn;
}

const BOOLEAN_template& FrameRelayHeader_template::fecn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field fecn of a non-specific template of type @FrameRelay_Types.FrameRelayHeader.");
return single_value->field_fecn;
}

BOOLEAN_template& FrameRelayHeader_template::becn()
{
set_specific();
return single_value->field_becn;
}

const BOOLEAN_template& FrameRelayHeader_template::becn() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field becn of a non-specific template of type @FrameRelay_Types.FrameRelayHeader.");
return single_value->field_becn;
}

BOOLEAN_template& FrameRelayHeader_template::de()
{
set_specific();
return single_value->field_de;
}

const BOOLEAN_template& FrameRelayHeader_template::de() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field de of a non-specific template of type @FrameRelay_Types.FrameRelayHeader.");
return single_value->field_de;
}

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

void FrameRelayHeader_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ dlci := ");
single_value->field_dlci.log();
TTCN_Logger::log_event_str(", c_r := ");
single_value->field_c__r.log();
TTCN_Logger::log_event_str(", fecn := ");
single_value->field_fecn.log();
TTCN_Logger::log_event_str(", becn := ");
single_value->field_becn.log();
TTCN_Logger::log_event_str(", de := ");
single_value->field_de.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 FrameRelayHeader_template::log_match(const FrameRelayHeader& 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_dlci.match(match_value.dlci(), legacy)){
TTCN_Logger::log_logmatch_info(".dlci");
single_value->field_dlci.log_match(match_value.dlci(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_c__r.match(match_value.c__r(), legacy)){
TTCN_Logger::log_logmatch_info(".c_r");
single_value->field_c__r.log_match(match_value.c__r(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_fecn.match(match_value.fecn(), legacy)){
TTCN_Logger::log_logmatch_info(".fecn");
single_value->field_fecn.log_match(match_value.fecn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_becn.match(match_value.becn(), legacy)){
TTCN_Logger::log_logmatch_info(".becn");
single_value->field_becn.log_match(match_value.becn(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_de.match(match_value.de(), legacy)){
TTCN_Logger::log_logmatch_info(".de");
single_value->field_de.log_match(match_value.de(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ dlci := ");
single_value->field_dlci.log_match(match_value.dlci(), legacy);
TTCN_Logger::log_event_str(", c_r := ");
single_value->field_c__r.log_match(match_value.c__r(), legacy);
TTCN_Logger::log_event_str(", fecn := ");
single_value->field_fecn.log_match(match_value.fecn(), legacy);
TTCN_Logger::log_event_str(", becn := ");
single_value->field_becn.log_match(match_value.becn(), legacy);
TTCN_Logger::log_event_str(", de := ");
single_value->field_de.log_match(match_value.de(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void FrameRelayHeader_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (dlci().is_bound()) dlci().set_implicit_omit();
if (c__r().is_bound()) c__r().set_implicit_omit();
if (fecn().is_bound()) fecn().set_implicit_omit();
if (becn().is_bound()) becn().set_implicit_omit();
if (de().is_bound()) de().set_implicit_omit();
}

void FrameRelayHeader_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_dlci.encode_text(text_buf);
single_value->field_c__r.encode_text(text_buf);
single_value->field_fecn.encode_text(text_buf);
single_value->field_becn.encode_text(text_buf);
single_value->field_de.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 @FrameRelay_Types.FrameRelayHeader.");
}
}

void FrameRelayHeader_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_dlci.decode_text(text_buf);
single_value->field_c__r.decode_text(text_buf);
single_value->field_fecn.decode_text(text_buf);
single_value->field_becn.decode_text(text_buf);
single_value->field_de.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 FrameRelayHeader_template[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 @FrameRelay_Types.FrameRelayHeader.");
}
}

void FrameRelayHeader_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: {
    FrameRelayHeader_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (5<param.get_size()) {
      param.error("record template of type @FrameRelay_Types.FrameRelayHeader has 5 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) dlci().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) c__r().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) fecn().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) becn().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) de().set_param(*param.get_elem(4));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "dlci")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          dlci().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "c_r")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          c__r().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "fecn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          fecn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "becn")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          becn().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "de")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          de().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 @FrameRelay_Types.FrameRelayHeader: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    FrameRelayHeader_template* precondition = new FrameRelayHeader_template;
    precondition->set_param(*param.get_elem(0));
    FrameRelayHeader_template* implied_template = new FrameRelayHeader_template;
    implied_template->set_param(*param.get_elem(1));
    *this = FrameRelayHeader_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@FrameRelay_Types.FrameRelayHeader");
  }
  is_ifpresent = param.get_ifpresent();
}

void FrameRelayHeader_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_dlci.check_restriction(t_res, t_name ? t_name : "@FrameRelay_Types.FrameRelayHeader");
single_value->field_c__r.check_restriction(t_res, t_name ? t_name : "@FrameRelay_Types.FrameRelayHeader");
single_value->field_fecn.check_restriction(t_res, t_name ? t_name : "@FrameRelay_Types.FrameRelayHeader");
single_value->field_becn.check_restriction(t_res, t_name ? t_name : "@FrameRelay_Types.FrameRelayHeader");
single_value->field_de.check_restriction(t_res, t_name ? t_name : "@FrameRelay_Types.FrameRelayHeader");
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 : "@FrameRelay_Types.FrameRelayHeader");
}

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

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

FrameRelayFrame::FrameRelayFrame()
{
}

FrameRelayFrame::FrameRelayFrame(const FrameRelayHeader& par_hdr,
    const OCTETSTRING& par_payload)
  :   field_hdr(par_hdr),
  field_payload(par_payload)
{
}

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

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

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

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

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

void FrameRelayFrame::set_implicit_omit()
{
if (hdr().is_bound()) hdr().set_implicit_omit();
if (payload().is_bound()) payload().set_implicit_omit();
}

void FrameRelayFrame::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 @FrameRelay_Types.FrameRelayFrame has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) hdr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) payload().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          hdr().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "payload")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          payload().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @FrameRelay_Types.FrameRelayFrame: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@FrameRelay_Types.FrameRelayFrame");
  }
}

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

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

struct FrameRelayFrame_template::single_value_struct {
FrameRelayHeader_template field_hdr;
OCTETSTRING_template field_payload;
};

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

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

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

FrameRelayFrame_template::FrameRelayFrame_template()
{
}

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

FrameRelayFrame_template::FrameRelayFrame_template(const FrameRelayFrame& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean FrameRelayFrame_template::match(const FrameRelayFrame& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.hdr().is_bound()) return FALSE;
if(!single_value->field_hdr.match(other_value.hdr(), legacy))return FALSE;
if(!other_value.payload().is_bound()) return FALSE;
if(!single_value->field_payload.match(other_value.payload(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @FrameRelay_Types.FrameRelayFrame.");
}
return FALSE;
}

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

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

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

FrameRelayFrame FrameRelayFrame_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 @FrameRelay_Types.FrameRelayFrame.");
FrameRelayFrame ret_val;
if (single_value->field_hdr.is_bound()) {
ret_val.hdr() = single_value->field_hdr.valueof();
}
if (single_value->field_payload.is_bound()) {
ret_val.payload() = single_value->field_payload.valueof();
}
return ret_val;
}

void FrameRelayFrame_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 @FrameRelay_Types.FrameRelayFrame.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new FrameRelayFrame_template[list_length];
}

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

FrameRelayHeader_template& FrameRelayFrame_template::hdr()
{
set_specific();
return single_value->field_hdr;
}

const FrameRelayHeader_template& FrameRelayFrame_template::hdr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field hdr of a non-specific template of type @FrameRelay_Types.FrameRelayFrame.");
return single_value->field_hdr;
}

OCTETSTRING_template& FrameRelayFrame_template::payload()
{
set_specific();
return single_value->field_payload;
}

const OCTETSTRING_template& FrameRelayFrame_template::payload() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field payload of a non-specific template of type @FrameRelay_Types.FrameRelayFrame.");
return single_value->field_payload;
}

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

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

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

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

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

void FrameRelayFrame_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_hdr.decode_text(text_buf);
single_value->field_payload.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new FrameRelayFrame_template[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 @FrameRelay_Types.FrameRelayFrame.");
}
}

void FrameRelayFrame_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: {
    FrameRelayFrame_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 @FrameRelay_Types.FrameRelayFrame has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) hdr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) payload().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "hdr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          hdr().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "payload")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          payload().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @FrameRelay_Types.FrameRelayFrame: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    FrameRelayFrame_template* precondition = new FrameRelayFrame_template;
    precondition->set_param(*param.get_elem(0));
    FrameRelayFrame_template* implied_template = new FrameRelayFrame_template;
    implied_template->set_param(*param.get_elem(1));
    *this = FrameRelayFrame_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@FrameRelay_Types.FrameRelayFrame");
  }
  is_ifpresent = param.get_ifpresent();
}

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

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

boolean FrameRelayFrame_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}


/* Bodies of functions, altsteps and testcases */

BOOLEAN bit2bool(const BITSTRING& bit)
{
TTCN_Location current_location("FrameRelay_Types.ttcn", 22, TTCN_Location::LOCATION_FUNCTION, "bit2bool");
current_location.update_lineno(23);
/* FrameRelay_Types.ttcn, line 23 */
if ((bit == bs_0)) {
current_location.update_lineno(24);
/* FrameRelay_Types.ttcn, line 24 */
return TRUE;
}
else {
current_location.update_lineno(26);
/* FrameRelay_Types.ttcn, line 26 */
return FALSE;
}
}

BITSTRING bool2bit(const BOOLEAN& pi)
{
TTCN_Location current_location("FrameRelay_Types.ttcn", 30, TTCN_Location::LOCATION_FUNCTION, "bool2bit");
current_location.update_lineno(31);
/* FrameRelay_Types.ttcn, line 31 */
if (pi) {
current_location.update_lineno(32);
/* FrameRelay_Types.ttcn, line 32 */
return bs_0;
}
else {
current_location.update_lineno(34);
/* FrameRelay_Types.ttcn, line 34 */
return bs_1;
}
}

FrameRelayHeader dec__FrameRelayFrameHeader(const OCTETSTRING& stream)
{
TTCN_Location current_location("FrameRelay_Types.ttcn", 38, TTCN_Location::LOCATION_FUNCTION, "dec_FrameRelayFrameHeader");
current_location.update_lineno(39);
/* FrameRelay_Types.ttcn, line 39 */
FrameRelayHeader frh;
current_location.update_lineno(40);
/* FrameRelay_Types.ttcn, line 40 */
BITSTRING hdr__b(oct2bit(substr(stream, 0, 2)));
current_location.update_lineno(41);
/* FrameRelay_Types.ttcn, line 41 */
BITSTRING dlci__b((substr(hdr__b, 0, 6) + substr(hdr__b, 8, 4)));
current_location.update_lineno(43);
/* FrameRelay_Types.ttcn, line 43 */
frh.dlci() = bit2int(dlci__b);
current_location.update_lineno(44);
/* FrameRelay_Types.ttcn, line 44 */
frh.c__r() = bit2bool(const_cast< const BITSTRING&>(hdr__b)[6]);
current_location.update_lineno(45);
/* FrameRelay_Types.ttcn, line 45 */
frh.fecn() = bit2bool(const_cast< const BITSTRING&>(hdr__b)[12]);
current_location.update_lineno(46);
/* FrameRelay_Types.ttcn, line 46 */
frh.becn() = bit2bool(const_cast< const BITSTRING&>(hdr__b)[13]);
current_location.update_lineno(47);
/* FrameRelay_Types.ttcn, line 47 */
frh.de() = bit2bool(const_cast< const BITSTRING&>(hdr__b)[14]);
current_location.update_lineno(49);
/* FrameRelay_Types.ttcn, line 49 */
return frh;
}

OCTETSTRING enc__FrameRelayFrameHeader(const FrameRelayHeader& frh)
{
TTCN_Location current_location("FrameRelay_Types.ttcn", 52, TTCN_Location::LOCATION_FUNCTION, "enc_FrameRelayFrameHeader");
current_location.update_lineno(53);
/* FrameRelay_Types.ttcn, line 53 */
BITSTRING hdr__b;
current_location.update_lineno(54);
/* FrameRelay_Types.ttcn, line 54 */
BITSTRING dlci__b(int2bit(const_cast< const FrameRelayHeader&>(frh).dlci(), 10));
current_location.update_lineno(56);
/* FrameRelay_Types.ttcn, line 56 */
hdr__b = ((substr(dlci__b, 0, 6) + bool2bit(const_cast< const FrameRelayHeader&>(frh).c__r())) + bs_1);
current_location.update_lineno(57);
/* FrameRelay_Types.ttcn, line 57 */
{
BITSTRING tmp_6;
tmp_6 = (((((hdr__b + substr(dlci__b, 6, 4)) + bool2bit(const_cast< const FrameRelayHeader&>(frh).fecn())) + bool2bit(const_cast< const FrameRelayHeader&>(frh).becn())) + bool2bit(const_cast< const FrameRelayHeader&>(frh).de())) + bs_0);
hdr__b = tmp_6;
}
current_location.update_lineno(59);
/* FrameRelay_Types.ttcn, line 59 */
return bit2oct(hdr__b);
}

FrameRelayFrame dec__FrameRelayFrame(const OCTETSTRING& stream)
{
TTCN_Location current_location("FrameRelay_Types.ttcn", 62, TTCN_Location::LOCATION_FUNCTION, "dec_FrameRelayFrame");
current_location.update_lineno(63);
/* FrameRelay_Types.ttcn, line 63 */
FrameRelayFrame fr;
current_location.update_lineno(64);
/* FrameRelay_Types.ttcn, line 64 */
fr.hdr() = dec__FrameRelayFrameHeader(substr(stream, 0, 2));
current_location.update_lineno(65);
/* FrameRelay_Types.ttcn, line 65 */
fr.payload() = substr(stream, 2, (stream.lengthof() - 2));
current_location.update_lineno(67);
/* FrameRelay_Types.ttcn, line 67 */
return fr;
}

OCTETSTRING enc__FrameRelayFrame(const FrameRelayFrame& si)
{
TTCN_Location current_location("FrameRelay_Types.ttcn", 70, TTCN_Location::LOCATION_FUNCTION, "enc_FrameRelayFrame");
current_location.update_lineno(71);
/* FrameRelay_Types.ttcn, line 71 */
return (enc__FrameRelayFrameHeader(const_cast< const FrameRelayFrame&>(si).hdr()) + const_cast< const FrameRelayFrame&>(si).payload());
}

FrameRelayFrame_template ts__FR(const INTEGER& dlci, const OCTETSTRING& payload, const BOOLEAN& c__r, const BOOLEAN& fecn, const BOOLEAN& becn, const BOOLEAN& de)
{
TTCN_Location current_location("FrameRelay_Types.ttcn", 76, TTCN_Location::LOCATION_TEMPLATE, "ts_FR");
FrameRelayFrame_template ret_val;
{
FrameRelayHeader_template& tmp_9 = ret_val.hdr();
tmp_9.dlci() = dlci;
tmp_9.c__r() = c__r;
tmp_9.fecn() = fecn;
tmp_9.becn() = becn;
tmp_9.de() = de;
}
ret_val.payload() = payload;
return ret_val;
}

FrameRelayFrame_template tr__FR(const INTEGER_template& dlci, const OCTETSTRING_template& payload, const BOOLEAN_template& c__r, const BOOLEAN_template& fecn, const BOOLEAN_template& becn, const BOOLEAN_template& de)
{
TTCN_Location current_location("FrameRelay_Types.ttcn", 86, TTCN_Location::LOCATION_TEMPLATE, "tr_FR");
FrameRelayFrame_template ret_val;
{
FrameRelayHeader_template& tmp_10 = ret_val.hdr();
tmp_10.dlci() = dlci;
tmp_10.c__r() = c__r;
tmp_10.fecn() = fecn;
tmp_10.becn() = becn;
tmp_10.de() = de;
}
ret_val.payload() = payload;
return ret_val;
}


/* Bodies of static functions */

void pre_init_module()
{
TTCN_Location current_location("FrameRelay_Types.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "FrameRelay_Types");
General__Types::module_object.pre_init_module();
module_object.add_function("bit2bool", (genericfunc_t)&bit2bool, NULL);
module_object.add_function("bool2bit", (genericfunc_t)&bool2bit, NULL);
module_object.add_function("dec_FrameRelayFrameHeader", (genericfunc_t)&dec__FrameRelayFrameHeader, NULL);
module_object.add_function("enc_FrameRelayFrameHeader", (genericfunc_t)&enc__FrameRelayFrameHeader, NULL);
module_object.add_function("dec_FrameRelayFrame", (genericfunc_t)&dec__FrameRelayFrame, NULL);
module_object.add_function("enc_FrameRelayFrame", (genericfunc_t)&enc__FrameRelayFrame, NULL);
}

void post_init_module()
{
TTCN_Location current_location("FrameRelay_Types.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "FrameRelay_Types");
General__Types::module_object.post_init_module();
current_location.update_lineno(76);
/* FrameRelay_Types.ttcn, line 76 */
const_ts__FR_fecn_defval = FALSE;
current_location.update_lineno(76);
/* FrameRelay_Types.ttcn, line 76 */
const_ts__FR_becn_defval = FALSE;
current_location.update_lineno(76);
/* FrameRelay_Types.ttcn, line 76 */
const_ts__FR_de_defval = FALSE;
current_location.update_lineno(87);
/* FrameRelay_Types.ttcn, line 87 */
template_tr__FR_payload_defval = ANY_VALUE;
current_location.update_lineno(88);
/* FrameRelay_Types.ttcn, line 88 */
template_tr__FR_c__r_defval = ANY_VALUE;
current_location.update_lineno(89);
/* FrameRelay_Types.ttcn, line 89 */
template_tr__FR_fecn_defval = ANY_VALUE;
current_location.update_lineno(90);
/* FrameRelay_Types.ttcn, line 90 */
template_tr__FR_becn_defval = ANY_VALUE;
current_location.update_lineno(91);
/* FrameRelay_Types.ttcn, line 91 */
template_tr__FR_de_defval = ANY_VALUE;
}


} /* end of namespace */
