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

namespace TCCInterface__Functions {

/* Literal string constants */

extern const OCTETSTRING os_0(0, NULL);
extern const CHARSTRING cs_0(':');
const unsigned char module_checksum[] = { 0xb7, 0x05, 0x6c, 0xdb, 0x77, 0x29, 0x0b, 0xcd, 0x32, 0x40, 0x8f, 0xff, 0x67, 0x8c, 0x2c, 0x6c };

/* Global variable definitions */

// No XER for CharstringList
const TTCN_Typedescriptor_t CharstringList_descr_ = { "@TCCInterface_Functions.CharstringList", NULL, NULL, NULL, NULL, NULL, NULL, NULL, &CHARSTRING_descr_, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       CharstringList_0_xer_ = { {"CHARSTRING>\n", "CHARSTRING>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t CharstringList_0_descr_ = { "@TCCInterface_Functions.CharstringList.<oftype>", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &CharstringList_0_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for IPAddresses
const TTCN_Typedescriptor_t IPAddresses_descr_ = { "@TCCInterface_Functions.IPAddresses", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for TCCInterface__IPAddressType
const TTCN_Typedescriptor_t TCCInterface__IPAddressType_descr_ = { "@TCCInterface_Functions.TCCInterface_IPAddressType", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for TCCInterface__ProtocolType
const TTCN_Typedescriptor_t TCCInterface__ProtocolType_descr_ = { "@TCCInterface_Functions.TCCInterface_ProtocolType", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for TCCInterface__PortStatus
const TTCN_Typedescriptor_t TCCInterface__PortStatus_descr_ = { "@TCCInterface_Functions.TCCInterface_PortStatus", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
INTEGER const_f__setIP_number_defval;
const INTEGER& f__setIP_number_defval = const_f__setIP_number_defval;
INTEGER const_f__setIP__ip_prefix_defval;
const INTEGER& f__setIP__ip_prefix_defval = const_f__setIP__ip_prefix_defval;
INTEGER const_f__setIP__ip_v__set_defval;
const INTEGER& f__setIP__ip_v__set_defval = const_f__setIP__ip_v__set_defval;
INTEGER const_f__delIP__ip_prefix_defval;
const INTEGER& f__delIP__ip_prefix_defval = const_f__delIP__ip_prefix_defval;
TCCInterface__IPAddressType const_f__getIP_addressType_defval;
const TCCInterface__IPAddressType& f__getIP_addressType_defval = const_f__getIP_addressType_defval;
TCCInterface__IPAddressType const_f__setInterfaceUp_addressType_defval;
const TCCInterface__IPAddressType& f__setInterfaceUp_addressType_defval = const_f__setInterfaceUp_addressType_defval;
TCCInterface__IPAddressType const_f__setInterfaceDown_addressType_defval;
const TCCInterface__IPAddressType& f__setInterfaceDown_addressType_defval = const_f__setInterfaceDown_addressType_defval;
TCCInterface__IPAddressType const_f__getIpAddr_addressType_defval;
const TCCInterface__IPAddressType& f__getIpAddr_addressType_defval = const_f__getIpAddr_addressType_defval;
TCCInterface__IPAddressType const_f__verifyIpAddr_pl__ipType_defval;
const TCCInterface__IPAddressType& f__verifyIpAddr_pl__ipType_defval = const_f__verifyIpAddr_pl__ipType_defval;
TTCN_Module module_object("TCCInterface_Functions", __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 */

IPAddresses::IPAddresses()
{
}

IPAddresses::IPAddresses(const CharstringList& par_ipv4List,
    const CharstringList& par_ipv6List)
  :   field_ipv4List(par_ipv4List),
  field_ipv6List(par_ipv6List)
{
}

IPAddresses::IPAddresses(const IPAddresses& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @TCCInterface_Functions.IPAddresses.");
if (other_value.ipv4List().is_bound()) field_ipv4List = other_value.ipv4List();
else field_ipv4List.clean_up();
if (other_value.ipv6List().is_bound()) field_ipv6List = other_value.ipv6List();
else field_ipv6List.clean_up();
}

void IPAddresses::clean_up()
{
field_ipv4List.clean_up();
field_ipv6List.clean_up();
}

const TTCN_Typedescriptor_t* IPAddresses::get_descriptor() const { return &IPAddresses_descr_; }
IPAddresses& IPAddresses::operator=(const IPAddresses& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @TCCInterface_Functions.IPAddresses.");
  if (other_value.ipv4List().is_bound()) field_ipv4List = other_value.ipv4List();
  else field_ipv4List.clean_up();
  if (other_value.ipv6List().is_bound()) field_ipv6List = other_value.ipv6List();
  else field_ipv6List.clean_up();
}
return *this;
}

boolean IPAddresses::operator==(const IPAddresses& other_value) const
{
return field_ipv4List==other_value.field_ipv4List
  && field_ipv6List==other_value.field_ipv6List;
}

boolean IPAddresses::is_bound() const
{
return (field_ipv4List.is_bound())
  || (field_ipv6List.is_bound());
}
boolean IPAddresses::is_value() const
{
return field_ipv4List.is_value()
  && field_ipv6List.is_value();
}
void IPAddresses::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ ipv4List := ");
field_ipv4List.log();
TTCN_Logger::log_event_str(", ipv6List := ");
field_ipv6List.log();
TTCN_Logger::log_event_str(" }");
}

void IPAddresses::set_implicit_omit()
{
if (ipv4List().is_bound()) ipv4List().set_implicit_omit();
if (ipv6List().is_bound()) ipv6List().set_implicit_omit();
}

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

void IPAddresses::encode_text(Text_Buf& text_buf) const
{
field_ipv4List.encode_text(text_buf);
field_ipv6List.encode_text(text_buf);
}

void IPAddresses::decode_text(Text_Buf& text_buf)
{
field_ipv4List.decode_text(text_buf);
field_ipv6List.decode_text(text_buf);
}

struct IPAddresses_template::single_value_struct {
CharstringList_template field_ipv4List;
CharstringList_template field_ipv6List;
};

void IPAddresses_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_ipv4List = ANY_VALUE;
single_value->field_ipv6List = ANY_VALUE;
}
}
}

void IPAddresses_template::copy_value(const IPAddresses& other_value)
{
single_value = new single_value_struct;
if (other_value.ipv4List().is_bound()) {
  single_value->field_ipv4List = other_value.ipv4List();
} else {
  single_value->field_ipv4List.clean_up();
}
if (other_value.ipv6List().is_bound()) {
  single_value->field_ipv6List = other_value.ipv6List();
} else {
  single_value->field_ipv6List.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void IPAddresses_template::copy_template(const IPAddresses_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.ipv4List().get_selection()) {
single_value->field_ipv4List = other_value.ipv4List();
} else {
single_value->field_ipv4List.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ipv6List().get_selection()) {
single_value->field_ipv6List = other_value.ipv6List();
} else {
single_value->field_ipv6List.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 IPAddresses_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 IPAddresses_template(*other_value.implication_.precondition);
implication_.implied_template = new IPAddresses_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 @TCCInterface_Functions.IPAddresses.");
break;
}
set_selection(other_value);
}

IPAddresses_template::IPAddresses_template()
{
}

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

IPAddresses_template::IPAddresses_template(const IPAddresses& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

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

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

boolean IPAddresses_template::match(const IPAddresses& 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.ipv4List().is_bound()) return FALSE;
if(!single_value->field_ipv4List.match(other_value.ipv4List(), legacy))return FALSE;
if(!other_value.ipv6List().is_bound()) return FALSE;
if(!single_value->field_ipv6List.match(other_value.ipv6List(), 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 @TCCInterface_Functions.IPAddresses.");
}
return FALSE;
}

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

boolean IPAddresses_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_ipv4List.is_value()
 && single_value->field_ipv6List.is_value();
}

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

IPAddresses IPAddresses_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 @TCCInterface_Functions.IPAddresses.");
IPAddresses ret_val;
if (single_value->field_ipv4List.is_bound()) {
ret_val.ipv4List() = single_value->field_ipv4List.valueof();
}
if (single_value->field_ipv6List.is_bound()) {
ret_val.ipv6List() = single_value->field_ipv6List.valueof();
}
return ret_val;
}

void IPAddresses_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 @TCCInterface_Functions.IPAddresses.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new IPAddresses_template[list_length];
}

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

CharstringList_template& IPAddresses_template::ipv4List()
{
set_specific();
return single_value->field_ipv4List;
}

const CharstringList_template& IPAddresses_template::ipv4List() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ipv4List of a non-specific template of type @TCCInterface_Functions.IPAddresses.");
return single_value->field_ipv4List;
}

CharstringList_template& IPAddresses_template::ipv6List()
{
set_specific();
return single_value->field_ipv6List;
}

const CharstringList_template& IPAddresses_template::ipv6List() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ipv6List of a non-specific template of type @TCCInterface_Functions.IPAddresses.");
return single_value->field_ipv6List;
}

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

void IPAddresses_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ ipv4List := ");
single_value->field_ipv4List.log();
TTCN_Logger::log_event_str(", ipv6List := ");
single_value->field_ipv6List.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 IPAddresses_template::log_match(const IPAddresses& 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_ipv4List.match(match_value.ipv4List(), legacy)){
TTCN_Logger::log_logmatch_info(".ipv4List");
single_value->field_ipv4List.log_match(match_value.ipv4List(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_ipv6List.match(match_value.ipv6List(), legacy)){
TTCN_Logger::log_logmatch_info(".ipv6List");
single_value->field_ipv6List.log_match(match_value.ipv6List(), 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("{ ipv4List := ");
single_value->field_ipv4List.log_match(match_value.ipv4List(), legacy);
TTCN_Logger::log_event_str(", ipv6List := ");
single_value->field_ipv6List.log_match(match_value.ipv6List(), 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 IPAddresses_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (ipv4List().is_bound()) ipv4List().set_implicit_omit();
if (ipv6List().is_bound()) ipv6List().set_implicit_omit();
}

void IPAddresses_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_ipv4List.encode_text(text_buf);
single_value->field_ipv6List.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 @TCCInterface_Functions.IPAddresses.");
}
}

void IPAddresses_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_ipv4List.decode_text(text_buf);
single_value->field_ipv6List.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 IPAddresses_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 @TCCInterface_Functions.IPAddresses.");
}
}

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

void IPAddresses_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_ipv4List.check_restriction(t_res, t_name ? t_name : "@TCCInterface_Functions.IPAddresses");
single_value->field_ipv6List.check_restriction(t_res, t_name ? t_name : "@TCCInterface_Functions.IPAddresses");
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 : "@TCCInterface_Functions.IPAddresses");
}

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

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

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

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

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

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

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

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

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

boolean TCCInterface__IPAddressType::operator==(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType comparison is an unknown numeric value %d", other_value);
return enum_value == other_value;
}

boolean TCCInterface__IPAddressType::operator==(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType.");
return enum_value == other_value;
}

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

boolean TCCInterface__IPAddressType::operator<(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType comparison is an unknown numeric value %d", other_value);
return enum_value < other_value;
}

boolean TCCInterface__IPAddressType::operator<(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType.");
return enum_value < other_value;
}

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

boolean TCCInterface__IPAddressType::operator>(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType comparison is an unknown numeric value %d", other_value);
return enum_value > other_value;
}

boolean TCCInterface__IPAddressType::operator>(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType.");
return enum_value > other_value;
}

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

const char *TCCInterface__IPAddressType::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case IPv4: return "IPv4";
case IPv6: return "IPv6";
case UNKNOWN: return "UNKNOWN";
default:
return "<unknown>";
}
}

TCCInterface__IPAddressType::enum_type TCCInterface__IPAddressType::str_to_enum(const char *str_par, const int* int_par, const int* int_par2)
{
if (int_par == NULL && int_par2 == NULL) {
if (!strcmp(str_par, "IPv4")) return IPv4;
if (!strcmp(str_par, "IPv6")) return IPv6;
if (!strcmp(str_par, "UNKNOWN")) return UNKNOWN;
}
return UNKNOWN_VALUE;
}

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

int TCCInterface__IPAddressType::enum2int(enum_type enum_par)
{
if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int TCCInterface__IPAddressType::enum2int(const TCCInterface__IPAddressType& enum_par)
{
if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

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

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

void TCCInterface__IPAddressType::log() const
{
if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value);
else TTCN_Logger::log_event_unbound();
}

void TCCInterface__IPAddressType::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "enumerated value");
  if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@TCCInterface_Functions.TCCInterface_IPAddressType");
  enum_value = str_to_enum(param.get_enumerated(), param.get_enumerated_value());
  if (!is_valid_enum(enum_value)) {
    param.error("Invalid enumerated value for type @TCCInterface_Functions.TCCInterface_IPAddressType.");
  }
}

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

void TCCInterface__IPAddressType::decode_text(Text_Buf& text_buf)
{
enum_value = (enum_type)text_buf.pull_int().get_val();
if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType.", enum_value);
}

void TCCInterface__IPAddressType_template::copy_template(const TCCInterface__IPAddressType_template& other_value)
{
set_selection(other_value);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = other_value.single_value;
break;
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new TCCInterface__IPAddressType_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 TCCInterface__IPAddressType_template(*other_value.implication_.precondition);
implication_.implied_template = new TCCInterface__IPAddressType_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType.");
}
}

TCCInterface__IPAddressType_template::TCCInterface__IPAddressType_template()
{
}

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

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

TCCInterface__IPAddressType_template::TCCInterface__IPAddressType_template(TCCInterface__IPAddressType::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

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

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

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

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

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

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

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

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

void TCCInterface__IPAddressType_template::clean_up()
{
switch (template_selection) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

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

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

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

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

TCCInterface__IPAddressType_template& TCCInterface__IPAddressType_template::operator=(const OPTIONAL<TCCInterface__IPAddressType>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (TCCInterface__IPAddressType::enum_type)(const TCCInterface__IPAddressType&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType.");
}
return *this;
}

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

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

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

TCCInterface__IPAddressType::enum_type TCCInterface__IPAddressType_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType.");
return single_value;
}

void TCCInterface__IPAddressType_template::set_type(template_sel template_type, unsigned int list_length)
{
clean_up();
switch (template_type) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new TCCInterface__IPAddressType_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType.");
}
}

TCCInterface__IPAddressType_template& TCCInterface__IPAddressType_template::list_item(unsigned int list_index)
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType.");
if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType.");
return value_list.list_value[list_index];
}

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

void TCCInterface__IPAddressType_template::log_match(const TCCInterface__IPAddressType& match_value, boolean) const
{
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}

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

void TCCInterface__IPAddressType_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (TCCInterface__IPAddressType::enum_type)text_buf.pull_int().get_val();
if (!TCCInterface__IPAddressType::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType.", single_value);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new TCCInterface__IPAddressType_template[value_list.n_values];
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @TCCInterface_Functions.TCCInterface_IPAddressType.");
}
}

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

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

void TCCInterface__IPAddressType_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "enumerated template");
  Module_Param_Ptr m_p = &param;
  switch (m_p->get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    TCCInterface__IPAddressType_template new_temp;
    new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size());
    for (size_t p_i=0; p_i<m_p->get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Enumerated: {
    TCCInterface__IPAddressType::enum_type enum_val = TCCInterface__IPAddressType::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!TCCInterface__IPAddressType::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @TCCInterface_Functions.TCCInterface_IPAddressType.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    TCCInterface__IPAddressType_template* precondition = new TCCInterface__IPAddressType_template;
    precondition->set_param(*m_p->get_elem(0));
    TCCInterface__IPAddressType_template* implied_template = new TCCInterface__IPAddressType_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = TCCInterface__IPAddressType_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@TCCInterface_Functions.TCCInterface_IPAddressType");
  }
  is_ifpresent = param.get_ifpresent();
}

void TCCInterface__IPAddressType_template::check_restriction(template_res t_res, const char* t_name,
boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_VALUE:
if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return;
break;
case TR_OMIT:
if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return;
break;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@TCCInterface_Functions.TCCInterface_IPAddressType");
}

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

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

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

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

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

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

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

boolean TCCInterface__ProtocolType::operator==(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType comparison is an unknown numeric value %d", other_value);
return enum_value == other_value;
}

boolean TCCInterface__ProtocolType::operator==(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType.");
return enum_value == other_value;
}

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

boolean TCCInterface__ProtocolType::operator<(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType comparison is an unknown numeric value %d", other_value);
return enum_value < other_value;
}

boolean TCCInterface__ProtocolType::operator<(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType.");
return enum_value < other_value;
}

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

boolean TCCInterface__ProtocolType::operator>(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType comparison is an unknown numeric value %d", other_value);
return enum_value > other_value;
}

boolean TCCInterface__ProtocolType::operator>(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType.");
return enum_value > other_value;
}

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

const char *TCCInterface__ProtocolType::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case PROTO__TYPE__UDP: return "PROTO_TYPE_UDP";
case PROTO__TYPE__TCP: return "PROTO_TYPE_TCP";
case PROTO__TYPE__SCTP: return "PROTO_TYPE_SCTP";
default:
return "<unknown>";
}
}

TCCInterface__ProtocolType::enum_type TCCInterface__ProtocolType::str_to_enum(const char *str_par, const int* int_par, const int* int_par2)
{
if (int_par == NULL && int_par2 == NULL) {
if (!strcmp(str_par, "PROTO_TYPE_UDP")) return PROTO__TYPE__UDP;
if (!strcmp(str_par, "PROTO_TYPE_TCP")) return PROTO__TYPE__TCP;
if (!strcmp(str_par, "PROTO_TYPE_SCTP")) return PROTO__TYPE__SCTP;
}
return UNKNOWN_VALUE;
}

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

int TCCInterface__ProtocolType::enum2int(enum_type enum_par)
{
if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int TCCInterface__ProtocolType::enum2int(const TCCInterface__ProtocolType& enum_par)
{
if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

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

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

void TCCInterface__ProtocolType::log() const
{
if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value);
else TTCN_Logger::log_event_unbound();
}

void TCCInterface__ProtocolType::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "enumerated value");
  if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@TCCInterface_Functions.TCCInterface_ProtocolType");
  enum_value = str_to_enum(param.get_enumerated(), param.get_enumerated_value());
  if (!is_valid_enum(enum_value)) {
    param.error("Invalid enumerated value for type @TCCInterface_Functions.TCCInterface_ProtocolType.");
  }
}

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

void TCCInterface__ProtocolType::decode_text(Text_Buf& text_buf)
{
enum_value = (enum_type)text_buf.pull_int().get_val();
if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType.", enum_value);
}

void TCCInterface__ProtocolType_template::copy_template(const TCCInterface__ProtocolType_template& other_value)
{
set_selection(other_value);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = other_value.single_value;
break;
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new TCCInterface__ProtocolType_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 TCCInterface__ProtocolType_template(*other_value.implication_.precondition);
implication_.implied_template = new TCCInterface__ProtocolType_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType.");
}
}

TCCInterface__ProtocolType_template::TCCInterface__ProtocolType_template()
{
}

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

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

TCCInterface__ProtocolType_template::TCCInterface__ProtocolType_template(TCCInterface__ProtocolType::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

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

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

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

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

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

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

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

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

void TCCInterface__ProtocolType_template::clean_up()
{
switch (template_selection) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

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

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

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

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

TCCInterface__ProtocolType_template& TCCInterface__ProtocolType_template::operator=(const OPTIONAL<TCCInterface__ProtocolType>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (TCCInterface__ProtocolType::enum_type)(const TCCInterface__ProtocolType&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType.");
}
return *this;
}

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

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

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

TCCInterface__ProtocolType::enum_type TCCInterface__ProtocolType_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType.");
return single_value;
}

void TCCInterface__ProtocolType_template::set_type(template_sel template_type, unsigned int list_length)
{
clean_up();
switch (template_type) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new TCCInterface__ProtocolType_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType.");
}
}

TCCInterface__ProtocolType_template& TCCInterface__ProtocolType_template::list_item(unsigned int list_index)
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType.");
if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType.");
return value_list.list_value[list_index];
}

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

void TCCInterface__ProtocolType_template::log_match(const TCCInterface__ProtocolType& match_value, boolean) const
{
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}

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

void TCCInterface__ProtocolType_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (TCCInterface__ProtocolType::enum_type)text_buf.pull_int().get_val();
if (!TCCInterface__ProtocolType::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType.", single_value);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new TCCInterface__ProtocolType_template[value_list.n_values];
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @TCCInterface_Functions.TCCInterface_ProtocolType.");
}
}

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

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

void TCCInterface__ProtocolType_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "enumerated template");
  Module_Param_Ptr m_p = &param;
  switch (m_p->get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    TCCInterface__ProtocolType_template new_temp;
    new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size());
    for (size_t p_i=0; p_i<m_p->get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Enumerated: {
    TCCInterface__ProtocolType::enum_type enum_val = TCCInterface__ProtocolType::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!TCCInterface__ProtocolType::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @TCCInterface_Functions.TCCInterface_ProtocolType.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    TCCInterface__ProtocolType_template* precondition = new TCCInterface__ProtocolType_template;
    precondition->set_param(*m_p->get_elem(0));
    TCCInterface__ProtocolType_template* implied_template = new TCCInterface__ProtocolType_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = TCCInterface__ProtocolType_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@TCCInterface_Functions.TCCInterface_ProtocolType");
  }
  is_ifpresent = param.get_ifpresent();
}

void TCCInterface__ProtocolType_template::check_restriction(template_res t_res, const char* t_name,
boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_VALUE:
if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return;
break;
case TR_OMIT:
if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return;
break;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@TCCInterface_Functions.TCCInterface_ProtocolType");
}

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

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

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

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

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

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

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

boolean TCCInterface__PortStatus::operator==(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus comparison is an unknown numeric value %d", other_value);
return enum_value == other_value;
}

boolean TCCInterface__PortStatus::operator==(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus.");
return enum_value == other_value;
}

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

boolean TCCInterface__PortStatus::operator<(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus comparison is an unknown numeric value %d", other_value);
return enum_value < other_value;
}

boolean TCCInterface__PortStatus::operator<(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus.");
return enum_value < other_value;
}

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

boolean TCCInterface__PortStatus::operator>(int other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus.");
if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus comparison is an unknown numeric value %d", other_value);
return enum_value > other_value;
}

boolean TCCInterface__PortStatus::operator>(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus.");
return enum_value > other_value;
}

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

const char *TCCInterface__PortStatus::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case PORT__STATUS__WAS__VACANT: return "PORT_STATUS_WAS_VACANT";
case PORT__STATUS__WAS__OCCUPIED: return "PORT_STATUS_WAS_OCCUPIED";
case PORT__STATUS__PARAMETER__ERROR: return "PORT_STATUS_PARAMETER_ERROR";
case PORT__STATUS__INTERNAL__ERROR: return "PORT_STATUS_INTERNAL_ERROR";
default:
return "<unknown>";
}
}

TCCInterface__PortStatus::enum_type TCCInterface__PortStatus::str_to_enum(const char *str_par, const int* int_par, const int* int_par2)
{
if (int_par == NULL && int_par2 == NULL) {
if (!strcmp(str_par, "PORT_STATUS_WAS_VACANT")) return PORT__STATUS__WAS__VACANT;
if (!strcmp(str_par, "PORT_STATUS_WAS_OCCUPIED")) return PORT__STATUS__WAS__OCCUPIED;
if (!strcmp(str_par, "PORT_STATUS_PARAMETER_ERROR")) return PORT__STATUS__PARAMETER__ERROR;
if (!strcmp(str_par, "PORT_STATUS_INTERNAL_ERROR")) return PORT__STATUS__INTERNAL__ERROR;
}
return UNKNOWN_VALUE;
}

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

int TCCInterface__PortStatus::enum2int(enum_type enum_par)
{
if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int TCCInterface__PortStatus::enum2int(const TCCInterface__PortStatus& enum_par)
{
if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

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

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

void TCCInterface__PortStatus::log() const
{
if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value);
else TTCN_Logger::log_event_unbound();
}

void TCCInterface__PortStatus::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "enumerated value");
  if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@TCCInterface_Functions.TCCInterface_PortStatus");
  enum_value = str_to_enum(param.get_enumerated(), param.get_enumerated_value());
  if (!is_valid_enum(enum_value)) {
    param.error("Invalid enumerated value for type @TCCInterface_Functions.TCCInterface_PortStatus.");
  }
}

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

void TCCInterface__PortStatus::decode_text(Text_Buf& text_buf)
{
enum_value = (enum_type)text_buf.pull_int().get_val();
if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @TCCInterface_Functions.TCCInterface_PortStatus.", enum_value);
}

void TCCInterface__PortStatus_template::copy_template(const TCCInterface__PortStatus_template& other_value)
{
set_selection(other_value);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = other_value.single_value;
break;
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new TCCInterface__PortStatus_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 TCCInterface__PortStatus_template(*other_value.implication_.precondition);
implication_.implied_template = new TCCInterface__PortStatus_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus.");
}
}

TCCInterface__PortStatus_template::TCCInterface__PortStatus_template()
{
}

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

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

TCCInterface__PortStatus_template::TCCInterface__PortStatus_template(TCCInterface__PortStatus::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

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

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

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

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

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

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

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

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

void TCCInterface__PortStatus_template::clean_up()
{
switch (template_selection) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

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

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

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

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

TCCInterface__PortStatus_template& TCCInterface__PortStatus_template::operator=(const OPTIONAL<TCCInterface__PortStatus>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (TCCInterface__PortStatus::enum_type)(const TCCInterface__PortStatus&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus.");
}
return *this;
}

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

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

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

TCCInterface__PortStatus::enum_type TCCInterface__PortStatus_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus.");
return single_value;
}

void TCCInterface__PortStatus_template::set_type(template_sel template_type, unsigned int list_length)
{
clean_up();
switch (template_type) {
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new TCCInterface__PortStatus_template[list_length];
break;
default:
TTCN_error("Setting an invalid type for a template of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus.");
}
}

TCCInterface__PortStatus_template& TCCInterface__PortStatus_template::list_item(unsigned int list_index)
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus.");
if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus.");
return value_list.list_value[list_index];
}

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

void TCCInterface__PortStatus_template::log_match(const TCCInterface__PortStatus& match_value, boolean) const
{
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}

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

void TCCInterface__PortStatus_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (TCCInterface__PortStatus::enum_type)text_buf.pull_int().get_val();
if (!TCCInterface__PortStatus::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus.", single_value);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new TCCInterface__PortStatus_template[value_list.n_values];
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @TCCInterface_Functions.TCCInterface_PortStatus.");
}
}

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

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

void TCCInterface__PortStatus_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "enumerated template");
  Module_Param_Ptr m_p = &param;
  switch (m_p->get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    TCCInterface__PortStatus_template new_temp;
    new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size());
    for (size_t p_i=0; p_i<m_p->get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Enumerated: {
    TCCInterface__PortStatus::enum_type enum_val = TCCInterface__PortStatus::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value());
    if (!TCCInterface__PortStatus::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @TCCInterface_Functions.TCCInterface_PortStatus.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    TCCInterface__PortStatus_template* precondition = new TCCInterface__PortStatus_template;
    precondition->set_param(*m_p->get_elem(0));
    TCCInterface__PortStatus_template* implied_template = new TCCInterface__PortStatus_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = TCCInterface__PortStatus_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@TCCInterface_Functions.TCCInterface_PortStatus");
  }
  is_ifpresent = param.get_ifpresent();
}

void TCCInterface__PortStatus_template::check_restriction(template_res t_res, const char* t_name,
boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_VALUE:
if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return;
break;
case TR_OMIT:
if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return;
break;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@TCCInterface_Functions.TCCInterface_PortStatus");
}


/* Bodies of functions, altsteps and testcases */

BOOLEAN f__verifyIpAddr(const CHARSTRING& pl__host, const TCCInterface__IPAddressType& pl__ipType)
{
TTCN_Location current_location("TCCInterface_Functions.ttcn", 380, TTCN_Location::LOCATION_FUNCTION, "f_verifyIpAddr");
current_location.update_lineno(382);
/* TCCInterface_Functions.ttcn, line 382 */
BOOLEAN vl__valid__ip((TCCConversion__Functions::f__convertIPAddrToBinary(pl__host) != os_0));
current_location.update_lineno(383);
/* TCCInterface_Functions.ttcn, line 383 */
{
boolean tmp_0;
tmp_0 = vl__valid__ip;
if (tmp_0) tmp_0 = (pl__ipType != TCCInterface__IPAddressType::UNKNOWN);
if (tmp_0) {
current_location.update_lineno(385);
/* TCCInterface_Functions.ttcn, line 385 */
BOOLEAN vl__ipv6__real((TCCConversion__Functions::f__strstr(pl__host, cs_0, TCCConversion__Functions::f__strstr_offset_defval) != -1));
current_location.update_lineno(386);
/* TCCInterface_Functions.ttcn, line 386 */
if ((pl__ipType == TCCInterface__IPAddressType::IPv4)) {
current_location.update_lineno(386);
/* TCCInterface_Functions.ttcn, line 386 */
return (!(vl__ipv6__real));
}
else {
current_location.update_lineno(387);
/* TCCInterface_Functions.ttcn, line 387 */
if ((pl__ipType == TCCInterface__IPAddressType::IPv6)) {
current_location.update_lineno(387);
/* TCCInterface_Functions.ttcn, line 387 */
return vl__ipv6__real;
}
}
}
}
current_location.update_lineno(389);
/* TCCInterface_Functions.ttcn, line 389 */
return vl__valid__ip;
}


/* Bodies of static functions */

void pre_init_module()
{
TTCN_Location current_location("TCCInterface_Functions.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "TCCInterface_Functions");
TCCConversion__Functions::module_object.pre_init_module();
module_object.add_function("f_getPortAvailabilityStatus", (genericfunc_t)&f__getPortAvailabilityStatus, NULL);
module_object.add_function("f_setIP", (genericfunc_t)&f__setIP, NULL);
module_object.add_function("f_setIP_ip", (genericfunc_t)&f__setIP__ip, NULL);
module_object.add_function("f_delIP_ip", (genericfunc_t)&f__delIP__ip, NULL);
module_object.add_function("f_deleteIP", (genericfunc_t)&f__deleteIP, NULL);
module_object.add_function("f_getIP", (genericfunc_t)&f__getIP, NULL);
module_object.add_function("f_setInterfaceUp", (genericfunc_t)&f__setInterfaceUp, NULL);
module_object.add_function("f_setInterfaceDown", (genericfunc_t)&f__setInterfaceDown, NULL);
module_object.add_function("f_getHostName", (genericfunc_t)&f__getHostName, NULL);
module_object.add_function("f_getIpAddr", (genericfunc_t)&f__getIpAddr, NULL);
module_object.add_function("f_getIpAddresses", (genericfunc_t)&f__getIpAddresses, NULL);
module_object.add_function("f_verifyIpAddr", (genericfunc_t)&f__verifyIpAddr, NULL);
}

void post_init_module()
{
TTCN_Location current_location("TCCInterface_Functions.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "TCCInterface_Functions");
TCCConversion__Functions::module_object.post_init_module();
current_location.update_lineno(152);
/* TCCInterface_Functions.ttcn, line 152 */
const_f__setIP_number_defval = 1;
current_location.update_lineno(177);
/* TCCInterface_Functions.ttcn, line 177 */
const_f__setIP__ip_prefix_defval = 32;
current_location.update_lineno(177);
/* TCCInterface_Functions.ttcn, line 177 */
const_f__setIP__ip_v__set_defval = 1;
current_location.update_lineno(201);
/* TCCInterface_Functions.ttcn, line 201 */
const_f__delIP__ip_prefix_defval = 32;
current_location.update_lineno(248);
/* TCCInterface_Functions.ttcn, line 248 */
const_f__getIP_addressType_defval = TCCInterface__IPAddressType::IPv4;
current_location.update_lineno(270);
/* TCCInterface_Functions.ttcn, line 270 */
const_f__setInterfaceUp_addressType_defval = TCCInterface__IPAddressType::IPv4;
current_location.update_lineno(292);
/* TCCInterface_Functions.ttcn, line 292 */
const_f__setInterfaceDown_addressType_defval = TCCInterface__IPAddressType::IPv4;
current_location.update_lineno(335);
/* TCCInterface_Functions.ttcn, line 335 */
const_f__getIpAddr_addressType_defval = TCCInterface__IPAddressType::IPv4;
current_location.update_lineno(380);
/* TCCInterface_Functions.ttcn, line 380 */
const_f__verifyIpAddr_pl__ipType_defval = TCCInterface__IPAddressType::UNKNOWN;
}


} /* end of namespace */
